Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I saw this: http://matplotlib.org/examples/pylab_examples/finance_work2.html

and being the lazy bum that I am, decided to steal it and use it for Indian stocks. Now matplotib.finance defines:

def fetch_historical_yahoo(ticker, date1, date2, cachename=None,dividends=False):
.....
urlFmt = 'http://table.finance.yahoo.com/table.csv?a=%d&b=%d&c=%d&d=%d&e=%d&f=%d&s=%s&y=0&g=%s&ignore=.csv'


url = urlFmt % (d1[0], d1[1], d1[2],d2[0], d2[1], d2[2], ticker, g)
.....
and then does
urlopen(url)

But the format for getting data from Yahoo India is slightly different. So I went to in.finance.yahoo.com and got the link to historical prices of Reliance Industries as:

http://ichart.finance.yahoo.com/table.csv?s=RELIANCE.NS&a=03&b=1&c=2012&d=02&e=31&f=2013&g=d&ignore=.csv

But now I pop this into a function "indian.py" as: urlFmt='http://ichart.finance.yahoo.com/table.csv?s=%s&d=%d&e=%d&f=%d&g=d&a=%d&b=%d&c=%d&ignore=.csv'

When I run this, I get a HTTP 404 error.

What am I doing wrong?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900