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

add iexcloud provider #34

Closed
wants to merge 0 commits into from
Closed

Conversation

cshanes
Copy link
Contributor

@cshanes cshanes commented Jan 11, 2022

Used gosuto's IEXCloud example from the Signals example scripts repo to add to OpenSignals. Here's an example snippet for how to use it:

from pathlib import Path
import pandas as pd
import numerapi
from opensignals.data.iexcloud import IEXCloud
from opensignals.features import DividendsAPY

db_dir = Path('db')

iexcloud = IEXCloud()
iexcloud.download_data(db_dir, region='US')

features_generators = [
    DividendsAPY()
]

train, test, live, feature_names = iexcloud.get_data(db_dir, features_generators=features_generators)

Let me know if there's additional documentation you'd like me to add

Copy link
Contributor

@jaapterwoerds jaapterwoerds left a comment

Choose a reason for hiding this comment

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

Nice work @cshanes.

@@ -208,6 +208,11 @@ def download_data(self, db_dir: pathlib.Path, recreate: bool = False) -> None:

ticker_data = self.get_ticker_data(db_dir)
ticker_map = self.get_tickers()

ticker_map[['_', 'region']] = ticker_map['bloomberg_ticker'].str.split(' ', n=2, expand=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather could override / decorate the get_tickers method to do this mapping. In that way the implementation specific knowledge stays within the IEXCloud provider. The region parameter could be a constructor parameter of IEXCloud provider.


def __init__(self, iex_token: str = None, iex_api_version: str = 'iexcloud-sandbox', get_prices=True, get_dividends=True):
# iexcloud package expects IEX_TOKEN and IEX_API_VERSION environment variables
if "IEX_TOKEN" not in os.environ:
Copy link
Contributor

Choose a reason for hiding this comment

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

From a quick look at the iexfinance github readme, it seems like you could pass the token to the library functions and also instance when instantiating the Stock object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants