Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve stocks load (link #3699) #3700

Merged
merged 6 commits into from
Dec 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions openbb_terminal/stocks/stocks_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,22 +926,19 @@ def additional_info_about_ticker(ticker: str) -> str:
if ".US" in ticker.upper():
ticker = ticker.rstrip(".US")
ticker = ticker.rstrip(".us")
ticker_info = yf.Ticker(ticker).info
ticker_stats = yf.Ticker(ticker).stats()
extra_info += "\n[param]Company: [/param]"
if "shortName" in ticker_info and ticker_info["shortName"]:
extra_info += ticker_info["shortName"]
extra_info += ticker_stats.get("quoteType", {}).get("shortName")
extra_info += "\n[param]Exchange: [/param]"
if "exchange" in ticker_info and ticker_info["exchange"]:
exchange_name = ticker_info["exchange"]
extra_info += (
exchange_mappings["X" + exchange_name]
if "X" + exchange_name in exchange_mappings
else exchange_name
)
exchange_name = ticker_stats.get("quoteType", {}).get("exchange")
extra_info += (
exchange_mappings["X" + exchange_name]
if "X" + exchange_name in exchange_mappings
else exchange_name
)

extra_info += "\n[param]Currency: [/param]"
if "currency" in ticker_info and ticker_info["currency"]:
extra_info += ticker_info["currency"]
extra_info += ticker_stats.get("summaryDetail", {}).get("currency")

else:
extra_info += "\n[param]Company: [/param]"
Expand Down