MultiversX Tracker is Live!

Python - cancel all open orders

Binance

Cryptocoins Exchanges / Binance 830 Views

I'm using the python-binance API and trying to recreate the DELETE api/v3/openOrders endpoint. I originally tried this solution recommended on the python-binance GitHub page:

def cancel_orders(self, **params): return self._delete('openOrders', True, data=params) 

But I was getting the following response: APIError(code=-2011): Unknown order sent.

So I tried replicating the request like this:

def cancel_open_orders(self, **params): uri = self._create_api_uri("openOrders", True, self.PUBLIC_API_VERSION) kwargs = self._get_request_kwargs("delete", True, force_params=False, data=params) data = { arg[0]: arg[1] for arg in kwargs["data"] } print(uri) print(data) headers = {"X-MBX-APIKEY": self.API_KEY} results = requests.delete(uri, data=data, headers=headers) print(results) 

uri and data print as

https://api.binance.com/api/v3/openOrders {'symbol': 'BTCUSDT', 'timestamp': '1625894171675', 'signature': '567c2dda12a0b8e26f66130ee2cf0187d630e7c4e69949e5b1ee7305cb1008b9'} 

Using this method, I get a simple <Response [400]> response.

How can I implement this in vanilla python?

submitted by /u/JHogg11
[link] [comments]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments