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?
[link] [comments]
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