mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-01-20 05:50:36 +00:00
feat: store (sanitized) configuration
This commit is contained in:
@@ -6,6 +6,7 @@ from zipfile import ZIP_DEFLATED, ZipFile
|
||||
|
||||
from pandas import DataFrame
|
||||
|
||||
from freqtrade.configuration import sanitize_config
|
||||
from freqtrade.constants import LAST_BT_RESULT_FN
|
||||
from freqtrade.enums.runmode import RunMode
|
||||
from freqtrade.ft_types import BacktestResultType
|
||||
@@ -85,6 +86,10 @@ def store_backtest_results(
|
||||
dump_json_to_file(stats_buf, stats_copy)
|
||||
zipf.writestr(json_filename.name, stats_buf.getvalue())
|
||||
|
||||
config_buf = StringIO()
|
||||
dump_json_to_file(config_buf, sanitize_config(config["original_config"]))
|
||||
zipf.writestr(f"{base_filename.stem}_config.json", config_buf.getvalue())
|
||||
|
||||
# Add market change data if present
|
||||
if market_change_data is not None:
|
||||
market_change_name = f"{base_filename.stem}_market_change.feather"
|
||||
|
||||
@@ -303,6 +303,8 @@ def test_store_backtest_results_real(tmp_path):
|
||||
with ZipFile(zip_file, "r") as zipf:
|
||||
assert "backtest-result-2024_01_01_15_05_25.json" in zipf.namelist()
|
||||
assert "backtest-result-2024_01_01_15_05_25_market_change.feather" in zipf.namelist()
|
||||
assert "backtest-result-2024_01_01_15_05_25_config.json" in zipf.namelist()
|
||||
|
||||
assert (tmp_path / LAST_BT_RESULT_FN).is_file()
|
||||
|
||||
# Last file reference should be updated
|
||||
|
||||
Reference in New Issue
Block a user