Update plotting tests for new strategy interface
This commit is contained in:
parent
9a03cb96f5
commit
f9f32a15bb
@ -386,8 +386,9 @@ def generate_candlestick_graph(pair: str, data: pd.DataFrame, trades: pd.DataFra
|
|||||||
)
|
)
|
||||||
fig.add_trace(candles, 1, 1)
|
fig.add_trace(candles, 1, 1)
|
||||||
|
|
||||||
if 'buy' in data.columns:
|
# TODO-lev: Needs short equivalent
|
||||||
df_buy = data[data['buy'] == 1]
|
if 'enter_long' in data.columns:
|
||||||
|
df_buy = data[data['enter_long'] == 1]
|
||||||
if len(df_buy) > 0:
|
if len(df_buy) > 0:
|
||||||
buys = go.Scatter(
|
buys = go.Scatter(
|
||||||
x=df_buy.date,
|
x=df_buy.date,
|
||||||
@ -405,8 +406,8 @@ def generate_candlestick_graph(pair: str, data: pd.DataFrame, trades: pd.DataFra
|
|||||||
else:
|
else:
|
||||||
logger.warning("No buy-signals found.")
|
logger.warning("No buy-signals found.")
|
||||||
|
|
||||||
if 'sell' in data.columns:
|
if 'exit_long' in data.columns:
|
||||||
df_sell = data[data['sell'] == 1]
|
df_sell = data[data['exit_long'] == 1]
|
||||||
if len(df_sell) > 0:
|
if len(df_sell) > 0:
|
||||||
sells = go.Scatter(
|
sells = go.Scatter(
|
||||||
x=df_sell.date,
|
x=df_sell.date,
|
||||||
|
@ -203,8 +203,8 @@ def test_generate_candlestick_graph_no_signals_no_trades(default_conf, mocker, t
|
|||||||
timerange = TimeRange(None, 'line', 0, -1000)
|
timerange = TimeRange(None, 'line', 0, -1000)
|
||||||
data = history.load_pair_history(pair=pair, timeframe='1m',
|
data = history.load_pair_history(pair=pair, timeframe='1m',
|
||||||
datadir=testdatadir, timerange=timerange)
|
datadir=testdatadir, timerange=timerange)
|
||||||
data['buy'] = 0
|
data['enter_long'] = 0
|
||||||
data['sell'] = 0
|
data['exit_long'] = 0
|
||||||
|
|
||||||
indicators1 = []
|
indicators1 = []
|
||||||
indicators2 = []
|
indicators2 = []
|
||||||
@ -264,12 +264,12 @@ def test_generate_candlestick_graph_no_trades(default_conf, mocker, testdatadir)
|
|||||||
buy = find_trace_in_fig_data(figure.data, "buy")
|
buy = find_trace_in_fig_data(figure.data, "buy")
|
||||||
assert isinstance(buy, go.Scatter)
|
assert isinstance(buy, go.Scatter)
|
||||||
# All buy-signals should be plotted
|
# All buy-signals should be plotted
|
||||||
assert int(data.buy.sum()) == len(buy.x)
|
assert int(data['enter_long'].sum()) == len(buy.x)
|
||||||
|
|
||||||
sell = find_trace_in_fig_data(figure.data, "sell")
|
sell = find_trace_in_fig_data(figure.data, "sell")
|
||||||
assert isinstance(sell, go.Scatter)
|
assert isinstance(sell, go.Scatter)
|
||||||
# All buy-signals should be plotted
|
# All buy-signals should be plotted
|
||||||
assert int(data.sell.sum()) == len(sell.x)
|
assert int(data['exit_long'].sum()) == len(sell.x)
|
||||||
|
|
||||||
assert find_trace_in_fig_data(figure.data, "Bollinger Band")
|
assert find_trace_in_fig_data(figure.data, "Bollinger Band")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user