Open In App

Introduction to NSE Tools Module in Python

Last Updated : 03 Aug, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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 tools
from nsetools import Nse
 
# creating a Nse object
nse = Nse()
 
# printing Nse object
print(nse)


Output : 
 

Driver Class for National Stock Exchange (NSE)

Getting Information 
 

Python3




# importing nse from nse tools
from nsetools import Nse
 
# creating a Nse object
nse = Nse()
 
# getting quote of the sbin
quote = nse.get_quote('sbin')
 
# printing company name
print(quote['companyName'])
 
# printing buy price
print("Buy Price : " + str(quote['buyPrice1']))


Output : 
 

State Bank of India
Buy Price : 191.45

 

Python3




# importing nse from nse tools
from nsetools import Nse
 
# creating a Nse object
nse = Nse()
 
# getting quote of the sbin
quote = nse.get_quote('sbin')
 
# printing company name
print(quote['companyName'])
 
# printing average price
print("Average Price : " + str(quote['averagePrice']))


Output : 
 

State Bank of India
Average Price : 193.9

 



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads