Add list-hyperopts command
This commit is contained in:
parent
3fe39a3e1b
commit
857eb5ff69
@ -14,6 +14,7 @@ from freqtrade.commands.deploy_commands import (start_create_userdir,
|
|||||||
from freqtrade.commands.hyperopt_commands import (start_hyperopt_list,
|
from freqtrade.commands.hyperopt_commands import (start_hyperopt_list,
|
||||||
start_hyperopt_show)
|
start_hyperopt_show)
|
||||||
from freqtrade.commands.list_commands import (start_list_exchanges,
|
from freqtrade.commands.list_commands import (start_list_exchanges,
|
||||||
|
start_list_hyperopts,
|
||||||
start_list_markets,
|
start_list_markets,
|
||||||
start_list_strategies,
|
start_list_strategies,
|
||||||
start_list_timeframes)
|
start_list_timeframes)
|
||||||
|
@ -32,6 +32,8 @@ ARGS_EDGE = ARGS_COMMON_OPTIMIZE + ["stoploss_range"]
|
|||||||
|
|
||||||
ARGS_LIST_STRATEGIES = ["strategy_path", "print_one_column"]
|
ARGS_LIST_STRATEGIES = ["strategy_path", "print_one_column"]
|
||||||
|
|
||||||
|
ARGS_LIST_HYPEROPTS = ["hyperopt_path", "print_one_column"]
|
||||||
|
|
||||||
ARGS_LIST_EXCHANGES = ["print_one_column", "list_exchanges_all"]
|
ARGS_LIST_EXCHANGES = ["print_one_column", "list_exchanges_all"]
|
||||||
|
|
||||||
ARGS_LIST_TIMEFRAMES = ["exchange", "print_one_column"]
|
ARGS_LIST_TIMEFRAMES = ["exchange", "print_one_column"]
|
||||||
@ -132,9 +134,10 @@ class Arguments:
|
|||||||
|
|
||||||
from freqtrade.commands import (start_create_userdir, start_download_data,
|
from freqtrade.commands import (start_create_userdir, start_download_data,
|
||||||
start_hyperopt_list, start_hyperopt_show,
|
start_hyperopt_list, start_hyperopt_show,
|
||||||
start_list_exchanges, start_list_markets,
|
start_list_exchanges, start_list_hyperopts,
|
||||||
start_list_strategies, start_new_hyperopt,
|
start_list_markets, start_list_strategies,
|
||||||
start_new_strategy, start_list_timeframes,
|
start_list_timeframes,
|
||||||
|
start_new_hyperopt, start_new_strategy,
|
||||||
start_plot_dataframe, start_plot_profit,
|
start_plot_dataframe, start_plot_profit,
|
||||||
start_backtesting, start_hyperopt, start_edge,
|
start_backtesting, start_hyperopt, start_edge,
|
||||||
start_test_pairlist, start_trading)
|
start_test_pairlist, start_trading)
|
||||||
@ -198,6 +201,15 @@ class Arguments:
|
|||||||
list_strategies_cmd.set_defaults(func=start_list_strategies)
|
list_strategies_cmd.set_defaults(func=start_list_strategies)
|
||||||
self._build_args(optionlist=ARGS_LIST_STRATEGIES, parser=list_strategies_cmd)
|
self._build_args(optionlist=ARGS_LIST_STRATEGIES, parser=list_strategies_cmd)
|
||||||
|
|
||||||
|
# Add list-hyperopts subcommand
|
||||||
|
list_hyperopts_cmd = subparsers.add_parser(
|
||||||
|
'list-hyperopts',
|
||||||
|
help='Print available hyperopt classes.',
|
||||||
|
parents=[_common_parser],
|
||||||
|
)
|
||||||
|
list_hyperopts_cmd.set_defaults(func=start_list_hyperopts)
|
||||||
|
self._build_args(optionlist=ARGS_LIST_HYPEROPTS, parser=list_hyperopts_cmd)
|
||||||
|
|
||||||
# Add list-exchanges subcommand
|
# Add list-exchanges subcommand
|
||||||
list_exchanges_cmd = subparsers.add_parser(
|
list_exchanges_cmd = subparsers.add_parser(
|
||||||
'list-exchanges',
|
'list-exchanges',
|
||||||
|
@ -38,7 +38,7 @@ def start_list_exchanges(args: Dict[str, Any]) -> None:
|
|||||||
|
|
||||||
def start_list_strategies(args: Dict[str, Any]) -> None:
|
def start_list_strategies(args: Dict[str, Any]) -> None:
|
||||||
"""
|
"""
|
||||||
Print Strategies available in a directory
|
Print files with Strategy custom classes available in the directory
|
||||||
"""
|
"""
|
||||||
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
||||||
|
|
||||||
@ -54,6 +54,26 @@ def start_list_strategies(args: Dict[str, Any]) -> None:
|
|||||||
print(tabulate(strats_to_print, headers='keys', tablefmt='pipe'))
|
print(tabulate(strats_to_print, headers='keys', tablefmt='pipe'))
|
||||||
|
|
||||||
|
|
||||||
|
def start_list_hyperopts(args: Dict[str, Any]) -> None:
|
||||||
|
"""
|
||||||
|
Print files with HyperOpt custom classes available in the directory
|
||||||
|
"""
|
||||||
|
from freqtrade.resolvers.hyperopt_resolver import HyperOptResolver
|
||||||
|
|
||||||
|
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
||||||
|
|
||||||
|
directory = Path(config.get('hyperopt_path', config['user_data_dir'] / USERPATH_HYPEROPTS))
|
||||||
|
hyperopts = HyperOptResolver.search_all_objects(directory)
|
||||||
|
# Sort alphabetically
|
||||||
|
hyperopts = sorted(hyperopts, key=lambda x: x['name'])
|
||||||
|
hyperopts_to_print = [{'name': s['name'], 'location': s['location'].name} for s in hyperopts]
|
||||||
|
|
||||||
|
if args['print_one_column']:
|
||||||
|
print('\n'.join([s['name'] for s in hyperopts]))
|
||||||
|
else:
|
||||||
|
print(tabulate(hyperopts_to_print, headers='keys', tablefmt='pipe'))
|
||||||
|
|
||||||
|
|
||||||
def start_list_timeframes(args: Dict[str, Any]) -> None:
|
def start_list_timeframes(args: Dict[str, Any]) -> None:
|
||||||
"""
|
"""
|
||||||
Print ticker intervals (timeframes) available on Exchange
|
Print ticker intervals (timeframes) available on Exchange
|
||||||
|
Loading…
Reference in New Issue
Block a user