fix: allow backtesting for specific exchanges
This commit is contained in:
@@ -44,6 +44,7 @@ class FtHas(TypedDict, total=False):
|
|||||||
funding_fee_timeframe: str
|
funding_fee_timeframe: str
|
||||||
funding_fee_candle_limit: int
|
funding_fee_candle_limit: int
|
||||||
floor_leverage: bool
|
floor_leverage: bool
|
||||||
|
uses_leverage_tiers: bool
|
||||||
needs_trading_fees: bool
|
needs_trading_fees: bool
|
||||||
order_props_in_contracts: list[Literal["amount", "cost", "filled", "remaining"]]
|
order_props_in_contracts: list[Literal["amount", "cost", "filled", "remaining"]]
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class Hyperliquid(Exchange):
|
|||||||
"stop_price_prop": "stopPrice",
|
"stop_price_prop": "stopPrice",
|
||||||
"funding_fee_timeframe": "1h",
|
"funding_fee_timeframe": "1h",
|
||||||
"funding_fee_candle_limit": 500,
|
"funding_fee_candle_limit": 500,
|
||||||
|
"uses_leverage_tiers": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
_supported_trading_mode_margin_pairs: list[tuple[TradingMode, MarginMode]] = [
|
_supported_trading_mode_margin_pairs: list[tuple[TradingMode, MarginMode]] = [
|
||||||
|
|||||||
@@ -360,8 +360,9 @@ class Backtesting:
|
|||||||
)
|
)
|
||||||
# Combine data to avoid combining the data per trade.
|
# Combine data to avoid combining the data per trade.
|
||||||
unavailable_pairs = []
|
unavailable_pairs = []
|
||||||
|
uses_leverage_tiers = self.exchange.get_option("uses_leverage_tiers", True)
|
||||||
for pair in self.pairlists.whitelist:
|
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)
|
unavailable_pairs.append(pair)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user