Relaxed risk budgeting: private API
PortfolioOptimisers.RelaxedRiskBudgetingAlgorithm — Type
abstract type RelaxedRiskBudgetingAlgorithm <: OptimisationAlgorithmSupertype of the three models of RelaxedRiskBudgeting.
Each subtype selects the cones that bound the variable $\psi$ of the model. The models are Models (A), (B) and (C) of [244], and the # Mathematical definition of RelaxedRiskBudgeting states them.
Related
BasicRelaxedRiskBudgetingRegularisedRelaxedRiskBudgetingRegularisedPenalisedRelaxedRiskBudgetingRelaxedRiskBudgetingset_relaxed_risk_budgeting_alg_constraints!
References
- [244] V. Gambeta and R. Kwon. Risk return trade-off in relaxed risk parity portfolio optimization. Journal of Risk and Financial Management 13, 237 (2020). Section 3.
PortfolioOptimisers.relaxed_risk_budgeting_td_defaults — Function
relaxed_risk_budgeting_td_defaults(
) -> @NamedTuple{rba::AssetRiskBudgeting{Nothing, Nothing, LogRiskBudgeting{Nothing}}}
Return the static defaults of the fields of RelaxedRiskBudgeting that can hold a TimeDependent schedule.
The constructor reads them when it checks a schedule through assert_time_dependent_substitution, and time_dependent_field_defaults returns them. So the value of each field outside a fold loop is stated in one place. A field whose static default is nothing is not in the result.
Returns
NamedTuple:(; rba = AssetRiskBudgeting()).
Related
PortfolioOptimisers.set_relaxed_risk_budgeting_alg_constraints! — Function
set_relaxed_risk_budgeting_alg_constraints!(alg, model::JuMP.Model, n::Integer,
Gw::VecJuMPScalar, z::VecJuMPScalar,
sigma_z::MatNum) -> NothingAdd the cones that bound $\psi$ in the model that alg selects.
The method dispatches on alg. Model (A) adds one cone. Models (B) and (C) add the regulating term $\rho$ and two cones. The # Mathematical definition of RelaxedRiskBudgeting states the three models.
JuMP formulation
Variables
psi: $\psi$, read from the model.rho: $\rho \geq 0$, created by Models (B) and (C).
Constraints
cbasic_rrp: $s_{c} (\psi, \mathbf{G} \boldsymbol{w}) \in \mathcal{K}_{2}$, forBasicRelaxedRiskBudgeting.creg_rrp_soc_1: $s_{c} (\psi, \mathbf{G} \boldsymbol{w}, \rho) \in \mathcal{K}_{2}$, forRegularisedRelaxedRiskBudgeting.creg_rrp_soc_2: $s_{c} (\rho, \sqrt{n}\, \mathbf{G} \boldsymbol{w}) \in \mathcal{K}_{2}$, forRegularisedRelaxedRiskBudgeting.creg_pen_rrp_soc_1: $s_{c} (\psi, \mathbf{G} \boldsymbol{w}, \rho) \in \mathcal{K}_{2}$, forRegularisedPenalisedRelaxedRiskBudgeting.creg_pen_rrp_soc_2: $s_{c} (\rho, \sqrt{n \lambda\, \mathrm{diag}(\mathbf{\Sigma}_{z})} \odot \boldsymbol{z}) \in \mathcal{K}_{2}$, forRegularisedPenalisedRelaxedRiskBudgeting.
Where:
- $s_c$: Constraint scale. It multiplies both sides of a row, so a positive value leaves the feasible set unchanged.
- $\mathcal{K}_{q} = \{(t, \boldsymbol{x}) : t \geq \lVert \boldsymbol{x} \rVert_{q}\}$: Norm cone of order $q$. $\mathcal{K}_{2}$ is the second-order cone.
- $n$: Number of entries of the budget.
- $\mathbf{G} \boldsymbol{w}$: The vector
Gw, whose norm is the standard deviation of the portfolio. - $\boldsymbol{z}$, $\mathbf{\Sigma}_{z}$: The decision vector
zand its covariance matrixsigma_z. - $\lambda$: Penalty
alg.p.
Arguments
alg: The model, aRelaxedRiskBudgetingAlgorithm.model::JuMP.Model: The JuMP optimisation model.n: Number of entries of the budget.Gw: The covariance factor times the weights. Its norm is the standard deviation of the portfolio.z: The decision vector that the penalty of Model (C) reads. It is the weights forAssetRiskBudgeting. ForFactorRiskBudgetingit is the factor weights, followed by the off-factor weights whenflag = true.sigma_z: Covariance matrix ofz.
Returns
nothing.
Related
PortfolioOptimisers._set_relaxed_risk_budgeting_constraints! — Method
_set_relaxed_risk_budgeting_constraints!(model, rrb, x, A, w, sigma, chol = nothing,
z = w, sigma_z = sigma)Add the variables, the cones of the budget and the cones on $\psi$ of a RelaxedRiskBudgeting to the model.
Each budgeted weight $x_{i}$ takes one cone with its marginal risk $\zeta_{i} = [\mathbf{A} \boldsymbol{w}]_{i}$, so $x_{i} \zeta_{i}$ is its contribution to the variance. The function then takes the covariance factor $\mathbf{G}$ of sigma, and adds the cones of rrb.alg through set_relaxed_risk_budgeting_alg_constraints!. The callers pass these values:
| Caller | x | A | w | sigma |
|---|---|---|---|---|
AssetRiskBudgeting | asset weights | $\mathbf{\Sigma}$ | asset weights | $\mathbf{\Sigma}$ |
FactorRiskBudgeting, flag = false | factor weights | $\mathbf{B}_1^\intercal \mathbf{\Sigma} \mathbf{B}_1$ | factor weights | $\mathbf{B}_1^\intercal \mathbf{\Sigma} \mathbf{B}_1$ |
FactorRiskBudgeting, flag = true | factor weights | $\mathbf{B}_1^\intercal \mathbf{\Sigma}$ | asset weights | $\mathbf{\Sigma}$ |
JuMP formulation
Variables
psi: $\psi \geq 0$.gamma: $\gamma \geq 0$.zeta: $\boldsymbol{\zeta} \geq \boldsymbol{0}$, one entry for each entry ofx.
Expressions
risk: $\psi - \gamma$, which the objectiveMinimumRiskminimises.
Constraints
crrp: $s_{c} (\boldsymbol{\zeta} - \mathbf{A} \boldsymbol{w}) = \boldsymbol{0}$.crrp_soc[i]: $s_{c} (x_{i} + \zeta_{i}, 2 \gamma \sqrt{b_{i}}, x_{i} - \zeta_{i}) \in \mathcal{K}_{2}$, which is $x_{i} \zeta_{i} \geq b_{i} \gamma^{2}$ with $x_{i} + \zeta_{i} \geq 0$.- The rows of
set_relaxed_risk_budgeting_alg_constraints!.
Where:
- $s_c$: Constraint scale. It multiplies both sides of a row, so a positive value leaves the feasible set unchanged.
- $\mathcal{K}_{q} = \{(t, \boldsymbol{x}) : t \geq \lVert \boldsymbol{x} \rVert_{q}\}$: Norm cone of order $q$. $\mathcal{K}_{2}$ is the second-order cone.
- $\boldsymbol{x}$, $\mathbf{A}$, $\boldsymbol{w}$: The arguments
x,Aandw. - $n$: Number of entries of the budget,
length(x). - $b_{i}$: Share of entry $i$ in the budget, its entry divided by the sum of the entries. The chain of the
# Mathematical definitionofRelaxedRiskBudgetingneeds shares that sum to one, and aRiskBudgetbuilt by hand keeps its own sum.
Relaxation
The encoding is not exact: the entries below bound the quantity instead of reproducing it, and the bound is tight only under the condition stated here.
- The row
crrp_soc[i]holdsgammaat or below $\min_{i} \sqrt{x_{i} \zeta_{i} / b_{i}}$, and the cones ofrrb.algholdpsiat or above the standard deviation of the portfolio. Sorisklies at or above the gap between the standard deviation and the least scaled contribution. - For
BasicRelaxedRiskBudgeting, with no off-factor weights, the bound is tight, andriskis zero, exactly when $x_{i} \zeta_{i} = b_{i} \boldsymbol{w}^\intercal \mathbf{\Sigma} \boldsymbol{w}$ for every $i$. The minimum reaches it when no other row of the model binds at that portfolio. - For the regularised models,
psialso bounds the regulating term, so the bound is not tight. At a portfolio that meets the budget,riskis at least $(\sqrt{n + 1} - 1)$ times the standard deviation in Model (B).
Arguments
model::JuMP.Model: The JuMP optimisation model.rrb::RelaxedRiskBudgeting: The optimiser. The function reads its budget,alg,mtx_sqrtandopt.strict.x::VecJuMPScalar: The budgeted weights, one entry for each entry of the budget.A::MatNum: The matrix that mapswto the marginal risks ofx.w::VecJuMPScalar: The weights whose standard deviation the cones on $\psi$ read.sigma::MatNum: Covariance matrix ofw.chol::Option{<:MatNum}: Covariance factor ofsigma, withchol' * chol == sigma. When it isnothing, the function takes the transpose of the square root ofsigmathatmatrix_square_rootgives underrrb.mtx_sqrt.z::VecJuMPScalar: The decision vector that the penalty ofRegularisedPenalisedRelaxedRiskBudgetingreads:w, or the factor weights followed by the off-factor weights whenflag = true.sigma_z::MatNum: Covariance matrix ofz.
Validation
- The budget has one entry for each entry of
x. Otherwise aDimensionMismatchnames both lengths.
Returns
rkb::RiskBudget: The budget that the cones read.
Related
PortfolioOptimisers.set_relaxed_risk_budgeting_constraints! — Function
set_relaxed_risk_budgeting_constraints!(model, rrb, pr, wb, args...)
set_relaxed_risk_budgeting_constraints!(model, rrb, pr, wb, rd::ReturnsResult)Add the weights and the cones of the model of a RelaxedRiskBudgeting to the model.
The method dispatches on rrb.rba. Each method registers the weights and calls _set_relaxed_risk_budgeting_constraints! with the vectors and the matrices that its budget reads. The weight bounds and the budgets come next, in phase 1 of the block of the head, set_block_constraints!, which assemble_jump_model! runs. The table of _set_relaxed_risk_budgeting_constraints! states the values that each method passes.
JuMP formulation
Variables
w: $\boldsymbol{w}$, registered byset_w!forAssetRiskBudgeting.w1,w2: $\boldsymbol{w}_{1}$, $\boldsymbol{w}_{2}$, registered byset_factor_risk_contribution_constraints!forFactorRiskBudgeting.wis then an expression of them.
Constraints
- The rows of
_set_relaxed_risk_budgeting_constraints!, with the budget on $\boldsymbol{w}$ forAssetRiskBudgeting, and on $\boldsymbol{w}_{1}$ forFactorRiskBudgeting.
Where:
- $\boldsymbol{w}$: Portfolio weights vector $N \times 1$.
- $\boldsymbol{w}_{1}$: Factor weights.
- $\boldsymbol{w}_2$: Off-factor weights, one entry for each direction of the null space of $\mathbf{B}^\intercal$. There are $N - N_f$ of them when $\mathbf{B}$ has full column rank.
Arguments
model::JuMP.Model: The JuMP optimisation model.rrb: The optimiser.pr: Prior result.wb::WeightBounds: Weight bound specification containing lower and upper bounds.rd: Returns data thatFactorRiskBudgetingreads when it fits the loadings. The asset method does not read it.
Validation
AssetRiskBudgeting: no weight bound is negative. Otherwiseassert_long_only_weight_boundsthrows anArgumentError. This is the one method that readswb.
Returns
ResolvedAssetRiskBudgetingforAssetRiskBudgeting, andResolvedFactorRiskBudgetingforFactorRiskBudgeting.
Related
References
- [244]
- V. Gambeta and R. Kwon. Risk Return Trade-Off in Relaxed Risk Parity Portfolio Optimization. Journal of Risk and Financial Management 13, 237 (2020).