From eabcee9eed40bdeba1ab2f24a471b9cb8b0d39a3 Mon Sep 17 00:00:00 2001 From: Si Feng Date: Wed, 20 Jun 2018 01:30:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BF=BD=E7=95=A5pyenv=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=9A=84.python-version=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0c5cb077..a218a899 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,7 @@ vn.ctp/build/* vn.lts/build/* .idea .vscode +.python-version .gitignore vn.trader/ctaAlgo/data/* From e8282a135de68efe61e6a2d70111359d8409768f Mon Sep 17 00:00:00 2001 From: Mark <99972538@qq.com> Date: Wed, 11 Jul 2018 15:33:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=9B=9E=E9=80=801?= =?UTF-8?q?=E5=88=86=E9=92=9F=EF=BC=8C0=EF=BC=9A00=E6=97=B6=E8=B7=A8?= =?UTF-8?q?=E6=97=A5=E5=9B=9E=E9=80=80=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 0:00时,人家日期时新的一天,而回退到23:59没有回退日期 --- examples/QuantosDataService/dataService.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/examples/QuantosDataService/dataService.py b/examples/QuantosDataService/dataService.py index 730cb2e2..89f6726d 100644 --- a/examples/QuantosDataService/dataService.py +++ b/examples/QuantosDataService/dataService.py @@ -62,7 +62,6 @@ def generateVtBar(row): bar.low = row['low'] bar.close = row['close'] bar.volume = row['volume'] - bar.date = str(row['date']) bar.time = str(row['time']).rjust(6, '0') @@ -70,6 +69,19 @@ def generateVtBar(row): hour=bar.time[0:2] minute=bar.time[2:4] sec=bar.time[4:6] + + # ------------------------------add by yzl :start + # print(row.date, type(row.date), row.time, type(row.time))# add by yzl to show the date type and value + # 20180328 < type'long' > 93400 < type'long' > + # 最佳改进方法: 构建一个datetime,然后滞后一分钟,不能简单0:00:00处理,日期减一,弊端:处理量太大 + # 改进2:找出 0:00,此时日期回退一天 + if int(hour) == 0 and int(minute) == 0: + temp_date = datetime(int(bar.date[:4]), int(bar.date[4:6]), int(bar.date[6:])).date() + temp_date = temp_date - timedelta(days=1) + bar.date = temp_date.strftime("%Y%m%d") + + # -------------------------------add by yzl :end + if minute=="00": minute="59" @@ -81,6 +93,8 @@ def generateVtBar(row): else: minute=str(int(minute)-1).rjust(2,'0') bar.time=hour+minute+sec + + bar.datetime = datetime.strptime(' '.join([bar.date, bar.time]), '%Y%m%d %H%M%S')