Merge branch 'freqtrade:develop' into feat/fix-max-drawdown-protection
This commit is contained in:
@@ -64,18 +64,15 @@ options:
|
|||||||
--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]
|
--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]
|
||||||
Provide a space-separated list of strategies to
|
Provide a space-separated list of strategies to
|
||||||
backtest. Please note that timeframe needs to be set
|
backtest. Please note that timeframe needs to be set
|
||||||
either in config or via command line. When using this
|
either in config or via command line.
|
||||||
together with `--export trades`, the strategy-name is
|
|
||||||
injected into the filename (so `backtest-data.json`
|
|
||||||
becomes `backtest-data-SampleStrategy.json`
|
|
||||||
--export {none,trades,signals}
|
--export {none,trades,signals}
|
||||||
Export backtest results (default: trades).
|
Export backtest results (default: trades).
|
||||||
--backtest-filename, --export-filename PATH
|
--backtest-filename, --export-filename PATH
|
||||||
Use this filename for backtest results.Example:
|
DEPRECATED: This option is deprecated for backtesting
|
||||||
`--backtest-
|
and will be removed in a future release. Using a
|
||||||
filename=backtest_results_2020-09-27_16-20-48.json`.
|
custom filename for backtest results is no longer
|
||||||
Assumes either `user_data/backtest_results/` or
|
supported. Use `--backtest-directory` to specify the
|
||||||
`--export-directory` as base directory.
|
directory.
|
||||||
--backtest-directory, --export-directory PATH
|
--backtest-directory, --export-directory PATH
|
||||||
Directory to use for backtest results. Example:
|
Directory to use for backtest results. Example:
|
||||||
`--export-directory=user_data/backtest_results/`.
|
`--export-directory=user_data/backtest_results/`.
|
||||||
|
|||||||
@@ -62,10 +62,7 @@ options:
|
|||||||
--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]
|
--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]
|
||||||
Provide a space-separated list of strategies to
|
Provide a space-separated list of strategies to
|
||||||
backtest. Please note that timeframe needs to be set
|
backtest. Please note that timeframe needs to be set
|
||||||
either in config or via command line. When using this
|
either in config or via command line.
|
||||||
together with `--export trades`, the strategy-name is
|
|
||||||
injected into the filename (so `backtest-data.json`
|
|
||||||
becomes `backtest-data-SampleStrategy.json`
|
|
||||||
--export {none,trades,signals}
|
--export {none,trades,signals}
|
||||||
Export backtest results (default: trades).
|
Export backtest results (default: trades).
|
||||||
--backtest-filename, --export-filename PATH
|
--backtest-filename, --export-filename PATH
|
||||||
|
|||||||
@@ -10,10 +10,7 @@ options:
|
|||||||
--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]
|
--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]
|
||||||
Provide a space-separated list of strategies to
|
Provide a space-separated list of strategies to
|
||||||
backtest. Please note that timeframe needs to be set
|
backtest. Please note that timeframe needs to be set
|
||||||
either in config or via command line. When using this
|
either in config or via command line.
|
||||||
together with `--export trades`, the strategy-name is
|
|
||||||
injected into the filename (so `backtest-data.json`
|
|
||||||
becomes `backtest-data-SampleStrategy.json`
|
|
||||||
--strategy-path PATH Specify additional strategy lookup path.
|
--strategy-path PATH Specify additional strategy lookup path.
|
||||||
--recursive-strategy-search
|
--recursive-strategy-search
|
||||||
Recursively search for a strategy in the strategies
|
Recursively search for a strategy in the strategies
|
||||||
|
|||||||
@@ -215,9 +215,7 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
"--strategy-list",
|
"--strategy-list",
|
||||||
help="Provide a space-separated list of strategies to backtest. "
|
help="Provide a space-separated list of strategies to backtest. "
|
||||||
"Please note that timeframe needs to be set either in config "
|
"Please note that timeframe needs to be set either in config "
|
||||||
"or via command line. When using this together with `--export trades`, "
|
"or via command line. ",
|
||||||
"the strategy-name is injected into the filename "
|
|
||||||
"(so `backtest-data.json` becomes `backtest-data-SampleStrategy.json`",
|
|
||||||
nargs="+",
|
nargs="+",
|
||||||
),
|
),
|
||||||
"backtest_notes": Arg(
|
"backtest_notes": Arg(
|
||||||
@@ -240,6 +238,14 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
"exportfilename": Arg(
|
"exportfilename": Arg(
|
||||||
"--backtest-filename",
|
"--backtest-filename",
|
||||||
"--export-filename",
|
"--export-filename",
|
||||||
|
fthelp={
|
||||||
|
"freqtrade backtesting": (
|
||||||
|
"DEPRECATED: This option is deprecated for backtesting and will be removed "
|
||||||
|
"in a future release. "
|
||||||
|
"Using a custom filename for backtest results is no longer supported. "
|
||||||
|
"Use `--backtest-directory` to specify the directory."
|
||||||
|
),
|
||||||
|
},
|
||||||
help="Use this filename for backtest results."
|
help="Use this filename for backtest results."
|
||||||
"Example: `--backtest-filename=backtest_results_2020-09-27_16-20-48.json`. "
|
"Example: `--backtest-filename=backtest_results_2020-09-27_16-20-48.json`. "
|
||||||
"Assumes either `user_data/backtest_results/` or `--export-directory` as base directory.",
|
"Assumes either `user_data/backtest_results/` or `--export-directory` as base directory.",
|
||||||
|
|||||||
@@ -221,30 +221,30 @@ class Configuration:
|
|||||||
config, argname="exportfilename", logstring="Storing backtest results to {} ..."
|
config, argname="exportfilename", logstring="Storing backtest results to {} ..."
|
||||||
)
|
)
|
||||||
config["exportfilename"] = Path(config["exportfilename"])
|
config["exportfilename"] = Path(config["exportfilename"])
|
||||||
if config.get("exportdirectory") and Path(config["exportdirectory"]).is_dir():
|
if config.get("exportfilename"):
|
||||||
logger.warning(
|
if Path(config["exportfilename"]).is_dir():
|
||||||
"DEPRECATED: Using `--export-filename` with directories is deprecated, "
|
logger.warning(
|
||||||
"use `--backtest-directory` instead."
|
"DEPRECATED: Using `--export-filename` with directories is deprecated, "
|
||||||
)
|
"use `--backtest-directory` instead."
|
||||||
if config.get("exportdirectory") is None:
|
)
|
||||||
# Fallback - assign export-directory directly.
|
if config.get("exportdirectory") is None:
|
||||||
config["exportdirectory"] = config["exportfilename"]
|
# Fallback - assign export-directory directly.
|
||||||
|
config["exportdirectory"] = config["exportfilename"]
|
||||||
|
elif config.get("runmode") == RunMode.BACKTEST:
|
||||||
|
logger.warning(
|
||||||
|
"DEPRECATED: Using `--export-filename` has no impact when backtesting. "
|
||||||
|
"Please use `--notes` to annotate backtest results and "
|
||||||
|
"`--backtest-directory` to specify the output directory. "
|
||||||
|
)
|
||||||
if not config.get("exportdirectory"):
|
if not config.get("exportdirectory"):
|
||||||
config["exportdirectory"] = config["user_data_dir"] / "backtest_results"
|
config["exportdirectory"] = config["user_data_dir"] / "backtest_results"
|
||||||
if not config.get("exportfilename"):
|
|
||||||
config["exportfilename"] = None
|
config["exportfilename"] = config.get("exportfilename", None)
|
||||||
if config.get("exportfilename"):
|
if config.get("exportfilename"):
|
||||||
# ensure exportfilename is a Path object
|
# ensure exportfilename is a Path object
|
||||||
config["exportfilename"] = Path(config["exportfilename"])
|
config["exportfilename"] = Path(config["exportfilename"])
|
||||||
config["exportdirectory"] = Path(config["exportdirectory"])
|
config["exportdirectory"] = Path(config["exportdirectory"])
|
||||||
|
|
||||||
if self.args.get("show_sensitive"):
|
|
||||||
logger.warning(
|
|
||||||
"Sensitive information will be shown in the upcoming output. "
|
|
||||||
"Please make sure to never share this output without redacting "
|
|
||||||
"the information yourself."
|
|
||||||
)
|
|
||||||
|
|
||||||
def _process_optimize_options(self, config: Config) -> None:
|
def _process_optimize_options(self, config: Config) -> None:
|
||||||
# This will override the strategy configuration
|
# This will override the strategy configuration
|
||||||
self._args_to_config(
|
self._args_to_config(
|
||||||
@@ -312,6 +312,13 @@ class Configuration:
|
|||||||
|
|
||||||
self._process_datadir_options(config)
|
self._process_datadir_options(config)
|
||||||
|
|
||||||
|
if self.args.get("show_sensitive"):
|
||||||
|
logger.warning(
|
||||||
|
"Sensitive information will be shown in the upcoming output. "
|
||||||
|
"Please make sure to never share this output without redacting "
|
||||||
|
"the information yourself."
|
||||||
|
)
|
||||||
|
|
||||||
self._args_to_config(
|
self._args_to_config(
|
||||||
config,
|
config,
|
||||||
argname="strategy_list",
|
argname="strategy_list",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+6
-1
@@ -84,7 +84,12 @@ def file_load_json(file: Path):
|
|||||||
|
|
||||||
def is_file_in_dir(file: Path, directory: Path) -> bool:
|
def is_file_in_dir(file: Path, directory: Path) -> bool:
|
||||||
"""
|
"""
|
||||||
Helper function to check if file is in directory.
|
Helper function to check if file is directly within a directory.
|
||||||
|
:param file: File to check
|
||||||
|
:param directory: Directory to check against
|
||||||
|
When used in the API, this parameter cannot be user controlled (outside of the config)
|
||||||
|
to avoid security issues.
|
||||||
|
:return: True if file is directly within directory, False otherwise
|
||||||
"""
|
"""
|
||||||
return file.is_file() and file.parent.samefile(directory)
|
return file.is_file() and file.parent.samefile(directory)
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ class ApiBG:
|
|||||||
|
|
||||||
# Generic background jobs
|
# Generic background jobs
|
||||||
|
|
||||||
# TODO: Change this to FtTTLCache
|
# TODO: Change this to FtTTLCache -> must be more intelligent than FtTTLCache - as we can't
|
||||||
|
# evict still running jobs.
|
||||||
jobs: dict[str, JobsContainer] = {}
|
jobs: dict[str, JobsContainer] = {}
|
||||||
# Pairlist evaluate things
|
# Pairlist evaluate things
|
||||||
pairlist_running: bool = False
|
pairlist_running: bool = False
|
||||||
|
|||||||
@@ -221,6 +221,9 @@ def test_setup_bt_configuration_with_arguments(mocker, default_conf, caplog) ->
|
|||||||
assert "exportfilename" in config
|
assert "exportfilename" in config
|
||||||
assert isinstance(config["exportfilename"], Path)
|
assert isinstance(config["exportfilename"], Path)
|
||||||
assert log_has("Storing backtest results to {} ...".format(config["exportfilename"]), caplog)
|
assert log_has("Storing backtest results to {} ...".format(config["exportfilename"]), caplog)
|
||||||
|
assert log_has_re(
|
||||||
|
"DEPRECATED: Using `--export-filename` has no impact when backtesting.*", caplog
|
||||||
|
)
|
||||||
|
|
||||||
assert "fee" in config
|
assert "fee" in config
|
||||||
assert log_has("Parameter --fee detected, setting fee to: {} ...".format(config["fee"]), caplog)
|
assert log_has("Parameter --fee detected, setting fee to: {} ...".format(config["fee"]), caplog)
|
||||||
|
|||||||
Reference in New Issue
Block a user