def __init__(self, timeseries, events_pool, initial_capital=5000.0): self._timeseries = timeseries self._open_orders = list() self._pre_settlement = 0 # 昨日结算价 self._datetime = None # 当前时间 self._init_captial = initial_capital self.api = SimulateTraderAPI(self, events_pool) # 模拟交易接口 # 用于分析策略性能数据 self.all_orders = [] self.initial_capital = initial_capital # 初始权益 self.current_positions = {} # 当前持仓 dict of list, 包含细节。 self.current_holdings = {} # 当前的资金 dict self.all_holdings = [] # 所有时间点上的资金 list of dict self.transactions = [] self.pp = []