add example, make sure to raise error on unsupported exchanges and/or trading mode

This commit is contained in:
Stefano
2025-09-22 15:55:36 +09:00
parent 07d5636d1e
commit 9c0d612729
6 changed files with 32 additions and 11 deletions

View File

@@ -41,6 +41,7 @@ class Binance(Exchange):
"fetch_orders_limit_minutes": None,
"l2_limit_range": [5, 10, 20, 50, 100, 500, 1000],
"ws_enabled": True,
"has_delisting": True,
}
_ft_has_futures: FtHas = {
"funding_fee_candle_limit": 1000,

View File

@@ -166,6 +166,7 @@ class Exchange:
"proxy_coin_mapping": {}, # Mapping for proxy coins
# Expected to be in the format {"fetchOHLCV": True} or {"fetchOHLCV": False}
"ws_enabled": False, # Set to true for exchanges with tested websocket support
"has_delisting": False, # Set to true for exchanges that have delisting pair checks
}
_ft_has: FtHas = {}
_ft_has_futures: FtHas = {}

View File

@@ -63,6 +63,9 @@ class FtHas(TypedDict, total=False):
# Websocket control
ws_enabled: bool
# Delisting check
has_delisting: bool
class Ticker(TypedDict):
symbol: str

View File

@@ -5,7 +5,7 @@ Delist pair list filter
import logging
from datetime import UTC, datetime, timedelta
from freqtrade.exceptions import OperationalException
from freqtrade.exceptions import ConfigurationError
from freqtrade.exchange.exchange_types import Ticker
from freqtrade.plugins.pairlist.IPairList import IPairList, PairlistParameter, SupportsBacktesting
@@ -21,8 +21,11 @@ class DelistFilter(IPairList):
self._max_days_from_now = self._pairlistconfig.get("max_days_from_now", 0)
if self._max_days_from_now < 0:
raise OperationalException("DelistFilter requires max_days_from_now to be >= 0")
self._enabled = self._max_days_from_now >= 0
raise ConfigurationError("DelistFilter requires max_days_from_now to be >= 0")
if not self._exchange._ft_has["has_delisting"]:
raise ConfigurationError(
"DelistFilter doesn't support this exchange and trading mode combination.",
)
@property
def needstickers(self) -> bool:
@@ -49,7 +52,7 @@ class DelistFilter(IPairList):
@staticmethod
def description() -> str:
return "Filter pairs that will bbe delisted on exchange."
return "Filter pairs that will be delisted on exchange."
@staticmethod
def available_parameters() -> dict[str, PairlistParameter]: