Tuesday, October 7, 2025
HomeLanguagesNseTools – Getting Applicable Margin of Company

NseTools – Getting Applicable Margin of Company

In this article we will see how we can get the applicable margin 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. In case of securities in Trade for Trade –Surveillance segment (TFT-S segment) the upfront margin rates (VaR Margin + Extreme Loss Margin) applicable is 100 % and each trade is marked to market based on the closing price of that security.
 

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 applicable margin from the quote with the help of ‘applicableMargin’ key 
5. Print the applicable margin 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 applicable margin
value = quote['applicableMargin']
 
# printing applicable margin
print("Applicable Margin  : " + str(value))


Output : 
 

Applicable Margin  : 19.23

Another example 
 

Python3




# importing nse from nse tools
from nsetools import Nse
 
# creating a Nse object
nse = Nse()
 
# nse stock code for hdfc
code = "hdfcbank"
 
# getting stock quote
quote = nse.get_quote(code)
 
# getting applicable margin
value = quote['applicableMargin']
 
# printing applicable margin
print("Applicable Margin  : " + str(value))


Output : 
 

Applicable Margin  : 18.2

 

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

Most Popular

Dominic
32339 POSTS0 COMMENTS
Milvus
86 POSTS0 COMMENTS
Nango Kala
6708 POSTS0 COMMENTS
Nicole Veronica
11872 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11936 POSTS0 COMMENTS
Shaida Kate Naidoo
6827 POSTS0 COMMENTS
Ted Musemwa
7090 POSTS0 COMMENTS
Thapelo Manthata
6780 POSTS0 COMMENTS
Umr Jansen
6784 POSTS0 COMMENTS