freqtrade / freqtrade

Free, open source crypto trading bot
https://www.freqtrade.io
GNU General Public License v3.0
28.66k stars 6.14k forks source link

Unable to initialize markets 'Binance' #9805

Closed Armondal closed 8 months ago

Armondal commented 8 months ago

Describe your environment

Describe the problem:

I'm trying to start Freqtrade with my Binance api credential but always getting error ERROR - Unable to initialize markets. I have successfully access my binance account using normal python script for the api.

Steps to reproduce:

  1. docker compose up -d

Observed Results:

I excted to it run properly also could see the web UI.

Relevant code exceptions or logs

my cofig.json

{ "max_open_trades": 3, "stake_currency": "USDT", "stake_amount": 1000, "tradable_balance_ratio": 0.99, "fiat_display_currency": "USD", "dry_run": true, "dry_run_wallet": 1000, "cancel_open_orders_on_exit": false, "trading_mode": "futures", "margin_mode": "isolated", "unfilledtimeout": { "entry": 10, "exit": 10, "exit_timeout_count": 0, "unit": "minutes" }, "entry_pricing": { "price_side": "same", "use_order_book": true, "order_book_top": 1, "price_last_balance": 0.0, "check_depth_of_market": { "enabled": false, "bids_to_ask_delta": 1 } }, "exit_pricing":{ "price_side": "same", "use_order_book": true, "order_book_top": 1 }, "exchange": { "name": "binance", "key": "x", "secret": "x", "ccxt_config": {}, "ccxt_async_config": {}, "pair_whitelist": [ ], "pair_blacklist": [ "BNB/.*" ] }, "pairlists": [ { "method": "VolumePairList", "number_assets": 20, "sort_key": "quoteVolume", "min_value": 0, "refresh_period": 1800 } ], "telegram": { "enabled": true, "token": "x", "chat_id": "x" }, "api_server": { "enabled": true, "listen_ip_address": "0.0.0.0", "listen_port": 8080, "username": "Freqtrader", "password": "SuperSecret1!", "verbosity": "error", "enable_openapi": false, "jwt_secret_key": "a5253cc279195e790d5ab4909224a6797adeb0c6d3c58797a20e2abca2174bee", "ws_token": "F5ziiRZMVPvIi0mOvo9vUYyU__NyQ-uHuQ", "CORS_origins": [] }, "bot_name": "freqtrade", "initial_state": "running", "force_entry_enable": false, "internals": { "process_throttle_secs": 5 } }

Note: Please copy/paste text of the messages, no screenshots of logs please.


