Wednesday, July 3, 2024
HomeLanguagesPythonIntroduction to NSE Tools Module in Python

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

 

Dominic Rubhabha Wardslaus
Dominic Rubhabha Wardslaushttps://neveropen.dev
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments