Sunday, December 29, 2024
Google search engine
HomeLanguagesNseTools – Getting Base Price of Company Stock

NseTools – Getting Base Price of Company Stock

In this article we will see how we can get the average price of given company using nsetools. Nsetools is a library for collecting real time data from National Stock Exchange of India. A stock quote is the price of a stock as quoted on an exchange. A basic quote for a specific stock provides information, such as its bid and ask price, last traded price, and volume traded. The Base Market Value is a value-weighted index composed of all the securities in an index trading at any given time. The base market value is helpful in determining the value of stock market value or index. The base value is regarded as the pulse of the stock and securities markets of an exchange.
 

Steps to get the Stock Quote 
1. Import the Nse from nsetools 
2. Create a Nse object 
3. From the Nse object get the stock quote with the help of get_quote method with the NSE Stock code of the company 
4. Get the base price from the quote with the help of ‘basePrice’ key 
5. Print the base price value 
 

Below is the implementation 
 

Python3




# importing nse from nse tools
from nsetools import Nse
 
# creating a Nse object
nse = Nse()
 
# nse stock code for wipro
code = "wipro"
 
# getting stock quote
quote = nse.get_quote(code)
 
# getting base price
value = quote['basePrice']
 
# printing base price
print("Base Price  : " + str(value))


Output : 
 

Base Price  : 281.05

Another example 
 

Python3




# importing nse from nse tools
from nsetools import Nse
 
# creating a Nse object
nse = Nse()
 
# nse stock code for sbi
code = "sbin"
 
# getting stock quote
quote = nse.get_quote(code)
 
# getting base price
value = quote['basePrice']
 
# printing base price
print("Base Price  : " + str(value))


Output : 
 

Base Price  : 191.6

 

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments