Skip to content

Commit

Permalink
优化 ctp 股票期权 tick 数据获取
Browse files Browse the repository at this point in the history
  • Loading branch information
Gwill committed Oct 30, 2018
1 parent 5b949c0 commit 3371401
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions vnpy/trader/gateway/ctpGateway/ctpGateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,33 @@ def onRtnDepthMarketData(self, data):
tick.askVolume1 = data['AskVolume1']

# 大商所日期转换
if tick.exchange is EXCHANGE_DCE:
if tick.exchange == EXCHANGE_DCE:
tick.date = datetime.now().strftime('%Y%m%d')


# 上交所,SEE,股票期权相关
if tick.exchange == EXCHANGE_SSE:
tick.bidPrice2 = data['BidPrice2']
tick.bidVolume2 = data['BidVolume2']
tick.askPrice2 = data['AskPrice2']
tick.askVolume2 = data['AskVolume2']

tick.bidPrice3 = data['BidPrice3']
tick.bidVolume3 = data['BidVolume3']
tick.askPrice3 = data['AskPrice3']
tick.askVolume3 = data['AskVolume3']

tick.bidPrice4 = data['BidPrice4']
tick.bidVolume4 = data['BidVolume4']
tick.askPrice4 = data['AskPrice4']
tick.askVolume4 = data['AskVolume4']

tick.bidPrice5 = data['BidPrice5']
tick.bidVolume5 = data['BidVolume5']
tick.askPrice5 = data['AskPrice5']
tick.askVolume5 = data['AskVolume5']

tick.date = data['TradingDay']

self.gateway.onTick(tick)

#----------------------------------------------------------------------
Expand Down

0 comments on commit 3371401

Please sign in to comment.