diff --git a/freqtrade/configuration/arguments.py b/freqtrade/configuration/arguments.py index 61c899f93..7b4a6f63f 100644 --- a/freqtrade/configuration/arguments.py +++ b/freqtrade/configuration/arguments.py @@ -34,10 +34,8 @@ ARGS_CREATE_USERDIR = ["user_data_dir"] ARGS_DOWNLOAD_DATA = ["pairs", "pairs_file", "days", "exchange", "timeframes", "erase"] -ARGS_PLOT_DATAFRAME = (ARGS_COMMON + ARGS_STRATEGY + - ["pairs", "indicators1", "indicators2", "plot_limit", "db_url", - "trade_source", "export", "exportfilename", "timerange", - "refresh_pairs"]) +ARGS_PLOT_DATAFRAME = ["pairs", "indicators1", "indicators2", "plot_limit", "db_url", + "trade_source", "export", "exportfilename", "timerange", "refresh_pairs"] ARGS_PLOT_PROFIT = (ARGS_COMMON + ARGS_STRATEGY + ["pairs", "timerange", "export", "exportfilename", "db_url", "trade_source"]) diff --git a/freqtrade/plot/plot_utils.py b/freqtrade/plot/plot_utils.py index 2a06ca185..125a1f46c 100644 --- a/freqtrade/plot/plot_utils.py +++ b/freqtrade/plot/plot_utils.py @@ -6,7 +6,7 @@ from freqtrade.utils import setup_utils_configuration def start_plot_dataframe(args: Namespace) -> None: """ - Plotting dataframe + Plotting dataframe helper """ # Import here to avoid errors if plot-dependencies are not installed. from freqtrade.plot.plotting import analyse_and_plot_pairs diff --git a/freqtrade/plot/plotting.py b/freqtrade/plot/plotting.py index f50987972..cb13e3147 100644 --- a/freqtrade/plot/plotting.py +++ b/freqtrade/plot/plotting.py @@ -328,11 +328,11 @@ def analyse_and_plot_pairs(config: Dict[str, Any]): """ From configuration provided - Initializes plot-script - -Get tickers data - -Generate Dafaframes populated with indicators and signals - -Load trades excecuted on same periods - -Generate Plotly plot objects - -Generate plot files + - Get tickers data + - Generate Dafaframes populated with indicators and signals based on configured strategy + - Load trades excecuted during the selected period + - Generate Plotly plot objects + - Generate plot files :return: None """ plot_elements = init_plotscript(config) diff --git a/freqtrade/tests/test_plotting.py b/freqtrade/tests/test_plotting.py index a78e38c1f..02660341e 100644 --- a/freqtrade/tests/test_plotting.py +++ b/freqtrade/tests/test_plotting.py @@ -9,13 +9,14 @@ from plotly.subplots import make_subplots from freqtrade.configuration import TimeRange from freqtrade.data import history from freqtrade.data.btanalysis import create_cum_profit, load_backtest_data +from freqtrade.plot.plot_utils import start_plot_dataframe from freqtrade.plot.plotting import (add_indicators, add_profit, generate_candlestick_graph, generate_plot_filename, generate_profit_graph, init_plotscript, plot_trades, store_plot_file) from freqtrade.strategy.default_strategy import DefaultStrategy -from freqtrade.tests.conftest import log_has, log_has_re +from freqtrade.tests.conftest import get_args, log_has, log_has_re def fig_generating_mock(fig, *args, **kwargs): @@ -270,3 +271,18 @@ def test_generate_profit_graph(): for pair in pairs: profit_pair = find_trace_in_fig_data(figure.data, f"Profit {pair}") assert isinstance(profit_pair, go.Scattergl) + + +def test_start_plot_dataframe(mocker): + aup = mocker.patch("freqtrade.plot.plotting.analyse_and_plot_pairs", MagicMock()) + args = [ + "--config", "config.json.example", + "plot-dataframe", + "--pairs", "ETH/BTC" + ] + start_plot_dataframe(get_args(args)) + + assert aup.call_count == 1 + called_config = aup.call_args_list[0][0][0] + assert "pairs" in called_config + assert called_config['pairs'] == ["ETH/BTC"]