From b1fff2765e67ebc86401d474ed8bb6f6059cc575 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Fri, 1 Dec 2017 23:44:29 +0800 Subject: [PATCH] [Fix]Close #581 --- vnpy/trader/gateway/ctpGateway/ctpGateway.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vnpy/trader/gateway/ctpGateway/ctpGateway.py b/vnpy/trader/gateway/ctpGateway/ctpGateway.py index 7291528f..dfe34f78 100644 --- a/vnpy/trader/gateway/ctpGateway/ctpGateway.py +++ b/vnpy/trader/gateway/ctpGateway/ctpGateway.py @@ -298,8 +298,12 @@ class CtpMdApi(MdApi): self.subscribe(subscribeReq) # 获取交易日 - self.tradingDate = data['TradingDay'] - self.tradingDt = datetime.strptime(self.tradingDate, '%Y%m%d') + #self.tradingDate = data['TradingDay'] + #self.tradingDt = datetime.strptime(self.tradingDate, '%Y%m%d') + + # 登录时通过本地时间来获取当前的日期 + self.tradingDt = datetime.now() + self.tradingDate = self.tradingDt.strftime('%Y%m%d') # 否则,推送错误信息 else: