-
Notifications
You must be signed in to change notification settings - Fork 683
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
ENH: Add support for AlphaVantage API #490
Conversation
@addisonlynch Please review the Travis failures https://travis-ci.org/pydata/pandas-datareader/builds/343250680 While most of them API key related, this ones fails on https://travis-ci.org/pydata/pandas-datareader/jobs/343250681 @davidastephens @jreback Who can add the Thanks |
Need to use same test pattern to skip module if API key is not available. |
@gliptak I can add a key to Travis. It won't actually be used for testing until the PR is merged since PRs can't access encryption variables to prevent leaking them by someone who could submit a useless PR that had |
I added the pytest.skipifs and fixed pandas 0.19.2 compat. Do you want me to add
unless PDR does obtain a higher call volume key. Let me know what works best. |
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 really good. Some small changes and doc string fixes. Also, could you add to readers/index.rst
docs/source/remote_data.rst
Outdated
access_key=os.getenv('ALPHAVANTAGE_API_KEY')) | ||
f.loc["2017-02-09"] | ||
|
||
The top-level function ``get_data_av`` is also provided. This function will |
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.
I don't really like get_data_av -- how could a new user know what av is? Maybe just the long get_data_alphavantage? Autocomplete is pretty good.
|
||
class AlphaVantage(_BaseReader): | ||
""" | ||
Base class for all AlphaVantage queries |
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.
I think there should be docstring here. Maybe we should use a doc string inheriter to simplify this?
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.
Nevermind - this is a base class.
pandas_datareader/av/forex.py
Outdated
|
||
Parameters | ||
---------- | ||
pairs : string, array-like object (list, tuple, Series) |
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.
Why not just keep the standard symbols?
pandas_datareader/av/sector.py
Outdated
|
||
Parameters | ||
---------- | ||
retry_count : int, default 3 |
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.
I don't think this docstring has all the arguments from the base class.
pandas_datareader/data.py
Outdated
@@ -47,6 +51,10 @@ | |||
'DataReader'] | |||
|
|||
|
|||
def get_data_av(*args, **kwargs): |
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.
get_data_alphavantage?
Done |
@bashtage was going to add the remaining endpoints today or tomorrow. Do you want me to push them to this pull or a separate one? Also, any direction you're able to provide on the preferred way to implement the technical indicators (see above) would be great. Thanks |
@bashtage Were your review items addressed? @addisonlynch Could you resolve the conflict? Thanks |
@gliptak conflicts resolved. Did indeed repair the requested changes |
Travis fails on unrelated errors (FRED and tiingo?). Are we ready to merge this otherwise? |
@bashtage Did you complete your review? Thanks |
AlphaVantage Readers
Adds support for nearly all of the AlphaVantage API endpoints.
Additions
AVTimeSeriesReader
- class to handle requests for data from the Stock Time Series endpointsget_data_av
, for TIME_SERIES_DAILYav-daily
for TIME_SERIES_DAILYav-daily-adjusted
for TIME_SERIES_DAILY_ADJUSTEDav-weekly
for TIME_SERIES_WEEKLYav-weekly-adjusted
for TIME_SERIES_WEEKLY_ADJUSTEDav-monthly
for TIME_SERIES_MONTHLYav-monthly-adjusted
TIME_SERIES_MONTHLY_ADJUSTEDAVQuotesReader
- class to handle requests for Batch Stock Quotes using top-levelget_quote_av
AVForexReader
- class to handle FX Exchange Rates endpoint (av-forex
or top-levelget_exchange_rate_av
)AVSectorPerformanceReader
- class to handle Sector Performances SECTOR endpointav-sector
or top-levelget_sector_performance_av
AlphaVantage
- base class for handling AlphaVantage requestsQuestions
int64
andfloat64
for the other new readers.TimeSeriesReader
to take the argumentfunction
which allows the selection of the daily/monthly/weekly endpoint? I have an implementation (see this gist) which uses separate readers for each (AVDailyReader
,AVDailyAdjustedReader
, etc.). Can switch over to that if it is more in-line with the current style.AlphaVantageTimeSeriesReader
seemed a bit long.Needs Help
ALPHAVANTAGE_API_KEY
Near Future
The above takes care of most of the AlphaVantage endpoints. There are two groups remaining:
AlphaVantage provides 52 technical indicators, each of which seems to take the same default (required) parameters:
function
,symbol
,interval
,apikey
. However, certain indicators (such as EMA) require additional parameterstime_period
,series_type
, etc.In addition, will need to add a reader to handle TIME_SERIES_INTRADAY
git diff upstream/master -u -- "*.py" | flake8 --diff