sync vnpy1.6.2
This commit is contained in:
parent
9287136356
commit
394d31d09b
30
.gitignore
vendored
30
.gitignore
vendored
@ -53,20 +53,22 @@ Release/
|
|||||||
=======
|
=======
|
||||||
api/vn.ctp/build/*
|
api/vn.ctp/build/*
|
||||||
api/vn.lts/build/*
|
api/vn.lts/build/*
|
||||||
trader/logs/vnpy*
|
vnpy/trader/logs/vnpy*
|
||||||
trader/logs/no*
|
vnpy/trader/logs/no*
|
||||||
trader/orders/*.csv
|
vnpy/trader/orders/*.csv
|
||||||
trader/learning/*
|
vnpy/trader/learning/*
|
||||||
trader/obj/*
|
vnpy/trader/obj/*
|
||||||
trader/temp/*
|
vnpy/trader/temp/*
|
||||||
trader/catStrategy/cache/*
|
vnpy/trader/app/catStrategy/cache/*
|
||||||
trader/catStrategy/ctaPeriod.py
|
vnpy/trader/app/catStrategy/ctaPeriod.py
|
||||||
trader/catStrategy/ctaRangeBar.py
|
vnpy/trader/app/catStrategy/ctaRangeBar.py
|
||||||
trader/catStrategy/ctaRenkoBar.py
|
vnpy/trader/app/catStrategy/ctaRenkoBar.py
|
||||||
trader/gateway/ctpGateway/CTP_EBF_connection.json
|
vnpy/trader/app/catStrategy/strategy_store/*
|
||||||
trader/gateway/ctpGateway/CTP_Post_connection.json
|
vnpy/trader/gateway/ctpGateway/CTP_EBF_connection.json
|
||||||
trader/gateway/ctpGateway/CTP_Prod_connection.json
|
vnpy/trader/gateway/ctpGateway/CTP_Post_connection.json
|
||||||
|
vnpy/trader/gateway/ctpGateway/CTP_Prod_connection.json
|
||||||
|
vnpy/trader/gateway/ctpGateway/CTP_JR_connection.json
|
||||||
|
vnpy/trader/gateway/ctpGateway/CTP_JR2_connection.json
|
||||||
|
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
[
|
|
||||||
|
|
||||||
|
|
||||||
]
|
|
@ -531,7 +531,6 @@ class CtaEngine(object):
|
|||||||
for strategy in self.strategyDict.values():
|
for strategy in self.strategyDict.values():
|
||||||
strategy.onTimer()
|
strategy.onTimer()
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
def insertData(self, dbName, collectionName, data):
|
def insertData(self, dbName, collectionName, data):
|
||||||
"""插入数据到数据库(这里的data可以是CtaTickData或者CtaBarData)"""
|
"""插入数据到数据库(这里的data可以是CtaTickData或者CtaBarData)"""
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
print u'init {0}'.format(os.path.dirname(__file__))
|
#print u'init {0}'.format(os.path.dirname(__file__))
|
||||||
from vnpy.trader import vtConstant
|
from vnpy.trader import vtConstant
|
||||||
from ctpGateway import CtpGateway
|
from ctpGateway import CtpGateway
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
# encoding: UTF-8
|
# encoding: UTF-8
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from setup_logger import setup_logger
|
from setup_logger import setup_logger
|
||||||
from simple_monitor import *
|
from vnpy.trader.simple_monitor import *
|
||||||
from vtEngine import MainEngine
|
from vnpy.trader.vtEngine import MainEngine
|
||||||
|
from vnpy.trader.gateway import ctpGateway
|
||||||
|
from threading import Thread
|
||||||
|
|
||||||
setup_logger(debug=True)
|
setup_logger(debug=True)
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
@ -37,6 +38,8 @@ class NoUiMain(object):
|
|||||||
print u'instance mainengine'
|
print u'instance mainengine'
|
||||||
self.mainEngine = MainEngine()
|
self.mainEngine = MainEngine()
|
||||||
|
|
||||||
|
self.mainEngine.addGateway(ctpGateway, self.gateway_name)
|
||||||
|
|
||||||
def trade_off(self):
|
def trade_off(self):
|
||||||
"""检查现在是否为非交易时间"""
|
"""检查现在是否为非交易时间"""
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
@ -140,7 +143,6 @@ class NoUiMain(object):
|
|||||||
def run_noui():
|
def run_noui():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
log_file_name = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
log_file_name = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||||
'logs',
|
'logs',
|
||||||
u'noUiMain_{0}.log'.format(datetime.now().strftime('%m%d_%H%M'))))
|
u'noUiMain_{0}.log'.format(datetime.now().strftime('%m%d_%H%M'))))
|
||||||
@ -160,9 +162,4 @@ if __name__ == '__main__':
|
|||||||
thread = Thread(target=run_noui, args=())
|
thread = Thread(target=run_noui, args=())
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
# 创建Qt应用对象,用于事件循环
|
|
||||||
#app = QtGui.QApplication(sys.argv)
|
|
||||||
#run_noui()
|
|
||||||
# 连续运行,用于输出行情
|
|
||||||
#app.exec_()
|
|
||||||
|
|
||||||
|
@ -101,7 +101,14 @@ class MainEngine(object):
|
|||||||
gateway = self.gatewayDict[gatewayName]
|
gateway = self.gatewayDict[gatewayName]
|
||||||
gateway.subscribe(subscribeReq)
|
gateway.subscribe(subscribeReq)
|
||||||
else:
|
else:
|
||||||
self.writeLog(text.GATEWAY_NOT_EXIST.format(gateway=gatewayName))
|
# 如果当前只有一个连接
|
||||||
|
if len(self.gatewayDict) == 1:
|
||||||
|
k = list(self.gatewayDict.keys())[0]
|
||||||
|
gateway = self.gatewayDict[k]
|
||||||
|
gateway.subscribe(subscribeReq)
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.writeLog(text.GATEWAY_NOT_EXIST.format(gateway=gatewayName))
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
def sendOrder(self, orderReq, gatewayName):
|
def sendOrder(self, orderReq, gatewayName):
|
||||||
|
Loading…
Reference in New Issue
Block a user