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

18 Replies, 1135 Views

Yo, yfinance python real time quotes and percentage change can be a bit tricky. I’ve noticed the delay too, especially during high-volume trading hours. If you’re okay with the delay, yfinance is still a solid free option.

For percentage change, I’d recommend using pandas to make it easier. Here’s a quick snippet:
```python
import yfinance as yf
import pandas as pd

data = yf.download("AAPL", period="1d", interval="1m")
data['Pct_Change'] = data['Close'].pct_change() * 100
print(data.tail())
```
If you need more accuracy, maybe look into APIs like Polygon.io.

Messages In This Thread



Users browsing this thread: 1 Guest(s)