Date: Oct 23,2024
In this analysis, we aim to optimize a portfolio of various Exchange Traded Funds (ETFs) using Modern Portfolio Theory (MPT). The goal is to find the optimal allocation for each ETF to maximize returns while minimizing risk. We will calculate the efficient frontier, the Sharpe ratio, and determine the optimal weights for each ETF in the portfolio.
#Data Retrieval We use the yfinance Python library to retrieve historical price data for each ETF in our list. The data includes the adjusted closing prices, which are crucial for accurate return calculations.
We read the CSV files saved in the specified directory and convert them to time series data. Each file is assumed to contain dates in the first column and prices in the second column, without headers.
Calculate the daily returns from the adjusted closing prices.
Modern Portfolio Theory (MPT) aims to construct a portfolio that offers the maximum expected return for a given level of risk. Using MPT, we can plot the efficient frontier, which shows the best possible returns for a specific level of risk.
The Sharpe ratio helps to assess the risk-adjusted return of a portfolio. A higher Sharpe ratio indicates a more favorable risk-return profile.
The tangency portfolio is the portfolio with the highest Sharpe ratio. Here, we determine the optimal allocation for each ETF in the portfolio.
## Percentages Tickers
## IVV 25.010715 IVV
## TLT 2.000000 TLT
## BRK-B 26.892690 BRK-B
## VUG 2.000000 VUG
## CHAT 2.000000 CHAT
## TIP 35.000000 TIP
## FTEC 2.000000 FTEC
## SCHD 5.096595 SCHD
We visualize the optimized allocation of each ETF in the portfolio using a bar chart.
Here, we calculate the key metrics for the optimized portfolio, including the annualized return, risk, and Sharpe ratio.
## **Portfolio Average Return:** 24.09 %
## **Portfolio Standard Deviation:** 7.46 %
## **Portfolio Sharpe Ratio:** 2.96
This analysis demonstrates how to optimize a portfolio of ETFs using Modern Portfolio Theory, calculate the efficient frontier, and determine the ideal allocation for each asset to achieve the best risk-adjusted return. The resulting optimized portfolio is designed to balance risk and return according to the specified constraints.