NSE stock quote realtime extract

NSE Quote Extract
There are many realtime stock ticker script/widgets that could be included in any webpage. However, it was difficult to find the one which I was looking for.
I wanted to have a select watchlist in my page, which could keep changing everyday, depending on the stocks that I was interested in, and needed to have the last traded NSE price displayed in my page at the click.
Probably, many of you may also be wanting to have such a script running for your website/page.
I was able to get this one up and running in my webpage, although written in a raw/crude way, nevertheless serving the purpose in a BIG way.
See below:

        


About the script :

What you are seeing above in the Table is last-traded-NSE-quote pulled thro' the script.

This is a PHP script that will read the content of NSE stock price page, and extract the last traded price and other relevant data for a stock, and display the same at the "Refresh" click. This has been very useful to me in my webpage, and I am sure you would also be impressed with it. It will certainly help in serving your purpose, until you find a better one.

You can also check out at Money & Stocks

What is required ?

Your website should be PHP enabled.
Create a text file, say "myscrips.txt" which shall have the following columns...

a typical myscrips.txt file would look like this :

     _______________________

     type,scripname,expirydt
     e,ACC,
     f,ACC,27DEC2012
     e,MARUTI,
     e,GRASIM,
     f,LT,27DEC2012

     _______________________

NOTE :
  #   the first row is the header line.
  #   In the example txt file above, there are 6 rows including the header line.
  #   There are 3 columns (type,scripname,expirydt) each seperated by a comma.
  #   The first column should be e or f (e-equity, f-futures)
  #  If the scrip is Equity, end the row/second column with comma.
  #  If the scrip is Futures Scrip, mention the expiry date after the comma for the second column.
  #  Expiry date should be in specific format as per NSE.
  #  You can have any number of scrips in this file. However more the number, retrieval of last traded price will be delayed.
  #  This txt file should be available in the same directory path where you will have the PHP script file run from.
  #  Whenever you require the scrips to be changed, just edit the myscrips.txt file, and that should be good enough to retrieve last traded NSE stock quote.
  #  Remember to edit the txt file for correct Expiry dates every month, wherever Futures scrips are in the txt file.
  #  Copy the below PHP code into a file, say nsequote.php and invoke the same in your website/webpage.


Please provide a link to this blog, when you implement this script/code in your webpage/website and also join me by clicking on "Join this site" link that is in left pane on this page.

   Let me have your feedback.

No comments:

Post a Comment