Fix create_cum_profit to work with trades that don't open on candle

opens
This commit is contained in:
Matthias
2019-10-28 14:24:12 +01:00
parent 17fce00a5e
commit e82460bde6
4 changed files with 17 additions and 11 deletions

View File

@@ -130,7 +130,7 @@ def test_create_cum_profit(testdatadir):
cum_profits = create_cum_profit(df.set_index('date'),
bt_data[bt_data["pair"] == 'POWR/BTC'],
"cum_profits")
"cum_profits", timeframe="5m")
assert "cum_profits" in cum_profits.columns
assert cum_profits.iloc[0]['cum_profits'] == 0
assert cum_profits.iloc[-1]['cum_profits'] == 0.0798005

View File

@@ -234,7 +234,7 @@ def test_add_profit(testdatadir):
cum_profits = create_cum_profit(df.set_index('date'),
bt_data[bt_data["pair"] == 'POWR/BTC'],
"cum_profits")
"cum_profits", timeframe="5m")
fig1 = add_profit(fig, row=2, data=cum_profits, column='cum_profits', name='Profits')
figure = fig1.layout.figure
@@ -256,7 +256,7 @@ def test_generate_profit_graph(testdatadir):
)
trades = trades[trades['pair'].isin(pairs)]
fig = generate_profit_graph(pairs, tickers, trades)
fig = generate_profit_graph(pairs, tickers, trades, timeframe="5m")
assert isinstance(fig, go.Figure)
assert fig.layout.title.text == "Freqtrade Profit plot"