V.Alabrune
V.Alabrune

Reputation: 11

ValueError: The Quandl API key must be provided

I have imported quandl however i am still getting this error message

import quandl
quandl.ApiConfig.api_key = 'X6mZSY79yeySfpCVJaKg'

ValueError: The Quandl API key must be provided either through the api_key variable or through the environmental variable QUANDL_API_KEY.

Mr_Techie = ['MSFT', 'NFLX', 'FB', 'AMZN']
Mr_Allstar = ['MSFT', 'PFE', 'F', 'WMT']

techie_potfolio = pd.DataFrame()
allstar_portfolio = pd.DataFrame()

for tech,allstar in zip(Mr_Techie, Mr_Allstar):
    techie_portfolio[tech]= wb.DataReader(tech, data_source='quandl', start='2013-1-1')['AdjClose']
    allstar_portfolio[allstar]= wb.DataReader(allstar, data_source='quandl', start='2013-1-1')['AdjClose']

Upvotes: 1

Views: 3580

Answers (1)

mlbishnoi
mlbishnoi

Reputation: 477

The source shows how the DataReader factory function passes it to the Quandl reader:

elif data_source == "quandl":
        return QuandlReader(symbols=name, start=start, end=end,
                            retry_count=retry_count, pause=pause,
                            session=session, api_key=access_key).read()

So try passing it to DataReader with the access_key argument:

 techie_portfolio[tech]=wb.DataReader(tech, data_source='quandl', start='2013-1-1',access_key=api-key)

Upvotes: 1

Related Questions