Adapt tests to new add_indicator methodology

This commit is contained in:
Matthias 2020-01-04 11:18:51 +01:00
parent f04873b0b0
commit 4628024de6
2 changed files with 6 additions and 4 deletions

View File

@ -177,6 +177,7 @@ def create_plotconfig(indicators1: List[str], indicators2: List[str], plot_confi
if 'subplots' not in plot_config:
plot_config['subplots'] = {}
return plot_config
def generate_candlestick_graph(pair: str, data: pd.DataFrame, trades: pd.DataFrame = None, *,
@ -195,7 +196,7 @@ def generate_candlestick_graph(pair: str, data: pd.DataFrame, trades: pd.DataFra
:param plot_config: Dict of Dicts containing advanced plot configuration
:return: Plotly figure
"""
plot_config = create_plotconfig(indicators1, indicators2)
plot_config = create_plotconfig(indicators1, indicators2, plot_config)
rows = 2 + len(plot_config['subplots'])
row_widths = [1 for _ in plot_config['subplots']]

View File

@ -66,8 +66,8 @@ def test_add_indicators(default_conf, testdatadir, caplog):
data = history.load_pair_history(pair=pair, timeframe='1m',
datadir=testdatadir, timerange=timerange)
indicators1 = ["ema10"]
indicators2 = ["macd"]
indicators1 = {"ema10": {}}
indicators2 = {"macd": {"color": "red"}}
# Generate buy/sell signals and indicators
strat = DefaultStrategy(default_conf)
@ -86,9 +86,10 @@ def test_add_indicators(default_conf, testdatadir, caplog):
macd = find_trace_in_fig_data(figure.data, "macd")
assert isinstance(macd, go.Scatter)
assert macd.yaxis == "y3"
assert macd.line.color == "red"
# No indicator found
fig3 = add_indicators(fig=deepcopy(fig), row=3, indicators=['no_indicator'], data=data)
fig3 = add_indicators(fig=deepcopy(fig), row=3, indicators={'no_indicator': {}}, data=data)
assert fig == fig3
assert log_has_re(r'Indicator "no_indicator" ignored\..*', caplog)