1

I'm using python pandas in order to get stock/index prices from yahoo finance. I use the web.DataReader([list of stocks], 'yahoo', start, end)

Many of these stocks are working fine. However, one doesn't. My questions is: How can I manage to successfully gather all of them?

The one called ^DJCI is the one that doesn't work. It is available on the website of yahoo and it has data. I can't even get it individually by doing the following:

web.DataReader('^DJCI', 'yahoo', start, end)

I get the following error:

IOError: after 3 tries, Yahoo! did not return a 200 for url 'http://ichart.finance.yahoo.com/table.csv?s=^DJCI&a=0&b=1&c=2015&d=0&e=9&f=2016&g=d&ignore=.csv'
Filip Eriksson
  • 975
  • 7
  • 30
  • 47

2 Answers2

0

Try searching for %5EDJCI. That is equivalent to ^DJCI. The reason ^DJCI didn't work might because ^ is not a normal character and you need to 1escape it.



1: I don't know the proper term for converting ^ to %5E.

EDIT 1

See Yahoo! Finance CSV file will not return Dow Jones (^DJI)

Community
  • 1
  • 1
NoOneIsHere
  • 1,054
  • 16
  • 28
0

The problem is not the special character in ^DJCI the problem is the availability of historical data of that index, if you check Historical Prices this message is displayed:

Historical quote data is unavailable for the specified date range.

I search other source like Quandl, with no luck. But according this article, you could have good correlation with "iShares S&P GSCI Commodity-Indexed Trust (GSG)", if you find a free source of ^DJCI please let me know. By this time a good alternative is to use GSG

web.DataReader('GSG', 'yahoo', start, end)
jrovegno
  • 699
  • 5
  • 11