sammchardy / python-binance

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

get_historical_klines_generator - APIError(code=-1104) #799

Open SteveChurch opened 3 years ago

SteveChurch commented 3 years ago

Describe the bug Using get_historical_klines_generator Causes APIError 1104

To Reproduce

            for klines in client.get_historical_klines_generator(
                    symbol="BTCUSDT",
                    interval=Client.KLINE_INTERVAL_1MINUTE,
                    start_str="1 Jan, 2005 UTC"
            ):
                store_candles(klines, pair)

Expected behavior I would expect data to be returned.

Environment (please complete the following information):

Logs or Additional context

Traceback (most recent call last):
  File "./manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/code/apps/crypto/management/commands/store_history_alltime.py", line 56, in handle
    for klines in client.get_historical_klines_generator(
  File "/usr/local/lib/python3.8/site-packages/binance/client.py", line 1032, in _historical_klines_generator
    output_data = self.get_klines(
  File "/usr/local/lib/python3.8/site-packages/binance/client.py", line 817, in get_klines
    return self._get('klines', data=params, version=self.PRIVATE_API_VERSION)
  File "/usr/local/lib/python3.8/site-packages/binance/client.py", line 320, in _get
    return self._request_api('get', path, signed, version, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/binance/client.py", line 265, in _request_api
    return self._request(method, uri, signed, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/binance/client.py", line 260, in _request
    return self._handle_response()
  File "/usr/local/lib/python3.8/site-packages/binance/client.py", line 313, in _handle_response
    raise BinanceAPIException(self.response)
binance.exceptions.BinanceAPIException: APIError(code=-1104): Not all sent parameters were read; read '4' parameter(s) but was sent '5'.
SteveChurch commented 3 years ago

https://github.com/sammchardy/python-binance/blob/ea11f4c212c43223e2cd212e3d53c435c940c704/binance/client.py#L1032

Issue above. Spot is not being handled properly and instead being passed through to the API

sammchardy commented 3 years ago

This should now be fixed in v1.0.0

SteveChurch commented 3 years ago

Thanks @sammchardy