Modernize vnpy/trader/app
This commit is contained in:
parent
29eb606e1c
commit
7a13aec4ec
@ -5,6 +5,7 @@
|
|||||||
可以使用和实盘相同的代码进行回测。
|
可以使用和实盘相同的代码进行回测。
|
||||||
'''
|
'''
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
@ -112,7 +113,7 @@ class BacktestingEngine(object):
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def output(self, content):
|
def output(self, content):
|
||||||
"""输出内容"""
|
"""输出内容"""
|
||||||
print str(datetime.now()) + "\t" + content
|
print(str(datetime.now()) + "\t" + content)
|
||||||
|
|
||||||
#------------------------------------------------
|
#------------------------------------------------
|
||||||
# 参数设置相关
|
# 参数设置相关
|
||||||
@ -1213,11 +1214,11 @@ class OptimizationSetting(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if end < start:
|
if end < start:
|
||||||
print u'参数起始点必须不大于终止点'
|
print(u'参数起始点必须不大于终止点')
|
||||||
return
|
return
|
||||||
|
|
||||||
if step <= 0:
|
if step <= 0:
|
||||||
print u'参数布进必须大于0'
|
print(u'参数布进必须大于0')
|
||||||
return
|
return
|
||||||
|
|
||||||
l = []
|
l = []
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
3. 将交易开拓者导出的历史数据载入到MongoDB中的函数
|
3. 将交易开拓者导出的历史数据载入到MongoDB中的函数
|
||||||
4. 将OKEX下载的历史数据载入到MongoDB中的函数
|
4. 将OKEX下载的历史数据载入到MongoDB中的函数
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
@ -26,7 +27,7 @@ def downloadEquityDailyBarts(self, symbol):
|
|||||||
"""
|
"""
|
||||||
下载股票的日行情,symbol是股票代码
|
下载股票的日行情,symbol是股票代码
|
||||||
"""
|
"""
|
||||||
print u'开始下载%s日行情' %symbol
|
print(u'开始下载%s日行情' %symbol)
|
||||||
|
|
||||||
# 查询数据库中已有数据的最后日期
|
# 查询数据库中已有数据的最后日期
|
||||||
cl = self.dbClient[DAILY_DB_NAME][symbol]
|
cl = self.dbClient[DAILY_DB_NAME][symbol]
|
||||||
@ -62,20 +63,20 @@ def downloadEquityDailyBarts(self, symbol):
|
|||||||
bar.datetime = datetime.strptime(bar.date, '%Y%m%d')
|
bar.datetime = datetime.strptime(bar.date, '%Y%m%d')
|
||||||
bar.volume = d.get('volume')
|
bar.volume = d.get('volume')
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print d
|
print(d)
|
||||||
|
|
||||||
flt = {'datetime': bar.datetime}
|
flt = {'datetime': bar.datetime}
|
||||||
self.dbClient[DAILY_DB_NAME][symbol].update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
self.dbClient[DAILY_DB_NAME][symbol].update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
||||||
|
|
||||||
print u'%s下载完成' %symbol
|
print(u'%s下载完成' %symbol)
|
||||||
else:
|
else:
|
||||||
print u'找不到合约%s' %symbol
|
print(u'找不到合约%s' %symbol)
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def loadMcCsv(fileName, dbName, symbol):
|
def loadMcCsv(fileName, dbName, symbol):
|
||||||
"""将Multicharts导出的csv格式的历史数据插入到Mongo数据库中"""
|
"""将Multicharts导出的csv格式的历史数据插入到Mongo数据库中"""
|
||||||
start = time()
|
start = time()
|
||||||
print u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol)
|
print(u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol))
|
||||||
|
|
||||||
# 锁定集合,并创建索引
|
# 锁定集合,并创建索引
|
||||||
client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
|
client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
|
||||||
@ -99,15 +100,15 @@ def loadMcCsv(fileName, dbName, symbol):
|
|||||||
|
|
||||||
flt = {'datetime': bar.datetime}
|
flt = {'datetime': bar.datetime}
|
||||||
collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
||||||
print bar.date, bar.time
|
print(bar.date, bar.time)
|
||||||
|
|
||||||
print u'插入完毕,耗时:%s' % (time()-start)
|
print(u'插入完毕,耗时:%s' % (time()-start))
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def loadTbCsv(fileName, dbName, symbol):
|
def loadTbCsv(fileName, dbName, symbol):
|
||||||
"""将TradeBlazer导出的csv格式的历史分钟数据插入到Mongo数据库中"""
|
"""将TradeBlazer导出的csv格式的历史分钟数据插入到Mongo数据库中"""
|
||||||
start = time()
|
start = time()
|
||||||
print u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol)
|
print(u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol))
|
||||||
|
|
||||||
# 锁定集合,并创建索引
|
# 锁定集合,并创建索引
|
||||||
client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
|
client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
|
||||||
@ -132,15 +133,15 @@ def loadTbCsv(fileName, dbName, symbol):
|
|||||||
|
|
||||||
flt = {'datetime': bar.datetime}
|
flt = {'datetime': bar.datetime}
|
||||||
collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
||||||
print bar.date, bar.time
|
print(bar.date, bar.time)
|
||||||
|
|
||||||
print u'插入完毕,耗时:%s' % (time()-start)
|
print(u'插入完毕,耗时:%s' % (time()-start))
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def loadTbPlusCsv(fileName, dbName, symbol):
|
def loadTbPlusCsv(fileName, dbName, symbol):
|
||||||
"""将TB极速版导出的csv格式的历史分钟数据插入到Mongo数据库中"""
|
"""将TB极速版导出的csv格式的历史分钟数据插入到Mongo数据库中"""
|
||||||
start = time()
|
start = time()
|
||||||
print u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol)
|
print(u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol))
|
||||||
|
|
||||||
# 锁定集合,并创建索引
|
# 锁定集合,并创建索引
|
||||||
client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
|
client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
|
||||||
@ -167,9 +168,9 @@ def loadTbPlusCsv(fileName, dbName, symbol):
|
|||||||
bar.openInterest = d[7]
|
bar.openInterest = d[7]
|
||||||
flt = {'datetime': bar.datetime}
|
flt = {'datetime': bar.datetime}
|
||||||
collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
||||||
print bar.date, bar.time
|
print(bar.date, bar.time)
|
||||||
|
|
||||||
print u'插入完毕,耗时:%s' % (time()-start)
|
print(u'插入完毕,耗时:%s' % (time()-start))
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
"""
|
"""
|
||||||
@ -186,7 +187,7 @@ def loadTdxCsv(fileName, dbName, symbol):
|
|||||||
"""将通达信导出的csv格式的历史分钟数据插入到Mongo数据库中"""
|
"""将通达信导出的csv格式的历史分钟数据插入到Mongo数据库中"""
|
||||||
start = time()
|
start = time()
|
||||||
date_correct = ""
|
date_correct = ""
|
||||||
print u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol)
|
print(u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol))
|
||||||
|
|
||||||
# 锁定集合,并创建索引
|
# 锁定集合,并创建索引
|
||||||
client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
|
client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
|
||||||
@ -218,7 +219,7 @@ def loadTdxCsv(fileName, dbName, symbol):
|
|||||||
flt = {'datetime': bar.datetime}
|
flt = {'datetime': bar.datetime}
|
||||||
collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
||||||
|
|
||||||
print u'插入完毕,耗时:%s' % (time()-start)
|
print(u'插入完毕,耗时:%s' % (time()-start))
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
"""
|
"""
|
||||||
@ -231,7 +232,7 @@ def loadTdxLc1(fileName, dbName, symbol):
|
|||||||
"""将通达信导出的lc1格式的历史分钟数据插入到Mongo数据库中"""
|
"""将通达信导出的lc1格式的历史分钟数据插入到Mongo数据库中"""
|
||||||
start = time()
|
start = time()
|
||||||
|
|
||||||
print u'开始读取通达信Lc1文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol)
|
print(u'开始读取通达信Lc1文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol))
|
||||||
|
|
||||||
# 锁定集合,并创建索引
|
# 锁定集合,并创建索引
|
||||||
client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
|
client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
|
||||||
@ -267,13 +268,13 @@ def loadTdxLc1(fileName, dbName, symbol):
|
|||||||
flt = {'datetime': bar.datetime}
|
flt = {'datetime': bar.datetime}
|
||||||
collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
||||||
|
|
||||||
print u'插入完毕,耗时:%s' % (time()-start)
|
print(u'插入完毕,耗时:%s' % (time()-start))
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def loadOKEXCsv(fileName, dbName, symbol):
|
def loadOKEXCsv(fileName, dbName, symbol):
|
||||||
"""将OKEX导出的csv格式的历史分钟数据插入到Mongo数据库中"""
|
"""将OKEX导出的csv格式的历史分钟数据插入到Mongo数据库中"""
|
||||||
start = time()
|
start = time()
|
||||||
print u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol)
|
print(u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol))
|
||||||
|
|
||||||
# 锁定集合,并创建索引
|
# 锁定集合,并创建索引
|
||||||
client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
|
client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
|
||||||
@ -304,5 +305,5 @@ def loadOKEXCsv(fileName, dbName, symbol):
|
|||||||
collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)
|
||||||
print('%s \t %s' % (bar.date, bar.time))
|
print('%s \t %s' % (bar.date, bar.time))
|
||||||
|
|
||||||
print u'插入完毕,耗时:%s' % (time()-start)
|
print(u'插入完毕,耗时:%s' % (time()-start))
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# encoding: UTF-8
|
# encoding: UTF-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
@ -10,4 +11,4 @@ from .chinese import text
|
|||||||
# 是否要使用英文
|
# 是否要使用英文
|
||||||
from vnpy.trader.vtGlobal import globalSetting
|
from vnpy.trader.vtGlobal import globalSetting
|
||||||
if globalSetting['language'] == 'english':
|
if globalSetting['language'] == 'english':
|
||||||
from english import text
|
from .english import text
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
'''
|
'''
|
||||||
动态载入所有的策略类
|
动态载入所有的策略类
|
||||||
'''
|
'''
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import importlib
|
import importlib
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# encoding: UTF-8
|
# encoding: UTF-8
|
||||||
|
|
||||||
from drEngine import DrEngine
|
from __future__ import absolute_import
|
||||||
from uiDrWidget import DrEngineManager
|
from .drEngine import DrEngine
|
||||||
|
from .uiDrWidget import DrEngineManager
|
||||||
|
|
||||||
appName = 'DataRecorder'
|
appName = 'DataRecorder'
|
||||||
appDisplayName = u'行情记录'
|
appDisplayName = u'行情记录'
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
# encoding: UTF-8
|
# encoding: UTF-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
# 默认设置
|
# 默认设置
|
||||||
from chinese import text
|
from .chinese import text
|
||||||
|
|
||||||
# 是否要使用英文
|
# 是否要使用英文
|
||||||
from vnpy.trader.vtGlobal import globalSetting
|
from vnpy.trader.vtGlobal import globalSetting
|
||||||
if globalSetting['language'] == 'english':
|
if globalSetting['language'] == 'english':
|
||||||
from english import text
|
from .english import text
|
@ -1,7 +1,8 @@
|
|||||||
# encoding: UTF-8
|
# encoding: UTF-8
|
||||||
|
|
||||||
from jsEngine import JsEngine
|
from __future__ import absolute_import
|
||||||
from uiJsWidget import JsEngineManager
|
from .jsEngine import JsEngine
|
||||||
|
from .uiJsWidget import JsEngineManager
|
||||||
|
|
||||||
appName = 'JaqsService'
|
appName = 'JaqsService'
|
||||||
appDisplayName = u'Jaqs服务'
|
appDisplayName = u'Jaqs服务'
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from __future__ import print_function
|
||||||
import zmq
|
import zmq
|
||||||
import Queue
|
import Queue
|
||||||
import threading
|
import threading
|
||||||
@ -108,11 +109,11 @@ class JRpcServer :
|
|||||||
#client_addr_map[client_id] = identity
|
#client_addr_map[client_id] = identity
|
||||||
self._on_data_arrived(identity, data)
|
self._on_data_arrived(identity, data)
|
||||||
|
|
||||||
except zmq.error.Again, e:
|
except zmq.error.Again as e:
|
||||||
#print "RECV timeout: ", e
|
#print "RECV timeout: ", e
|
||||||
pass
|
pass
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print("_recv_run:", e)
|
print(("_recv_run:", e))
|
||||||
|
|
||||||
def _callback_run(self):
|
def _callback_run(self):
|
||||||
while not self._should_close:
|
while not self._should_close:
|
||||||
@ -120,12 +121,12 @@ class JRpcServer :
|
|||||||
r = self._callback_queue.get(timeout = 1)
|
r = self._callback_queue.get(timeout = 1)
|
||||||
if r :
|
if r :
|
||||||
r()
|
r()
|
||||||
except Queue.Empty, e:
|
except Queue.Empty as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
traceback.print_exc(e)
|
traceback.print_exc(e)
|
||||||
print "_callback_run", type(e), e
|
print("_callback_run", type(e), e)
|
||||||
|
|
||||||
def _async_call(self, func):
|
def _async_call(self, func):
|
||||||
self._callback_queue.put( func )
|
self._callback_queue.put( func )
|
||||||
@ -164,12 +165,12 @@ class JRpcServer :
|
|||||||
#print "RECV", msg
|
#print "RECV", msg
|
||||||
|
|
||||||
if not msg:
|
if not msg:
|
||||||
print "wrong message format"
|
print("wrong message format")
|
||||||
return
|
return
|
||||||
|
|
||||||
method = msg['method'] if msg.has_key('method') else None
|
method = msg['method'] if 'method' in msg else None
|
||||||
|
|
||||||
call_id = msg['id'] if msg.has_key('id') and msg['id'] else None
|
call_id = msg['id'] if 'id' in msg and msg['id'] else None
|
||||||
|
|
||||||
if call_id and method:
|
if call_id and method:
|
||||||
if method == ".sys.heartbeat":
|
if method == ".sys.heartbeat":
|
||||||
@ -183,8 +184,8 @@ class JRpcServer :
|
|||||||
if self.on_call :
|
if self.on_call :
|
||||||
self._async_call( lambda : self.on_call(identity, msg))
|
self._async_call( lambda : self.on_call(identity, msg))
|
||||||
|
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print( "_on_data_arrived:", e)
|
print(( "_on_data_arrived:", e))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
# encoding: UTF-8
|
# encoding: UTF-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
import json
|
import json
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
import jrpc_server
|
from . import jrpc_server
|
||||||
|
|
||||||
from vnpy.event import Event
|
from vnpy.event import Event
|
||||||
from vnpy.trader.vtFunction import getJsonPath
|
from vnpy.trader.vtFunction import getJsonPath
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import jrpc_server
|
from __future__ import print_function
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from . import jrpc_server
|
||||||
import time
|
import time
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from qdata.database import DatabaseConn
|
from qdata.database import DatabaseConn
|
||||||
@ -15,7 +17,7 @@ db = None
|
|||||||
def on_call(client_id, req):
|
def on_call(client_id, req):
|
||||||
|
|
||||||
if req['method'] != '.sys.heartbeat':
|
if req['method'] != '.sys.heartbeat':
|
||||||
print "on_call", req
|
print("on_call", req)
|
||||||
|
|
||||||
if req['method'] == 'auth.login':
|
if req['method'] == 'auth.login':
|
||||||
server.send_rsp(client_id, req, result = { "username" : "fixme", "name": "fixme" })
|
server.send_rsp(client_id, req, result = { "username" : "fixme", "name": "fixme" })
|
||||||
@ -25,7 +27,7 @@ def on_call(client_id, req):
|
|||||||
server.send_rsp(client_id, req, error=[-1, "unknown method"])
|
server.send_rsp(client_id, req, error=[-1, "unknown method"])
|
||||||
return
|
return
|
||||||
|
|
||||||
if not req.has_key('params'):
|
if 'params' not in req:
|
||||||
server.send_rsp(client_id, req, error=[-1, "missing params"])
|
server.send_rsp(client_id, req, error=[-1, "missing params"])
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -55,7 +57,7 @@ def run():
|
|||||||
server = jrpc_server.JRpcServer()
|
server = jrpc_server.JRpcServer()
|
||||||
server.on_call = on_call
|
server.on_call = on_call
|
||||||
addr = "tcp://%s:%s"%(st.HOST, st.PORT)
|
addr = "tcp://%s:%s"%(st.HOST, st.PORT)
|
||||||
print "listen at " + addr
|
print("listen at " + addr)
|
||||||
server.listen(addr)
|
server.listen(addr)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
@ -159,9 +159,11 @@ class CalendarManager(QtWidgets.QWidget):
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def runCalendarEditor():
|
def runCalendarEditor():
|
||||||
"""运行日历编辑器"""
|
"""运行日历编辑器"""
|
||||||
reload(sys)
|
try: # Python 2
|
||||||
sys.setdefaultencoding('utf8')
|
reload(sys)
|
||||||
|
sys.setdefaultencoding('utf8')
|
||||||
|
except NameError: # Python 3
|
||||||
|
pass
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
app.setFont(QtGui.QFont(u'微软雅黑', 12))
|
app.setFont(QtGui.QFont(u'微软雅黑', 12))
|
||||||
|
|
||||||
@ -249,4 +251,4 @@ def getTimeToMaturity(expiryDate):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runCalendarEditor()
|
runCalendarEditor()
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
'''
|
'''
|
||||||
动态载入所有的策略类
|
动态载入所有的策略类
|
||||||
'''
|
'''
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import importlib
|
import importlib
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# encoding: UTF-8
|
# encoding: UTF-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
from vnpy.event import Event
|
from vnpy.event import Event
|
||||||
|
|
||||||
from vnpy.trader.vtConstant import DIRECTION_LONG, DIRECTION_SHORT, OFFSET_OPEN, OFFSET_CLOSE, PRICETYPE_LIMITPRICE
|
from vnpy.trader.vtConstant import DIRECTION_LONG, DIRECTION_SHORT, OFFSET_OPEN, OFFSET_CLOSE, PRICETYPE_LIMITPRICE
|
||||||
@ -7,7 +8,7 @@ from vnpy.trader.vtObject import VtOrderReq
|
|||||||
from vnpy.trader.vtEvent import EVENT_TICK, EVENT_TRADE
|
from vnpy.trader.vtEvent import EVENT_TICK, EVENT_TRADE
|
||||||
from vnpy.trader.uiBasicWidget import WorkingOrderMonitor, PositionMonitor
|
from vnpy.trader.uiBasicWidget import WorkingOrderMonitor, PositionMonitor
|
||||||
|
|
||||||
from uiOmBase import *
|
from .uiOmBase import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ from __future__ import division
|
|||||||
import os
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
from six import text_type
|
||||||
|
|
||||||
from vnpy.event import Event
|
from vnpy.event import Event
|
||||||
|
|
||||||
from .omBase import EVENT_OM_LOG
|
from .omBase import EVENT_OM_LOG
|
||||||
@ -113,7 +115,7 @@ class OmManager(QtWidgets.QWidget):
|
|||||||
def initOmEngine(self):
|
def initOmEngine(self):
|
||||||
"""初始化引擎"""
|
"""初始化引擎"""
|
||||||
path = os.getcwd()
|
path = os.getcwd()
|
||||||
fileName = unicode(self.comboSettingFile.currentText())
|
fileName = text_type(self.comboSettingFile.currentText())
|
||||||
fileName = os.path.join(path, fileName)
|
fileName = os.path.join(path, fileName)
|
||||||
result = self.omEngine.initEngine(fileName)
|
result = self.omEngine.initEngine(fileName)
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# encoding: UTF-8
|
# encoding: UTF-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
from .rmEngine import RmEngine
|
from .rmEngine import RmEngine
|
||||||
from .uiRmWidget import RmEngineManager
|
from .uiRmWidget import RmEngineManager
|
||||||
|
|
||||||
@ -7,4 +8,4 @@ appName = 'RiskManager'
|
|||||||
appDisplayName = u'风险管理'
|
appDisplayName = u'风险管理'
|
||||||
appEngine = RmEngine
|
appEngine = RmEngine
|
||||||
appWidget = RmEngineManager
|
appWidget = RmEngineManager
|
||||||
appIco = 'rm.ico'
|
appIco = 'rm.ico'
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# encoding: UTF-8
|
# encoding: UTF-8
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
@ -10,4 +11,4 @@ from .chinese import text
|
|||||||
# 是否要使用英文
|
# 是否要使用英文
|
||||||
from vnpy.trader.vtGlobal import globalSetting
|
from vnpy.trader.vtGlobal import globalSetting
|
||||||
if globalSetting['language'] == 'english':
|
if globalSetting['language'] == 'english':
|
||||||
from english import text
|
from .english import text
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
from six import text_type
|
||||||
|
|
||||||
from vnpy.event import Event
|
from vnpy.event import Event
|
||||||
from vnpy.trader.uiQt import QtWidgets, QtCore
|
from vnpy.trader.uiQt import QtWidgets, QtCore
|
||||||
from vnpy.trader.uiBasicWidget import (BasicMonitor, BasicCell, PnlCell,
|
from vnpy.trader.uiBasicWidget import (BasicMonitor, BasicCell, PnlCell,
|
||||||
@ -338,7 +340,7 @@ class StModeComboBox(QtWidgets.QComboBox):
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def setMode(self):
|
def setMode(self):
|
||||||
"""设置模式"""
|
"""设置模式"""
|
||||||
mode = unicode(self.currentText())
|
mode = text_type(self.currentText())
|
||||||
self.algoEngine.setAlgoMode(self.spreadName, mode)
|
self.algoEngine.setAlgoMode(self.spreadName, mode)
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
@ -582,4 +584,4 @@ class StManager(QtWidgets.QWidget):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user