From cc7d341afc09a453f0d07f716e6bfb334e52541a Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 19 Mar 2024 18:19:22 +0100 Subject: [PATCH] Add overrides for Exchange Support --- freqtrade/exchange/exchange.py | 4 ++++ tests/exchange/test_exchange.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 84b4212bd..2bf92c389 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -88,6 +88,8 @@ class Exchange: "order_props_in_contracts": ['amount', 'filled', 'remaining'], # Override createMarketBuyOrderRequiresPrice where ccxt has it wrong "marketOrderRequiresPrice": False, + "exchange_has_overrides": {}, # Dictionary overriding ccxt's "has". + # Expected to be in the format {"fetchOHLCV": True} or {"fetchOHLCV": False} } _ft_has: Dict = {} _ft_has_futures: Dict = {} @@ -717,6 +719,8 @@ class Exchange: :param endpoint: Name of endpoint (e.g. 'fetchOHLCV', 'fetchTickers') :return: bool """ + if endpoint in self._ft_has.get('exchange_has_overrides', {}): + return self._ft_has['exchange_has_overrides'][endpoint] return endpoint in self._api.has and self._api.has[endpoint] def get_precision_amount(self, pair: str) -> Optional[float]: diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index 34d4ca4c6..104730d8c 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -1066,6 +1066,9 @@ def test_exchange_has(default_conf, mocker): exchange = get_patched_exchange(mocker, default_conf, api_mock) assert not exchange.exchange_has("deadbeef") + exchange._ft_has['exchange_has_overrides'] = {'deadbeef': True} + assert exchange.exchange_has("deadbeef") + @pytest.mark.parametrize("side,leverage", [ ("buy", 1),