Utilize quantitative analysis techniques with Python and Pandas, and you want to determine which portfolio is performing the best across multiple areas: volatility, returns, risk, and Sharpe ratios.
- Prepare the Data
- Perform Quantitative Analysis
- Create a Custom Portfolio
Read in and clean several CSV files for analysis. The CSV files contain data on whale portfolio returns, algorithmic trading portfolio returns, and S&P 500 historical prices.
Analyze the data to determine if any of the portfolios outperform the stock market (that is, the S&P 500). Specifically, you will do a performance analysis and a risk analysis, and then calculate rolling statistics and Sharpe ratios.
- Calculate and plot 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 mimic the S&P 500.
- Choose one portfolio, then calculate and plot the 60-day rolling beta between that portfolio and the S&P 500.
Investment managers and their institutional investors look at the return-to-risk ratio, not just the returns. After all, if you have two portfolios that each offer a 10% return, yet one is lower risk, you would invest in the lower-risk portfolio, right? Follow these steps:
- Using the daily returns, calculate the Sharpe ratios and visualize them in a bar plot.
- Determine whether the algorithmic strategies outperform both the market (S&P 500) and the whales portfolios.
- Use YFinance to choose 3-5 stocks for your portfolio
- Calculate the portfolio returns
- Calculate the weighted returns for your portfolio, assuming equal number of shares per stock
- Add your portfolio returns to the DataFrame with the other portfolios.
- Run the following analyses:
- Calculate the annualized standard deviation
- Calculate and plot the rolling standard deviation with a 21 day windo
- Calculate and plot the correlation
- Calculate and plot beta for your portfolio compared to the S&P 60 TSX
- Calculate the Sharpe ratios and generate a bar plot
- Determine how does your custom portfolio perform?