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)

34 comments:

Unknown 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.

0|P said...

Thanks Mayan you gave me an idea :)

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

A python wrapper would be great :)

A Day In Life.. 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

haranesh sokharaya 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 .

Unknown 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

Anonymous said...

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

Thanks

Unknown said...

hey Kapil i too need the php code of it.My email is kpldave@gmail.com. Thanks in advance.

Unknown said...

Need the code in PHP and ASP.NET(C#)
Please help
maddycheema@gmail.com

Amulya Sahoo said...

hey Kapil i too need the php code of it.My email is amulya349@gmail.com. Thanks in advance.

Unknown said...

Hey Er. Kapil Can u please send me your code that u had made in php. Or u can share the way how you completed the task using php that will be really great. My mail id- harshagrawal022@gmail.com
thanks in advance

Unknown said...

Hi Fiends,

I need indian live stock market php api for my PHP website.

Please help me for this if possible.

Unknown said...

Hello all the php commenter, i also need the same api in php. So please let me help if you can. My email: 247webs@gmail.com

cd said...

i also need the same api in asp.net. So please let me help if you can. My email: dudhat777@gmail.com

Unknown said...

I need the code in java. plz can anyone send it if they have it.

email - mayur.kale1892@gmail.com

doesitmatter said...

Hello Mayank,

Even I am thinking of scraping data from http://www.bseindia.com/. I found the url which they use to get data.

But my concern is, if that would be illegal?

Please let me know if you have any information on this.
And Same for bseindia.com

Thanks.

CapitalStars07 said...

Suresh Prabhu's second Rail Budget failed to lift the domestic equity market on Thursday, as a 6 per cent crash in the Chinese stock market had a rub-off on local stocks and pulled them down.
equity intraday tips
Best accurate stock tips

Ram Katariya said...

Investors who invest big amount in Stock market can look for Stock tips and advices from Epic Research to avoid losses.

Unknown said...
This comment has been removed by the author.
Unknown said...

Hello Er. Kapil,

Can u please send me your code that u had made in php. Or u can share the way how you completed the task using php that will be really great. My mail id - imdnayak@naver.com
thanks in advance

Yash said...

Is this legal?

Unknown said...

thanks for sharing , nice post

Unknown said...

Hi Fiends,

I need indian live stock market php api for my PHP website.

Please help me for this if possible.

Anonymous said...

I'm thankful for finding your blog post. I've bookmarked this site and will return again soon.
Top 10 advisory firm in Indore

Anonymous said...

hi all this is sri venkatesh, working in codeignator frame work, i have bse api to buy or sell bse mutual funds i need code hit that api in curl ,when i tried it refusing, can any one help on this. if u have code can u share to me and my email id-venkat07509@gmail.com

Best database provider said...


Thank you for sharing This knowledge. Excellently written article.,
USA company Info database

Best call center services said...

Wonderful article. Fascinating to read. I love to read such an excellent article. Thanks! It has made my task more and extra easy. Keep rocking.
data solution service provider in india