mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-29 13:32:08 +00:00
Spoooooky bugs - Futures menu ++ (#3230)
* Some futures cleanup * #3141 * Fix #3146 * Add check to covid slopes Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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"])
|
||||
|
||||
@@ -281,7 +281,7 @@ def display_curve(
|
||||
marker="o",
|
||||
linestyle="dashed",
|
||||
linewidth=2,
|
||||
markersize=12,
|
||||
markersize=8,
|
||||
color=next(colors, "#FCED00"),
|
||||
)
|
||||
make_white(ax)
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user