parent
8137b6af14
commit
3431b9b15e
@ -9,6 +9,8 @@ from time import sleep
|
||||
from datetime import datetime, time
|
||||
from multiprocessing import Process
|
||||
|
||||
import webbrowser
|
||||
|
||||
from webServer import run as runWebServer
|
||||
from tradingServer import main as runTradingServer
|
||||
from vnpy.trader.vtEngine import LogEngine
|
||||
@ -28,6 +30,9 @@ if __name__ == '__main__':
|
||||
pWeb = None
|
||||
pTrading = None
|
||||
|
||||
import os
|
||||
print(os.getpid())
|
||||
|
||||
while True:
|
||||
le.info('-'*30)
|
||||
|
||||
@ -49,6 +54,8 @@ if __name__ == '__main__':
|
||||
pWeb.start()
|
||||
le.info(u'启动WEB服务器进程')
|
||||
|
||||
webbrowser.open('http://127.0.0.1:5000')
|
||||
|
||||
else:
|
||||
le.info(u'当前处于非交易时间段')
|
||||
|
||||
|
@ -50,8 +50,8 @@ with open("WEB_setting.json") as f:
|
||||
|
||||
# 创建Flask对象
|
||||
from flask import Flask, send_file
|
||||
from flask.ext.restful import Api, Resource, reqparse
|
||||
from flask.ext.socketio import SocketIO
|
||||
from flask_restful import Api, Resource, reqparse
|
||||
from flask_socketio import SocketIO
|
||||
from flask_cors import *
|
||||
|
||||
app = Flask(__name__)
|
||||
@ -510,6 +510,7 @@ class CtaStrategyStop(Resource):
|
||||
engine.stopStrategy(name)
|
||||
return {'result_code':'success','data':''}
|
||||
|
||||
|
||||
########################################################################
|
||||
class CtaStrategyName(Resource):
|
||||
"""»ñÈ¡²ßÂÔÃû"""
|
||||
@ -533,6 +534,7 @@ class CtaStrategyName(Resource):
|
||||
l = engine.getStrategyNames()
|
||||
return {'result_code':'success','data':l}
|
||||
|
||||
|
||||
########################################################################
|
||||
class CtaStrategyLoad(Resource):
|
||||
"""加载策略"""
|
||||
@ -672,7 +674,11 @@ ee.register(EVENT_CTA_STRATEGY, handleEvent)
|
||||
#----------------------------------------------------------------------
|
||||
def run():
|
||||
"""启动Web服务"""
|
||||
socketio.run(app,debug=True,host='0.0.0.0',port=5000)
|
||||
socketio.run(app,
|
||||
debug=True,
|
||||
host='0.0.0.0',
|
||||
port=5000,
|
||||
use_reloader=False)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -11,3 +11,4 @@ flask-restful
|
||||
flask-cors
|
||||
gevent-websocket
|
||||
pyjwt
|
||||
webbrowser
|
Loading…
Reference in New Issue
Block a user