From 35cc3efd5a2b854bac0b25fb11caaaf3abedd0ad Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 6 Sep 2025 10:14:50 +0200 Subject: [PATCH] feat: improve docstring and error handling part of #12206 --- freqtrade/data/dataprovider.py | 3 ++- freqtrade/exchange/exchange.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/freqtrade/data/dataprovider.py b/freqtrade/data/dataprovider.py index d991733f9..76e2c5491 100644 --- a/freqtrade/data/dataprovider.py +++ b/freqtrade/data/dataprovider.py @@ -577,7 +577,8 @@ class DataProvider: Warning: Performs a network request - so use with common sense. :param pair: Pair to get the data for :return: Funding rate dict from exchange or empty dict if funding rate is not available - If available, the "funding_rate" field will contain the funding rate. + If available, the "fundingRate" field will contain the funding rate. + "fundingTimestamp" and "fundingDatetime" will contain the next funding times. Actually filled fields may vary between exchanges. """ if self._exchange is None: diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 5151b641e..e9be3a1e6 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -2010,6 +2010,8 @@ class Exchange: Won't work for non-futures markets """ try: + if pair not in self.markets or self.markets[pair].get("active", False) is False: + raise ExchangeError(f"Pair {pair} not available") return self._api.fetch_funding_rate(pair) except ccxt.NotSupported as e: raise OperationalException(