okama.EfficientFrontier.minimize_risk
- EfficientFrontier.minimize_risk(target_return, monthly_return=False, tolerance=1e-08)
Find minimal risk given the target return within given bounds.
In Mean-Variance optimization the objective function is risk (standard deviation of return time series).
Optimization returns a “point” on the Efficient Frontier with values:
weights of assets
annualized mean rate of return
Compound annual growth rate (CAGR)
annualized risk (annualized value of standard deviation)
Target return can have a monthly or annual value.
Bounds are defined with ‘bounds’ property.
- Parameters:
- target_returnfloat
Rate of return value. The optimization process looks for a portfolio with the target_return and minimum risk. Target return value can be in monthly or annual values depending on ‘monthly_return’ option.
- monthly_returnbool, default False
Defines whether to use rate of return monthly (True) or annual (False) values.
- tolerancefloat, default 1e-08
Sets the accuracy for the solver.
- Returns:
- dict
Point on the Efficient Frontier with assets weights, mean return, CAGR, risk.
Examples
>>> ef = ok.EfficientFrontier(['SPY.US', 'AGG.US', 'GLD.US'], last_date='2021-07') >>> ef.minimize_risk(target_return=0.044, monthly_return=False) {'SPY.US': 0.03817252986735185, 'AGG.US': 0.9618274701326482, 'GLD.US': 0.0, 'Mean return': 0.04400000000000004, 'CAGR': 0.04335075344214023, 'Risk': 0.037003608635098856}