-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Update stocks_helper.py #2025
Update stocks_helper.py #2025
Conversation
When a stock is returned: Market: CLOSEDSENIOR PLC 10p Fixed to show: Market: CLOSED Company: SENIOT PLC 10p
Added logic for US if source requires .US. without this logic Datetime is printed twice.
Updated logic to fix pyLint Error.
Why does this bug occur and what does that company mean exactly? |
Further testing revealed Upper and Lower case issues, if .upper() is used it throws errors. This function uses yfinance to return info data for tickers. Yahoo does not have .US suffix for US stocks but other feeds may (will) have this. Some testing gave the following: Stock: │ Datetime: Timezone: Exchange: Market: Currency: Company: or: Datetime: 2022 Jul 01 07:51 Timezone: Europe/London Exchange: LSE Currency: GBp Market: OPENSENIOR PLC 10P or this: Datetime: Datetime: 2022 Jul 01 02:44 Timezone: America/New_York Currency: USD Market: CLOSED Company: Final Result is this: Datetime: 2022 Jul 01 02:51 Timezone: America/New_York Currency: USD Market: CLOSED Company: Apple Inc. I don't think this function is overly complex and could do with a refactor at some point.
This is just ticker info returned from yfinance and displayed when stock is loaded. The formatting was incorrect and in some instances it displayed extra info. I think it still requires some work but the initial bugs identified are fixed. |
Alright, makes sense to do it this way then. |
fixed Black error
RE the Pylint error, I am 99% sure I tested this with both lower and uppercase in the terminal and I got an issue hence the change to the logic: ************* Module openbb_terminal.stocks.stocks_helper I also tried a .upper() but this function did not like a str. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Will merge once tests pass. Thanks for this!!
When a stock is returned:
Market: CLOSEDSENIOR PLC 10p
Fixed to show:
Market: CLOSED
Company: SENIOR PLC 10p
Description
How has this been tested?
Checklist:
Others
pre-commit install
.pytest tests/...
.