How to Use yfinance for Mutual Fund Percent Change Tracking?

22 Replies, 1805 Views

Hey, thanks for sharing! I’ve been using yfinance for mutual fund percent change tracking too, and it’s been pretty reliable. One tip: if you’re tracking multiple funds, you can loop through a list of tickers to automate the process.

```python
tickers = ["VFIAX", "VTSAX", "VBTLX"]
for ticker in tickers:
mf = yf.Ticker(ticker)
data = mf.history(period="1y")
percent_change = (data['Close'][-1] - data['Close'][0]) / data['Close'][0] * 100
print(f"{ticker}: {percent_change:.2f}%")
```
Saves a ton of time!

Messages In This Thread



Users browsing this thread: 1 Guest(s)