Handle some merge aftermaths

This commit is contained in:
Matthias 2019-10-20 19:54:38 +02:00
parent 2d34c0f52d
commit 1c503f39b2
6 changed files with 47 additions and 42 deletions

View File

@ -32,7 +32,7 @@ jobs:
name: backtest name: backtest
- script: - script:
- cp config.json.example config.json - cp config.json.example config.json
- freqtrade hyperopt --datadir tests/testdata -e 5 --strategy DefaultStrategy --hyperopt DefaultHyperOpts - freqtrade hyperopt --datadir tests/testdata -e 5 --strategy DefaultStrategy --hyperopt DefaultHyperOpt
name: hyperopt name: hyperopt
- script: flake8 - script: flake8
name: flake8 name: flake8

View File

@ -153,7 +153,8 @@ class Arguments:
self._build_args(optionlist=ARGS_CREATE_USERDIR, parser=create_userdir_cmd) self._build_args(optionlist=ARGS_CREATE_USERDIR, parser=create_userdir_cmd)
# Add list-exchanges subcommand # Add list-exchanges subcommand
list_exchanges_cmd = subparsers.add_parser('list-exchanges', list_exchanges_cmd = subparsers.add_parser(
'list-exchanges',
help='Print available exchanges.', help='Print available exchanges.',
parents=[_common_parser], parents=[_common_parser],
) )
@ -163,13 +164,15 @@ class Arguments:
# Add list-timeframes subcommand # Add list-timeframes subcommand
list_timeframes_cmd = subparsers.add_parser( list_timeframes_cmd = subparsers.add_parser(
'list-timeframes', 'list-timeframes',
help='Print available ticker intervals (timeframes) for the exchange.' help='Print available ticker intervals (timeframes) for the exchange.',
parents=[_common_parser],
) )
list_timeframes_cmd.set_defaults(func=start_list_timeframes) list_timeframes_cmd.set_defaults(func=start_list_timeframes)
self._build_args(optionlist=ARGS_LIST_TIMEFRAMES, parser=list_timeframes_cmd) self._build_args(optionlist=ARGS_LIST_TIMEFRAMES, parser=list_timeframes_cmd)
# Add download-data subcommand # Add download-data subcommand
download_data_cmd = subparsers.add_parser('download-data', download_data_cmd = subparsers.add_parser(
'download-data',
help='Download backtesting data.', help='Download backtesting data.',
parents=[_common_parser], parents=[_common_parser],
) )
@ -177,7 +180,8 @@ class Arguments:
self._build_args(optionlist=ARGS_DOWNLOAD_DATA, parser=download_data_cmd) self._build_args(optionlist=ARGS_DOWNLOAD_DATA, parser=download_data_cmd)
# Add Plotting subcommand # Add Plotting subcommand
plot_dataframe_cmd = subparsers.add_parser('plot-dataframe', plot_dataframe_cmd = subparsers.add_parser(
'plot-dataframe',
help='Plot candles with indicators.', help='Plot candles with indicators.',
parents=[_common_parser, _strategy_parser], parents=[_common_parser, _strategy_parser],
) )
@ -185,7 +189,8 @@ class Arguments:
self._build_args(optionlist=ARGS_PLOT_DATAFRAME, parser=plot_dataframe_cmd) self._build_args(optionlist=ARGS_PLOT_DATAFRAME, parser=plot_dataframe_cmd)
# Plot profit # Plot profit
plot_profit_cmd = subparsers.add_parser('plot-profit', plot_profit_cmd = subparsers.add_parser(
'plot-profit',
help='Generate plot showing profits.', help='Generate plot showing profits.',
parents=[_common_parser], parents=[_common_parser],
) )

View File

