Skip to content
13

Tracking risk measure

PortfolioOptimisers.RiskTrackingError Type
julia
struct RiskTrackingError{__T_tr, __T_r, __T_err, __T_alg} <: AbstractTracking

Represents the Risk Tracking Error configuration for benchmark weight tracking.

RiskTrackingError specifies that tracking error against a benchmark should be measured as a risk quantity (rather than a norm). It wraps a WeightsTracking benchmark, a risk measure r, a scalar error tolerance err, and a tracking algorithm alg.

Fields

  • tr: Benchmark weights tracking specification.

  • r: Risk measure used to compute the tracking error.

  • err: Scalar error tolerance (non-negative finite number).

  • alg: Tracking algorithm (IndependentVariableTracking or DependentVariableTracking).

Constructors

julia
RiskTrackingError(;
    tr::WeightsTracking,
    r::AbstractBaseRiskMeasure = StandardDeviation(),
    err::Number = 0.0,
    alg::VariableTracking = IndependentVariableTracking()
) -> RiskTrackingError

Keywords correspond to the struct's fields.

Validation

Related

source
PortfolioOptimisers.TrackingRiskMeasure Type
julia
struct TrackingRiskMeasure{__T_settings, __T_tr, __T_alg} <: RiskMeasure

Represents the Tracking Error risk measure.

TrackingRiskMeasure penalises portfolio deviation from a benchmark by computing a norm of the difference between portfolio returns and a benchmark return series or benchmark weights. The tracking error can be defined using returns-based or weights-based benchmarks, and the norm is configurable.

Mathematical Definition

Let x be the portfolio returns series, b the benchmark returns, and NT the number of observations. The L2 tracking error is:

TE(w)=1NTxb22.

Other norms can be selected via the alg field.

Fields

  • settings: Risk measure configuration.

  • tr: Tracking algorithm specifying the benchmark (weights- or returns-based).

  • alg: Norm type for the tracking error (L2Tracking, SquaredL2Tracking, etc.).

Constructors

julia
TrackingRiskMeasure(;
    settings::RiskMeasureSettings = RiskMeasureSettings(),
    tr::AbstractTrackingAlgorithm,
    alg::NormTracking = L2Tracking()
) -> TrackingRiskMeasure

Keywords correspond to the struct's fields.

Functor

julia
(r::TrackingRiskMeasure)(w::VecNum, X::MatNum, fees = nothing)

Computes the Tracking Error of a portfolio weight vector w.

Arguments

  • w::VecNum: Portfolio weights vector.

  • X::MatNum: Asset returns matrix (T×N).

  • fees: Optional fee structure.

Examples

julia
julia> TrackingRiskMeasure(; tr = ReturnsTracking(; w = [0.1, -0.2, 0.3]))
TrackingRiskMeasure
  settings ┼ RiskMeasureSettings
           │   scale ┼ Float64: 1.0
           │      ub ┼ nothing
           │     rke ┴ Bool: true
        tr ┼ ReturnsTracking
           │   w ┴ Vector{Float64}: [0.1, -0.2, 0.3]
       alg ┼ L2Tracking
           │   ddof ┴ Int64: 1

Related

source
PortfolioOptimisers.RiskTrackingRiskMeasure Type
julia
struct RiskTrackingRiskMeasure{__T_settings, __T_tr, __T_r, __T_alg} <: RiskMeasure

Represents the Risk Tracking risk measure.

RiskTrackingRiskMeasure computes the deviation of portfolio risk from a benchmark portfolio risk, using any base risk measure. Two modes are supported:

  • Independent (IndependentVariableTracking): computes the risk of the weight difference wwb.

  • Dependent (DependentVariableTracking): computes the absolute difference between the portfolio risk and the benchmark risk.

Mathematical Definition

Independent mode:

RkTrackindep(w)=ρ(wwb),

Dependent mode:

RkTrackdep(w)=|ρ(w)ρ(wb)|,

where wb are the benchmark weights and ρ is the chosen risk measure.

Fields

  • settings: Risk measure configuration.

  • tr: Benchmark weights tracking specification.

  • r: Risk measure for computing the tracking deviation.

  • alg: Tracking mode (IndependentVariableTracking or DependentVariableTracking).

Constructors

julia
RiskTrackingRiskMeasure(;
    settings::RiskMeasureSettings = RiskMeasureSettings(),
    tr::WeightsTracking,
    r::AbstractBaseRiskMeasure = Variance(),
    alg::VariableTracking = IndependentVariableTracking()
) -> RiskTrackingRiskMeasure

Keywords correspond to the struct's fields.

Functor

julia
(r::RiskTrackingRiskMeasure)(w::VecNum, X::MatNum, fees = nothing)

Computes the Risk Tracking deviation of a portfolio weight vector w.

Arguments

  • w::VecNum: Portfolio weights vector.

  • X::MatNum: Asset returns matrix (T×N).

  • fees: Optional fee structure.

Examples

julia
julia> RiskTrackingRiskMeasure(; tr = WeightsTracking(; w = [0.5, 0.5]))
RiskTrackingRiskMeasure
  settings ┼ RiskMeasureSettings
           │   scale ┼ Float64: 1.0
           │      ub ┼ nothing
           │     rke ┴ Bool: true
        tr ┼ WeightsTracking
           │    fees ┼ nothing
           │       w ┼ Vector{Float64}: [0.5, 0.5]
           │   fixed ┴ Bool: false
         r ┼ Variance
           │   settings ┼ RiskMeasureSettings
           │            │   scale ┼ Int64: 1
           │            │      ub ┼ nothing
           │            │     rke ┴ Bool: false
           │      sigma ┼ nothing
           │       chol ┼ nothing
           │         rc ┼ nothing
           │        alg ┴ SquaredSOCRiskExpr()
       alg ┴ IndependentVariableTracking()

Related

source
PortfolioOptimisers.TrRM Type
julia
const TrRM = Union{<:TrackingRiskMeasure, <:RiskTrackingRiskMeasure}

Union of tracking risk measures used for dispatch on factory methods and expected risk computations.

Related

source