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