financelurker / crypto-trades-firefly-iii

This service lets you import your movements on supported crypto trading platforms to your Firefly III account. Keep an overview of your traded crypto assets.
GNU General Public License v3.0
23 stars 3 forks source link

Error connecting to Binance Account #3

Open Fabiettus opened 2 years ago

Fabiettus commented 2 years ago

Hi, deployed in a docker stack with firefly iii, i can't connecto to binance. I think error is caused by a "binanceAPIexception" but i'm not so skilled to determine if i'm right. You can read the Log from the container below:

Binance: Initializing trade import from crypto exchange to Firefly III
Binance: Trying to connect to your account...
Traceback (most recent call last):
  File "/opt/crypto-trades-firefly-iii/src/backends/exchanges/impls/binance_wrapper.py", line 216, in connect
    if not new_client.get_account_status().get('success') is True:
  File "/usr/local/lib/python3.9/site-packages/binance/client.py", line 2024, in get_account_status
    res = self._request_withdraw_api('get', 'accountStatus.html', True, data=params)
  File "/usr/local/lib/python3.9/site-packages/binance/client.py", line 270, in _request_withdraw_api
    return self._request(method, uri, signed, True, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/binance/client.py", line 260, in _request
    return self._handle_response()
  File "/usr/local/lib/python3.9/site-packages/binance/client.py", line 313, in _handle_response
    raise BinanceAPIException(self.response)
**binance.exceptions.BinanceAPIException: APIError(code=0): Invalid JSON error message from Binance: This endpoint has been deprecated, please integrate with “GET@/sapi/v1/account/status”. See details in the announcement: https://www.binance.com/en/support/announcement/f45dde7da58b473aa885349946bed269**

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/crypto-trades-firefly-iii/src/main.py", line 15, in start
    worker(impl_meta_class_instances)
  File "/opt/crypto-trades-firefly-iii/src/main.py", line 58, in worker
    exchange.get('timer_object').initial_sync(exchange.get('name'))
  File "/opt/crypto-trades-firefly-iii/src/importer/sync_timer.py", line 15, in initial_sync
    self.last_sync_interval_begin_timestamp = self.import_all_from_exchange(begin_of_sync_timestamp,
  File "/opt/crypto-trades-firefly-iii/src/importer/sync_timer.py", line 70, in import_all_from_exchange
    sync_logic.interval_processor(begin_timestamp, to_timestamp, True, trading_platform)
  File "/opt/crypto-trades-firefly-iii/src/importer/sync_logic.py", line 200, in interval_processor
    exchange_interface = exchange_interface_factory.get_specific_exchange_interface(trading_platform)
  File "/opt/crypto-trades-firefly-iii/src/backends/exchanges/exchange_interface_factory.py", line 8, in get_specific_exchange_interface
    return instance.get_exchange_client()
  File "/opt/crypto-trades-firefly-iii/src/backends/exchanges/impls/binance_wrapper.py", line 50, in get_exchange_client
    return BinanceClient()
  File "/opt/crypto-trades-firefly-iii/src/backends/exchanges/impls/binance_wrapper.py", line 80, in __init__
    self.connect()
  File "/opt/crypto-trades-firefly-iii/src/backends/exchanges/impls/binance_wrapper.py", line 226, in connect
    print('Binance: Cannot connect to your account.' % be)
TypeError: not all arguments converted during string formatting

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/crypto-trades-firefly-iii/src/main.py", line 69, in <module>
    start()
  File "/opt/crypto-trades-firefly-iii/src/main.py", line 18, in start
    print(str(e) % e)
TypeError: not all arguments converted during string formatting
Traceback (most recent call last):
  File "/opt/crypto-trades-firefly-iii/src/backends/exchanges/impls/binance_wrapper.py", line 216, in connect
--------------------------------------------------------
Trying to connect to your Firefly III account...
Connection to your Firefly III account established.
--------------------------------------------------------
Migration: Checking if there are any account or transaction identifiers to migrate.
Migration: 0 notes of accounts or transactions were migrated.

Binance: Initializing trade import from crypto exchange to Firefly III
    if not new_client.get_account_status().get('success') is True:
  File "/usr/local/lib/python3.9/site-packages/binance/client.py", line 2024, in get_account_status
Binance: Trying to connect to your account...
    res = self._request_withdraw_api('get', 'accountStatus.html', True, data=params)
  File "/usr/local/lib/python3.9/site-packages/binance/client.py", line 270, in _request_withdraw_api
    return self._request(method, uri, signed, True, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/binance/client.py", line 260, in _request
    return self._handle_response()
  File "/usr/local/lib/python3.9/site-packages/binance/client.py", line 313, in _handle_response
    raise BinanceAPIException(self.response)
binance.exceptions.BinanceAPIException: APIError(code=0): Invalid JSON error message from Binance: This endpoint has been deprecated, please integrate with “GET@/sapi/v1/account/status”. See details in the announcement: https://www.binance.com/en/support/announcement/f45dde7da58b473aa885349946bed269

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/crypto-trades-firefly-iii/src/main.py", line 15, in start
    worker(impl_meta_class_instances)
  File "/opt/crypto-trades-firefly-iii/src/main.py", line 58, in worker
    exchange.get('timer_object').initial_sync(exchange.get('name'))
  File "/opt/crypto-trades-firefly-iii/src/importer/sync_timer.py", line 15, in initial_sync
    self.last_sync_interval_begin_timestamp = self.import_all_from_exchange(begin_of_sync_timestamp,
  File "/opt/crypto-trades-firefly-iii/src/importer/sync_timer.py", line 70, in import_all_from_exchange
    sync_logic.interval_processor(begin_timestamp, to_timestamp, True, trading_platform)
  File "/opt/crypto-trades-firefly-iii/src/importer/sync_logic.py", line 200, in interval_processor
    exchange_interface = exchange_interface_factory.get_specific_exchange_interface(trading_platform)
  File "/opt/crypto-trades-firefly-iii/src/backends/exchanges/exchange_interface_factory.py", line 8, in get_specific_exchange_interface
    return instance.get_exchange_client()
  File "/opt/crypto-trades-firefly-iii/src/backends/exchanges/impls/binance_wrapper.py", line 50, in get_exchange_client
    return BinanceClient()
  File "/opt/crypto-trades-firefly-iii/src/backends/exchanges/impls/binance_wrapper.py", line 80, in __init__
    self.connect()
  File "/opt/crypto-trades-firefly-iii/src/backends/exchanges/impls/binance_wrapper.py", line 226, in connect
    print('Binance: Cannot connect to your account.' % be)
TypeError: not all arguments converted during string formatting

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/crypto-trades-firefly-iii/src/main.py", line 69, in <module>
    start()
  File "/opt/crypto-trades-firefly-iii/src/main.py", line 18, in start
    print(str(e) % e)
TypeError: not all arguments converted during string formatting
ren0d1 commented 2 years ago

Binance has redone their APIs between the creation of this repo and now leading to the fact that the endpoints used by this script aren't valid anymore. The problem is that it looks like the support of this project has long been stopped without any prior notice (haven't even approved a simple PR from more than a year ago).

However, since there is no usage of a hardcoded python library version and the project is using an external python library (which has been updated correctly) to connect to the Binance API, you can solve your issue by building the image using the Dockerfile and using that image instead.