fix: allow backtesting for specific exchanges

This commit is contained in:
Matthias
2025-03-30 19:33:53 +02:00
parent 31aa397492
commit ac9b26cc57
3 changed files with 4 additions and 1 deletions

View File

@@ -44,6 +44,7 @@ class FtHas(TypedDict, total=False):
funding_fee_timeframe: str
funding_fee_candle_limit: int
floor_leverage: bool
uses_leverage_tiers: bool
needs_trading_fees: bool
order_props_in_contracts: list[Literal["amount", "cost", "filled", "remaining"]]

View File

@@ -35,6 +35,7 @@ class Hyperliquid(Exchange):
"stop_price_prop": "stopPrice",
"funding_fee_timeframe": "1h",
"funding_fee_candle_limit": 500,
"uses_leverage_tiers": False,
}
_supported_trading_mode_margin_pairs: list[tuple[TradingMode, MarginMode]] = [

View File

@@ -360,8 +360,9 @@ class Backtesting:
)
# Combine data to avoid combining the data per trade.
unavailable_pairs = []
uses_leverage_tiers = self.exchange.get_option("uses_leverage_tiers", True)
for pair in self.pairlists.whitelist:
if pair not in self.exchange._leverage_tiers:
if uses_leverage_tiers and pair not in self.exchange._leverage_tiers:
unavailable_pairs.append(pair)
continue