python-binance
python-binance copied to clipboard
#auto-cancel-all-open-orders-trade
Is the https://binance-docs.github.io/apidocs/futures/en/#auto-cancel-all-open-orders-trade
method implemented in this wrapper? I'm not able to find the right fonction for it.
futures_cancel_orders
calls #cancel-multiple-orders-trade
and it's not what I need. I want to implement thecountdownTime
over and over so if my bot stops, it kills all open orders.
See Client.futures_cancel_all_open_orders
Hello, is this method Client.futures_cancel_all_open_orders implemented for USD-M or only for Coin-M futures? When trying to use it with USD-M futures, I get a binance.exceptions.BinanceAPIException: APIError(code=-1121): Invalid symbol. for "ETHBUSD". So wondering what's the problem. Thanks!
You can extend the Client class like this:
class MyBinanceClient(Client):
"""Extended python-binance `Client`: added countdown_cancel_all method"""
def countdown_cancel_all(self, symbol: str, countdownTime: int, recvWindow: int = 5000):
"""Auto-Cancel All Open Orders
https://binance-docs.github.io/apidocs/futures/en/#auto-cancel-all-open-orders-trade
:param symbol: Name of symbol pair e.g. BNBBTC.
:type symbol: str
:param countdownTime: countdown time, 1000 for 1 second. 0 to cancel the timer
:type countdownTime: int
:param recvWindow: Optional; the number of milliseconds after timestamp the request is valid for (default is 5000)
:type recvWindow: int
:returns API response:
.. code-block:: python
{
"symbol": "BTCUSDT",
"countdownTime": "100000"
}
"""
return self._request_futures_api('post', 'countdownCancelAll', True,
data=dict(symbol=symbol, countdownTime=countdownTime, recvWindow=recvWindow))