import pandas_datareader.data as web
df = web.DataReader('^GSPC', 'yahoo', start='1950-01-03', end='2017-09-14')
If I go on the Yahoo Finance website I can manually download data from 1950, so why can't I do that using pandas datareader? I mean I got the data already, just curious about why it didn't work.
Edit: I get this error:
Traceback (most recent call last):
File "C:/Users/x/PycharmProjects/Programming for Finance/getsp.py", line 7, in <module>
df = web.DataReader('^GSPC', 'yahoo', start='1950-01-03', end='2017-09-14')
File "C:\Users\x\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas_datareader\data.py", line 121, in DataReader
session=session).read()
File "C:\Users\x\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas_datareader\yahoo\daily.py", line 115, in read
df = super(YahooDailyReader, self).read()
File "C:\Users\x\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas_datareader\base.py", line 181, in read
params=self._get_params(self.symbols))
File "C:\Users\x\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas_datareader\yahoo\daily.py", line 99, in _get_params
unix_start = int(time.mktime(self.start.timetuple()))
OverflowError: mktime argument out of range
You may try package
yfinance
.