You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to calculate the monthly and annual percent return for a fund like VSMPX. My understanding is that the Adjusted Close from yfinance takes into account splits and dividends.
To get the percent return I am doing:
hist = ticker.history(start="2020-01-01", end=None, interval="1d", auto_adjust=True)
# Calculate daily, monthly, and annual percentage returns
daily_returns = hist['Close'].pct_change()
monthly_returns = hist['Close'].resample('M').last().pct_change()
annual_returns = hist['Close'].resample('Y').last().pct_change()
# Save the returns to CSV files
daily_returns.to_csv("VSMPX_daily_adjusted_returns.csv")
monthly_returns.to_csv("VSMPX_monthly_adjusted_returns.csv")
annual_returns.to_csv("VSMPX_annual_adjusted_returns.csv")
However, when I check the total return percentage on the Yahoo Finance website, my adjusted return percentages are off by a little.
For example, you can see that my 2019 annual return is 30.79%, but on Yahoo Finance, it is 30.82%. I realize this is a small descripency but I want 1) Understand why there is a difference 2) I noticed every other total return is the same as Yahoo Finance, so concerned I am doing something wrong.
The text was updated successfully, but these errors were encountered:
I am trying to calculate the monthly and annual percent return for a fund like VSMPX. My understanding is that the Adjusted Close from yfinance takes into account splits and dividends.
To get the percent return I am doing:
My annual return is the following:
However, when I check the total return percentage on the Yahoo Finance website, my adjusted return percentages are off by a little.
For example, you can see that my 2019 annual return is 30.79%, but on Yahoo Finance, it is 30.82%. I realize this is a small descripency but I want 1) Understand why there is a difference 2) I noticed every other total return is the same as Yahoo Finance, so concerned I am doing something wrong.
The text was updated successfully, but these errors were encountered: