Merge pull request #11481 from mrpabloyeah/add-year-to-backtest-breakdowns

Add year to backtest breakdowns
This commit is contained in:
Matthias
2025-03-11 20:45:15 +01:00
committed by GitHub
7 changed files with 18 additions and 12 deletions

View File

@@ -257,7 +257,8 @@
"enum": [ "enum": [
"day", "day",
"week", "week",
"month" "month",
"year"
] ]
} }
}, },

View File

@@ -2,7 +2,7 @@
usage: freqtrade backtesting-show [-h] [-v] [--no-color] [--logfile FILE] [-V] usage: freqtrade backtesting-show [-h] [-v] [--no-color] [--logfile FILE] [-V]
[-c PATH] [-d PATH] [--userdir PATH] [-c PATH] [-d PATH] [--userdir PATH]
[--export-filename PATH] [--show-pair-list] [--export-filename PATH] [--show-pair-list]
[--breakdown {day,week,month} [{day,week,month} ...]] [--breakdown {day,week,month,year} [{day,week,month,year} ...]]
options: options:
-h, --help show this help message and exit -h, --help show this help message and exit
@@ -11,8 +11,9 @@ options:
`--export` to be set as well. Example: `--export-filen `--export` to be set as well. Example: `--export-filen
ame=user_data/backtest_results/backtest_today.json` ame=user_data/backtest_results/backtest_today.json`
--show-pair-list Show backtesting pairlist sorted by profit. --show-pair-list Show backtesting pairlist sorted by profit.
--breakdown {day,week,month} [{day,week,month} ...] --breakdown {day,week,month,year} [{day,week,month,year} ...]
Show backtesting breakdown per [day, week, month]. Show backtesting breakdown per [day, week, month,
year].
Common arguments: Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages). -v, --verbose Verbose mode (-vv for more, -vvv to get all messages).

View File

@@ -15,7 +15,7 @@ usage: freqtrade backtesting [-h] [-v] [--no-color] [--logfile FILE] [-V]
[--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]] [--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]]
[--export {none,trades,signals}] [--export {none,trades,signals}]
[--export-filename PATH] [--export-filename PATH]
[--breakdown {day,week,month} [{day,week,month} ...]] [--breakdown {day,week,month,year} [{day,week,month,year} ...]]
[--cache {none,day,week,month}] [--cache {none,day,week,month}]
[--freqai-backtest-live-models] [--freqai-backtest-live-models]
@@ -65,8 +65,9 @@ options:
Use this filename for backtest results.Requires Use this filename for backtest results.Requires
`--export` to be set as well. Example: `--export-filen `--export` to be set as well. Example: `--export-filen
ame=user_data/backtest_results/backtest_today.json` ame=user_data/backtest_results/backtest_today.json`
--breakdown {day,week,month} [{day,week,month} ...] --breakdown {day,week,month,year} [{day,week,month,year} ...]
Show backtesting breakdown per [day, week, month]. Show backtesting breakdown per [day, week, month,
year].
--cache {none,day,week,month} --cache {none,day,week,month}
Load a cached backtest result no older than specified Load a cached backtest result no older than specified
age (default: day). age (default: day).

View File

@@ -4,7 +4,7 @@ usage: freqtrade hyperopt-show [-h] [-v] [--no-color] [--logfile FILE] [-V]
[--profitable] [-n INT] [--print-json] [--profitable] [-n INT] [--print-json]
[--hyperopt-filename FILENAME] [--no-header] [--hyperopt-filename FILENAME] [--no-header]
[--disable-param-export] [--disable-param-export]
[--breakdown {day,week,month} [{day,week,month} ...]] [--breakdown {day,week,month,year} [{day,week,month,year} ...]]
options: options:
-h, --help show this help message and exit -h, --help show this help message and exit
@@ -18,8 +18,9 @@ options:
--no-header Do not print epoch details header. --no-header Do not print epoch details header.
--disable-param-export --disable-param-export
Disable automatic hyperopt parameter export. Disable automatic hyperopt parameter export.
--breakdown {day,week,month} [{day,week,month} ...] --breakdown {day,week,month,year} [{day,week,month,year} ...]
Show backtesting breakdown per [day, week, month]. Show backtesting breakdown per [day, week, month,
year].
Common arguments: Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages). -v, --verbose Verbose mode (-vv for more, -vvv to get all messages).

View File

@@ -224,7 +224,7 @@ AVAILABLE_CLI_OPTIONS = {
), ),
"backtest_breakdown": Arg( "backtest_breakdown": Arg(
"--breakdown", "--breakdown",
help="Show backtesting breakdown per [day, week, month].", help="Show backtesting breakdown per [day, week, month, year].",
nargs="+", nargs="+",
choices=constants.BACKTEST_BREAKDOWNS, choices=constants.BACKTEST_BREAKDOWNS,
), ),

View File

@@ -59,7 +59,7 @@ AVAILABLE_PAIRLISTS = [
"VolatilityFilter", "VolatilityFilter",
] ]
AVAILABLE_DATAHANDLERS = ["json", "jsongz", "feather", "parquet"] 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_AGE = ["none", "day", "week", "month"]
BACKTEST_CACHE_DEFAULT = "day" BACKTEST_CACHE_DEFAULT = "day"
DRY_RUN_WALLET = 1000 DRY_RUN_WALLET = 1000

View File

@@ -212,6 +212,8 @@ def _get_resample_from_period(period: str) -> str:
return "1W-MON" return "1W-MON"
if period == "month": if period == "month":
return "1ME" return "1ME"
if period == "year":
return "1Y"
raise ValueError(f"Period {period} is not supported.") raise ValueError(f"Period {period} is not supported.")