This commit is contained in:
vn.py 2019-04-26 09:38:02 +08:00
parent 8d2e83067b
commit d8f7298dc8

View File

@ -97,6 +97,8 @@ class CtaEngine(BaseEngine):
self.rq_client = None self.rq_client = None
self.rq_symbols = set() self.rq_symbols = set()
self.vt_tradeids = set() # for filtering duplicate trade
self.offset_converter = OffsetConverter(self.main_engine) self.offset_converter = OffsetConverter(self.main_engine)
def init_engine(self): def init_engine(self):
@ -190,6 +192,11 @@ class CtaEngine(BaseEngine):
"""""" """"""
trade = event.data 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) self.offset_converter.update_trade(trade)
strategy = self.orderid_strategy_map.get(trade.vt_orderid, None) strategy = self.orderid_strategy_map.get(trade.vt_orderid, None)