Search code examples
python-3.xpandaspandas-datareaderelixir-iex

Connecting to "Iex" or "morningstar" and retrieve data


I try to retrieve historical financial Data from iex or morningstar. For this I use the Following Code.

import pandas as pd
pd.core.common.is_list_like = pd.api.types.is_list_like
import pandas_datareader.data as web
import datetime

start = datetime.datetime(2019, 1, 1)
end = datetime.datetime(2019, 1, 10)
facebook = web.DataReader("FB", 'morningstar', start, end)

print(facebook.head())

Unfortunatly I get the error message:

NotImplementedError: data_source='morningstar' is not implemented

or

ValueError: The IEX Cloud API key must be provided either through the api_key variable or through the environment variable IEX_API_KEY

depending on which of both sources I use.

I tried to

pip uninstall pandas-datareader
pip install pandas-datareader

several times and also restarted the kernel but nothing changes. Was there any change to this APIs or am I doing anything wrong?


Solution

  • From the documentation:

    You need to obtain the IEX_API_KEY from IEX and pass it to os.environ["IEX_API_KEY"]. (https://pandas-datareader.readthedocs.io/en/latest/remote_data.html#remote-data-iex) I don't know if the IEX API still works.

    The morningstar is not implemented. The following data sources (at the time of writing) are:

        Tiingo
        IEX
        Alpha Vantage
        Enigma
        Quandl
        St.Louis FED (FRED)
        Kenneth French’s data library
        World Bank
        OECD
        Eurostat
        Thrift Savings Plan
        Nasdaq Trader symbol definitions
        Stooq
        MOEX