plot-profit should fail gracefully if no trade is within the selected timerange

closes #4119
This commit is contained in:
Matthias
2020-12-30 08:30:41 +01:00
parent b8899b39ec
commit 2fdda8e448
2 changed files with 6 additions and 0 deletions

View File

@@ -353,6 +353,10 @@ def test_generate_profit_graph(testdatadir):
profit_pair = find_trace_in_fig_data(figure.data, f"Profit {pair}")
assert isinstance(profit_pair, go.Scatter)
with pytest.raises(OperationalException, match=r"No trades found.*"):
# Pair cannot be empty - so it's an empty dataframe.
generate_profit_graph(pairs, data, trades.loc[trades['pair'].isnull()], timeframe="5m")
def test_start_plot_dataframe(mocker):
aup = mocker.patch("freqtrade.plot.plotting.load_and_plot_trades", MagicMock())