示例#1
0
    def __init__(self, interface):
        self.interface = interface
        self.position_manager = LocalPositionManager(interface.exec_intercept)
        # 每日资金情况

        self.pre_balance = 0
        self.daily_life = defaultdict(AliasDayResult)
        self.date = None
        self.commission = 0
        self.commission_expense = 0
        self.pre_commission_expense = 0
        self.count_statistics = 0
        self.pre_count = 0
        self.initial_capital = 0

        self.init = False
示例#2
0
 def update_params(self, params: dict):
     """ 更新本地账户回测参数 """
     for i, v in params.items():
         if i == "initial_capital" and not self.init:
             self.balance = v
             self.pre_balance = v
             self.initial_capital = v
             self.init = True
             continue
         else:
             pass
         setattr(self, i, v)
     if not self.init_position_manager_flag:
         self.position_manager = LocalPositionManager(params)
         self.init_position_manager_flag = True
     else:
         pass
示例#3
0
    def __init__(self, interface):
        self.interface = interface
        self.position_manager = LocalPositionManager(interface.params)

        self.pre_balance = 0
        self.daily_life = defaultdict(AliasDayResult)
        # 日期
        self.date = None
        # 手续费
        self.commission = 0
        self.commission_expense = 0
        # 昨日手续费
        self.pre_commission_expense = 0
        self.count_statistics = 0
        self.pre_count = 0
        # 初始资金
        self.initial_capital = 0
        # 占用保证金
        self.occupation_margin = 0

        self.init = False