mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-02-03 12:51:37 +00:00
feat: introduce --export-directory
This commit is contained in:
@@ -54,6 +54,7 @@ ARGS_BACKTEST = [
|
||||
"strategy_list",
|
||||
"export",
|
||||
"exportfilename",
|
||||
"exportdirectory",
|
||||
"backtest_breakdown",
|
||||
"backtest_cache",
|
||||
"freqai_backtest_live_models",
|
||||
@@ -94,7 +95,12 @@ ARGS_LIST_FREQAIMODELS = ["freqaimodel_path", "print_one_column"]
|
||||
|
||||
ARGS_LIST_HYPEROPTS = ["hyperopt_path", "print_one_column"]
|
||||
|
||||
ARGS_BACKTEST_SHOW = ["exportfilename", "backtest_show_pair_list", "backtest_breakdown"]
|
||||
ARGS_BACKTEST_SHOW = [
|
||||
"exportfilename",
|
||||
"exportdirectory",
|
||||
"backtest_show_pair_list",
|
||||
"backtest_breakdown",
|
||||
]
|
||||
|
||||
ARGS_LIST_EXCHANGES = ["print_one_column", "list_exchanges_all", "trading_mode", "dex_exchanges"]
|
||||
|
||||
|
||||
@@ -209,6 +209,12 @@ AVAILABLE_CLI_OPTIONS = {
|
||||
help="Add notes to the backtest results.",
|
||||
metavar="TEXT",
|
||||
),
|
||||
"exportdirectory": Arg(
|
||||
"--export-directory",
|
||||
help="Directory to use for backtest results."
|
||||
"Example: `--export-directory=user_data/backtest_results/`",
|
||||
metavar="PATH",
|
||||
),
|
||||
"exportfilename": Arg(
|
||||
"--backtest-filename",
|
||||
"--export-filename",
|
||||
|
||||
@@ -209,13 +209,27 @@ class Configuration:
|
||||
config.update({"datadir": create_datadir(config, self.args.get("datadir"))})
|
||||
logger.info("Using data directory: %s ...", config.get("datadir"))
|
||||
|
||||
self._args_to_config(
|
||||
config, argname="exportdirectory", logstring="Using {} as backtest directory ..."
|
||||
)
|
||||
|
||||
if self.args.get("exportfilename"):
|
||||
self._args_to_config(
|
||||
config, argname="exportfilename", logstring="Storing backtest results to {} ..."
|
||||
)
|
||||
config["exportfilename"] = Path(config["exportfilename"])
|
||||
else:
|
||||
config["exportfilename"] = config["user_data_dir"] / "backtest_results"
|
||||
if config["exportdirectory"].is_dir():
|
||||
logger.warning(
|
||||
"DEPRECATED: Using `--export-filename` with directories is deprecated, "
|
||||
"use `--export-directory` instead."
|
||||
)
|
||||
if config.get("exportdirectory") is None:
|
||||
# Fallback - assign export-directory directly.
|
||||
config["exportdirectory"] = config["exportfilename"]
|
||||
|
||||
if not config.get("exportdirectory"):
|
||||
config["exportdirectory"] = config["user_data_dir"] / "backtest_results"
|
||||
config["exportdirectory"] = Path(config["exportdirectory"])
|
||||
|
||||
if self.args.get("show_sensitive"):
|
||||
logger.warning(
|
||||
|
||||
Reference in New Issue
Block a user