From d8f7298dc850e1ee47a91838985f90f6e87894a3 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Fri, 26 Apr 2019 09:38:02 +0800 Subject: [PATCH] [Fix]close #1633 --- vnpy/app/cta_strategy/engine.py | 7 +++++++ 1 file changed, 7 insertions(+) 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)