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.lts/build/*
|
||||
trader/logs/vnpy*
|
||||
trader/logs/no*
|
||||
trader/orders/*.csv
|
||||
trader/learning/*
|
||||
trader/obj/*
|
||||
trader/temp/*
|
||||
trader/catStrategy/cache/*
|
||||
trader/catStrategy/ctaPeriod.py
|
||||
trader/catStrategy/ctaRangeBar.py
|
||||
trader/catStrategy/ctaRenkoBar.py
|
||||
trader/gateway/ctpGateway/CTP_EBF_connection.json
|
||||
trader/gateway/ctpGateway/CTP_Post_connection.json
|
||||
trader/gateway/ctpGateway/CTP_Prod_connection.json
|
||||
|
||||
vnpy/trader/logs/vnpy*
|
||||
vnpy/trader/logs/no*
|
||||
vnpy/trader/orders/*.csv
|
||||
vnpy/trader/learning/*
|
||||
vnpy/trader/obj/*
|
||||
vnpy/trader/temp/*
|
||||
vnpy/trader/app/catStrategy/cache/*
|
||||
vnpy/trader/app/catStrategy/ctaPeriod.py
|
||||
vnpy/trader/app/catStrategy/ctaRangeBar.py
|
||||
vnpy/trader/app/catStrategy/ctaRenkoBar.py
|
||||
vnpy/trader/app/catStrategy/strategy_store/*
|
||||
vnpy/trader/gateway/ctpGateway/CTP_EBF_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
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
[
|
||||
|
||||
|
||||
]
|
@ -531,7 +531,6 @@ class CtaEngine(object):
|
||||
for strategy in self.strategyDict.values():
|
||||
strategy.onTimer()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def insertData(self, dbName, collectionName, data):
|
||||
"""插入数据到数据库(这里的data可以是CtaTickData或者CtaBarData)"""
|
||||
|
@ -3,7 +3,7 @@
|
||||
import sys
|
||||
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 ctpGateway import CtpGateway
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
|
||||
import os
|
||||
|
||||
from setup_logger import setup_logger
|
||||
from simple_monitor import *
|
||||
from vtEngine import MainEngine
|
||||
from vnpy.trader.simple_monitor import *
|
||||
from vnpy.trader.vtEngine import MainEngine
|
||||
from vnpy.trader.gateway import ctpGateway
|
||||
from threading import Thread
|
||||
|
||||
setup_logger(debug=True)
|
||||
# ----------------------------------------------------------------------
|
||||
@ -37,6 +38,8 @@ class NoUiMain(object):
|
||||
print u'instance mainengine'
|
||||
self.mainEngine = MainEngine()
|
||||
|
||||
self.mainEngine.addGateway(ctpGateway, self.gateway_name)
|
||||
|
||||
def trade_off(self):
|
||||
"""检查现在是否为非交易时间"""
|
||||
now = datetime.now()
|
||||
@ -140,7 +143,6 @@ class NoUiMain(object):
|
||||
def run_noui():
|
||||
|
||||
try:
|
||||
|
||||
log_file_name = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||
'logs',
|
||||
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.start()
|
||||
|
||||
# 创建Qt应用对象,用于事件循环
|
||||
#app = QtGui.QApplication(sys.argv)
|
||||
#run_noui()
|
||||
# 连续运行,用于输出行情
|
||||
#app.exec_()
|
||||
|
||||
|
@ -101,7 +101,14 @@ class MainEngine(object):
|
||||
gateway = self.gatewayDict[gatewayName]
|
||||
gateway.subscribe(subscribeReq)
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user