This commit is contained in:
vn.py 2018-01-08 16:46:21 +08:00
parent c320ce844f
commit 2c305e8496

View File

@ -10,10 +10,12 @@ import json
import csv import csv
import os import os
import copy import copy
import traceback
from collections import OrderedDict from collections import OrderedDict
from datetime import datetime, timedelta from datetime import datetime, timedelta
from Queue import Queue, Empty from Queue import Queue, Empty
from threading import Thread from threading import Thread
from pymongo.errors import DuplicateKeyError
from vnpy.event import Event from vnpy.event import Event
from vnpy.trader.vtEvent import * from vnpy.trader.vtEvent import *
@ -241,7 +243,10 @@ class DrEngine(object):
#self.mainEngine.dbUpdate(dbName, collectionName, d, flt, True) #self.mainEngine.dbUpdate(dbName, collectionName, d, flt, True)
# 使用insert模式更新数据可能存在时间戳重复的情况需要用户自行清洗 # 使用insert模式更新数据可能存在时间戳重复的情况需要用户自行清洗
self.mainEngine.dbInsert(dbName, collectionName, d) try:
self.mainEngine.dbInsert(dbName, collectionName, d)
except DuplicateKeyError:
self.writeDrLog(u'键值重复插入失败,报错信息:' %traceback.format_exc())
except Empty: except Empty:
pass pass