mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-16 04:41:15 +00:00
chore: move some setting-validations to config-schema
This commit is contained in:
@@ -5,7 +5,7 @@ Definition of cli arguments used in arguments.py
|
|||||||
from argparse import ArgumentTypeError
|
from argparse import ArgumentTypeError
|
||||||
|
|
||||||
from freqtrade import constants
|
from freqtrade import constants
|
||||||
from freqtrade.constants import HYPEROPT_LOSS_BUILTIN
|
from freqtrade.constants import HYPEROPT_BUILTIN_SPACES, HYPEROPT_LOSS_BUILTIN
|
||||||
from freqtrade.enums import CandleType
|
from freqtrade.enums import CandleType
|
||||||
|
|
||||||
|
|
||||||
@@ -278,26 +278,15 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
),
|
),
|
||||||
"spaces": Arg(
|
"spaces": Arg(
|
||||||
"--spaces",
|
"--spaces",
|
||||||
help="Specify which parameters to hyperopt. Space-separated list.",
|
help="Specify which parameters to hyperopt. Space-separated list. Available options: "
|
||||||
choices=[
|
f"{', '.join(HYPEROPT_BUILTIN_SPACES)}. Default: `default` - "
|
||||||
"all",
|
"which includes all spaces except for 'trailing', 'protection', and 'trades'.",
|
||||||
"buy",
|
|
||||||
"sell",
|
|
||||||
"roi",
|
|
||||||
"stoploss",
|
|
||||||
"trailing",
|
|
||||||
"protection",
|
|
||||||
"trades",
|
|
||||||
"default",
|
|
||||||
],
|
|
||||||
nargs="+",
|
nargs="+",
|
||||||
default="default",
|
|
||||||
),
|
),
|
||||||
"analyze_per_epoch": Arg(
|
"analyze_per_epoch": Arg(
|
||||||
"--analyze-per-epoch",
|
"--analyze-per-epoch",
|
||||||
help="Run populate_indicators once per epoch.",
|
help="Run populate_indicators once per epoch.",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
default=False,
|
|
||||||
),
|
),
|
||||||
"print_all": Arg(
|
"print_all": Arg(
|
||||||
"--print-all",
|
"--print-all",
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
# Required json-schema for user specified config
|
# Required json-schema for user specified config
|
||||||
|
|
||||||
|
|
||||||
from freqtrade.constants import (
|
from freqtrade.constants import (
|
||||||
AVAILABLE_DATAHANDLERS,
|
AVAILABLE_DATAHANDLERS,
|
||||||
AVAILABLE_PAIRLISTS,
|
AVAILABLE_PAIRLISTS,
|
||||||
BACKTEST_BREAKDOWNS,
|
BACKTEST_BREAKDOWNS,
|
||||||
|
BACKTEST_CACHE_AGE,
|
||||||
DRY_RUN_WALLET,
|
DRY_RUN_WALLET,
|
||||||
EXPORT_OPTIONS,
|
EXPORT_OPTIONS,
|
||||||
|
HYPEROPT_BUILTIN_SPACES,
|
||||||
|
HYPEROPT_LOSS_BUILTIN,
|
||||||
MARGIN_MODES,
|
MARGIN_MODES,
|
||||||
ORDERTIF_POSSIBILITIES,
|
ORDERTIF_POSSIBILITIES,
|
||||||
ORDERTYPE_POSSIBILITIES,
|
ORDERTYPE_POSSIBILITIES,
|
||||||
@@ -228,6 +232,76 @@ CONF_SCHEMA = {
|
|||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {"type": "string", "enum": BACKTEST_BREAKDOWNS},
|
"items": {"type": "string", "enum": BACKTEST_BREAKDOWNS},
|
||||||
},
|
},
|
||||||
|
"backtest_cache": {
|
||||||
|
"description": "Load a cached backtest result no older than specified age.",
|
||||||
|
"type": "string",
|
||||||
|
"enum": BACKTEST_CACHE_AGE,
|
||||||
|
},
|
||||||
|
# Hyperopt
|
||||||
|
"hyperopt_path": {
|
||||||
|
"description": "Specify additional lookup path for Hyperopt Loss functions.",
|
||||||
|
"type": "string",
|
||||||
|
},
|
||||||
|
"epochs": {
|
||||||
|
"description": "Number of training epochs for Hyperopt.",
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 1,
|
||||||
|
},
|
||||||
|
"early_stop": {
|
||||||
|
"description": (
|
||||||
|
"Early stop hyperopt if no improvement after <epochs>. Set to 0 to disable."
|
||||||
|
),
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
},
|
||||||
|
"spaces": {
|
||||||
|
"description": (
|
||||||
|
"Hyperopt parameter spaces to optimize. Default is the default set and"
|
||||||
|
"includes all spaces except for 'trailing', 'protection', and 'trades'."
|
||||||
|
),
|
||||||
|
"type": "array",
|
||||||
|
"items": {"type": "string", "enum": HYPEROPT_BUILTIN_SPACES},
|
||||||
|
"default": ["default"],
|
||||||
|
},
|
||||||
|
"analyze_per_epoch": {
|
||||||
|
"description": "Perform analysis after each epoch in Hyperopt.",
|
||||||
|
"type": "boolean",
|
||||||
|
},
|
||||||
|
"print_all": {
|
||||||
|
"description": "Print all hyperopt trials, not just the best ones.",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": False,
|
||||||
|
},
|
||||||
|
"hyperopt_jobs": {
|
||||||
|
"description": (
|
||||||
|
"The number of concurrently running jobs for hyperoptimization "
|
||||||
|
"(hyperopt worker processes). "
|
||||||
|
"If -1 (default), all CPUs are used, for -2, all CPUs but one are used, etc. "
|
||||||
|
"If 1 is given, no parallel computing is used."
|
||||||
|
),
|
||||||
|
"type": "integer",
|
||||||
|
"default": -1,
|
||||||
|
},
|
||||||
|
"hyperopt_random_state": {
|
||||||
|
"description": "Random state for hyperopt trials.",
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
},
|
||||||
|
"hyperopt_min_trades": {
|
||||||
|
"description": "Minimum number of trades per epoch for hyperopt.",
|
||||||
|
"type": "integer",
|
||||||
|
"minimum": 0,
|
||||||
|
},
|
||||||
|
"hyperopt_loss": {
|
||||||
|
"description": (
|
||||||
|
"The class name of the hyperopt loss function class (IHyperOptLoss). "
|
||||||
|
"Different functions can generate completely different results, "
|
||||||
|
"since the target for optimization is different. Built-in Hyperopt-loss-functions are: "
|
||||||
|
f"{', '.join(HYPEROPT_LOSS_BUILTIN)}"
|
||||||
|
),
|
||||||
|
"type": "string",
|
||||||
|
},
|
||||||
|
# end hyperopt
|
||||||
"bot_name": {
|
"bot_name": {
|
||||||
"description": "Name of the trading bot. Passed via API to a client.",
|
"description": "Name of the trading bot. Passed via API to a client.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|||||||
@@ -41,6 +41,18 @@ HYPEROPT_LOSS_BUILTIN = [
|
|||||||
"ProfitDrawDownHyperOptLoss",
|
"ProfitDrawDownHyperOptLoss",
|
||||||
"MultiMetricHyperOptLoss",
|
"MultiMetricHyperOptLoss",
|
||||||
]
|
]
|
||||||
|
HYPEROPT_BUILTIN_SPACES = [
|
||||||
|
"all",
|
||||||
|
"buy",
|
||||||
|
"sell",
|
||||||
|
"roi",
|
||||||
|
"stoploss",
|
||||||
|
"trailing",
|
||||||
|
"protection",
|
||||||
|
"trades",
|
||||||
|
"default",
|
||||||
|
]
|
||||||
|
|
||||||
AVAILABLE_PAIRLISTS = [
|
AVAILABLE_PAIRLISTS = [
|
||||||
"StaticPairList",
|
"StaticPairList",
|
||||||
"VolumePairList",
|
"VolumePairList",
|
||||||
|
|||||||
Reference in New Issue
Block a user