From 0ebe56a2f39d049c7b67ca9bd597040c6aaba9da Mon Sep 17 00:00:00 2001 From: chenxy123 Date: Mon, 31 Oct 2016 23:16:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86CTP=E8=A1=8C=E6=83=85=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E7=9A=84tick=E6=97=A5=E6=9C=9F=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vn.trader/ctpGateway/ctpGateway.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vn.trader/ctpGateway/ctpGateway.py b/vn.trader/ctpGateway/ctpGateway.py index a765c0ca..19b0dcc0 100644 --- a/vn.trader/ctpGateway/ctpGateway.py +++ b/vn.trader/ctpGateway/ctpGateway.py @@ -11,6 +11,7 @@ vtSymbol直接使用symbol import os import json from copy import copy +from datetime import datetime from vnctpmd import MdApi from vnctptd import TdApi @@ -330,7 +331,10 @@ class CtpMdApi(MdApi): tick.volume = data['Volume'] tick.openInterest = data['OpenInterest'] tick.time = '.'.join([data['UpdateTime'], str(data['UpdateMillisec']/100)]) - tick.date = data['TradingDay'] + + # 这里由于交易所夜盘时段的交易日数据有误,所以选择本地获取 + #tick.date = data['TradingDay'] + tick.date = datetime.now().strftime('%Y%m%d') tick.openPrice = data['OpenPrice'] tick.highPrice = data['HighestPrice']