Factor Modeling, Portfolio Construction, Python, Log Returns, Finance.
def risk_parity(self): # Implement Risk Parity for portfolio construction cov_matrix = np.cov(self.log_returns, rowvar=False) inv_cov_matrix = np.linalg.inv(cov_matrix) risk_contribution = inv_cov_matrix @ self.mean_variance_optimization() weights = risk_contribution / np.sum(risk_contribution)