SP500, Dow Jones and Nasdaq tickers won't work Python

1.2k views Asked by At

The tickers for SP500, Dow Jones, and NASDAQ being ^GSPC, ^IXIC, and ^DJI, no longer work.

import datetime, quandl
from pandas_datareader import data, wb

start = datetime.datetime(2016,8,20)
end = datetime.datetime(2017, 8, 20)

sp500 = data.DataReader('^GSPC','google', start, end)  # S&P 500
nq = data.DataReader('^IXIC','google', start, end)  # NASDAQ
dj = data.DataReader('^DJI','google', start, end)   # Dow

I've also tried quandl, and the same problem occurred.

sp500 = quandl.get("WIKI/^GSPC", trim_start= start, trim_end=end)
dji = quandl.get("WIKI/INDEX_DJI", trim_start=start, trim_end=end)

Any idea if there is away around this problem? Presumably these tickers are out of date, and there are new ones for each of them. Downloading them isn't very Pythonic or cool :/ Any help is appreciated!

1

There are 1 answers

1
Robbotnik On

For accessing the Dow Jones Index use:

dji = quandl.get("BCB/UDJIAD1", 
              trim_start='2018-03-01', 
              trim_end='2018-03-31')