plot-profit: Make "auto-open" HTML result optional

Adding an "--auto-open" argument.
This improves tool processing of the results, while still allowing to open the HTML file for easy use.
This commit is contained in:
Janos
2021-05-30 16:11:24 +02:00
parent 3dab58e6db
commit 812eb229df
7 changed files with 18 additions and 4 deletions

View File

@@ -186,18 +186,22 @@ def test_plot_dataframe_options() -> None:
assert pargs['pairs'] == ['UNITTEST/BTC']
def test_plot_profit_options() -> None:
@pytest.mark.parametrize('auto_open_arg', [True, False])
def test_plot_profit_options(auto_open_arg: bool) -> None:
args = [
'plot-profit',
'-p', 'UNITTEST/BTC',
'--trade-source', 'DB',
'--db-url', 'sqlite:///whatever.sqlite',
]
if auto_open_arg:
args.append('--auto-open')
pargs = Arguments(args).get_parsed_arg()
assert pargs['trade_source'] == 'DB'
assert pargs['pairs'] == ['UNITTEST/BTC']
assert pargs['db_url'] == 'sqlite:///whatever.sqlite'
assert pargs['plot_auto_open'] == auto_open_arg
def test_config_notallowed(mocker) -> None:

View File

@@ -460,7 +460,7 @@ def test_plot_profit(default_conf, mocker, testdatadir):
assert store_mock.call_count == 1
assert profit_mock.call_args_list[0][0][0] == default_conf['pairs']
assert store_mock.call_args_list[0][1]['auto_open'] is True
assert store_mock.call_args_list[0][1]['auto_open'] is False
@pytest.mark.parametrize("ind1,ind2,plot_conf,exp", [