From 44b7ecf1088e406b33f4201735639a3c0221bb25 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Wed, 14 Feb 2018 13:02:16 +0800 Subject: [PATCH] =?UTF-8?q?[Mod]=E4=BF=AE=E6=94=B9QuantosDataService?= =?UTF-8?q?=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/QuantosDataService/dataService.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/QuantosDataService/dataService.py b/examples/QuantosDataService/dataService.py index 2d7eff1b..c5c4f25e 100644 --- a/examples/QuantosDataService/dataService.py +++ b/examples/QuantosDataService/dataService.py @@ -86,7 +86,13 @@ def downMinuteBarBySymbol(api, vtSymbol, startDate, endDate=''): start = time() code, exchange = vtSymbol.split('.') - cl = db[code] + + # 对于期货合约的vtSymbol没有交易所后缀 + if exchange in ['SSE', 'SZSE']: + cl = db[vtSymbol] + else: + cl = db[code] + cl.ensure_index([('datetime', ASCENDING)], unique=True) # 添加索引 dt = datetime.strptime(startDate, '%Y%m%d')