Merge pull request #734 from Yohoman/dev

Update dataService.py
This commit is contained in:
vn.py 2018-02-14 12:58:34 +08:00 committed by GitHub
commit c99a085daa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,7 +85,8 @@ def downMinuteBarBySymbol(api, vtSymbol, startDate, endDate=''):
"""下载某一合约的分钟线数据"""
start = time()
cl = db[vtSymbol]
code, exchange = vtSymbol.split('.')
cl = db[code]
cl.ensure_index([('datetime', ASCENDING)], unique=True) # 添加索引
dt = datetime.strptime(startDate, '%Y%m%d')
@ -96,7 +97,6 @@ def downMinuteBarBySymbol(api, vtSymbol, startDate, endDate=''):
end = datetime.now()
delta = timedelta(1)
code, exchange = vtSymbol.split('.')
symbol = '.'.join([code, exchangeMap[exchange]])
while dt <= end: