Sep 17, 2009

API for BSE Shares data in India

Earlier today I was looking for an API which provides stock quotes for Indian market(BSE) in real time. But couldn't really find anything close to it. The only option left for me was to scrape the information from any one of the sites which provide live quotes for Indian shares.

After eye-balling couple of sites I shortlisted on http://bseindia.com. Since this is the official site of the Bombay Stock Exchange, I thought they would provide me the information as real as I could get. Moreover the web page which provides scrip information looked quite simple for me to scrape.

Luckily I did not have to scrape the HTML data to get my content. I reverse engineered the process of displaying the scrip information on the browser and realized that bseindia.com was actually using an API. The API though would return all the information as a comma separated list.

Finally I created a gem out of it (yes it was a ruby script) and thought it would be a good idea to share it. So here it is, my first open source ruby gem called BseQuote. You can build it yourself after downloading the code from github. Share your feedback if you find it useful.

(Picture credit: cc Niyantha / Flickr)