Tracking Error Constraints: private API

PortfolioOptimisers.set_tracking_error_constraints! — Function
set_tracking_error_constraints!(model::JuMP.Model, pr::Option{<:AbstractPriorResult}, ::Nothing, args...; kwargs...)
set_tracking_error_constraints!(model::JuMP.Model, pr::AbstractPriorResult, tres::Tr_VecTr, args...; kwargs...)
set_tracking_error_constraints!(model::JuMP.Model, i::Integer, pr::AbstractPriorResult, tr, args...; prefix::Symbol = Symbol(""), kwargs...)

Add tracking error constraints to the JuMP optimisation model.

The method on tres = nothing adds no row. A tracking error whose type or norm has no method is a MethodError. The methods on one tracking error dispatch on the tracking algorithm type:

  • L1Norm: Enforces ‖net_X - wb * k‖₁ ≤ err * (T - ddof) via NormOneCone.
  • L2Norm: Enforces a scaled L2 norm via SecondOrderCone.
  • SquaredL2Norm: The same cone, with the bound square-rooted, because err bounds the squared error that norm_error reports.
  • LpNorm: Enforces a scaled Lp norm via power cone.
  • LInfNorm: Enforces ‖net_X - wb * k‖_∞ ≤ err via NormInfinityCone.
  • IndependentVariableTracking: Substitutes w - wb for w and applies the chosen risk constraint.
  • DependentVariableTracking: Constrains the difference between portfolio risk and benchmark risk. The inner build reads the lifted matrix of the head's weights, weights_prefix. The bound holds from above only, $R(\boldsymbol{w}) \leq R(\boldsymbol{w}_b) + \mathrm{err}$, for every inner measure whose model is an upper bound on the risk, as DependentVariableTracking states. A portfolio whose risk is below the benchmark risk by more than err also satisfies it.

The collection method iterates over all tracking errors in tres.

Mathematical definition

\[\begin{align} t_{tr} &\geq \lVert \mathbf{X}\boldsymbol{w} - \boldsymbol{b} k \rVert_p \cdot c_p^{-1}\,, \\ t_{tr} &\leq \mathrm{err} \cdot k\,. \end{align}\]

Where:

  • $t_{tr}$: Auxiliary tracking error scalar variable.
  • $\mathbf{X}$: Asset returns matrix ($T \times N$).
  • $\boldsymbol{w}$: Portfolio weights vector $N \times 1$.
  • $\boldsymbol{b}$: Benchmark return vector.
  • $k$: Variable that scales the budget in the homogenised problem.
  • $p$: Norm order.
  • $c_p$: Norm-specific scaling factor, norm_factor of the norm ($T - d$, $\sqrt{T - d}$, $1$, etc.).
  • $\mathrm{err}$: Tracking error tolerance.

Arguments

  • model::JuMP.Model: The JuMP optimisation model.
  • i::Integer: Constraint index for generating unique variable and constraint names.
  • pr::AbstractPriorResult: Prior result providing the return matrix X.
  • tr: Tracking error specification.
  • tres: One tracking error, a vector of them, or nothing.
  • opt: The RiskConstraintOwner whose programme the constraint joins, read by the risk-based variants for the solver a Deferred Quantity is resolved against (risk_constraint_solver).
  • pl: Optional phylogeny constraints.
  • fees: Optional fees structure.
  • prefix::Symbol: The Model State namespace the entries are registered under, Symbol("") for a head's own, so a programme Allocation Set's tracking error joins a leader's model beside the head's own under the namespace of its block, blk_2_. The net returns X w are formed under the same prefix, over the rows of pr and their count.

Returns

  • nothing.

Related

source
PortfolioOptimisers.tracking_error_soc_factor — Function
tracking_error_soc_factor(
    f::L2Norm,
    err::Number,
    T::Integer
) -> Any

Convert a TrackingError tolerance into the bound on the second-order cone variable.

Both norms share one cone, which bounds $\lVert \mathbf{X}\boldsymbol{w} - \boldsymbol{b}k \rVert_2$. They do not share the quantity that err bounds. norm_error divides that norm by $\sqrt{T - d}$ for an L2Norm and squares it before dividing by $T - d$ for a SquaredL2Norm, so the second bound is square-rooted here to keep the model, the functor and set_risk_constraints! in agreement.

Arguments

  • f: The NormError the tracking error carries.
  • err::Number: Tracking error tolerance.
  • T::Integer: Number of observations.

Returns

  • f::Number: Upper bound on the cone variable, before the budget scaling by $k$.

Related

source
PortfolioOptimisers.tracking_benchmark_expression — Function
tracking_benchmark_expression(model::JuMP.Model, b::VecNum, prefix::Symbol)
tracking_benchmark_expression(model::JuMP.Model, B::MatNum, prefix::Symbol)

Return the benchmark return series that a tracking constraint subtracts from the net portfolio returns.

The model states the weights scaled by the budget variable $k$, so both forms carry that scale and stay linear in the weights.

  • A series is fixed, so it scales with the budget variable: $\boldsymbol{b}k$.
  • A matrix holds one benchmark per asset, the bound benchmark of a DataBenchmarkTracking, so the series is $\mathbf{B}\boldsymbol{w}$ on the weights of the model under prefix. These are the weights of the net portfolio returns under the same prefix, and they carry the scale already.

Arguments

  • model::JuMP.Model: The JuMP optimisation model.
  • b, B: The benchmark that tracking_benchmark returns.
  • prefix::Symbol: The Model State namespace of the weights.

Returns

  • The benchmark return series, a vector of affine expressions with one entry per row.

Related

source