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

Polygon stock load #1757

Merged
merged 12 commits into from
May 3, 2022
Merged

Polygon stock load #1757

merged 12 commits into from
May 3, 2022

Conversation

jmaslek
Copy link
Collaborator

@jmaslek jmaslek commented May 3, 2022

Adding in load --source polygon from polygon.io

The free tier allows 5 calls/minute and it seems that the minute calls give a lotto data, up to 50,000 entries... We already have polygon API key in the terminal.

More to come :D

I did tests

edit: I did more

@deeleeramone here are figi and SIK codes from polygon's endpoint

            AAPL Codes             
┏━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃                  ┃              ┃
┡━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┩
│ CIK              │ 0000320193   │
├──────────────────┼──────────────┤
│ COMPOSITE FIGI   │ BBG000B9XRY4 │
├──────────────────┼──────────────┤
│ SHARE CLASS FIGI │ BBG001S5N8V8 │
├──────────────────┼──────────────┤
│ SIC CODE         │ 3571         │
└──────────────────┴──────────────┘

@jmaslek jmaslek added the feat XS Extra small feature label May 3, 2022
@jmaslek jmaslek requested a review from DidierRLopes May 3, 2022 02:00
openbb_terminal/parent_classes.py Outdated Show resolved Hide resolved
@@ -111,7 +112,9 @@ def print_help(self):
{self.add_info}[cmds]
quote view the current price for a specific stock ticker
candle view a candle chart for a specific stock ticker
news latest news of the company[/cmds] [src][News API][/src]
news latest news of the company [src][News API][/src]
codes FIGI, SIK and SIC codes codes[/cmds] [src][Polygon.io][/src]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this worth being a command?

Also, we should only display this command if there is a valid polygon key

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.

we show the news line even if there is not a valid news api key

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the Polygon data here can be accessed with their free tier? if yes, nvm my comment. If not, let's hide it for users that don't have a valid paid API key

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup :D afaik everything they have can be accessed through the free tier.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So nevermind what I said!

import yfinance as yf
from alpha_vantage.timeseries import TimeSeries
from numpy.core.fromnumeric import transpose
from plotly.subplots import make_subplots
from scipy import stats

from openbb_terminal.config_terminal import theme
from openbb_terminal.config_terminal import theme, API_POLYGON_KEY
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's load config_terminal as cfg and then use cfg.API_POLYGON_KEY. That's how we doing in the other places

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from your last PR: why would I import config terminal twice?
Screen Shot 2022-05-03 at 10 07 52 AM

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't like implicit imports. I think having cfg.theme is much more visible where that comes from, and would rather us doing that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just tryna use your code against you ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that also imports everything and is why we initially had such slow load times

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config_terminal is always loaded even if you do from config_terminal import theme it just creates that theme reference on the file.

The slow load times were "solved" by putting the import within a command, not based on how we load a module.

I am still a pain 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that you are <3

now approve

@DidierRLopes DidierRLopes merged commit 7d55b6f into OpenBB-finance:main May 3, 2022
@deeleeramone
Copy link
Contributor

deeleeramone commented May 3, 2022 via email

@jmaslek jmaslek deleted the polygon_stocks branch February 14, 2024 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat XS Extra small feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants