In this one we will be retrieving basic price data from Yahoo finance via the yfinance python library. The library makes it very easy to do this without the need for any authentication, do note that any price data received from Yahoo finance is delayed by 15 minutes.
The script will take user input, which will go on to be used by the ‘Ticker’ module which will allow us to access ticker data. In this example we will be pulling the latest price (delayed) and the previous end of day closing price.
Full source code seen below:
import yfinance as yf while 1 == 1: Input = input('Please Enter Symbol: ') Ticker = yf.Ticker(Input) Ticker = Ticker.info market_Close = Ticker['previousClose'] market_price = Ticker['regularMarketPrice'] print(market_Close,market_price)