@ -27,7 +27,7 @@ from tests.conftest import (get_args, log_has, log_has_re, patch_exchange,
def hyperopt(default_conf, mocker): def hyperopt(default_conf, mocker):
default_conf.update({ default_conf.update({
'spaces': ['all'], 'spaces': ['all'],
'hyperopt': 'DefaultHyperOpts', 'hyperopt': 'DefaultHyperOpt',
}) })
patch_exchange(mocker) patch_exchange(mocker)
return Hyperopt(default_conf) return Hyperopt(default_conf)
@ -73,7 +73,7 @@ def test_setup_hyperopt_configuration_without_arguments(mocker, default_conf, ca
args = [ args = [
'hyperopt', 'hyperopt',
'--config', 'config.json', '--config', 'config.json',
'--hyperopt', 'DefaultHyperOpts', '--hyperopt', 'DefaultHyperOpt',
] ]
config = setup_configuration(get_args(args), RunMode.HYPEROPT) config = setup_configuration(get_args(args), RunMode.HYPEROPT)
@ -105,7 +105,7 @@ def test_setup_hyperopt_configuration_with_arguments(mocker, default_conf, caplo
args = [ args = [
'hyperopt', 'hyperopt',
'--config', 'config.json', '--config', 'config.json',
'--hyperopt', 'DefaultHyperOpts', '--hyperopt', 'DefaultHyperOpt',
'--datadir', '/foo/bar', '--datadir', '/foo/bar',
'--ticker-interval', '1m', '--ticker-interval', '1m',
'--timerange', ':100', '--timerange', ':100',
@ -160,7 +160,7 @@ def test_hyperoptresolver(mocker, default_conf, caplog) -> None:
'freqtrade.resolvers.hyperopt_resolver.HyperOptResolver._load_hyperopt', 'freqtrade.resolvers.hyperopt_resolver.HyperOptResolver._load_hyperopt',
MagicMock(return_value=hyperopt(default_conf)) MagicMock(return_value=hyperopt(default_conf))
) )
default_conf.update({'hyperopt': 'DefaultHyperOpts'}) default_conf.update({'hyperopt': 'DefaultHyperOpt'})
x = HyperOptResolver(default_conf).hyperopt x = HyperOptResolver(default_conf).hyperopt
assert not hasattr(x, 'populate_buy_trend') assert not hasattr(x, 'populate_buy_trend')
assert not hasattr(x, 'populate_sell_trend') assert not hasattr(x, 'populate_sell_trend')
@ -214,7 +214,7 @@ def test_start_not_installed(mocker, default_conf, caplog, import_fails) -> None
args = [ args = [
'hyperopt', 'hyperopt',
'--config', 'config.json', '--config', 'config.json',
'--hyperopt', 'DefaultHyperOpts', '--hyperopt', 'DefaultHyperOpt',
'--epochs', '5' '--epochs', '5'
] ]
args = get_args(args) args = get_args(args)
@ -232,7 +232,7 @@ def test_start(mocker, default_conf, caplog) -> None:
args = [ args = [
'hyperopt', 'hyperopt',
'--config', 'config.json', '--config', 'config.json',
'--hyperopt', 'DefaultHyperOpts', '--hyperopt', 'DefaultHyperOpt',
'--epochs', '5' '--epochs', '5'
] ]
args = get_args(args) args = get_args(args)
@ -255,7 +255,7 @@ def test_start_no_data(mocker, default_conf, caplog) -> None:
args = [ args = [
'hyperopt', 'hyperopt',
'--config', 'config.json', '--config', 'config.json',
'--hyperopt', 'DefaultHyperOpts', '--hyperopt', 'DefaultHyperOpt',
'--epochs', '5' '--epochs', '5'
] ]
args = get_args(args) args = get_args(args)
@ -273,7 +273,7 @@ def test_start_filelock(mocker, default_conf, caplog) -> None:
args = [ args = [
'hyperopt', 'hyperopt',
'--config', 'config.json', '--config', 'config.json',
'--hyperopt', 'DefaultHyperOpts', '--hyperopt', 'DefaultHyperOpt',
'--epochs', '5' '--epochs', '5'
] ]
args = get_args(args) args = get_args(args)
@ -425,7 +425,7 @@ def test_start_calls_optimizer(mocker, default_conf, caplog, capsys) -> None:
patch_exchange(mocker) patch_exchange(mocker)
default_conf.update({'config': 'config.json.example', default_conf.update({'config': 'config.json.example',
'hyperopt': 'DefaultHyperOpts', 'hyperopt': 'DefaultHyperOpt',
'epochs': 1, 'epochs': 1,
'timerange': None, 'timerange': None,
'spaces': 'all', 'spaces': 'all',
@ -530,7 +530,7 @@ def test_buy_strategy_generator(hyperopt, testdatadir) -> None:
def test_generate_optimizer(mocker, default_conf) -> None: def test_generate_optimizer(mocker, default_conf) -> None:
default_conf.update({'config': 'config.json.example', default_conf.update({'config': 'config.json.example',
'hyperopt': 'DefaultHyperOpts', 'hyperopt': 'DefaultHyperOpt',
'timerange': None, 'timerange': None,
'spaces': 'all', 'spaces': 'all',
'hyperopt_min_trades': 1, 'hyperopt_min_trades': 1,
@ -597,7 +597,7 @@ def test_generate_optimizer(mocker, default_conf) -> None:
def test_clean_hyperopt(mocker, default_conf, caplog): def test_clean_hyperopt(mocker, default_conf, caplog):
patch_exchange(mocker) patch_exchange(mocker)
default_conf.update({'config': 'config.json.example', default_conf.update({'config': 'config.json.example',
'hyperopt': 'DefaultHyperOpts', 'hyperopt': 'DefaultHyperOpt',
'epochs': 1, 'epochs': 1,
'timerange': None, 'timerange': None,
'spaces': 'all', 'spaces': 'all',
@ -614,7 +614,7 @@ def test_clean_hyperopt(mocker, default_conf, caplog):
def test_continue_hyperopt(mocker, default_conf, caplog): def test_continue_hyperopt(mocker, default_conf, caplog):
patch_exchange(mocker) patch_exchange(mocker)
default_conf.update({'config': 'config.json.example', default_conf.update({'config': 'config.json.example',
'hyperopt': 'DefaultHyperOpts', 'hyperopt': 'DefaultHyperOpt',
'epochs': 1, 'epochs': 1,
'timerange': None, 'timerange': None,
'spaces': 'all', 'spaces': 'all',
@ -644,7 +644,7 @@ def test_print_json_spaces_all(mocker, default_conf, caplog, capsys) -> None:
patch_exchange(mocker) patch_exchange(mocker)
default_conf.update({'config': 'config.json.example', default_conf.update({'config': 'config.json.example',
'hyperopt': 'DefaultHyperOpts', 'hyperopt': 'DefaultHyperOpt',
'epochs': 1, 'epochs': 1,
'timerange': None, 'timerange': None,
'spaces': 'all', 'spaces': 'all',
@ -682,7 +682,7 @@ def test_print_json_spaces_roi_stoploss(mocker, default_conf, caplog, capsys) ->
patch_exchange(mocker) patch_exchange(mocker)
default_conf.update({'config': 'config.json.example', default_conf.update({'config': 'config.json.example',
'hyperopt': 'DefaultHyperOpts', 'hyperopt': 'DefaultHyperOpt',
'epochs': 1, 'epochs': 1,
'timerange': None, 'timerange': None,
'spaces': 'roi stoploss', 'spaces': 'roi stoploss',
@ -721,7 +721,7 @@ def test_simplified_interface_roi_stoploss(mocker, default_conf, caplog, capsys)
patch_exchange(mocker) patch_exchange(mocker)
default_conf.update({'config': 'config.json.example', default_conf.update({'config': 'config.json.example',
'hyperopt': 'DefaultHyperOpts', 'hyperopt': 'DefaultHyperOpt',
'epochs': 1, 'epochs': 1,
'timerange': None, 'timerange': None,
'spaces': 'roi stoploss', 'spaces': 'roi stoploss',
@ -763,7 +763,7 @@ def test_simplified_interface_all_failed(mocker, default_conf, caplog, capsys) -
patch_exchange(mocker) patch_exchange(mocker)
default_conf.update({'config': 'config.json.example', default_conf.update({'config': 'config.json.example',
'hyperopt': 'DefaultHyperOpts', 'hyperopt': 'DefaultHyperOpt',
'epochs': 1, 'epochs': 1,
'timerange': None, 'timerange': None,
'spaces': 'all', 'spaces': 'all',
@ -797,7 +797,7 @@ def test_simplified_interface_buy(mocker, default_conf, caplog, capsys) -> None:
patch_exchange(mocker) patch_exchange(mocker)
default_conf.update({'config': 'config.json.example', default_conf.update({'config': 'config.json.example',
'hyperopt': 'DefaultHyperOpts', 'hyperopt': 'DefaultHyperOpt',
'epochs': 1, 'epochs': 1,
'timerange': None, 'timerange': None,
'spaces': 'buy', 'spaces': 'buy',
@ -843,7 +843,7 @@ def test_simplified_interface_sell(mocker, default_conf, caplog, capsys) -> None
patch_exchange(mocker) patch_exchange(mocker)
default_conf.update({'config': 'config.json.example', default_conf.update({'config': 'config.json.example',
'hyperopt': 'DefaultHyperOpts', 'hyperopt': 'DefaultHyperOpt',
'epochs': 1, 'epochs': 1,
'timerange': None, 'timerange': None,
'spaces': 'sell', 'spaces': 'sell',
@ -891,7 +891,7 @@ def test_simplified_interface_failed(mocker, default_conf, caplog, capsys, metho
patch_exchange(mocker) patch_exchange(mocker)
default_conf.update({'config': 'config.json.example', default_conf.update({'config': 'config.json.example',
'hyperopt': 'DefaultHyperOpts', 'hyperopt': 'DefaultHyperOpt',
'epochs': 1, 'epochs': 1,
'timerange': None, 'timerange': None,
'spaces': space, 'spaces': space,

View File

@ -61,7 +61,7 @@ def test_load_strategy_invalid_directory(result, caplog, default_conf):
assert log_has_re(r'Path .*' + r'some.*path.*' + r'.* does not exist', caplog) assert log_has_re(r'Path .*' + r'some.*path.*' + r'.* does not exist', caplog)
assert 'adx' in resolver.strategy.advise_indicators(result, {'pair': 'ETH/BTC'}) assert 'rsi' in resolver.strategy.advise_indicators(result, {'pair': 'ETH/BTC'})
def test_load_not_found_strategy(default_conf): def test_load_not_found_strategy(default_conf):

View File

@ -186,7 +186,7 @@ def test_config_notallowed(mocker) -> None:
] ]
pargs = Arguments(args).get_parsed_arg() pargs = Arguments(args).get_parsed_arg()
assert pargs["config"] is None assert "config" not in pargs
# When file exists: # When file exists:
mocker.patch.object(Path, "is_file", MagicMock(return_value=True)) mocker.patch.object(Path, "is_file", MagicMock(return_value=True))
@ -195,7 +195,7 @@ def test_config_notallowed(mocker) -> None:
] ]
pargs = Arguments(args).get_parsed_arg() pargs = Arguments(args).get_parsed_arg()
# config is not added even if it exists, since create-userdir is in the notallowed list # config is not added even if it exists, since create-userdir is in the notallowed list
assert pargs["config"] is None assert "config" not in pargs
def test_config_notrequired(mocker) -> None: def test_config_notrequired(mocker) -> None:

View File

@ -95,8 +95,8 @@ def test_list_timeframes(mocker, capsys):
# Test with --config config.json.example # Test with --config config.json.example
args = [ args = [
'--config', 'config.json.example',
"list-timeframes", "list-timeframes",
'--config', 'config.json.example',
] ]
start_list_timeframes(get_args(args)) start_list_timeframes(get_args(args))
captured = capsys.readouterr() captured = capsys.readouterr()
@ -139,8 +139,8 @@ def test_list_timeframes(mocker, capsys):
# Test with --one-column # Test with --one-column
args = [ args = [
'--config', 'config.json.example',
"list-timeframes", "list-timeframes",
'--config', 'config.json.example',
"--one-column", "--one-column",
] ]
start_list_timeframes(get_args(args)) start_list_timeframes(get_args(args))