Stock Price Using Python

mahabub.devs3
Mahabubur Rahman
Published on Sep, 28 2024 1 min read 0 comments
image

 

Install package - 

pip install yfinance

 

Write code - 

import yfinance as yf
STK = input("Enter share name: ").upper()
data = yf.Ticker (STK).history (period="1d")
last_market_price = data['Close'].iloc[-1]
print(f" Last market price {STK):", last_market_price)


Output : 

Enter share name: nvda
Last market price NVDA: 116.06999969482422

 

 

0 Comments