pandas used to facilitate access to data providers' APIs directly, but this functionality has moved to the related pandas-datareader library. The stability of the APIs varies with provider policies, and as of June 2o18 at version 0.7, the following sources are available:
Source |
Scope |
Comment |
Yahoo! Finance |
EOD price, dividends, split data for stock and FX pairs |
Unstable |
Tiingo |
EOD prices on equities, mutual funds, and ETFs |
Free registration required |
The Investors Exchange (IEX) |
Historical stock prices, order-book data |
Limited to five years |
Robinhood |
EOD equity prices |
Limited to one year |
Quandl |
Marketplace for a broad range of asset prices |
Premium data require a subscription |
Nasdaq |
Latest ticker symbols traded on Nasdaq with some additional info |
|
Stooq |
Some stock market index data |
|
MOEX |
Moscow Stock Exchange Data |
|
Alpha Vantage |
EOD stock prices and FX pairs |
|
Fama/French |
Factor returns and research portfolios from the FF Data Library |
Access and retrieval of data follow a similar API for all sources, as illustrated for Yahoo! Finance:
import pandas_datareader.data as web
from datetime import datetime
start = '2014' # accepts strings
end = datetime(2017, 5, 24) # or datetime objects
yahoo= web.DataReader('FB', 'yahoo', start=start, end=end)
yahoo.info()
DatetimeIndex: 856 entries, 2014-01-02 to 2017-05-25
Data columns (total 6 columns):
High 856 non-null float64
Low 856 non-null float64
Open 856 non-null float64
Close 856 non-null float64
Volume 856 non-null int64
Adj Close 856 non-null float64
dtypes: float64(5), int64(1)