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)

14 comments:

rishi said...

Hi do u have this code in php ? I am not familiar in ruby. Please help

Mayank Sharma said...

No I do not have code in php.

Megalomaniac said...

Thanks Mayan you gave me an idea :)

hitesh said...
This comment has been removed by the author.
zubinmehta said...

A python wrapper would be great :)

Anu said...

Hi Mayank,
The ruby script looks promising but can you confirm the validity of the url_string you used to retrieve data.

I'm trying it but it kind off redirecting me to BSE's 'file not found' page.

Any help would be much appreciated!

Thanks,
Anupam

TEDPOL said...

Hey,I want to use this in java is there any code available if so please replay...
E-mail id : harnesh007@gmail.com

Er. Kapil said...

hai thanks for this gem this is very usefull and i have ported this code to php it works for me , thank u very much .

Pankaj said...

Kapil, can you share the PHP code that has worked for you?

Akella Kiran said...

Hi kapil and pankaj please share the code in php.......thats would helpful for me.......to a.s.kiran75@gmail.com

Thanks to mayank

Alok Vatsa said...

Hi Sir,I want to use this in java, is there any code available if so please replay...
E-mail id : alok.skywalker1@gmail.com

Shanmugam said...

Hi is this legal to use ?

merup07 said...

Hey,I want to use this in java is there any code available if so please replay immediately.need it very badly...

email id:merupshah.1991@gmail.com

jaykesh patel said...

Hi kapil,pankajand kiran please share the code in php.......thats would helpful for me.......to jay@3sided.co.in

Thanks