BSE Live Stock (Share Price) Data into Excel

How about crowd-testing? This happens already with big product companies which releases beta versions to public to test the functionality and to identify any product limitations.

Coming to our weblog, till the last post the Excel portfolio management product is getting the current market prices from NSE but some of our friends asked for getting the latest market prices from BSE. So this post initiates fetching live share prices from BSE. Logically there is no much difference between fetching data from NSE or BSE as we follow the same steps that are 1>Fetch the data from internet 2>Perform string manipulations to update the data. As explained in NSE part1 post, we will use the VBA function to get the data from internet. Only change from that code is change the URL from which we fetch the data. Here we are using URL http://www.bseindia.com/stock-share-price/SiteCache/EQHeaderData.aspx?text=500002 One difference with initial NSE implementation is instead of script id the BSE URL is using scrip code. For NSE, it may be easy to remember the scrip id but remembering scrip code is tough ask (at least for me). So we will use the search functionality implemented for picking NSE scripids for picking the BSE scrip codes.

The other difference with NSE implementation is how we perform the string manipulation on the data fetched from internet. Given NSE web data is of JSON type, we can fetch easily with key / pair combination of required information. But the BSE data is just a text response so we need to understand what pattern the response forming. On closer observation, we can see that last comma separated values in previousClose, open, dayHigh, dayLow, lastTradedPrice. Though we can fetch the desired result with only Excel formulas as explained in the post, here we are doing through VBA code to reduce the lengthy formulas. The VBA code consists of public function taking the BSE url response and the which parameter value we want. So the current market price which is last traded price is of last value in CSV of response. Accordingly the function splits the BSE web response and returns the desired result as given by the second input parameter passed to function.

The Excel workbook can be downloaded here BSE Live Stock Prices in Excel Ver 1 – Portfolio Mangement Through Excel.

Advertisements

About Paripurnachari

Finance Professional, Coder, Engineer
This entry was posted in Technology and tagged , , , , , , . Bookmark the permalink.

2 Responses to BSE Live Stock (Share Price) Data into Excel

  1. siddharth says:

    Hey thanks a lot for the excel, it’s amazing!
    Can you tell me how to refresh the excel to get current stock price without closing excel?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s