From 895a668eed60fbd6adaa810db53a72ec81ceca9e Mon Sep 17 00:00:00 2001 From: msincenselee Date: Fri, 14 Feb 2020 09:32:01 +0800 Subject: [PATCH] [bug fix] --- vnpy/app/cta_strategy_pro/engine.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vnpy/app/cta_strategy_pro/engine.py b/vnpy/app/cta_strategy_pro/engine.py index fb2387c3..345f8af4 100644 --- a/vnpy/app/cta_strategy_pro/engine.py +++ b/vnpy/app/cta_strategy_pro/engine.py @@ -267,7 +267,7 @@ class CtaEngine(BaseEngine): # else: # strategy.pos -= trade.volume # 根据策略名称,写入 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', 'direction', 'offset', 'price', 'volume', 'idx_price'] trade_dict = OrderedDict() @@ -719,7 +719,8 @@ class CtaEngine(BaseEngine): else: # 添加 合约订阅 vt_symbol <=> 策略实例 strategy 映射. strategies = self.symbol_strategy_map[vt_symbol] - strategies.append(strategy) + if strategy not in strategies: + strategies.append(strategy) # 添加 策略名 strategy_name <=> 合约订阅 vt_symbol 的映射 subscribe_symbol_set = self.strategy_symbol_map[strategy.strategy_name]