Files
AI-Stock-Trader/WebServer/AIPython/currentprice.py
T

7 lines
204 B
Python

import yfinance as yf
def getCurrentPrice(symbol):
ticker = yf.Ticker(symbol)
data = ticker.history(period="1d", interval="1m")
current_price = data['Close'].iloc[-1]
return current_price