[Add]增加WebTrader的主页路由
This commit is contained in:
parent
67f7b8be3b
commit
2f9af196a8
@ -56,7 +56,6 @@ api = Api(app)
|
||||
socketio = SocketIO(app)
|
||||
|
||||
# 创建资源
|
||||
|
||||
########################################################################
|
||||
class Token(Resource):
|
||||
"""登录验证"""
|
||||
@ -204,16 +203,33 @@ class Order(Resource):
|
||||
|
||||
vtOrderID = args['vtOrderID']
|
||||
|
||||
order = me.getOrder(vtOrderID)
|
||||
if not order:
|
||||
return {'result_code':'error','message':'vtOrderID error'}
|
||||
# 撤单某一委托
|
||||
if vtOrderID:
|
||||
order = me.getOrder(vtOrderID)
|
||||
if not order:
|
||||
return {'result_code':'error','message':'vtOrderID error'}
|
||||
|
||||
self.cancel(order)
|
||||
# 全撤
|
||||
else:
|
||||
l = me.getAllWorkingOrders()
|
||||
|
||||
for order in l:
|
||||
self.cancel(order)
|
||||
|
||||
return {'result_code':'success','data':""}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def cancel(self, order):
|
||||
"""撤单"""
|
||||
req = VtCancelOrderReq()
|
||||
req.orderID = order.orderID
|
||||
req.exchange = order.exchange
|
||||
req.symbol = order.symbol
|
||||
req.frontID = order.frontID
|
||||
req.sessionID = order.sessionID
|
||||
me.cancelOrder(req, order.gatewayName)
|
||||
return {'result_code':'success','data':""}
|
||||
|
||||
|
||||
########################################################################
|
||||
class Trade(Resource):
|
||||
@ -598,7 +614,8 @@ class CtaStrategyVar(Resource):
|
||||
@app.route('/')
|
||||
def index_html():
|
||||
"""首页"""
|
||||
return send_file( os.path.abspath('.') + '/web/index.html' )
|
||||
return send_file('./templates/index.html')
|
||||
|
||||
|
||||
# 注册资源
|
||||
api.add_resource(Token, '/token')
|
||||
|
@ -5,7 +5,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<script src="https://cdn.bootcss.com/socket.io/2.0.4/socket.io.slim.js"></script>
|
||||
<link href="https://cdn.bootcss.com/element-ui/2.0.11/theme-chalk/index.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="css/style.css">
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
Loading…
Reference in New Issue
Block a user