Closed igkoh closed 4 years ago
Hi,@Ingyu, yes.You can cancel all orders with no params.e.g.: await self.trader.revoke_order().You can refer to the implemention here: https://github.com/hbdmapi/hbdm_Python/blob/master/alpha/platforms/huobi_swap_trade.py#L400
Is there simple way to apply filters direction='sell', offset='open' in all orders. -- There is no simple way to do this now.You have to cancel all orders or cancel the multiple orders.
github ref: https://github.com/huobiapi/Futures-Python-demo/blob/master/REST-Python3.5-demo/hbdm_api_demo.py Are there batch cancellations like dm.send_contract_batchorder extending usage of dm.send_contract_order? Or can one apply filter for direction and offset in cancel_all_contract_order? dm.cancel_all_contract_order(symbol='BTC')
On Sat, Aug 1, 2020 at 4:20 PM foonsun notifications@github.com wrote:
Hi,@InGyu https://github.com/InGyu, yes.You can cancel all orders by inputing no params.e.g.: await self.trader.revoke_order().You can refer to the implemention here: https://github.com/hbdmapi/hbdm_Python/blob/master/alpha/platforms/huobi_swap_trade.py#L400
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hbdmapi/hbdm_Python/issues/12#issuecomment-667487320, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3PHDEFKVASA36DB7YI2R3R6O627ANCNFSM4PRQDEWQ .
Thanks for precise answer for cancel of ALL orders by _, errors = await self.trader.revoke_order()
In strategy.py, async cancel_orders, order_nos=[739150457171329025,739150457141968897,739153049423159296,739153049406382082]
trial 1: _, errors = await self.trader.revoke_order(ordernos) |-> failed to cancel the corresponding order with ID trial 2: , errors = await self.trader.revoke_order(*order_nos) |-> failed to cancel the corresponding order with ID
Other trials as
order_nos=['739150457171329025','739150457141968897','739153049423159296','739153049406382082']
trial 1: _, errors = await self.trader.revoke_order(ordernos) |-> failed to cancel the corresponding order with ID trial 2: , errors = await self.trader.revoke_order(*order_nos) |-> failed to cancel the corresponding order with ID
What mistakes have I erred here? best regards, Ingyu
On Sat, Aug 1, 2020 at 6:10 PM ingyu koh ingyukoh@gmail.com wrote:
github ref: https://github.com/huobiapi/Futures-Python-demo/blob/master/REST-Python3.5-demo/hbdm_api_demo.py Are there batch cancellations like dm.send_contract_batchorder extending usage of dm.send_contract_order? Or can one apply filter for direction and offset in cancel_all_contract_order? dm.cancel_all_contract_order(symbol='BTC')
On Sat, Aug 1, 2020 at 4:20 PM foonsun notifications@github.com wrote:
Hi,@InGyu https://github.com/InGyu, yes.You can cancel all orders by inputing no params.e.g.: await self.trader.revoke_order().You can refer to the implemention here: https://github.com/hbdmapi/hbdm_Python/blob/master/alpha/platforms/huobi_swap_trade.py#L400
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hbdmapi/hbdm_Python/issues/12#issuecomment-667487320, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3PHDEFKVASA36DB7YI2R3R6O627ANCNFSM4PRQDEWQ .
Following the code in strategy.py
order_nos = [ orderno for orderno in self.trader.orders ]
if len(order_nos)>=10:
_, errors = await self.trader.revoke_order(*order_nos)
if errors:
logger.error(self.strategy,"cancel future order error! error:", errors, caller=self)
else:
logger.info(self.strategy,"cancel future order:", order_nos, caller=self)
order_nos= ['739431140758372353', '739431140770955264', '739431140783538176', '739431140796121088', '739431140804509696', '739431140821286912', '739431153076871168', '739431153089454080', '739431153102036992', '739431153114619904', '739431153131397120', '739431153139785728']
Why does revoke_order of list of string ordernos fail to cancel? Best regards, Ingyu
@igkoh You need to submit 10 orders at most by using the interface.The number of the orders exceed 10.
Thanks, foonsun. As you explained precisely, I confirmed cancellation of list of order nos less or equal than 10 as order_nos = [ orderno for orderno in self.trader.orders ] if len(order_nos)>=10: order_nos=order_nos[:10] ##cut upto list size <=10 _, errors = await self.trader.revoke_order(*order_nos)
Best regards, Ingyu
Thanks, foonsun. As you explained precisely, I confirmed cancellation of list of order nos less or equal than 10 as order_nos = [ orderno for orderno in self.trader.orders ] if len(order_nos)>=10: order_nos=ordernos[:10] ##cut upto list size <=10 , errors = await self.trader.revoke_order(*order_nos)
Best regards, Ingyu
On Sat, Aug 1, 2020 at 4:20 PM foonsun notifications@github.com wrote:
Hi,@InGyu https://github.com/InGyu, yes.You can cancel all orders by inputing no params.e.g.: await self.trader.revoke_order().You can refer to the implemention here: https://github.com/hbdmapi/hbdm_Python/blob/master/alpha/platforms/huobi_swap_trade.py#L400
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hbdmapi/hbdm_Python/issues/12#issuecomment-667487320, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3PHDEFKVASA36DB7YI2R3R6O627ANCNFSM4PRQDEWQ .
@igkoh great job.
If there are 300 order nos to cancel of offset=close, should I put time.sleep(0.001) [ 1/1000 second ] or async/await handles in loop automatically in 30 consecutive revoke_order?
Best regards, Ingyu
Fast cancelation of orders_no In async cancel_orders of list of orders_no order_nos=['739132369126199297','739132369126199297','739132369138782208','739132369147170816'] await self.trader.revoke_order(*order_nos)
-> async on_ticker's await self.cancel_orders
In a fast changing market situation, this cancellation of large orders takes a considerable time. Is there faster way of cancelling the orders, for example with filter, direction='sell', offset='open' or 'close'.
For example rest_api of cancel_all_contract _order dm = HuobiDM(URL, ACCESS_KEY, SECRET_KEY) dm.cancel_all_contract_order(symbol='BTC') is quite fast in cancelling all orders.
Is there simple way to apply filters direction='sell', offset='open' in all orders. Best regards, Ingyu