[Add]增加CTP行情接口对于获取到交易所数据前的行情推送的过滤

This commit is contained in:
vn.py 2017-10-31 21:40:20 +08:00
parent 7ca9b8da1f
commit 71ae09a89b

View File

@ -342,12 +342,17 @@ class CtpMdApi(MdApi):
#----------------------------------------------------------------------
def onRtnDepthMarketData(self, data):
"""行情推送"""
# 过滤尚未获取合约交易所时的行情推送
symbol = data['InstrumentID']
if symbol not in symbolExchangeDict:
return
# 创建对象
tick = VtTickData()
tick.gatewayName = self.gatewayName
tick.symbol = data['InstrumentID']
tick.exchange = symbolExchangeDict.get(tick.symbol, EXCHANGE_UNKNOWN)
tick.symbol = symbol
tick.exchange = symbolExchangeDict[tick.symbol]
tick.vtSymbol = tick.symbol #'.'.join([tick.symbol, tick.exchange])
tick.lastPrice = data['LastPrice']