From a0cbdc91355cb2703f0eaf5dca0085abe56b3d77 Mon Sep 17 00:00:00 2001 From: mrpabloyeah Date: Sun, 9 Mar 2025 18:21:33 +0100 Subject: [PATCH 1/4] Add year to backtest breakdowns --- freqtrade/constants.py | 2 +- freqtrade/optimize/optimize_reports/optimize_reports.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/freqtrade/constants.py b/freqtrade/constants.py index 2d3b4a5e8..1b99dd6ec 100644 --- a/freqtrade/constants.py +++ b/freqtrade/constants.py @@ -59,7 +59,7 @@ AVAILABLE_PAIRLISTS = [ "VolatilityFilter", ] AVAILABLE_DATAHANDLERS = ["json", "jsongz", "feather", "parquet"] -BACKTEST_BREAKDOWNS = ["day", "week", "month"] +BACKTEST_BREAKDOWNS = ["day", "week", "month", "year"] BACKTEST_CACHE_AGE = ["none", "day", "week", "month"] BACKTEST_CACHE_DEFAULT = "day" DRY_RUN_WALLET = 1000 diff --git a/freqtrade/optimize/optimize_reports/optimize_reports.py b/freqtrade/optimize/optimize_reports/optimize_reports.py index edcdf757a..a798eaf7a 100644 --- a/freqtrade/optimize/optimize_reports/optimize_reports.py +++ b/freqtrade/optimize/optimize_reports/optimize_reports.py @@ -212,6 +212,8 @@ def _get_resample_from_period(period: str) -> str: return "1W-MON" if period == "month": return "1ME" + if period == "year": + return "1Y" raise ValueError(f"Period {period} is not supported.") From 3281049264d2d33b01b852cc9835c0a6292854fe Mon Sep 17 00:00:00 2001 From: mrpabloyeah Date: Mon, 10 Mar 2025 18:44:01 +0100 Subject: [PATCH 2/4] Add year also in cli_options --- freqtrade/commands/cli_options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/commands/cli_options.py b/freqtrade/commands/cli_options.py index 16f5d1c4d..6eaa9e3a5 100755 --- a/freqtrade/commands/cli_options.py +++ b/freqtrade/commands/cli_options.py @@ -224,7 +224,7 @@ AVAILABLE_CLI_OPTIONS = { ), "backtest_breakdown": Arg( "--breakdown", - help="Show backtesting breakdown per [day, week, month].", + help="Show backtesting breakdown per [day, week, month, year].", nargs="+", choices=constants.BACKTEST_BREAKDOWNS, ), From 265a798f780e8bb8623dd47a887a0321611e7155 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 11 Mar 2025 06:37:44 +0100 Subject: [PATCH 3/4] docs: auto-generate command snippets --- docs/commands/backtesting-show.md | 7 ++++--- docs/commands/backtesting.md | 7 ++++--- docs/commands/hyperopt-show.md | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/docs/commands/backtesting-show.md b/docs/commands/backtesting-show.md index 1c7889851..a1b146a82 100644 --- a/docs/commands/backtesting-show.md +++ b/docs/commands/backtesting-show.md @@ -2,7 +2,7 @@ usage: freqtrade backtesting-show [-h] [-v] [--no-color] [--logfile FILE] [-V] [-c PATH] [-d PATH] [--userdir PATH] [--export-filename PATH] [--show-pair-list] - [--breakdown {day,week,month} [{day,week,month} ...]] + [--breakdown {day,week,month,year} [{day,week,month,year} ...]] options: -h, --help show this help message and exit @@ -11,8 +11,9 @@ options: `--export` to be set as well. Example: `--export-filen ame=user_data/backtest_results/backtest_today.json` --show-pair-list Show backtesting pairlist sorted by profit. - --breakdown {day,week,month} [{day,week,month} ...] - Show backtesting breakdown per [day, week, month]. + --breakdown {day,week,month,year} [{day,week,month,year} ...] + Show backtesting breakdown per [day, week, month, + year]. Common arguments: -v, --verbose Verbose mode (-vv for more, -vvv to get all messages). diff --git a/docs/commands/backtesting.md b/docs/commands/backtesting.md index 160bda7cc..395ab4b00 100644 --- a/docs/commands/backtesting.md +++ b/docs/commands/backtesting.md @@ -15,7 +15,7 @@ usage: freqtrade backtesting [-h] [-v] [--no-color] [--logfile FILE] [-V] [--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]] [--export {none,trades,signals}] [--export-filename PATH] - [--breakdown {day,week,month} [{day,week,month} ...]] + [--breakdown {day,week,month,year} [{day,week,month,year} ...]] [--cache {none,day,week,month}] [--freqai-backtest-live-models] @@ -65,8 +65,9 @@ options: Use this filename for backtest results.Requires `--export` to be set as well. Example: `--export-filen ame=user_data/backtest_results/backtest_today.json` - --breakdown {day,week,month} [{day,week,month} ...] - Show backtesting breakdown per [day, week, month]. + --breakdown {day,week,month,year} [{day,week,month,year} ...] + Show backtesting breakdown per [day, week, month, + year]. --cache {none,day,week,month} Load a cached backtest result no older than specified age (default: day). diff --git a/docs/commands/hyperopt-show.md b/docs/commands/hyperopt-show.md index 9c7c378ab..14d6516e9 100644 --- a/docs/commands/hyperopt-show.md +++ b/docs/commands/hyperopt-show.md @@ -4,7 +4,7 @@ usage: freqtrade hyperopt-show [-h] [-v] [--no-color] [--logfile FILE] [-V] [--profitable] [-n INT] [--print-json] [--hyperopt-filename FILENAME] [--no-header] [--disable-param-export] - [--breakdown {day,week,month} [{day,week,month} ...]] + [--breakdown {day,week,month,year} [{day,week,month,year} ...]] options: -h, --help show this help message and exit @@ -18,8 +18,9 @@ options: --no-header Do not print epoch details header. --disable-param-export Disable automatic hyperopt parameter export. - --breakdown {day,week,month} [{day,week,month} ...] - Show backtesting breakdown per [day, week, month]. + --breakdown {day,week,month,year} [{day,week,month,year} ...] + Show backtesting breakdown per [day, week, month, + year]. Common arguments: -v, --verbose Verbose mode (-vv for more, -vvv to get all messages). From 442b29e0eab8979b5f1c24adf4d3122547aec700 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 11 Mar 2025 20:01:21 +0100 Subject: [PATCH 4/4] chore: run schema export --- build_helpers/schema.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_helpers/schema.json b/build_helpers/schema.json index 15764df90..4601b9728 100644 --- a/build_helpers/schema.json +++ b/build_helpers/schema.json @@ -257,7 +257,8 @@ "enum": [ "day", "week", - "month" + "month", + "year" ] } },