From b2423fa390890924bef35ac9db07904d6840156f Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 16 Nov 2024 11:54:54 +0100 Subject: [PATCH] chore: remove explicit ohlcv_candle_limit in favor of config option --- freqtrade/exchange/bybit.py | 11 ++--------- freqtrade/exchange/hyperliquid.py | 14 +++----------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/freqtrade/exchange/bybit.py b/freqtrade/exchange/bybit.py index d143a7543..405c5630d 100644 --- a/freqtrade/exchange/bybit.py +++ b/freqtrade/exchange/bybit.py @@ -7,7 +7,7 @@ from typing import Any import ccxt from freqtrade.constants import BuySell -from freqtrade.enums import CandleType, MarginMode, PriceType, TradingMode +from freqtrade.enums import MarginMode, PriceType, TradingMode from freqtrade.exceptions import DDosProtection, ExchangeError, OperationalException, TemporaryError from freqtrade.exchange import Exchange from freqtrade.exchange.common import retrier @@ -47,6 +47,7 @@ class Bybit(Exchange): "ohlcv_has_history": True, "mark_ohlcv_timeframe": "4h", "funding_fee_timeframe": "8h", + "funding_fee_candle_limit": 200, "stoploss_on_exchange": True, "stoploss_order_types": {"limit": "limit", "market": "market"}, # bybit response parsing fails to populate stopLossPrice @@ -114,14 +115,6 @@ class Bybit(Exchange): except ccxt.BaseError as e: raise OperationalException(e) from e - def ohlcv_candle_limit( - self, timeframe: str, candle_type: CandleType, since_ms: int | None = None - ) -> int: - if candle_type == CandleType.FUNDING_RATE: - return 200 - - return super().ohlcv_candle_limit(timeframe, candle_type, since_ms) - def _lev_prep(self, pair: str, leverage: float, side: BuySell, accept_fail: bool = False): if self.trading_mode != TradingMode.SPOT: params = {"leverage": leverage} diff --git a/freqtrade/exchange/hyperliquid.py b/freqtrade/exchange/hyperliquid.py index 2807f1be6..fc3a458e3 100644 --- a/freqtrade/exchange/hyperliquid.py +++ b/freqtrade/exchange/hyperliquid.py @@ -4,7 +4,7 @@ import logging from datetime import datetime from freqtrade.constants import BuySell -from freqtrade.enums import CandleType, MarginMode, TradingMode +from freqtrade.enums import MarginMode, TradingMode from freqtrade.exceptions import ExchangeError, OperationalException from freqtrade.exchange import Exchange from freqtrade.exchange.exchange_types import FtHas @@ -26,12 +26,13 @@ class Hyperliquid(Exchange): "tickers_have_bid_ask": False, "stoploss_on_exchange": False, "exchange_has_overrides": {"fetchTrades": False}, - "funding_fee_timeframe": "1h", "marketOrderRequiresPrice": True, } _ft_has_futures: FtHas = { "stoploss_on_exchange": True, "stoploss_order_types": {"limit": "limit"}, + "funding_fee_timeframe": "1h", + "funding_fee_candle_limit": 500, } _supported_trading_mode_margin_pairs: list[tuple[TradingMode, MarginMode]] = [ @@ -54,15 +55,6 @@ class Hyperliquid(Exchange): else: return 1.0 - def ohlcv_candle_limit( - self, timeframe: str, candle_type: CandleType, since_ms: int | None = None - ) -> int: - # Funding rate candles have a different limit - if candle_type == CandleType.FUNDING_RATE: - return 500 - - return super().ohlcv_candle_limit(timeframe, candle_type, since_ms) - def _lev_prep(self, pair: str, leverage: float, side: BuySell, accept_fail: bool = False): if self.trading_mode != TradingMode.SPOT: # Hyperliquid expects leverage to be an int