Skip to content

Commit

Permalink
Merge pull request vnpy#259 from vnpy/revert-253-master
Browse files Browse the repository at this point in the history
Revert "在行情订阅中,增加了编辑订阅合约的功能"
  • Loading branch information
vnpy authored Mar 10, 2017
2 parents f2dba02 + 0bc2256 commit aaa7a04
Show file tree
Hide file tree
Showing 8 changed files with 229 additions and 881 deletions.
110 changes: 25 additions & 85 deletions vn.trader/dataRecorder/DR_setting.json
Original file line number Diff line number Diff line change
@@ -1,91 +1,31 @@
{
"working": true,
"tick": [
[
"au1706",
"CTP"
],
[
"a1705",
"CTP"
],
[
"m1705",
"CTP"
],
[
"bu1706",
"CTP"
],
[
"SR705",
"CTP"
],
[
"TA705",
"CTP"
],
[
"MA705",
"CTP"
],
[
"RM705",
"CTP"
],
[
"FG705",
"CTP"
],
[
"OI705",
"CTP"
]
"working": false,

"tick":
[
["m1609", "XSPEED"],
["IF1606", "SGIT"],
["IH1606", "SGIT"],
["IH1606", "SGIT"],
["IC1606", "SGIT"],
["IC1606", "SGIT"],
["600036", "LTS", "SZSE"],
["EUR.USD", "IB", "IDEALPRO", "USD", "外汇"]
],
"bar": [
[
"au1706",
"CTP"
],
[
"a1705",
"CTP"
],
[
"m1705",
"CTP"
],
[
"bu1706",
"CTP"
],
[
"SR705",
"CTP"
],
[
"TA705",
"CTP"
],
[
"MA705",
"CTP"
],
[
"RM705",
"CTP"
],
[
"FG705",
"CTP"
],
[
"OI705",
"CTP"
]

"bar":
[
["IF1605", "SGIT"],
["IF1606", "SGIT"],
["IH1606", "SGIT"],
["IH1606", "SGIT"],
["IC1606", "SGIT"],
["IC1606", "SGIT"]
],
"active": {
"IF0000": "IF1605",

"active":
{
"IF0000": "IF1605",
"IH0000": "IH1605",
"IC0000": "IC1605"
}
Expand Down
26 changes: 9 additions & 17 deletions vn.trader/dataRecorder/drEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
使用DR_setting.json来配置需要收集的合约,以及主力合约代码。
'''

import copy
import json
import os
from datetime import datetime
import copy
from collections import OrderedDict
from datetime import datetime, timedelta
from Queue import Queue
from threading import Thread

from drBase import *
from eventEngine import *
from vtFunction import todayDate
from vtGateway import VtSubscribeReq, VtLogData
from drBase import *
from vtFunction import todayDate


########################################################################
Expand Down Expand Up @@ -50,17 +53,6 @@ def __init__(self, mainEngine, eventEngine):

# 载入设置,订阅行情
self.loadSetting()

def saveSetting(self, setting):
"""保存设置"""
setting['working'] = self.working
with open(self.settingFileName, 'w') as f:
try:
str = json.dumps(setting, indent=2)
f.write(str)
except:
pass
return True

#----------------------------------------------------------------------
def loadSetting(self):
Expand All @@ -69,8 +61,8 @@ def loadSetting(self):
drSetting = json.load(f)

# 如果working设为False则不启动行情记录功能
self.working = drSetting['working']
if not self.working:
working = drSetting['working']
if not working:
return

if 'tick' in drSetting:
Expand Down
Loading

0 comments on commit aaa7a04

Please sign in to comment.