1

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']
vahdet
  • 6,357
  • 9
  • 51
  • 106
V.Alabrune
  • 11
  • 1
  • 3

1 Answers1

1

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)
mlbishnoi
  • 457
  • 5
  • 13