[Add]增加WebTrader的全撤功能
This commit is contained in:
parent
a41cecce5b
commit
076fc5ed47
@ -140,6 +140,7 @@ class Order(Resource):
|
||||
self.deleteParser = reqparse.RequestParser()
|
||||
self.deleteParser.add_argument('vtOrderID')
|
||||
self.deleteParser.add_argument('token')
|
||||
self.deleteParser.add_argument('cancelAll')
|
||||
|
||||
super(Order, self).__init__()
|
||||
|
||||
@ -193,6 +194,10 @@ class Order(Resource):
|
||||
if token != TOKEN:
|
||||
return None
|
||||
|
||||
cancelAll = args['cancelAll']
|
||||
|
||||
# 单一撤单
|
||||
if not cancelAll:
|
||||
vtOrderID = args['vtOrderID']
|
||||
|
||||
order = me.getOrder(vtOrderID)
|
||||
@ -204,6 +209,16 @@ class Order(Resource):
|
||||
req.exchange = order.exchange
|
||||
req.symbol = order.symbol
|
||||
me.cancelOrder(req, order.gatewayName)
|
||||
# 全撤
|
||||
else:
|
||||
l = me.getAllWorkingOrders()
|
||||
|
||||
for order in l:
|
||||
req = VtCancelOrderReq()
|
||||
req.orderID = order.orderID
|
||||
req.exchange = order.exchange
|
||||
req.symbol = order.symbol
|
||||
me.cancelOrder(req, order.gatewayName)
|
||||
|
||||
|
||||
########################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user