minor: cosmetics in arguments.py
This commit is contained in:
parent
ce2a5b2838
commit
8e272e5774
@ -43,11 +43,10 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
help='Log to the file specified.',
|
help='Log to the file specified.',
|
||||||
metavar='FILE',
|
metavar='FILE',
|
||||||
),
|
),
|
||||||
|
|
||||||
"version": Arg(
|
"version": Arg(
|
||||||
'--version',
|
'--version',
|
||||||
action='version',
|
action='version',
|
||||||
version=f'%(prog)s {__version__}'
|
version=f'%(prog)s {__version__}',
|
||||||
),
|
),
|
||||||
"config": Arg(
|
"config": Arg(
|
||||||
'-c', '--config',
|
'-c', '--config',
|
||||||
@ -55,17 +54,19 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
f'Multiple --config options may be used. '
|
f'Multiple --config options may be used. '
|
||||||
f'Can be set to `-` to read config from stdin.',
|
f'Can be set to `-` to read config from stdin.',
|
||||||
action='append',
|
action='append',
|
||||||
metavar='PATH',),
|
metavar='PATH',
|
||||||
|
),
|
||||||
"datadir": Arg(
|
"datadir": Arg(
|
||||||
'-d', '--datadir',
|
'-d', '--datadir',
|
||||||
help='Path to backtest data.',
|
help='Path to backtest data.',
|
||||||
metavar='PATH',),
|
metavar='PATH',
|
||||||
|
),
|
||||||
# Main options
|
# Main options
|
||||||
"strategy": Arg(
|
"strategy": Arg(
|
||||||
'-s', '--strategy',
|
'-s', '--strategy',
|
||||||
help='Specify strategy class name (default: `%(default)s`).',
|
help='Specify strategy class name (default: `%(default)s`).',
|
||||||
default='DefaultStrategy',
|
|
||||||
metavar='NAME',
|
metavar='NAME',
|
||||||
|
default='DefaultStrategy',
|
||||||
),
|
),
|
||||||
"strategy_path": Arg(
|
"strategy_path": Arg(
|
||||||
'--strategy-path',
|
'--strategy-path',
|
||||||
@ -125,14 +126,14 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
'--eps', '--enable-position-stacking',
|
'--eps', '--enable-position-stacking',
|
||||||
help='Allow buying the same pair multiple times (position stacking).',
|
help='Allow buying the same pair multiple times (position stacking).',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False
|
default=False,
|
||||||
),
|
),
|
||||||
"use_max_market_positions": Arg(
|
"use_max_market_positions": Arg(
|
||||||
'--dmmp', '--disable-max-market-positions',
|
'--dmmp', '--disable-max-market-positions',
|
||||||
help='Disable applying `max_open_trades` during backtest '
|
help='Disable applying `max_open_trades` during backtest '
|
||||||
'(same as setting `max_open_trades` to a very high number).',
|
'(same as setting `max_open_trades` to a very high number).',
|
||||||
action='store_false',
|
action='store_false',
|
||||||
default=True
|
default=True,
|
||||||
),
|
),
|
||||||
"live": Arg(
|
"live": Arg(
|
||||||
'-l', '--live',
|
'-l', '--live',
|
||||||
@ -158,9 +159,9 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
help='Save backtest results to the file with this filename (default: `%(default)s`). '
|
help='Save backtest results to the file with this filename (default: `%(default)s`). '
|
||||||
'Requires `--export` to be set as well. '
|
'Requires `--export` to be set as well. '
|
||||||
'Example: `--export-filename=user_data/backtest_data/backtest_today.json`',
|
'Example: `--export-filename=user_data/backtest_data/backtest_today.json`',
|
||||||
|
metavar='PATH',
|
||||||
default=os.path.join('user_data', 'backtest_data',
|
default=os.path.join('user_data', 'backtest_data',
|
||||||
'backtest-result.json'),
|
'backtest-result.json'),
|
||||||
metavar='PATH',
|
|
||||||
),
|
),
|
||||||
# Edge
|
# Edge
|
||||||
"stoploss_range": Arg(
|
"stoploss_range": Arg(
|
||||||
@ -169,33 +170,33 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
'The format is "min,max,step" (without any space). '
|
'The format is "min,max,step" (without any space). '
|
||||||
'Example: `--stoplosses=-0.01,-0.1,-0.001`',
|
'Example: `--stoplosses=-0.01,-0.1,-0.001`',
|
||||||
),
|
),
|
||||||
# hyperopt
|
# Hyperopt
|
||||||
"hyperopt": Arg(
|
"hyperopt": Arg(
|
||||||
'--customhyperopt',
|
'--customhyperopt',
|
||||||
help='Specify hyperopt class name (default: `%(default)s`).',
|
help='Specify hyperopt class name (default: `%(default)s`).',
|
||||||
default=constants.DEFAULT_HYPEROPT,
|
|
||||||
metavar='NAME',
|
metavar='NAME',
|
||||||
|
default=constants.DEFAULT_HYPEROPT,
|
||||||
),
|
),
|
||||||
"epochs": Arg(
|
"epochs": Arg(
|
||||||
'-e', '--epochs',
|
'-e', '--epochs',
|
||||||
help='Specify number of epochs (default: %(default)d).',
|
help='Specify number of epochs (default: %(default)d).',
|
||||||
default=constants.HYPEROPT_EPOCH,
|
|
||||||
type=int,
|
type=int,
|
||||||
metavar='INT',
|
metavar='INT',
|
||||||
|
default=constants.HYPEROPT_EPOCH,
|
||||||
),
|
),
|
||||||
"spaces": Arg(
|
"spaces": Arg(
|
||||||
'-s', '--spaces',
|
'-s', '--spaces',
|
||||||
help='Specify which parameters to hyperopt. Space-separated list. '
|
help='Specify which parameters to hyperopt. Space-separated list. '
|
||||||
'Default: `%(default)s`.',
|
'Default: `%(default)s`.',
|
||||||
choices=['all', 'buy', 'sell', 'roi', 'stoploss'],
|
choices=['all', 'buy', 'sell', 'roi', 'stoploss'],
|
||||||
default='all',
|
|
||||||
nargs='+',
|
nargs='+',
|
||||||
|
default='all',
|
||||||
),
|
),
|
||||||
"print_all": Arg(
|
"print_all": Arg(
|
||||||
'--print-all',
|
'--print-all',
|
||||||
help='Print all results, not only the best ones.',
|
help='Print all results, not only the best ones.',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False
|
default=False,
|
||||||
),
|
),
|
||||||
"hyperopt_jobs": Arg(
|
"hyperopt_jobs": Arg(
|
||||||
'-j', '--job-workers',
|
'-j', '--job-workers',
|
||||||
@ -203,9 +204,9 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
'(hyperopt worker processes). '
|
'(hyperopt worker processes). '
|
||||||
'If -1 (default), all CPUs are used, for -2, all CPUs but one are used, etc. '
|
'If -1 (default), all CPUs are used, for -2, all CPUs but one are used, etc. '
|
||||||
'If 1 is given, no parallel computing code is used at all.',
|
'If 1 is given, no parallel computing code is used at all.',
|
||||||
default=-1,
|
|
||||||
type=int,
|
type=int,
|
||||||
metavar='JOBS',
|
metavar='JOBS',
|
||||||
|
default=-1,
|
||||||
),
|
),
|
||||||
"hyperopt_random_state": Arg(
|
"hyperopt_random_state": Arg(
|
||||||
'--random-state',
|
'--random-state',
|
||||||
@ -217,9 +218,9 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
'--min-trades',
|
'--min-trades',
|
||||||
help="Set minimal desired number of trades for evaluations in the hyperopt "
|
help="Set minimal desired number of trades for evaluations in the hyperopt "
|
||||||
"optimization path (default: 1).",
|
"optimization path (default: 1).",
|
||||||
default=1,
|
|
||||||
type=check_int_positive,
|
type=check_int_positive,
|
||||||
metavar='INT',
|
metavar='INT',
|
||||||
|
default=1,
|
||||||
),
|
),
|
||||||
# List_exchange
|
# List_exchange
|
||||||
"print_one_column": Arg(
|
"print_one_column": Arg(
|
||||||
@ -233,7 +234,6 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
help='Show profits for only these pairs. Pairs are comma-separated.',
|
help='Show profits for only these pairs. Pairs are comma-separated.',
|
||||||
),
|
),
|
||||||
# Download data
|
# Download data
|
||||||
|
|
||||||
"pairs_file": Arg(
|
"pairs_file": Arg(
|
||||||
'--pairs-file',
|
'--pairs-file',
|
||||||
help='File containing a list of pairs to download.',
|
help='File containing a list of pairs to download.',
|
||||||
@ -263,7 +263,7 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
help='Clean all existing data for the selected exchange/pairs/timeframes.',
|
help='Clean all existing data for the selected exchange/pairs/timeframes.',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
),
|
),
|
||||||
# Plot_df_options
|
# Plot dataframe options
|
||||||
"indicators1": Arg(
|
"indicators1": Arg(
|
||||||
'--indicators1',
|
'--indicators1',
|
||||||
help='Set indicators from your strategy you want in the first row of the graph. '
|
help='Set indicators from your strategy you want in the first row of the graph. '
|
||||||
@ -280,16 +280,17 @@ AVAILABLE_CLI_OPTIONS = {
|
|||||||
'--plot-limit',
|
'--plot-limit',
|
||||||
help='Specify tick limit for plotting. Notice: too high values cause huge files. '
|
help='Specify tick limit for plotting. Notice: too high values cause huge files. '
|
||||||
'Default: %(default)s.',
|
'Default: %(default)s.',
|
||||||
default=750,
|
|
||||||
type=int,
|
type=int,
|
||||||
|
metavar='INT',
|
||||||
|
default=750,
|
||||||
),
|
),
|
||||||
"trade_source": Arg(
|
"trade_source": Arg(
|
||||||
'--trade-source',
|
'--trade-source',
|
||||||
help='Specify the source for trades (Can be DB or file (backtest file)) '
|
help='Specify the source for trades (Can be DB or file (backtest file)) '
|
||||||
'Default: %(default)s',
|
'Default: %(default)s',
|
||||||
|
choices=["DB", "file"],
|
||||||
default="file",
|
default="file",
|
||||||
choices=["DB", "file"]
|
),
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ARGS_COMMON = ["loglevel", "logfile", "version", "config", "datadir"]
|
ARGS_COMMON = ["loglevel", "logfile", "version", "config", "datadir"]
|
||||||
@ -309,8 +310,7 @@ ARGS_HYPEROPT = ARGS_COMMON_OPTIMIZE + ["hyperopt", "position_stacking", "epochs
|
|||||||
|
|
||||||
ARGS_EDGE = ARGS_COMMON_OPTIMIZE + ["stoploss_range"]
|
ARGS_EDGE = ARGS_COMMON_OPTIMIZE + ["stoploss_range"]
|
||||||
|
|
||||||
|
ARGS_LIST_EXCHANGES = ["print_one_column"]
|
||||||
ARGS_LIST_EXCHANGE = ["print_one_column"]
|
|
||||||
|
|
||||||
ARGS_DOWNLOADER = ARGS_COMMON + ["pairs", "pairs_file", "days", "exchange", "timeframes", "erase"]
|
ARGS_DOWNLOADER = ARGS_COMMON + ["pairs", "pairs_file", "days", "exchange", "timeframes", "erase"]
|
||||||
|
|
||||||
@ -339,7 +339,6 @@ class Arguments(object):
|
|||||||
"""
|
"""
|
||||||
Arguments Class. Manage the arguments received by the cli
|
Arguments Class. Manage the arguments received by the cli
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, args: Optional[List[str]], description: str) -> None:
|
def __init__(self, args: Optional[List[str]], description: str) -> None:
|
||||||
self.args = args
|
self.args = args
|
||||||
self.parsed_arg: Optional[argparse.Namespace] = None
|
self.parsed_arg: Optional[argparse.Namespace] = None
|
||||||
@ -412,7 +411,7 @@ class Arguments(object):
|
|||||||
help='Print available exchanges.'
|
help='Print available exchanges.'
|
||||||
)
|
)
|
||||||
list_exchanges_cmd.set_defaults(func=start_list_exchanges)
|
list_exchanges_cmd.set_defaults(func=start_list_exchanges)
|
||||||
self.build_args(optionlist=ARGS_LIST_EXCHANGE, parser=list_exchanges_cmd)
|
self.build_args(optionlist=ARGS_LIST_EXCHANGES, parser=list_exchanges_cmd)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parse_timerange(text: Optional[str]) -> TimeRange:
|
def parse_timerange(text: Optional[str]) -> TimeRange:
|
||||||
|
Loading…
Reference in New Issue
Block a user