移除可能导致某些期权和价差行情Tick丢失的过滤机制

This commit is contained in:
vn.py 2017-06-27 17:29:22 +08:00
parent 788aa4acb7
commit 654c7d0e8a

View File

@ -329,10 +329,6 @@ class CtpMdApi(MdApi):
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onRtnDepthMarketData(self, data): def onRtnDepthMarketData(self, data):
"""行情推送""" """行情推送"""
# 忽略成交量为0的无效tick数据
if not data['Volume']:
return
# 创建对象 # 创建对象
tick = VtTickData() tick = VtTickData()
tick.gatewayName = self.gatewayName tick.gatewayName = self.gatewayName
@ -710,7 +706,7 @@ class CtpTdApi(TdApi):
pos.positionProfit += data['PositionProfit'] pos.positionProfit += data['PositionProfit']
# 计算持仓均价 # 计算持仓均价
if pos.position: if pos.position and pos.symbol in self.symbolSizeDict:
size = self.symbolSizeDict[pos.symbol] size = self.symbolSizeDict[pos.symbol]
pos.price = (cost + data['PositionCost']) / (pos.position * size) pos.price = (cost + data['PositionCost']) / (pos.position * size)