sammchardy / python-binance

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

get_historical_trades is private endpoint? #804

Open davidxiao opened 3 years ago

davidxiao commented 3 years ago

why calling get_historical_trades got the below errors while others like get_order_book work fine? isn't it public endpoint?

(.env) plays:bot/ $ cat test.py

from binance.client import Client client = Client() client.get_historical_trades(symbol='BNBBTC')

client.get_order_book(symbol='BNBBTC')

(.env) plays:bot/ $ python test.py [16:07:1] Traceback (most recent call last): File "test.py", line 4, in client.get_historical_trades(symbol='BNBBTC') File "/Users/plays/py/bot/.env/lib/python3.8/site-packages/binance/client.py", line 682, in get_historical_trades return self._get('historicalTrades', data=params, version=self.PRIVATE_API_VERSION) File "/Users/plays/py/bot/.env/lib/python3.8/site-packages/binance/client.py", line 346, in _get return self._request_api('get', path, signed, version, kwargs) File "/Users/plays/py/bot/.env/lib/python3.8/site-packages/binance/client.py", line 309, in _request_api return self._request(method, uri, signed, kwargs) File "/Users/plays/py/bot/.env/lib/python3.8/site-packages/binance/client.py", line 292, in _request return self._handle_response(response) File "/Users/plays/py/bot/.env/lib/python3.8/site-packages/binance/client.py", line 301, in _handle_response raise BinanceAPIException(response, response.status_code, response.text) binance.exceptions.BinanceAPIException: APIError(code=-2014): API-key format invalid.

sammchardy commented 3 years ago

This endpoint was updated from v1 to v3, according to the docs this now requires a key and should be updated in the library.

https://binance-docs.github.io/apidocs/spot/en/#old-trade-lookup

sammchardy commented 3 years ago

Actually on further testing it doesn't require to be signed.

Are you setting a tld parameter for the Client?