From 00f9da4c689819a4f725c2460f4ae2ff5a7c45b7 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Mon, 7 May 2018 22:39:25 +0800 Subject: [PATCH] [Fix]Close #792 --- examples/QuantosDataService/dataService.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/QuantosDataService/dataService.py b/examples/QuantosDataService/dataService.py index c5c4f25e..cf2766c1 100644 --- a/examples/QuantosDataService/dataService.py +++ b/examples/QuantosDataService/dataService.py @@ -50,7 +50,12 @@ def generateVtBar(row): bar.symbol = symbol bar.exchange = exchangeMapReverse[exchange] - bar.vtSymbol = '.'.join([bar.symbol, bar.exchange]) + + if bar.exchange in ['SSE', 'SZSE']: + bar.vtSymbol = '.'.join([bar.symbol, bar.exchange]) + else: + bar.vtSymbol = bar.symbol + bar.open = row['open'] bar.high = row['high'] bar.low = row['low'] @@ -92,7 +97,7 @@ def downMinuteBarBySymbol(api, vtSymbol, startDate, endDate=''): cl = db[vtSymbol] else: cl = db[code] - + cl.ensure_index([('datetime', ASCENDING)], unique=True) # 添加索引 dt = datetime.strptime(startDate, '%Y%m%d')