Rolling Statistic Exponetially Weighted Average
I will be creating a Retirement Planning tool; that will use the Alpaca API to grab historical closing prices for a projected retirement portfolio. The portfolio will be composed of stocks and bonds, later running a few different Monte Carlo simulations to predict the portfolio performance at 30 years.
First, read and clean several CSV files for analysis using Pandas as a DataFrame. Be ready to convert the dates to a DateTimeIndex. Next, detect and remove null values. If any columns have dollar signs or characters other than numeric values, remove those characters and convert the data types as needed. Join the CSV into a single DataFrame with columns for each portfolio's returns.
Analyze the data to see if any portfolios outperform the stock market (i.e., the S&P 500).
Calculate and plot the daily returns of all portfolios. Calculate and plot cumulative returns for all portfolios. Does any portfolio outperform the S&P 500?
Create a box plot for each of the returns. Calculate the standard deviation for each portfolio. Determine which portfolios are riskier than the S&P 500. Calculate the Annualized Standard Deviation.
Calculate and plot the rolling standard deviation for all portfolios using a 21-day window. Calculate and plot the correlation between each stock to determine which portfolios may mimic the S&P 500. Choose one portfolio, then calculate and plot the 60-day rolling beta between it and the S&P 500.
An alternative method to calculate a rolling window is to take the exponentially weighted moving average. Also, like a moving window average, but it assigns greater importance to more recent observations.
Investment managers and their institutional investors look at the return-to-risk ratio, not just the returns. If; you have two portfolios that each offer a 10% return on investment. Yet one is lower risk; which portfolio would be the best fit?