2024-01-04 15:44:17 +00:00
|
|
|
import logging
|
|
|
|
from typing import Optional
|
|
|
|
|
|
|
|
from freqtrade.constants import Config
|
2024-03-15 05:40:42 +00:00
|
|
|
from freqtrade.data.history import get_datahandler
|
2024-01-04 15:44:17 +00:00
|
|
|
from freqtrade.enums import TradingMode
|
|
|
|
from freqtrade.exchange import Exchange
|
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
def migrate_funding_fee_timeframe(config: Config, exchange: Optional[Exchange]):
|
2024-05-12 14:56:05 +00:00
|
|
|
if config.get("trading_mode", TradingMode.SPOT) != TradingMode.FUTURES:
|
2024-01-04 15:44:17 +00:00
|
|
|
# only act on futures
|
|
|
|
return
|
|
|
|
|
|
|
|
if not exchange:
|
|
|
|
from freqtrade.resolvers import ExchangeResolver
|
2024-05-12 14:56:05 +00:00
|
|
|
|
2024-01-04 15:44:17 +00:00
|
|
|
exchange = ExchangeResolver.load_exchange(config, validate=False)
|
|
|
|
|
2024-05-12 14:56:05 +00:00
|
|
|
ff_timeframe = exchange.get_option("funding_fee_timeframe")
|
2024-01-04 15:44:17 +00:00
|
|
|
|
2024-05-12 14:56:05 +00:00
|
|
|
dhc = get_datahandler(config["datadir"], config["dataformat_ohlcv"])
|
2024-01-04 15:44:17 +00:00
|
|
|
dhc.fix_funding_fee_timeframe(ff_timeframe)
|