Introduction to NSE Tools Module in Python

NSE National Stock Exchange of India Limited is the leading stock exchange of India, located in Mumbai, Maharashtra. NSE was established in 1992 as the first dematerialized electronic exchange in the country.
nsetools is a library for collecting real time data from National Stock Exchange of India. It can be used in various types of projects which requires fetching live quotes for a given stock or index or building large data sets for further data analytics. We can also build command line interface applications which can provide us live market details at a blazing fast speeds, much faster than any browser. The accuracy of data is only as correct as provided on http://www.nseindia.com
In order to install nse tools we have to use the command given below
pip install nsetools
Creating a Nse object
Python3
# importing nse from nse toolsfrom nsetools import Nse# creating a Nse objectnse = Nse()# printing Nse objectprint(nse) |
Output :
Driver Class for National Stock Exchange (NSE)
Getting Information
Python3
# importing nse from nse toolsfrom nsetools import Nse# creating a Nse objectnse = Nse()# getting quote of the sbinquote = nse.get_quote('sbin')# printing company nameprint(quote['companyName'])# printing buy priceprint("Buy Price : " + str(quote['buyPrice1'])) |
Output :
State Bank of India Buy Price : 191.45
Python3
# importing nse from nse toolsfrom nsetools import Nse# creating a Nse objectnse = Nse()# getting quote of the sbinquote = nse.get_quote('sbin')# printing company nameprint(quote['companyName'])# printing average priceprint("Average Price : " + str(quote['averagePrice'])) |
Output :
State Bank of India Average Price : 193.9



