sammchardy / python-binance

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

APIError(code=-1121): Invalid symbol. get_historical_klines #1206

Closed fightdirector closed 2 years ago

fightdirector commented 2 years ago

Describe the bug

Returns error when pair is ONEUSDT. No error when pair is BTCUSDT.

Traceback (most recent call last): File "D:/Fight/My Documents/Python/Crypto/binance live bot pullback orderblock.py", line 92, in trader() File "D:/Fight/My Documents/Python/Crypto/binance live bot pullback orderblock.py", line 61, in trader df = getdata(coin) File "D:/Fight/My Documents/Python/Crypto/binance live bot pullback orderblock.py", line 19, in getdata frame = pd.DataFrame(client.get_historical_klines(symbol, File "C:\Users\Fight\AppData\Local\Programs\Python\Python38\lib\site-packages\binance\client.py", line 934, in get_historical_klines return self._historical_klines( File "C:\Users\Fight\AppData\Local\Programs\Python\Python38\lib\site-packages\binance\client.py", line 973, in _historical_klines first_valid_ts = self._get_earliest_valid_timestamp(symbol, interval, klines_type) File "C:\Users\Fight\AppData\Local\Programs\Python\Python38\lib\site-packages\binance\client.py", line 904, in _get_earliest_valid_timestamp kline = self._klines( File "C:\Users\Fight\AppData\Local\Programs\Python\Python38\lib\site-packages\binance\client.py", line 883, in _klines return self.get_klines(params) File "C:\Users\Fight\AppData\Local\Programs\Python\Python38\lib\site-packages\binance\client.py", line 868, in get_klines return self._get('klines', data=params, version=self.PRIVATE_API_VERSION) File "C:\Users\Fight\AppData\Local\Programs\Python\Python38\lib\site-packages\binance\client.py", line 371, in _get return self._request_api('get', path, signed, version, kwargs) File "C:\Users\Fight\AppData\Local\Programs\Python\Python38\lib\site-packages\binance\client.py", line 334, in _request_api return self._request(method, uri, signed, **kwargs) File "C:\Users\Fight\AppData\Local\Programs\Python\Python38\lib\site-packages\binance\client.py", line 315, in _request return self._handle_response(self.response) File "C:\Users\Fight\AppData\Local\Programs\Python\Python38\lib\site-packages\binance\client.py", line 324, in _handle_response raise BinanceAPIException(response, response.status_code, response.text) binance.exceptions.BinanceAPIException: APIError(code=-1121): Invalid symbol.

Process finished with exit code 1

To Reproduce def getdata(symbol): frame = pd.DataFrame(client.get_historical_klines("ONEUSDT", '5m', '2 hours ago UTC+3'))

Environment (please complete the following information):