Moment risk measure constraints: private API

PortfolioOptimisers.calc_risk_constraint_target — Function
calc_risk_constraint_target(
    model::Model,
    _::Union{LowOrderMoment{var"#s9830", var"#s9829", Nothing, var"#s9828"}, HighOrderMoment{var"#s9830", var"#s9829", Nothing, var"#s9828"}} where {var"#s9830", var"#s9829", var"#s9828"},
    w::AbstractVector{<:Union{Number, AbstractJuMPScalar}},
    mu::AbstractVector{<:Union{Number, AbstractJuMPScalar}},
    args...
) -> Any

Compute the target return used as the reference level for lower/upper moment risk constraints.

Dispatches on the type of r.mu: when nothing, uses the prior mean vector mu; when a VecNum, uses r.mu; when a VecScalar, combines the vector and scalar parts with k; when a scalar Number, scales it by k.

A per-asset target (the first three) is a gross expected return, and the series it centres is net of the fee. So add_fees_to_ret! subtracts the mean fee per period from it, the same charge the net expected return carries, and the target is the net mean. A per period fee then cancels from every deviation, as moment_target_fees makes it cancel at the value level. A scalar target is a threshold on the net series, so it takes no fee.

Arguments

  • model::JuMP.Model: The JuMP optimisation model.
  • r::LoHiOrderMoment: Risk measure carrying the target specification.
  • w: Portfolio weight vector.
  • mu::VecNum: Prior mean return vector.
  • k: Leverage/scale variable from the model.

Returns

  • The scalar target return used as the lower moment reference.

Related

source
PortfolioOptimisers.set_second_moment_risk! — Function
set_second_moment_risk!(
    model::Model,
    ::QuadRiskExpr,
    i,
    factor::Number,
    second_moment,
    args...;
    prefix
) -> Tuple{Any, Any}

Build the second-moment risk JuMP expression in one of four encodings.

The QuadRiskExpr overload encodes variance as a quadratic dot product. The RSOCRiskExpr overload uses a rotated second-order cone to encode the squared norm. The SquaredSOCRiskExpr overload squares an existing SOC variable. The SOCRiskExpr overload returns the SOC variable directly (standard deviation form). All methods return the risk expression and a scaling factor.

Arguments

  • model::JuMP.Model: The JuMP optimisation model.
  • i: Constraint index for unique variable and constraint naming.
  • factor::Number: Variance correction factor (e.g. 1 / (T - 1)).
  • second_moment: Return deviation vector or matrix.
  • namet, namec: Bare Model State entry names for the auxiliary variable and its constraint.
  • tsecond_moment: Pre-existing SOC variable (used by SquaredSOC/SOC overloads).

Keyword arguments

  • prefix::Symbol: Model State namespace (default: empty, i.e. the bare key).

Returns

  • A 2-tuple (r_expr, factor) of the risk JuMP expression and its scaling factor.

Related

source
PortfolioOptimisers.second_moment_bound_val — Function
second_moment_bound_val(
    _::SecondMomentFormulation,
    ub::Frontier,
    factor::Number
) -> Frontier{_A, _B, LinearBound} where {_A, _B}

Convert an upper-bound value to the appropriate scale for the second-moment bounding variable.

Scales ub by inv(factor) and, when the formulation is not SOCRiskExpr, applies a square-root transformation to convert from variance to standard-deviation units. Returns nothing when ub is nothing.

Arguments

  • alg::SecondMomentFormulation: Second-moment risk formulation (e.g. SOCRiskExpr).
  • ub: Upper bound value (scalar, vector, Frontier, or nothing).
  • factor::Number: Variance correction factor.

Returns

  • The rescaled upper bound, or nothing when ub is nothing.

Related

source