diff --git a/freqtrade/data/history/history_utils.py b/freqtrade/data/history/history_utils.py index eff705d06..0970c0e95 100644 --- a/freqtrade/data/history/history_utils.py +++ b/freqtrade/data/history/history_utils.py @@ -281,9 +281,12 @@ def refresh_backtest_ohlcv_data(exchange: Exchange, pairs: List[str], timeframes timeframe=str(timeframe), new_pairs_days=new_pairs_days, candle_type=candle_type) if trading_mode == 'futures': - # TODO-lev: Use correct candletype (and timeframe) depending on exchange - timeframe = '1h' - candle_type = CandleType.MARK + # Predefined candletype (and timeframe) depending on exchange + # Downloads what is necessary to backtest based on futures data. + timeframe = exchange._ft_has['mark_ohlcv_timeframe'] + candle_type = CandleType.from_string(exchange._ft_has['mark_ohlcv_price']) + # candle_type = CandleType.MARK + # TODO: this could be in most parts to the above. if erase: if data_handler.ohlcv_purge(pair, timeframe, candle_type=candle_type): diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index d53f8c6e2..6d0130b55 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -70,6 +70,7 @@ class Exchange: "l2_limit_range": None, "l2_limit_range_required": True, # Allow Empty L2 limit (kucoin) "mark_ohlcv_price": "mark", + "mark_ohlcv_timeframe": "8h", "ccxt_futures_name": "swap" } _ft_has: Dict = {} diff --git a/freqtrade/exchange/ftx.py b/freqtrade/exchange/ftx.py index fc7bc682e..36a08239d 100644 --- a/freqtrade/exchange/ftx.py +++ b/freqtrade/exchange/ftx.py @@ -21,6 +21,7 @@ class Ftx(Exchange): "stoploss_on_exchange": True, "ohlcv_candle_limit": 1500, "mark_ohlcv_price": "index", + "mark_ohlcv_timeframe": "1h", "ccxt_futures_name": "future" } diff --git a/freqtrade/exchange/kraken.py b/freqtrade/exchange/kraken.py index 42d817222..40944d15b 100644 --- a/freqtrade/exchange/kraken.py +++ b/freqtrade/exchange/kraken.py @@ -22,6 +22,7 @@ class Kraken(Exchange): "ohlcv_candle_limit": 720, "trades_pagination": "id", "trades_pagination_arg": "since", + "mark_ohlcv_timeframe": "4h", } _supported_trading_mode_collateral_pairs: List[Tuple[TradingMode, Collateral]] = [