修复DataRecorder的bug

This commit is contained in:
vn.py 2017-08-07 11:10:38 +08:00
parent 857668d27a
commit fe198aa40f
2 changed files with 40 additions and 4 deletions

View File

@ -101,6 +101,18 @@ class DrEngine(object):
tick = VtTickData() # 该tick实例可以用于缓存部分数据目前未使用
self.tickDict[vtSymbol] = tick
# 保存到配置字典中
if vtSymbol not in self.settingDict:
d = {
'symbol': symbol,
'gateway': setting[1],
'tick': True
}
self.settingDict[vtSymbol] = d
else:
d = self.settingDict[vtSymbol]
d['tick'] = True
if 'bar' in drSetting:
l = drSetting['bar']
@ -124,6 +136,18 @@ class DrEngine(object):
bar = VtBarData()
self.barDict[vtSymbol] = bar
# 保存到配置字典中
if vtSymbol not in self.settingDict:
d = {
'symbol': symbol,
'gateway': setting[1],
'bar': True
}
self.settingDict[vtSymbol] = d
else:
d = self.settingDict[vtSymbol]
d['bar'] = True
if 'active' in drSetting:
d = drSetting['active']
@ -131,6 +155,18 @@ class DrEngine(object):
# 注意这里的vtSymbol对于IB和LTS接口应该后缀.交易所
for activeSymbol, vtSymbol in d.items():
self.activeSymbolDict[vtSymbol] = activeSymbol
# 保存到配置字典中
if vtSymbol not in self.settingDict:
d = {
'symbol': symbol,
'gateway': setting[1],
'active': True
}
self.settingDict[vtSymbol] = d
else:
d = self.settingDict[vtSymbol]
d['active'] = True
##----------------------------------------------------------------------
#def loadCsvSetting(self):
@ -174,7 +210,7 @@ class DrEngine(object):
#self.activeSymbolDict[vtSymbol] = activeSymbol
## 保存配置到缓存中
self.settingDict[vtSymbol] = d
#self.settingDict[vtSymbol] = d
#----------------------------------------------------------------------
def getSetting(self):

View File

@ -118,17 +118,17 @@ class DrEngineManager(QtWidgets.QWidget):
setting = self.drEngine.getSetting()
for d in setting.values():
if d['tick']:
if 'tick' in d and d['tick']:
self.tickTable.insertRow(0)
self.tickTable.setItem(0, 0, TableCell(d['symbol']))
self.tickTable.setItem(0, 1, TableCell(d['gateway']))
if d['bar']:
if 'bar' in d and d['bar']:
self.barTable.insertRow(0)
self.barTable.setItem(0, 0, TableCell(d['symbol']))
self.barTable.setItem(0, 1, TableCell(d['gateway']))
if d['active']:
if 'active'in d and d['active']:
self.activeTable.insertRow(0)
self.activeTable.setItem(0, 0, TableCell(d['active']))
self.activeTable.setItem(0, 1, TableCell(d['symbol']))