将CTP行情推送的tick日期改为本地获取

This commit is contained in:
chenxy123 2016-10-31 23:16:28 +08:00
parent 002b35ab98
commit 0ebe56a2f3

View File

@ -11,6 +11,7 @@ vtSymbol直接使用symbol
import os import os
import json import json
from copy import copy from copy import copy
from datetime import datetime
from vnctpmd import MdApi from vnctpmd import MdApi
from vnctptd import TdApi from vnctptd import TdApi
@ -330,7 +331,10 @@ class CtpMdApi(MdApi):
tick.volume = data['Volume'] tick.volume = data['Volume']
tick.openInterest = data['OpenInterest'] tick.openInterest = data['OpenInterest']
tick.time = '.'.join([data['UpdateTime'], str(data['UpdateMillisec']/100)]) 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.openPrice = data['OpenPrice']
tick.highPrice = data['HighestPrice'] tick.highPrice = data['HighestPrice']