Search code examples
pythonpython-3.xquandlpandas-datareader

Adjusted Price for ETFs


I'm looking for Adjusted Price (price adjusted to factor in dividends and corporate actions) for ETFs, but have not been successful. Is there any free (with limits is fine) data sources out there for this?

Update:

A Python API would be ideal, as I am coding in Python for this task. But a different language, or a direct csv file download may potentially work too.


I have been getting adjusted stock prices using pandas_datareader with quandl as the data source (google and yahoo seem not to work anymore). This works:

web.DataReader('WIKI/AAPL', 'quandl', '2017-05-01', '2017-05-31')['AdjClose']

But it doesn't work for ETFs:

web.DataReader('WIKI/IVV', 'quandl', '2017-05-01', '2017-05-31')['AdjClose']

RemoteDataError: Unable to read URL: https://www.quandl.com/api/v3/datasets/WIKI/IVV.csv?start_date=2006-05-01&end_date=2006-05-31&order=asc

Response Text: b'code,message\nQECx02, You have submitted an incorrect Quandl code. Please check your Quandl codes and try again.\n'


I also tried calling the quandl library directly. This works ('x' represents my api key):

quandl.get('WIKI/AAPL',trim_start='2006-05-01',trim_end = '2006-05-31',authtoken='x')

while this doesn't:

quandl.get('WIKI/IVV',trim_start='2006-05-01',trim_end = '2006-05-31',authtoken='x')

NotFoundError: (Status 404) (Quandl Error QECx02) You have submitted an incorrect Quandl code. Please check your Quandl codes and try again.


Solution

  • I've been using https://www.iextrading.com and it has been working perfectly for me. Haven't notice any rate limiting and the data appears to be very clean.

    Here is an example call for what you are looking for

    https://api.iextrading.com/1.0/stock/IVV/chart/1m
    

    There is also a python module built around this API: https://github.com/addisonlynch/iexfinance

    However, I am not sure how far back the data goes...

    Last summer I also wrote a API for downloading historical prices from yahoo. It returns price and adjusted price: https://github.com/AndrewRPorter/yahoo-historical