Created
December 30, 2021 20:30
-
-
Save hitesh83/9863ca884dbb8378260ce785d1ba498b to your computer and use it in GitHub Desktop.
NSE rate udpate in python3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GNU nano 4.8 rate.py | |
# importing nse from nse tools | |
from nsetools import Nse | |
# creating a Nse object | |
nse = Nse() | |
stock = input("Enter Your Stock short code here ") | |
# getting quote of the sbin | |
quote = nse.get_quote(stock) | |
#t2 = stock | |
# printing company name | |
#print(quote) | |
print(quote['companyName']) | |
#print(t2) | |
#print(stock, type(stock)) | |
# printing average price | |
print("Average Price : " + str(quote['averagePrice'])) | |
print("Price Change in Rs :" + str(quote['change'])) | |
print("Total Treaded Volune " + str(quote['totalTradedVolume'])) | |
print("Today day high : " + str(quote['dayHigh'])) | |
print("LC will be at :" + str(quote['pricebandlower'])) | |
print("UC will be at :" + str(quote['pricebandupper'])) | |
print("52W Low was Rs : " + str(quote['low52'])) | |
print("52W high was Rs : " + str(quote['high52'])) | |
print("Change in percentage " + str(quote['pChange'])) | |
print("Previous Closed at Rs :" + str(quote['previousClose'])) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
importing nse from nse tools
from nsetools import Nse
#from datetime import datetime
import datetime, time
creating a Nse object
nse = Nse()
#stock = input("Enter Your Stock short code here ")
bnf = nse.get_index_quote("nifty bank")
nifty = nse.get_index_quote("nifty 50")
#print(adv_dec)
getting quote of the sbin
#quote = nse.get_quote(stock)
#t2 = stock
printing company name
#print(quote)
#print("*******")
print(bnf['name'])
#print(t2)
#print(stock, type(stock))
printing average price
print("Last Price : " + str(bnf['lastPrice']))
print("Change in Points :" + str(bnf['change']))
#print("Total Treaded Volune " + str(adv_dec[['totalTradedVolume']))
#print("Today day high : " + str(adv_dec[['dayHigh']))
#print("LC will be at :" + str(quote['pricebandlower']))
#print("UC will be at :" + str(quote['pricebandupper']))
#print("52W Low was Rs : " + str(quote['low52']))
#print("52W high was Rs : " + str(quote['high52']))
print("Change in percentage " + str(bnf['pChange']))
#print("Previous Closed at Rs :" + str(quote['previousClose']))
#print("")
print(nifty['name'])
print("Last Price : " + str(nifty['lastPrice']))
print("Change in Points :" + str(nifty['change']))
print("Change in percentage " + str(nifty['pChange']))
#print("")
time = time.strftime('%d-%b-%Y %H:%M %p', time.localtime())
print("Date as on : ", time)
print("Join https://t.me/StockInvestorClubChannel")