Repository for codes related to finding the return and risk of securities and portfolios, mean-variance optimization and implementing the Capital Asset Pricing Model in Python.
Contents:
- return-risk-single - To calculate the annual return and volatility of a single stock and basic visualizations.
- return-risk-portfolio - To calculate the annual return, volatility, diversifiable risk of a portfolio of stocks. Also includes a comparison with a stock index (S&P500)
- ef-2-assets - To calculate the return and volatility of random portfolios containing two risky assets, to plot them and visually identify the efficient frontier
- mvo-portfolio-risky - To calculate the return and volatility of a portfolio containing many risky assets, to plot them and to rigorously calculate the efficient frontier using a mean variance optimizer function.
- two-fund-theorem - To calculate the return and volatility of a portfolio containing many risky assets and one riskfree asset. Here we also demonstrate the two-fund theorem
- beta-linreg - To calculate the beta of a stock using linear regression in Python
- var-single-asset - To calculate the Value-at-Risk of a single asset using historical returns in Python