From 33714018de13d45cf89ec5e2ce712e78e42598a5 Mon Sep 17 00:00:00 2001 From: G_will Date: Tue, 30 Oct 2018 11:46:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20ctp=20=E8=82=A1=E7=A5=A8?= =?UTF-8?q?=E6=9C=9F=E6=9D=83=20tick=20=E6=95=B0=E6=8D=AE=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/trader/gateway/ctpGateway/ctpGateway.py | 28 ++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/vnpy/trader/gateway/ctpGateway/ctpGateway.py b/vnpy/trader/gateway/ctpGateway/ctpGateway.py index d6cfff21..3d726019 100644 --- a/vnpy/trader/gateway/ctpGateway/ctpGateway.py +++ b/vnpy/trader/gateway/ctpGateway/ctpGateway.py @@ -376,9 +376,33 @@ class CtpMdApi(MdApi): 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) #----------------------------------------------------------------------