Forums

CCXT doesn't load balance on BINANCE

hi? there is some problems HTTPError Traceback (most recent call last) File ~/.local/lib/python3.9/site-packages/ccxt/base/exchange.py:620, in Exchange.fetch(self, url, method, headers, body) 619 self.logger.debug("%s %s, Response: %s %s %s", method, url, http_status_code, headers, http_response) --> 620 response.raise_for_status() 622 except Timeout as e:

File /usr/local/lib/python3.9/site-packages/requests/models.py:1021, in Response.raise_for_status(self) 1020 if http_error_msg: -> 1021 raise HTTPError(http_error_msg, response=self)

HTTPError: 451 Client Error: for url: https://api.binance.com/sapi/v1/capital/config/getall?timestamp=1670407431375&recvWindow=10000&signature=c9f0d7f70c9a4298d2d90bc51adaf00cae31b2301444c590016f6cfb00353cfa

The above exception was the direct cause of the following exception:

ExchangeError Traceback (most recent call last) Input In [10], in <cell line: 1>() ----> 1 exchange.fetch_balance()

File ~/.local/lib/python3.9/site-packages/ccxt/binance.py:1814, in binance.fetch_balance(self, params) 1805 def fetch_balance(self, params={}): 1806 """ 1807 query for balance and get the amount of funds available for trading or funds locked in orders 1808 :param dict params: extra parameters specific to the binance api endpoint (...) 1812 :returns dict: a balance structure <https://docs.ccxt.com/en/latest/manual.html?#balance-structure> 1813 """ -> 1814 self.load_markets() 1815 defaultType = self.safe_string_2(self.options, 'fetchBalance', 'defaultType', 'spot') 1816 type = self.safe_string(params, 'type', defaultType)

File ~/.local/lib/python3.9/site-packages/ccxt/base/exchange.py:1430, in Exchange.load_markets(self, reload, params) 1428 currencies = None 1429 if self.has['fetchCurrencies'] is True: -> 1430 currencies = self.fetch_currencies() 1431 markets = self.fetch_markets(params) 1432 return self.set_markets(markets, currencies)

File ~/.local/lib/python3.9/site-packages/ccxt/binance.py:1304, in binance.fetch_currencies(self, params) 1302 if apiBackup is not None: 1303 return None -> 1304 response = self.sapiGetCapitalConfigGetall(params) 1305 result = {} 1306 for i in range(0, len(response)): 1307 # 1308 # { (...) 1383 # } 1384 #

File ~/.local/lib/python3.9/site-packages/ccxt/base/exchange.py:500, in Exchange.define_rest_api_endpoint.<locals>.partialer.<locals>.inner(_self, params, context) 498 if context is not None: 499 inner_kwargs['context'] = params --> 500 return entry(_self, **inner_kwargs)

File ~/.local/lib/python3.9/site-packages/ccxt/binance.py:5558, in binance.request(self, path, api, method, params, headers, body, config, context) 5557 def request(self, path, api='public', method='GET', params={}, headers=None, body=None, config={}, context={}): -> 5558 response = self.fetch2(path, api, method, params, headers, body, config, context) 5559 # a workaround for {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."} 5560 if (api == 'private') or (api == 'wapi'):

File ~/.local/lib/python3.9/site-packages/ccxt/base/exchange.py:2607, in Exchange.fetch2(self, path, api, method, params, headers, body, config, context) 2605 self.lastRestRequestTimestamp = self.milliseconds() 2606 request = self.sign(path, api, method, params, headers, body) -> 2607 return self.fetch(request['url'], request['method'], request['headers'], request['body'])

File ~/.local/lib/python3.9/site-packages/ccxt/base/exchange.py:639, in Exchange.fetch(self, url, method, headers, body) 637 if not skip_further_error_handling: 638 self.handle_http_status_code(http_status_code, http_status_text, url, method, http_response) --> 639 raise ExchangeError(details) from e 641 except requestsConnectionError as e: 642 error_string = str(e)

ExchangeError: binance GET https://api.binance.com/sapi/v1/capital/config/getall?timestamp=1670407431375&recvWindow=10000&signature=c9f0d7f70c9a4298d2d90bc51adaf00cae31b2301444c590016f6cfb00353cfa

1 ​

Hi there, please refer to my reply on your other post: https://www.pythonanywhere.com/forums/topic/31299/#id_post_107839. This is likely caused by the same issue