sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
5.88k stars 2.2k forks source link

binance.us some endpoints do not work #1196

Open aosavas opened 2 years ago

aosavas commented 2 years ago

Describe the bug Some of the endpoints do not work with binance.us. For ex: get_account_api_permissions()

To Reproduce client = Client(api_key, api_secret, tld = "US") client.get_all_orders(symbol='BNBBTC') <---WORKS client.get_account_api_trading_status() <--- DOES NOT WORK

Traceback (most recent call last): File "", line 1, in File "/home/ubuntu/.local/lib/python3.8/site-packages/binance/client.py", line 2146, in get_account_api_trading_status return self._request_margin_api('get', 'account/apiTradingStatus', True, data=params) File "/home/ubuntu/.local/lib/python3.8/site-packages/binance/client.py", line 364, in _request_margin_api return self._request(method, uri, signed, **kwargs) File "/home/ubuntu/.local/lib/python3.8/site-packages/binance/client.py", line 315, in _request return self._handle_response(self.response) File "/home/ubuntu/.local/lib/python3.8/site-packages/binance/client.py", line 324, in _handle_response raise BinanceAPIException(response, response.status_code, response.text) File "/home/ubuntu/.local/lib/python3.8/site-packages/binance/exceptions.py", line 14, in init self.code = json_res['code'] KeyError: 'code'

Environment (please complete the following information):

Logs or Additional context Not sure if it works .com as I do not have a ".com" account but there are multiple endpoints that are listed and not working.

alphazwest commented 1 year ago

Getting the same error for several endpoints as well -- also using the .us API w/o a .com account to confirm.

Currently known issues with the following:

get_trade_fee with either the symbol kwarg or not.

get_account_api_trading_status

Upon inspection, the raw JSON return is similar to the following:

{'timestamp': removed, 'status': 404, 'error': 'Not Found', 'message': 'No message available', 'path': '/sapi/v1/asset/assetDetail'}

Notably, there is no 'code' key nor is there a 'msg' key (looking at line 15 in exceptions.py in the BinanceAPIException class which would be executed directly after the json_res['code'] portion.

psych0v0yager commented 1 year ago

Has there been any update on this?

OpenCoderX commented 1 year ago

Same issue here with get_account() , the docs at https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#account-information-user_data reference a v3 uri