mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-14 20:01:18 +00:00
feat: limit downloadable funding rates to funding rate interval
Limit using wrong funding-rate timeframes, which can cause wrong information and assumptions in the strategy Part of #12206
This commit is contained in:
@@ -2566,13 +2566,18 @@ class Exchange:
|
|||||||
input_coroutines: list[Coroutine[Any, Any, OHLCVResponse]] = []
|
input_coroutines: list[Coroutine[Any, Any, OHLCVResponse]] = []
|
||||||
cached_pairs = []
|
cached_pairs = []
|
||||||
for pair, timeframe, candle_type in set(pair_list):
|
for pair, timeframe, candle_type in set(pair_list):
|
||||||
if timeframe not in self.timeframes and candle_type in (
|
invalid_funding = (
|
||||||
|
candle_type == CandleType.FUNDING_RATE
|
||||||
|
and timeframe != self.get_option("funding_fee_timeframe")
|
||||||
|
)
|
||||||
|
invalid_timeframe = timeframe not in self.timeframes and candle_type in (
|
||||||
CandleType.SPOT,
|
CandleType.SPOT,
|
||||||
CandleType.FUTURES,
|
CandleType.FUTURES,
|
||||||
):
|
)
|
||||||
|
if invalid_timeframe or invalid_funding:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"Cannot download ({pair}, {timeframe}) combination as this timeframe is "
|
f"Cannot download ({pair}, {timeframe}, {candle_type}) combination as this "
|
||||||
f"not available on {self.name}. Available timeframes are "
|
f"timeframe is not available on {self.name}. Available timeframes are "
|
||||||
f"{', '.join(self.timeframes)}."
|
f"{', '.join(self.timeframes)}."
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -2335,7 +2335,7 @@ def test_refresh_latest_ohlcv(mocker, default_conf_usdt, caplog, candle_type) ->
|
|||||||
if candle_type != CandleType.MARK:
|
if candle_type != CandleType.MARK:
|
||||||
assert not res
|
assert not res
|
||||||
assert len(res) == 0
|
assert len(res) == 0
|
||||||
assert log_has_re(r"Cannot download \(IOTA\/USDT, 3m\).*", caplog)
|
assert log_has_re(r"Cannot download \(IOTA\/USDT, 3m, \S+\).*", caplog)
|
||||||
else:
|
else:
|
||||||
assert len(res) == 1
|
assert len(res) == 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user