diff --git a/vnpy/app/cta_strategy/engine.py b/vnpy/app/cta_strategy/engine.py index ebe8ad73..901a7207 100644 --- a/vnpy/app/cta_strategy/engine.py +++ b/vnpy/app/cta_strategy/engine.py @@ -97,6 +97,8 @@ class CtaEngine(BaseEngine): self.rq_client = None self.rq_symbols = set() + self.vt_tradeids = set() # for filtering duplicate trade + self.offset_converter = OffsetConverter(self.main_engine) def init_engine(self): @@ -190,6 +192,11 @@ class CtaEngine(BaseEngine): """""" trade = event.data + # Filter duplicate trade push + if trade.vt_tradeid in self.vt_tradeids: + return + self.vt_tradeids.add(trade.vt_tradeid) + self.offset_converter.update_trade(trade) strategy = self.orderid_strategy_map.get(trade.vt_orderid, None)