Remove scattergl and fix tests
This commit is contained in:
parent
83e596c06f
commit
764a35d035
@ -91,7 +91,7 @@ def add_profit(fig, row, data: pd.DataFrame, column: str, name: str) -> make_sub
|
|||||||
:param name: Name to use
|
:param name: Name to use
|
||||||
:return: fig with added profit plot
|
:return: fig with added profit plot
|
||||||
"""
|
"""
|
||||||
profit = go.Scattergl(
|
profit = go.Scatter(
|
||||||
x=data.index,
|
x=data.index,
|
||||||
y=data[column],
|
y=data[column],
|
||||||
name=name,
|
name=name,
|
||||||
@ -241,7 +241,7 @@ def generate_candlestick_graph(pair: str, data: pd.DataFrame, trades: pd.DataFra
|
|||||||
if 'bb_upperband' in indicators1 and 'bb_lowerband' in indicators1:
|
if 'bb_upperband' in indicators1 and 'bb_lowerband' in indicators1:
|
||||||
indicators1.remove('bb_upperband')
|
indicators1.remove('bb_upperband')
|
||||||
indicators1.remove('bb_lowerband')
|
indicators1.remove('bb_lowerband')
|
||||||
|
|
||||||
# Add indicators to main plot
|
# Add indicators to main plot
|
||||||
fig = add_indicators(fig=fig, row=1, indicators=indicators1, data=data)
|
fig = add_indicators(fig=fig, row=1, indicators=indicators1, data=data)
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ def generate_profit_graph(pairs: str, tickers: Dict[str, pd.DataFrame],
|
|||||||
df_comb = create_cum_profit(df_comb, trades, 'cum_profit')
|
df_comb = create_cum_profit(df_comb, trades, 'cum_profit')
|
||||||
|
|
||||||
# Plot the pairs average close prices, and total profit growth
|
# Plot the pairs average close prices, and total profit growth
|
||||||
avgclose = go.Scattergl(
|
avgclose = go.Scatter(
|
||||||
x=df_comb.index,
|
x=df_comb.index,
|
||||||
y=df_comb['mean'],
|
y=df_comb['mean'],
|
||||||
name='Avg close price',
|
name='Avg close price',
|
||||||
|
@ -197,8 +197,7 @@ def test_generate_candlestick_graph_no_trades(default_conf, mocker, testdatadir)
|
|||||||
# All buy-signals should be plotted
|
# All buy-signals should be plotted
|
||||||
assert int(data.sell.sum()) == len(sell.x)
|
assert int(data.sell.sum()) == len(sell.x)
|
||||||
|
|
||||||
assert find_trace_in_fig_data(figure.data, "BB lower")
|
assert find_trace_in_fig_data(figure.data, "Bollinger Band")
|
||||||
assert find_trace_in_fig_data(figure.data, "BB upper")
|
|
||||||
|
|
||||||
assert row_mock.call_count == 2
|
assert row_mock.call_count == 2
|
||||||
assert trades_mock.call_count == 1
|
assert trades_mock.call_count == 1
|
||||||
@ -239,7 +238,7 @@ def test_add_profit(testdatadir):
|
|||||||
fig1 = add_profit(fig, row=2, data=cum_profits, column='cum_profits', name='Profits')
|
fig1 = add_profit(fig, row=2, data=cum_profits, column='cum_profits', name='Profits')
|
||||||
figure = fig1.layout.figure
|
figure = fig1.layout.figure
|
||||||
profits = find_trace_in_fig_data(figure.data, "Profits")
|
profits = find_trace_in_fig_data(figure.data, "Profits")
|
||||||
assert isinstance(profits, go.Scattergl)
|
assert isinstance(profits, go.Scatter)
|
||||||
assert profits.yaxis == "y2"
|
assert profits.yaxis == "y2"
|
||||||
|
|
||||||
|
|
||||||
@ -268,14 +267,14 @@ def test_generate_profit_graph(testdatadir):
|
|||||||
assert len(figure.data) == 4
|
assert len(figure.data) == 4
|
||||||
|
|
||||||
avgclose = find_trace_in_fig_data(figure.data, "Avg close price")
|
avgclose = find_trace_in_fig_data(figure.data, "Avg close price")
|
||||||
assert isinstance(avgclose, go.Scattergl)
|
assert isinstance(avgclose, go.Scatter)
|
||||||
|
|
||||||
profit = find_trace_in_fig_data(figure.data, "Profit")
|
profit = find_trace_in_fig_data(figure.data, "Profit")
|
||||||
assert isinstance(profit, go.Scattergl)
|
assert isinstance(profit, go.Scatter)
|
||||||
|
|
||||||
for pair in pairs:
|
for pair in pairs:
|
||||||
profit_pair = find_trace_in_fig_data(figure.data, f"Profit {pair}")
|
profit_pair = find_trace_in_fig_data(figure.data, f"Profit {pair}")
|
||||||
assert isinstance(profit_pair, go.Scattergl)
|
assert isinstance(profit_pair, go.Scatter)
|
||||||
|
|
||||||
|
|
||||||
def test_start_plot_dataframe(mocker):
|
def test_start_plot_dataframe(mocker):
|
||||||
|
Loading…
Reference in New Issue
Block a user