2024-02-12 13:53:35 freqtrade  | 2024-02-12 07:53:35,663 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'options': {'defaultType': 'swap'}}
2024-02-12 13:53:35 freqtrade  | 2024-02-12 07:53:35,667 - freqtrade.exchange.exchange - INFO - Applying additional ccxt config: {'options': {'defaultType': 'swap'}}
2024-02-12 13:53:35 freqtrade  | 2024-02-12 07:53:35,671 - freqtrade.exchange.exchange - INFO - Using Exchange "Binance"
2024-02-12 13:53:46 freqtrade  | 2024-02-12 07:53:46,366 - freqtrade.exchange.exchange - ERROR - Unable to initialize markets.
2024-02-12 13:53:46 freqtrade  | Traceback (most recent call last):
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 467, in _make_request
2024-02-12 13:53:46 freqtrade  |     self._validate_conn(conn)
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1096, in _validate_conn
2024-02-12 13:53:46 freqtrade  |     conn.connect()
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/urllib3/connection.py", line 642, in connect
2024-02-12 13:53:46 freqtrade  |     sock_and_verified = _ssl_wrap_socket_and_match_hostname(
2024-02-12 13:53:46 freqtrade  |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/urllib3/connection.py", line 782, in _ssl_wrap_socket_and_match_hostname
2024-02-12 13:53:46 freqtrade  |     ssl_sock = ssl_wrap_socket(
2024-02-12 13:53:46 freqtrade  |                ^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/urllib3/util/ssl_.py", line 470, in ssl_wrap_socket
2024-02-12 13:53:46 freqtrade  |     ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
2024-02-12 13:53:46 freqtrade  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/urllib3/util/ssl_.py", line 514, in _ssl_wrap_socket_impl
2024-02-12 13:53:46 freqtrade  |     return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
2024-02-12 13:53:46 freqtrade  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/usr/local/lib/python3.11/ssl.py", line 517, in wrap_socket
2024-02-12 13:53:46 freqtrade  |     return self.sslsocket_class._create(
2024-02-12 13:53:46 freqtrade  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/usr/local/lib/python3.11/ssl.py", line 1108, in _create
2024-02-12 13:53:46 freqtrade  |     self.do_handshake()
2024-02-12 13:53:46 freqtrade  |   File "/usr/local/lib/python3.11/ssl.py", line 1383, in do_handshake
2024-02-12 13:53:46 freqtrade  |     self._sslobj.do_handshake()
2024-02-12 13:53:46 freqtrade  | TimeoutError: _ssl.c:989: The handshake operation timed out
2024-02-12 13:53:46 freqtrade  | 
2024-02-12 13:53:46 freqtrade  | The above exception was the direct cause of the following exception:
2024-02-12 13:53:46 freqtrade  | 
2024-02-12 13:53:46 freqtrade  | Traceback (most recent call last):
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
2024-02-12 13:53:46 freqtrade  |     resp = conn.urlopen(
2024-02-12 13:53:46 freqtrade  |            ^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 844, in urlopen
2024-02-12 13:53:46 freqtrade  |     retries = retries.increment(
2024-02-12 13:53:46 freqtrade  |               ^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/urllib3/util/retry.py", line 470, in increment
2024-02-12 13:53:46 freqtrade  |     raise reraise(type(error), error, _stacktrace)
2024-02-12 13:53:46 freqtrade  |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/urllib3/util/util.py", line 39, in reraise
2024-02-12 13:53:46 freqtrade  |     raise value
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 790, in urlopen
2024-02-12 13:53:46 freqtrade  |     response = self._make_request(
2024-02-12 13:53:46 freqtrade  |                ^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 491, in _make_request
2024-02-12 13:53:46 freqtrade  |     raise new_e
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 469, in _make_request
2024-02-12 13:53:46 freqtrade  |     self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 370, in _raise_timeout
2024-02-12 13:53:46 freqtrade  |     raise ReadTimeoutError(
2024-02-12 13:53:46 freqtrade  | urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='fapi.binance.com', port=443): Read timed out. (read timeout=10.0)
2024-02-12 13:53:46 freqtrade  | 
2024-02-12 13:53:46 freqtrade  | During handling of the above exception, another exception occurred:
2024-02-12 13:53:46 freqtrade  | 
2024-02-12 13:53:46 freqtrade  | Traceback (most recent call last):
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/ccxt/base/exchange.py", line 596, in fetch
2024-02-12 13:53:46 freqtrade  |     response = self.session.request(
2024-02-12 13:53:46 freqtrade  |                ^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
2024-02-12 13:53:46 freqtrade  |     resp = self.send(prep, **send_kwargs)
2024-02-12 13:53:46 freqtrade  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
2024-02-12 13:53:46 freqtrade  |     r = adapter.send(request, **kwargs)
2024-02-12 13:53:46 freqtrade  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/requests/adapters.py", line 532, in send
2024-02-12 13:53:46 freqtrade  |     raise ReadTimeout(e, request=request)
2024-02-12 13:53:46 freqtrade  | requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='fapi.binance.com', port=443): Read timed out. (read timeout=10.0)
2024-02-12 13:53:46 freqtrade  | 
2024-02-12 13:53:46 freqtrade  | The above exception was the direct cause of the following exception:
2024-02-12 13:53:46 freqtrade  | 
2024-02-12 13:53:46 freqtrade  | Traceback (most recent call last):
2024-02-12 13:53:46 freqtrade  |   File "/freqtrade/freqtrade/exchange/exchange.py", line 484, in _load_markets
2024-02-12 13:53:46 freqtrade  |     self._markets = self._api.load_markets(params={})
2024-02-12 13:53:46 freqtrade  |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/ccxt/base/exchange.py", line 1464, in load_markets
2024-02-12 13:53:46 freqtrade  |     markets = self.fetch_markets(params)
2024-02-12 13:53:46 freqtrade  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/ccxt/binance.py", line 2054, in fetch_markets
2024-02-12 13:53:46 freqtrade  |     promisesRaw.append(self.fapiPublicGetExchangeInfo(params))
2024-02-12 13:53:46 freqtrade  |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/ccxt/base/types.py", line 34, in unbound_method
2024-02-12 13:53:46 freqtrade  |     return _self.request(self.path, self.api, self.method, params, config=self.config)
2024-02-12 13:53:46 freqtrade  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/ccxt/binance.py", line 8177, in request
2024-02-12 13:53:46 freqtrade  |     response = self.fetch2(path, api, method, params, headers, body, config)
2024-02-12 13:53:46 freqtrade  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/ccxt/base/exchange.py", line 3350, in fetch2
2024-02-12 13:53:46 freqtrade  |     return self.fetch(request['url'], request['method'], request['headers'], request['body'])
2024-02-12 13:53:46 freqtrade  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/home/ftuser/.local/lib/python3.11/site-packages/ccxt/base/exchange.py", line 626, in fetch
2024-02-12 13:53:46 freqtrade  |     raise RequestTimeout(details) from e
2024-02-12 13:53:46 freqtrade  | ccxt.base.errors.RequestTimeout: binance GET https://fapi.binance.com/fapi/v1/exchangeInfo
2024-02-12 13:53:46 freqtrade  | 2024-02-12 07:53:46,396 - freqtrade.commands.trade_commands - ERROR - Could not load markets, therefore cannot start. Please investigate the above error for more details.
2024-02-12 13:53:46 freqtrade  | 2024-02-12 07:53:46,397 - freqtrade.commands.trade_commands - ERROR - Fatal exception!
2024-02-12 13:53:46 freqtrade  | Traceback (most recent call last):
2024-02-12 13:53:46 freqtrade  |   File "/freqtrade/freqtrade/commands/trade_commands.py", line 24, in start_trading
2024-02-12 13:53:46 freqtrade  |     worker = Worker(args)
2024-02-12 13:53:46 freqtrade  |              ^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/freqtrade/freqtrade/worker.py", line 37, in __init__
2024-02-12 13:53:46 freqtrade  |     self._init(False)
2024-02-12 13:53:46 freqtrade  |   File "/freqtrade/freqtrade/worker.py", line 53, in _init
2024-02-12 13:53:46 freqtrade  |     self.freqtrade = FreqtradeBot(self._config)
2024-02-12 13:53:46 freqtrade  |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/freqtrade/freqtrade/freqtradebot.py", line 76, in __init__
2024-02-12 13:53:46 freqtrade  |     self.exchange = ExchangeResolver.load_exchange(
2024-02-12 13:53:46 freqtrade  |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/freqtrade/freqtrade/resolvers/exchange_resolver.py", line 37, in load_exchange
2024-02-12 13:53:46 freqtrade  |     exchange = ExchangeResolver._load_exchange(
2024-02-12 13:53:46 freqtrade  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/freqtrade/freqtrade/resolvers/exchange_resolver.py", line 64, in _load_exchange
2024-02-12 13:53:46 freqtrade  |     exchange = ex_class(**kwargs)
2024-02-12 13:53:46 freqtrade  |                ^^^^^^^^^^^^^^^^^^
2024-02-12 13:53:46 freqtrade  |   File "/freqtrade/freqtrade/exchange/exchange.py", line 189, in __init__
2024-02-12 13:53:46 freqtrade  |     self.validate_config(config)
2024-02-12 13:53:46 freqtrade  |   File "/freqtrade/freqtrade/exchange/exchange.py", line 227, in validate_config
2024-02-12 13:53:46 freqtrade  |     self.validate_stakecurrency(config['stake_currency'])
2024-02-12 13:53:46 freqtrade  |   File "/freqtrade/freqtrade/exchange/exchange.py", line 521, in validate_stakecurrency
2024-02-12 13:53:46 freqtrade  |     raise OperationalException(
2024-02-12 13:53:46 freqtrade  | freqtrade.exceptions.OperationalException: Could not load markets, therefore cannot start. Please investigate the above error for more details.
stash86 commented 8 months ago

make sure your country is allowed to trade on Binance

Armondal commented 8 months ago

Thanks found the issue