mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-29 04:32:43 +00:00
Small danglewood bugs (#2197)
* add user agent to yahoo request * initialize pandas series with float * Add a billions to economy SCALE * add color to rtps * make values required for certain settings * spell required correctly, dont block -h in settngs * quick lint * added couple guess games lines lol
This commit is contained in:
5
guess_game.json
vendored
5
guess_game.json
vendored
@@ -4,5 +4,8 @@
|
||||
"get management team from AAPL": "stocks/load AAPL/fa/mgmt",
|
||||
"check future IPOs": "stocks/disc/fipo",
|
||||
"search tickers with word 'Technology' from India": "stocks/search Technology -c India",
|
||||
"get consumer price index for Portugal": "economy/macro -p CPI -c Portugal"
|
||||
"get consumer price index for Portugal": "economy/macro -p CPI -c Portugal",
|
||||
"load in SPY etf and get top holdings": "etf/load SPY/holdings",
|
||||
"get forward rates for Euro to USD": "forex/load EURUSD/fwd",
|
||||
"load AAPL and compare the balance sheet with microsofts" : "stocks/load AAPL/ca/add MSFT/balance"
|
||||
}
|
||||
|
||||
@@ -61,7 +61,8 @@ def realtime_performance_sector(
|
||||
)
|
||||
|
||||
else:
|
||||
ax = df_rtp.plot(kind="barh")
|
||||
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)
|
||||
theme.style_primary_axis(ax)
|
||||
ax.set_title("Real Time Performance (%) per Sector")
|
||||
ax.tick_params(axis="x", labelrotation=90)
|
||||
|
||||
@@ -411,6 +411,7 @@ SCALES = {
|
||||
"Thousands": 1_000,
|
||||
"Millions": 1_000_000,
|
||||
"Hundreds of millions": 100_000_000,
|
||||
"Billions": 1_000_000_000,
|
||||
"Units": 1,
|
||||
}
|
||||
|
||||
@@ -503,10 +504,10 @@ def get_macro_data(
|
||||
|
||||
if country not in COUNTRY_CODES:
|
||||
console.print(f"No data available for the country {country}.")
|
||||
return pd.Series(), ""
|
||||
return pd.Series(dtype=float), ""
|
||||
if parameter not in PARAMETERS:
|
||||
console.print(f"The parameter {parameter} is not an option for {country}.")
|
||||
return pd.Series(), ""
|
||||
return pd.Series(dtype=float), ""
|
||||
|
||||
country_code = COUNTRY_CODES[country]
|
||||
country_currency = COUNTRY_CURRENCIES[country]
|
||||
@@ -533,7 +534,7 @@ def get_macro_data(
|
||||
f"No data available for {parameter} ({PARAMETERS[parameter]['name']}) "
|
||||
f"of country {country.replace('_', ' ')}"
|
||||
)
|
||||
return pd.Series(), ""
|
||||
return pd.Series(dtype=float), ""
|
||||
|
||||
if start_date or end_date:
|
||||
df = df.loc[start_date:end_date]
|
||||
|
||||
@@ -207,11 +207,12 @@ class SettingsController(BaseController):
|
||||
type=int,
|
||||
dest="value",
|
||||
help="value",
|
||||
required="-h" not in other_args,
|
||||
)
|
||||
if other_args and "-" not in other_args[0][0]:
|
||||
other_args.insert(0, "-v")
|
||||
ns_parser = parse_simple_args(parser, other_args)
|
||||
if ns_parser:
|
||||
if ns_parser and ns_parser.value:
|
||||
set_key(obbff.ENV_FILE, "OPENBB_PLOT_DPI", str(ns_parser.value))
|
||||
cfg_plot.PLOT_DPI = ns_parser.value
|
||||
console.print("")
|
||||
@@ -231,6 +232,7 @@ class SettingsController(BaseController):
|
||||
type=int,
|
||||
dest="value",
|
||||
help="value",
|
||||
required="-h" not in other_args,
|
||||
)
|
||||
if other_args and "-" not in other_args[0][0]:
|
||||
other_args.insert(0, "-v")
|
||||
@@ -255,6 +257,7 @@ class SettingsController(BaseController):
|
||||
type=int,
|
||||
dest="value",
|
||||
help="value",
|
||||
required="-h" not in other_args,
|
||||
)
|
||||
if other_args and "-" not in other_args[0][0]:
|
||||
other_args.insert(0, "-v")
|
||||
|
||||
@@ -7,6 +7,7 @@ import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.helper_funcs import get_user_agent
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -22,6 +23,8 @@ def get_most_shorted() -> pd.DataFrame:
|
||||
"""
|
||||
url = "https://finance.yahoo.com/screener/predefined/most_shorted_stocks"
|
||||
|
||||
data = pd.read_html(requests.get(url).text)[0]
|
||||
data = pd.read_html(
|
||||
requests.get(url, headers={"User-Agent": get_user_agent()}).text
|
||||
)[0]
|
||||
data = data.iloc[:, :-1]
|
||||
return data
|
||||
|
||||
Reference in New Issue
Block a user