From 9722c338cf707d35c9293517b6d245ea4aaa0fd2 Mon Sep 17 00:00:00 2001 From: James Maslek Date: Tue, 1 Nov 2022 06:55:21 -0400 Subject: [PATCH] Spoooooky bugs - Futures menu ++ (#3230) * Some futures cleanup * #3141 * Fix #3146 * Add check to covid slopes Co-authored-by: Henrique Joaquim --- openbb_terminal/alternative/covid/covid_controller.py | 3 +++ openbb_terminal/economy/alphavantage_view.py | 10 +++++++++- openbb_terminal/futures/futures_controller.py | 2 +- openbb_terminal/futures/yfinance_model.py | 2 ++ openbb_terminal/futures/yfinance_view.py | 2 +- openbb_terminal/sdk.py | 4 ---- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/openbb_terminal/alternative/covid/covid_controller.py b/openbb_terminal/alternative/covid/covid_controller.py index 7f2627a3b80..8e88b21ad24 100644 --- a/openbb_terminal/alternative/covid/covid_controller.py +++ b/openbb_terminal/alternative/covid/covid_controller.py @@ -253,6 +253,9 @@ class CovidController(BaseController): parser, other_args, export_allowed=EXPORT_ONLY_RAW_DATA_ALLOWED, limit=10 ) if ns_parser: + if ns_parser.days < 2: + console.print("[red]Days must be greater than 1[/red]") + return covid_view.display_case_slopes( days_back=ns_parser.days, limit=ns_parser.limit, diff --git a/openbb_terminal/economy/alphavantage_view.py b/openbb_terminal/economy/alphavantage_view.py index 8f0deb4b330..147a3d0c7bc 100644 --- a/openbb_terminal/economy/alphavantage_view.py +++ b/openbb_terminal/economy/alphavantage_view.py @@ -56,10 +56,18 @@ def realtime_performance_sector( ) else: + + if external_axes is None: + _, ax = plt.subplots(figsize=plot_autoscale(), dpi=cfp.PLOT_DPI) + elif is_valid_axes_count(external_axes, 1): + (ax,) = external_axes + else: + return + df_rtp.set_index("Sector", inplace=True) df_rtp = df_rtp.squeeze(axis=1) colors = [theme.up_color if x > 0 else theme.down_color for x in df_rtp.values] - ax = df_rtp.plot(kind="barh", color=colors) + df_rtp.plot(kind="barh", color=colors, ax=ax) theme.style_primary_axis(ax) ax.set_title("Real Time Performance (%) per Sector") ax.tick_params(axis="x", labelrotation=90) diff --git a/openbb_terminal/futures/futures_controller.py b/openbb_terminal/futures/futures_controller.py index 4c03a98c286..31e94503385 100644 --- a/openbb_terminal/futures/futures_controller.py +++ b/openbb_terminal/futures/futures_controller.py @@ -218,9 +218,9 @@ class FuturesController(BaseController): dest="ticker", type=str, choices=self.all_tickers, - default="", help="Future curve to be selected", metavar="Futures symbol", + required="-h" not in other_args, ) if other_args and "-" not in other_args[0][0]: other_args.insert(0, "-t") diff --git a/openbb_terminal/futures/yfinance_model.py b/openbb_terminal/futures/yfinance_model.py index b6e2dcae221..f3b92c4464a 100644 --- a/openbb_terminal/futures/yfinance_model.py +++ b/openbb_terminal/futures/yfinance_model.py @@ -148,4 +148,6 @@ def get_curve_futures( if not futures_index: return pd.DataFrame() + futures_index = pd.to_datetime(futures_index) + return pd.DataFrame(index=futures_index, data=futures_curve, columns=["Futures"]) diff --git a/openbb_terminal/futures/yfinance_view.py b/openbb_terminal/futures/yfinance_view.py index e4e10a38ed3..d330bab98fb 100644 --- a/openbb_terminal/futures/yfinance_view.py +++ b/openbb_terminal/futures/yfinance_view.py @@ -281,7 +281,7 @@ def display_curve( marker="o", linestyle="dashed", linewidth=2, - markersize=12, + markersize=8, color=next(colors, "#FCED00"), ) make_white(ax) diff --git a/openbb_terminal/sdk.py b/openbb_terminal/sdk.py index dfba4e3e22d..59d64b80735 100644 --- a/openbb_terminal/sdk.py +++ b/openbb_terminal/sdk.py @@ -1010,10 +1010,6 @@ functions = { "model": "openbb_terminal.economy.investingcom_model.get_yieldcurve", "view": "openbb_terminal.economy.investingcom_view.display_yieldcurve", }, - "economy.spread": { - "model": "openbb_terminal.economy.investingcom_model.get_spread_matrix", - "view": "openbb_terminal.economy.investingcom_view.display_spread_matrix", - }, "economy.country_codes": { "model": "openbb_terminal.economy.nasdaq_model.get_country_codes" },