2024-01-04 16:22:34 +00:00
|
|
|
from shutil import copytree
|
|
|
|
|
|
|
|
from freqtrade.util.migrations import migrate_funding_fee_timeframe
|
|
|
|
|
|
|
|
|
|
|
|
def test_migrate_funding_rate_timeframe(default_conf_usdt, tmp_path, testdatadir):
|
2024-05-12 13:41:07 +00:00
|
|
|
copytree(testdatadir / "futures", tmp_path / "futures")
|
|
|
|
file_4h = tmp_path / "futures" / "XRP_USDT_USDT-4h-funding_rate.feather"
|
|
|
|
file_8h = tmp_path / "futures" / "XRP_USDT_USDT-8h-funding_rate.feather"
|
|
|
|
file_1h = tmp_path / "futures" / "XRP_USDT_USDT-1h-futures.feather"
|
2024-01-04 16:22:34 +00:00
|
|
|
file_8h.rename(file_4h)
|
|
|
|
assert file_1h.exists()
|
|
|
|
assert file_4h.exists()
|
|
|
|
assert not file_8h.exists()
|
|
|
|
|
2024-05-12 13:41:07 +00:00
|
|
|
default_conf_usdt["datadir"] = tmp_path
|
2024-01-04 16:22:34 +00:00
|
|
|
|
|
|
|
# Inactive on spot trading ...
|
|
|
|
migrate_funding_fee_timeframe(default_conf_usdt, None)
|
|
|
|
|
2024-05-12 13:41:07 +00:00
|
|
|
default_conf_usdt["trading_mode"] = "futures"
|
2024-01-04 16:22:34 +00:00
|
|
|
|
|
|
|
migrate_funding_fee_timeframe(default_conf_usdt, None)
|
|
|
|
|
|
|
|
assert not file_4h.exists()
|
|
|
|
assert file_8h.exists()
|
|
|
|
# futures files is untouched.
|
|
|
|
assert file_1h.exists()
|