Turnover risk measure

PortfolioOptimisers.TurnoverRiskMeasureType
struct TurnoverRiskMeasure{__T_settings, __T_w, __T_fixed} <: RiskMeasure

Represents the Turnover risk measure.

TurnoverRiskMeasure penalises portfolio rebalancing by measuring the $L^1$ distance between the new portfolio weights and a reference weight vector. It controls trading costs and limits portfolio drift.

Mathematical definition

Let $\boldsymbol{w}$ be the new portfolio weights and $\boldsymbol{w}_0$ the reference (previous or target) weights:

\[\begin{align} \mathrm{Turnover}(\boldsymbol{w}) &= \lVert \boldsymbol{w}_0 - \boldsymbol{w} \rVert_1 = \sum_{i=1}^{N} |w_{0,i} - w_i|\,. \end{align}\]

Where:

  • $\mathrm{Turnover}(\boldsymbol{w})$: Portfolio turnover.
  • $\boldsymbol{w}$: Portfolio weights vector $N \times 1$.
  • $\boldsymbol{w}_0$: Reference (previous or target) portfolio weights vector $N \times 1$.
  • $N$: Number of assets.

Fields

  • settings: Risk measure settings.
  • w: Reference portfolio weights vector.
  • fixed: Whether the estimator is fixed and does not update with new weights.

Constructors

TurnoverRiskMeasure(;    settings::RiskMeasureSettings = RiskMeasureSettings(),    w::VecNum,    fixed::Bool = false) -> TurnoverRiskMeasure

Keywords correspond to the struct's fields.

Validation

  • !isempty(w).

Functor

(r::TurnoverRiskMeasure)(w::VecNum)

Computes the Turnover risk of a portfolio weight vector w.

Arguments

  • w::VecNum: New portfolio weights vector.

The penalty carries no Fees of its own, so fee amortisation cannot reach it. It re-evaluates $\lVert \boldsymbol{w}_0 - \boldsymbol{w} \rVert_1$ fresh every fold, against whichever reference weights factory supplies.

View parameters

When port_opt_view is called on this type, the following @vprop-tagged fields are automatically subset to the selected indices:

Examples

julia> TurnoverRiskMeasure(; w = [0.5, 0.5])TurnoverRiskMeasure  settings ┼ RiskMeasureSettings           │   scale ┼ Float64: 1.0           │      ub ┼ nothing           │     rke ┴ Bool: true         w ┼ Vector{Float64}: [0.5, 0.5]     fixed ┴ Bool: false

Related

source
PortfolioOptimisers.port_opt_viewMethod
port_opt_view(x, i, args...; kwargs...) -> nothing_scalar_array_view(x, i)

Sub-select an estimator, result, or algorithm to the asset/observation index i.

port_opt_view is the index-selection counterpart of factory: where factory threads runtime values down a composed struct tree, port_opt_view threads an index selection — restricting every data-bearing field and composed child to the subset i. It is the mechanism that makes meta-optimisers (NestedClustered, SubsetResampling) and cross-validation variants operate on subproblems with identical struct shapes.

Callers do not normally call port_opt_view directly; it is driven by meta-optimisers and cross-validation internals. It is public (not exported) because extension authors who implement a new composed estimator may need to define a method. Use @vprop on data-bearing fields to have the method generated automatically.

This universal fallback handles leaf values: arrays are sliced via nothing_scalar_array_view; scalars, nothing, estimators without data fields, and algorithms pass through unchanged. Composed structs that recurse into children define their own (more specific) method — emitted by @vprop or hand-written.

The threaded tail args... (typically the returns matrix X for the JuMP families) and any kwargs are accepted and dropped here, so a macro-threaded port_opt_view(child, i, X) never MethodErrors on a leaf field.

Algorithm

  1. Drop args... and kwargs.... This method is the leaf of the recursion, so it threads nothing further.
  2. Return nothing_scalar_array_view of x at i, whose own algorithm names the rule for each leaf type.

Related

source
PortfolioOptimisers.factoryFunction
factory(
    r::TurnoverRiskMeasure,
    ,
    ,
    ;
    ...
) -> TurnoverRiskMeasure
factory(
    r::TurnoverRiskMeasure,
    ,
    ,
    ,
    w::Union{Nothing, AbstractVector{<:Union{var"#s136", var"#s53"} where {var"#s136"<:Number, var"#s53"<:AbstractJuMPScalar}}},
    args...;
    kwargs...
) -> TurnoverRiskMeasure

Create an instance of TurnoverRiskMeasure from a full optimisation context, forwarding the optional weight argument w to factory(r, w).

Ignores prior result, solver, and uncertainty set arguments — only w is used.

Related

source