From 545cd3a9948c1360ada490c19990ceed142015ef Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 3 Jul 2025 08:25:15 +0200 Subject: [PATCH] chore: ft_has should be before remove_credentials --- freqtrade/exchange/exchange.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 6631532bf..51fad1bf9 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -199,6 +199,19 @@ class Exchange: self._config.update(config) + # Leverage properties + self.trading_mode: TradingMode = config.get("trading_mode", TradingMode.SPOT) + self.margin_mode: MarginMode = ( + MarginMode(config.get("margin_mode")) if config.get("margin_mode") else MarginMode.NONE + ) + self.liquidation_buffer = config.get("liquidation_buffer", 0.05) + + exchange_conf: ExchangeConfig = exchange_config if exchange_config else config["exchange"] + + # Deep merge ft_has with default ft_has options + # Must be called before ft_has is used. + self.build_ft_has(exchange_conf) + # Holds last candle refreshed time of each pair self._pairs_last_refresh_time: dict[PairWithTimeframe, int] = {} # Timestamp of last markets refresh @@ -227,22 +240,10 @@ class Exchange: if config["dry_run"]: logger.info("Instance is running with dry_run enabled") logger.info(f"Using CCXT {ccxt.__version__}") - exchange_conf: ExchangeConfig = exchange_config if exchange_config else config["exchange"] remove_exchange_credentials(exchange_conf, config.get("dry_run", False)) self.log_responses = exchange_conf.get("log_responses", False) - # Leverage properties - self.trading_mode: TradingMode = config.get("trading_mode", TradingMode.SPOT) - self.margin_mode: MarginMode = ( - MarginMode(config.get("margin_mode")) if config.get("margin_mode") else MarginMode.NONE - ) - self.liquidation_buffer = config.get("liquidation_buffer", 0.05) - - # Deep merge ft_has with default ft_has options - # Must be called before ft_has is used. - self.build_ft_has(exchange_conf) - # Assign this directly for easy access self._ohlcv_partial_candle = self._ft_has["ohlcv_partial_candle"]