diff options
author | teh_coderer <me@tehcoderer.com> | 2023-05-24 15:46:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-24 20:46:40 +0000 |
commit | e07a5a382619cdbfec3a4f5188aa9dea958cbdf9 (patch) | |
tree | 77c46cc5e8d5e55066c484e0778c6f8993b52d26 | |
parent | 77b2da0cd37eeeabbb9bbab21fc8325023629469 (diff) |
hotfix/ Options Historical + Crypto candles (#5064)
* fix options/crypto candles
* fix streamlit indicators
* Update Indicators.py
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | openbb_terminal/core/plots/plotly_helper.py | 1 | ||||
-rw-r--r-- | openbb_terminal/cryptocurrency/cryptocurrency_helpers.py | 4 | ||||
-rw-r--r-- | openbb_terminal/dashboards/stream/pages/Indicators.py | 17 | ||||
-rw-r--r-- | openbb_terminal/stocks/options/chartexchange_view.py | 5 | ||||
-rw-r--r-- | openbb_terminal/stocks/options/intrinio_view.py | 6 | ||||
-rw-r--r-- | openbb_terminal/stocks/options/tradier_view.py | 2 |
7 files changed, 23 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore index e3616f955db..2067d043615 100644 --- a/.gitignore +++ b/.gitignore @@ -43,7 +43,7 @@ website/terminaltest openbb_terminal/core/plots/assets/plotly*.js .dccache *rome.json - +**/node_modules/* # pyinstaller artifacts *.pyo dist/* diff --git a/openbb_terminal/core/plots/plotly_helper.py b/openbb_terminal/core/plots/plotly_helper.py index 25589b2228b..0ede57301e6 100644 --- a/openbb_terminal/core/plots/plotly_helper.py +++ b/openbb_terminal/core/plots/plotly_helper.py @@ -1592,6 +1592,7 @@ class OpenBBFigure(go.Figure): xref="paper", x=1, y=0, + showarrow=False, text="OpenBB Terminal", font_size=17, font_color="gray", diff --git a/openbb_terminal/cryptocurrency/cryptocurrency_helpers.py b/openbb_terminal/cryptocurrency/cryptocurrency_helpers.py index c6e4fd7d627..9f88d23a739 100644 --- a/openbb_terminal/cryptocurrency/cryptocurrency_helpers.py +++ b/openbb_terminal/cryptocurrency/cryptocurrency_helpers.py @@ -915,12 +915,12 @@ def plot_candles( # pylint: disable=too-many-arguments name=f"{symbol} OHLC", row=1, col=1, - secondary_y=volume, + secondary_y=False, ) if volume: fig.add_inchart_volume(data) - fig.set_yaxis_title("Price", row=1, col=1, secondary_y=volume, type=yscale) + fig.set_yaxis_title("Price", row=1, col=1, secondary_y=False, type=yscale) fig.update_layout(showlegend=False) return fig.show(external=external_axes) diff --git a/openbb_terminal/dashboards/stream/pages/Indicators.py b/openbb_terminal/dashboards/stream/pages/Indicators.py index 74a8a5c3a0b..9be698a5aae 100644 --- a/openbb_terminal/dashboards/stream/pages/Indicators.py +++ b/openbb_terminal/dashboards/stream/pages/Indicators.py @@ -102,7 +102,7 @@ async def plot_indicators( main_ticker, candles=not tickers, volume=not tickers, - volume_ticks_x=5, + volume_ticks_x=7, ) fig.update_traces(showlegend=False) @@ -149,8 +149,8 @@ async def plot_indicators( showline=False, zeroline=False, title_text="% Change", - ticksuffix=f"{'':>20}", side="left", + title_standoff=5, tickformat=".2%", overlaying="y", ) @@ -167,13 +167,20 @@ async def plot_indicators( y_min -= y_range * 0.05 y_max += y_range * 0.05 - yaxis = "yaxis" if tickers else "yaxis2" - fig.update_layout( - {yaxis: dict(range=[y_min, y_max], autorange=False)}, + yaxis=dict(range=[y_min, y_max], autorange=False), title=dict(x=0.5, xanchor="center", yanchor="top", y=0.99, text=title), showlegend=True, height=550 + (20 * rows), + legend=dict( + bgcolor="rgba(0,0,0,0.5)", + bordercolor="#F5EFF3", + borderwidth=1, + x=0.01, + y=0.01, + xanchor="left", + yanchor="bottom", + ), ) return fig diff --git a/openbb_terminal/stocks/options/chartexchange_view.py b/openbb_terminal/stocks/options/chartexchange_view.py index 6b71d9c08a6..7741a7b5c88 100644 --- a/openbb_terminal/stocks/options/chartexchange_view.py +++ b/openbb_terminal/stocks/options/chartexchange_view.py @@ -38,6 +38,7 @@ def plot_chart( OpenBBFigure Plotly figure object """ + titles_list = ["Historical", symbol, price, option_type.title()] fig = OpenBBFigure.create_subplots( rows=1, @@ -45,7 +46,7 @@ def plot_chart( vertical_spacing=0.06, specs=[[{"secondary_y": True}]], ) - fig.set_title(f"Historical {symbol} {price} {option_type.title()}") + fig.set_title(" ".join(str(x) for x in titles_list if x)) fig.add_candlestick( open=df.Open, @@ -56,7 +57,7 @@ def plot_chart( name=f"{price} {option_type.title()} OHLC", row=1, col=1, - secondary_y=True, + secondary_y=False, ) fig.add_inchart_volume(df) fig.hide_holidays() diff --git a/openbb_terminal/stocks/options/intrinio_view.py b/openbb_terminal/stocks/options/intrinio_view.py index e5ec49fa476..4a6c262d06f 100644 --- a/openbb_terminal/stocks/options/intrinio_view.py +++ b/openbb_terminal/stocks/options/intrinio_view.py @@ -71,13 +71,13 @@ def display_historical( df_hist.columns = [x.title() for x in df_hist.columns] + titles_list = [symbol, strike, op_type] fig = OpenBBFigure.create_subplots( rows=1, cols=1, specs=[[{"secondary_y": True}]], vertical_spacing=0.03, - subplot_titles=[f"{symbol} {strike} {op_type}"], - ) + ).set_title(" ".join([str(x) for x in titles_list if x])) fig.add_candlestick( open=df_hist["Open"], @@ -88,7 +88,7 @@ def display_historical( name=f"{symbol} OHLC", row=1, col=1, - secondary_y=True, + secondary_y=False, ) fig.add_inchart_volume(df_hist) fig.hide_holidays() diff --git a/openbb_terminal/stocks/options/tradier_view.py b/openbb_terminal/stocks/options/tradier_view.py index 45b992f2fbd..5e1e384f561 100644 --- a/openbb_terminal/stocks/options/tradier_view.py +++ b/openbb_terminal/stocks/options/tradier_view.py @@ -88,7 +88,7 @@ def display_historical( name=f"{symbol} OHLC", row=1, col=1, - secondary_y=True, + secondary_y=False, ) fig.add_inchart_volume(df_hist) fig.hide_holidays() |