minimize_risk
- EfficientFrontier.minimize_risk(target_value)
Calculate the portfolio properties to minimize annualized risk at the target CAGR.
This method finds the portfolio weights that minimize the annualized risk (standard deviation) while achieving a specified target Compound Annual Growth Rate (CAGR).
The optimization is performed for a rebalanced portfolio over the period from ‘first_date’ to ‘last_date’. CAGR is the rate of return required for an investment to grow from its initial to its final value, assuming all incomes were reinvested.
- Parameters:
- target_valuefloat
Target Compound Annual Growth Rate (CAGR) for the portfolio. Should be a decimal value (e.g., 0.107 for 10.7% annual return).
- Returns:
- dict
Dictionary containing: - Asset weights (one key per asset symbol or name) - ‘CAGR’: Target CAGR value - ‘Risk’: Minimized annualized risk (standard deviation) - ‘Weights’: Array of optimal weights - ‘iterations’: Number of optimization iterations performed
- Raises:
- RuntimeError
If no solution is found for the given target CAGR value.
Examples
>>> frontier = ok.EfficientFrontier(["SPY.US", "AGG.US"]) >>> point = frontier.minimize_risk(0.08) >>> round(point["CAGR"], 2) 0.08