[bug fix]

This commit is contained in:
msincenselee 2020-02-14 09:32:01 +08:00
parent a2ba747859
commit 895a668eed

View File

@ -267,7 +267,7 @@ class CtaEngine(BaseEngine):
# else: # else:
# strategy.pos -= trade.volume # strategy.pos -= trade.volume
# 根据策略名称,写入 data\straetgy_name_trade.csv文件 # 根据策略名称,写入 data\straetgy_name_trade.csv文件
strategy_name = getattr(strategy, 'name') strategy_name = getattr(strategy, 'strategy_name')
trade_fields = ['datetime', 'symbol', 'exchange', 'vt_symbol', 'tradeid', 'vt_tradeid', 'orderid', 'vt_orderid', trade_fields = ['datetime', 'symbol', 'exchange', 'vt_symbol', 'tradeid', 'vt_tradeid', 'orderid', 'vt_orderid',
'direction', 'offset', 'price', 'volume', 'idx_price'] 'direction', 'offset', 'price', 'volume', 'idx_price']
trade_dict = OrderedDict() trade_dict = OrderedDict()
@ -719,6 +719,7 @@ class CtaEngine(BaseEngine):
else: else:
# 添加 合约订阅 vt_symbol <=> 策略实例 strategy 映射. # 添加 合约订阅 vt_symbol <=> 策略实例 strategy 映射.
strategies = self.symbol_strategy_map[vt_symbol] strategies = self.symbol_strategy_map[vt_symbol]
if strategy not in strategies:
strategies.append(strategy) strategies.append(strategy)
# 添加 策略名 strategy_name <=> 合约订阅 vt_symbol 的映射 # 添加 策略名 strategy_name <=> 合约订阅 vt_symbol 的映射