How to Get yfinance Python Real-Time Quotes and Percentage Change for Stocks?

18 Replies, 1154 Views

Hey there! I’ve been using yfinance python real time quotes and percentage change for a while now. The delay is kinda annoying, but it’s free, so can’t complain too much.

For percentage change, I use this method:
```python
import yfinance as yf

ticker = yf.Ticker("TSLA")
hist = ticker.history(period="1d", interval="1m")
hist['Pct_Change'] = hist['Close'].pct_change() * 100
print(hist[['Close', 'Pct_Change']])
```
If you’re looking for real-time data, maybe try Tradier or TD Ameritrade’s API. They’re a bit more advanced but worth it.

Messages In This Thread



Users browsing this thread: 1 Guest(s)