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)

33 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

BIGPROFIT BUZZ said...

Financial discipline and patience are the two most important basis for making money in the stock market. It is well established that the investors who stayed in the market who held their stocks over a significance period, have become wealthiest. You will observe that you will multifold your money by following our advice.
Now we should conclude that we can come together to manifold your investments in the stock market. This is a wellSHARE MARKET NSE BSE FREE TIPS INTRADAY TIPSbeginning and in the near future you will be benefited, as has been observed in case of our thousands of customers/clients. We assure you to give our prime attention to your valued suggestions please.
Regards
BIGPROFITBUZZ TEAM

KAPIL DAVE said...

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

Malvinder Cheema said...

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

SHRISTOCKTIPS said...

Share Market Investment made profitable by SHRISTOCKTIPS - Get NSE/BSE Tips via SMS and Yahoo Messenger. We give daily stock market tips for future and cash segments. From the last few days we were saying to make a sell position in Nifty & all stocks .Now again we proved that whatever the market we will get very handsome profitSHARE MARKET, NSE BSE TIPSMarket crashed as a ballon without air. Sellers are running at tsunami in the market .Buyers can't do anything in the market. Still we have a negative outlook for the Nifty & stocks for the coming week. Make a sell position at a higher level take a stoploss of 5550 spot for the Nifty & all stocks. We suggest you to please carry a stoploss in the market. Do not make any buy position for long run. There is no buying in the market Only a dead cat bounce is in the market. Hope you will earn some good profit in coming week.
Regards
SHRISTOCKTIPS TEAM

.Amulya Sahoo said...

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

BIGPROFITBUZZ said...

BigProfitbuzz is an Indian stock market advisory firm. BigProfitbuzz proven month after month that trading and investing in stock market can be profitable whether market is bull or bear. Those who made a buy at Again and again we are giving greatSHARE TIPS, COMMODITY TIPScalls with good profit. For the coming week we suggest not to overconfident with the buy position .Trade with the stop losses with the view of intraday only. You can take our two days trial also to get proper advise. If you think we can make some profit for you then you can join our paid services to increase your capital with low risk. In current scenario NIFTY is showing positive sigh still negative news from the US. So stay away from the market Or take our trial for proper support and service.
Regards
BIGPROFITBUZZ TEAM

BIGPROFITBUZZ said...

BigProfitbuzz is an Indian stock market advisory firm. BigProfitbuzz proven month after month that trading and investing in stock market can be profitable whether market is bull or bear. For the coming week Trader can make a buy position in the NIFTYINTRADAY STOCK TIPS, NSE BSE TIPSOne can buy NIFTY at 6000-6050 with the stoploss of 5900 for the target of 6200-6300 .Trader can also make a buy position in NIFTY stocks with stoploss to their capacity but try to buy at the prescribed NIFTY level. Always keep stoploss with your trade. You can take our two days trial to check our accuracy. For further update visit our website.
Regards
BIGPROFITBUZZ TEAM

SHRISTOCKTIPS said...

Share Market Investment made profitable by SHRISTOCKTIPS- Get NSE/BSE Tips via SMS and Yahoo Messenger. As suggested last week our all paid client a very handsome profit in NIFTY & NIFTY stocks. They bought around 6000-6050 & sold it at 6300. Now they have covered their position. Now for a coming week we suggest all the traders to trade with a light quantity because market is in on its peak. It is very necessary forNSE BSE, STOCK TIPSNIFTY to show some consolidation for coming week. But one thing is totally confirm that NIFTY has entered in a bullish trend. Nifty will definitely touch 6500-6600 level very soon. So we advise all the trades to wait till consolidation to over then sit on the buy side to earn a good profit. For further updates you can visit our website.
Regards
SHRISTOCKTIPS TEAM

Harsh Agrawal 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

Pankit Gajjar said...

Hi Fiends,

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

Please help me for this if possible.

Rahul Chourasiya 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

Dudhat Chetan said...

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

Mayur Kale 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.

pranjali upadhyay 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.

Dipti Ranjan Nayak said...
This comment has been removed by the author.
Dipti Ranjan Nayak 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 Verma said...

Is this legal?