Skip to content
13

Base Risk Measures

PortfolioOptimisers.RiskMeasure Type
julia
abstract type RiskMeasure <: OptimisationRiskMeasure

Abstract supertype for standard risk measures used in portfolio optimisation.

Subtype RiskMeasure to implement concrete risk measures that quantify portfolio risk and can be used as objectives or constraints in optimisation problems. This type ensures compatibility with the optimisation framework and enables composability with other estimators and algorithms.

Related Types

source
PortfolioOptimisers.HierarchicalRiskMeasure Type
julia
abstract type HierarchicalRiskMeasure <: OptimisationRiskMeasure

Abstract supertype for hierarchical risk measures used in portfolio optimisation.

Subtype HierarchicalRiskMeasure to implement risk measures that operate on hierarchical or clustered portfolio structures. These measures are designed for use as objectives or constraints in optimisation problems that leverage asset clustering, hierarchical risk parity, or similar techniques.

Related Types

source
PortfolioOptimisers.Frontier Type
julia
struct Frontier{__T_N, __T_factor, __T_flag} <: AbstractAlgorithm

Defines the number of points on the efficient frontier (Pareto Front).

Fields

  • N: Number of points on the efficient frontier.

  • factor: Scaling factor, used to normalise moment-based risk measures.

  • flag: Boolean flag indicating whether to use the risk measure value as-is (true) or apply a square root (false).

Constructors

Creates a Frontier with the specified number of points, scaling factor, and flag.

julia
Frontier(;
    N::Integer = 20,
) -> Frontier

Creates a Frontier with N points, a scaling factor of 1, and flag = true. This is used to set the appropriate frontier bounds in variance_risk_bounds_val and second_moment_bound_val.

julia
PortfolioOptimisers._Frontier(;
    N::Integer = 20,
    factor::Number = 1.0,
    flag::Bool = true
) -> Frontier

Keywords correspond to the struct's fields.

Validation

  • N > 0.

  • isfinite(factor) and factor > 0.

Examples

julia
julia> Frontier(; N = 15)
Frontier
       N ┼ Int64: 15
  factor ┼ Int64: 1
    flag ┴ Bool: true

Related

source
PortfolioOptimisers.RiskMeasureSettings Type
julia
struct RiskMeasureSettings{__T_scale, __T_ub, __T_rke} <: AbstractRiskMeasureSettings

Settings type for configuring risk measure estimators in PortfolioOptimisers.jl. Encapsulates scaling, upper bounds, and risk evaluation flags for risk measures used in optimisation routines.

Fields

  • scale: Scaling factor applied to the risk measure.

  • ub: Upper bound(s) for the risk measure.

  • rke: Boolean flag indicating whether or not to include the risk measure in the JuMP model's risk expression. If false, a risk measure can be used to constrain the risk of an optimisation, without including it in the risk expression.

Constructors

julia
RiskMeasureSettings(;
    scale::Number = 1.0,
    ub::Option{<:RkRtBounds} = nothing,
    rke::Bool = true,
) -> RiskMeasureSettings

Creates a RiskMeasureSettings instance with the specified scale, upper bound, and risk evaluation flag.

Validation

Examples

julia
julia> RiskMeasureSettings()
RiskMeasureSettings
  scale ┼ Float64: 1.0
     ub ┼ nothing
    rke ┴ Bool: true

Related

source
PortfolioOptimisers.HierarchicalRiskMeasureSettings Type
julia
struct HierarchicalRiskMeasureSettings{__T_scale} <: AbstractRiskMeasureSettings

Settings type for configuring hierarchical risk measure estimators in PortfolioOptimisers.jl.

Used for HierarchicalRiskMeasure, where it is impossible to set a risk upper bound.

Fields

  • scale: Scaling factor applied to the hierarchical risk measure.

Constructors

julia
HierarchicalRiskMeasureSettings(;
    scale::Number,
) -> HierarchicalRiskMeasureSettings

Creates a HierarchicalRiskMeasureSettings instance with the specified scaling factor.

Validation

  • scale must be finite.

Examples

julia
julia> HierarchicalRiskMeasureSettings()
HierarchicalRiskMeasureSettings
  scale ┴ Float64: 1.0

Related

source
PortfolioOptimisers.SumScalariser Type
julia
struct SumScalariser <: NonHierarchicalScalariser

Scalariser that combines multiple risk measures using a weighted sum.

SumScalariser aggregates a vector of risk measures by computing the weighted sum of their scaled values. The weights are specified in the scale field of RiskMeasureSettings or HierarchicalRiskMeasureSettings. This scalarisation strategy is used in portfolio optimisation routines that require a single risk value from multiple risk measures.

ϕ=i=1Nwiri.

Where:

  • N: Number of risk measures.

  • i: Subscript denoting the i-th risk measure.

  • ri: i-th risk measure value.

  • wi: Weight of the i-th risk measure.

Related

source
PortfolioOptimisers.MaxScalariser Type
julia
struct MaxScalariser <: NonHierarchicalScalariser

Scalariser that selects the risk expression whose scaled value is the largest.

MaxScalariser aggregates a vector of risk measures by selecting the maximum of their scaled values. The weights are specified in the scale field of RiskMeasureSettings or HierarchicalRiskMeasureSettings. In clustering optimisations, the risk of each cluster is computed separately, so there is no coherence in which risk measure is chosen between clusters.

ϕ=maxi(1,N)(wiri).

Where:

  • N: Number of risk measures.

  • i: Subscript denoting the i-th risk measure.

  • ri: i-th risk measure value.

  • wi: Weight of the i-th risk measure.

Related

source
PortfolioOptimisers.MinScalariser Type
julia
struct MinScalariser <: HierarchicalScalariser

Scalariser that selects the risk expression whose scaled value is the largest.

MinScalariser aggregates a vector of risk measures by selecting the minimum of their scaled values. The weights are specified in the scale field of RiskMeasureSettings or HierarchicalRiskMeasureSettings. In clustering optimisations, the risk of each cluster is computed separately, so there is no coherence in which risk measure is chosen between clusters.

ϕ=mini(1,N)(wiri).

Where:

  • N: Number of risk measures.

  • i: Subscript denoting the i-th risk measure.

  • ri: i-th risk measure value.

  • wi: Weight of the i-th risk measure.

Related

source
PortfolioOptimisers.LogSumExpScalariser Type
julia
struct LogSumExpScalariser{__T_gamma} <: NonHierarchicalScalariser

Scalariser that aggregates multiple risk measures using the log-sum-exp function.

LogSumExpScalariser combines a vector of risk measures by applying the log-sum-exp transformation to their scaled values. The weights are specified in the scale field of RiskMeasureSettings or HierarchicalRiskMeasureSettings.

The parameter gamma controls the approximation accuracy to the maximum function: as gamma → 0, the function approaches the weighted sum; as gamma → ∞, it approaches the maximum. This behaviour is only true in JuMP-based optimisations. In clustering optimisations, each cluster's risk is computed separately, so there is no coherence between clusters.

ϕ=1γlog(i=1Nexp[γwiri]).

Where:

  • N: Number of risk measures.

  • i: Subscript denoting the i-th risk measure.

  • ri: i-th risk measure value.

  • wi: Weight of the i-th risk measure.

  • γ: Positive parameter controlling the interpolation between the weighted sum and the maximum functions.

Fields

  • gamma: Positive parameter controlling the interpolation between the weighted sum and the maximum functions.

Constructors

julia
LogSumExpScalariser(;
    gamma::Number = 1.0,
) -> LogSumExpScalariser

Keywords correspond to the struct's fields.

Validation

  • gamma > 0.

Examples

julia
julia> LogSumExpScalariser()
LogSumExpScalariser
  gamma ┴ Float64: 1.0

Related

source
PortfolioOptimisers.AbstractBaseRiskMeasure Type
julia
abstract type AbstractBaseRiskMeasure <: AbstractEstimator

Abstract supertype for all risk measure estimators in PortfolioOptimisers.jl.

Defines the interface for risk measure types, which quantify portfolio risk using various statistical or econometric methods. All concrete risk measure types should subtype AbstractBaseRiskMeasure to ensure consistency and composability within the optimisation framework.

All concrete risk measures can be used as functors (callable structs) to compute their associated risk quantity.

Related Types

source
PortfolioOptimisers.NonOptimisationRiskMeasure Type
julia
abstract type NonOptimisationRiskMeasure <: AbstractBaseRiskMeasure

Abstract supertype for risk measures that are not intended for use in portfolio optimisation routines.

These risk measures are typically used for analysis, reporting, or diagnostics, and are not designed to be included as objectives or constraints in optimisation problems. Subtype this when implementing a risk measure that should not be selectable by optimisation algorithms.

Related Types

source
PortfolioOptimisers.OptimisationRiskMeasure Type
julia
abstract type OptimisationRiskMeasure <: AbstractBaseRiskMeasure

Abstract supertype for risk measures that are intended for use in portfolio optimisation routines.

All concrete risk measures that can be used as objectives or constraints in optimisation problems should subtype OptimisationRiskMeasure. This ensures compatibility with the optimisation framework and enables composability with other estimators and algorithms.

Related Types

source
PortfolioOptimisers.AbstractRiskMeasureSettings Type
julia
abstract type AbstractRiskMeasureSettings <: AbstractEstimator

Abstract supertype for all risk measure settings in PortfolioOptimisers.jl.

Defines the interface for settings types that configure the behavior of risk measure estimators. All concrete risk measure settings types should subtype AbstractRiskMeasureSettings to ensure consistency and composability within the optimisation framework.

Related Types

source
PortfolioOptimisers.Scalariser Type
julia
abstract type Scalariser <: AbstractEstimator

Abstract supertype for scalarisation strategies used to combine multiple risk measures into a single scalar value for optimisation.

Subtype Scalariser to implement different methods for aggregating risk measures. These strategies are used in portfolio optimisation routines that require a single risk value from multiple risk measures.

Related Types

source
PortfolioOptimisers.NonHierarchicalScalariser Type
julia
abstract type NonHierarchicalScalariser <: Scalariser

Abstract supertype for scalarisation strategies that combine multiple risk measures into a single scalar value compatible with all portfolio optimisation estimators.

Subtype NonHierarchicalScalariser to implement aggregation methods that work with all optimisation estimators.

Related Types

source
PortfolioOptimisers.HierarchicalScalariser Type
julia
abstract type HierarchicalScalariser <: Scalariser

Abstract supertype for scalarisation strategies that combine multiple risk measures into a single scalar value compatible only with hierarchical optimisations.

Subtype HierarchicalScalariser to implement aggregation methods that only work with hierarchical optimisation estimators.

Related Types

source
PortfolioOptimisers.nothing_scalar_array_selector Function
julia
nothing_scalar_array_selector(risk_variable::Nothing, prior_variable::Nothing)
nothing_scalar_array_selector(risk_variable::Num_ArrNum_VecScalar_DynWeights, ::Any)
nothing_scalar_array_selector(risk_variable::Nothing, prior_variable::Num_ArrNum_VecScalar_DynWeights)

Function for selecting a non-nothing value when provided by a risk measure, or fall back to a value contained in a prior result

Arguments

  • risk_variable : The risk-side input.

  • prior_variable : The prior-side input.

Returns

  • If both inputs are nothing returns nothing.

  • If risk_variable is not nothing, returns risk_variable.

  • If risk_variable is nothing and prior_variable is not nothing, returns prior_variable.

source
PortfolioOptimisers.VecBaseRM Type
julia
const VecBaseRM = AbstractVector{<:AbstractBaseRiskMeasure}

Alias for an abstract vector of AbstractBaseRiskMeasure elements.

Related

source
PortfolioOptimisers.VecOptRM Type
julia
const VecOptRM = AbstractVector{<:OptimisationRiskMeasure}

Alias for an abstract vector of OptimisationRiskMeasure elements.

Related

source
PortfolioOptimisers.OptRM_VecOptRM Type
julia
const OptRM_VecOptRM = Union{<:OptimisationRiskMeasure, <:VecOptRM}

Union type accepting a single OptimisationRiskMeasure or a vector of them.

Related

source
PortfolioOptimisers.VecRM Type
julia
const VecRM = AbstractVector{<:RiskMeasure}

Alias for an abstract vector of RiskMeasure elements.

Related

source
PortfolioOptimisers.RM_VecRM Type
julia
const RM_VecRM = Union{<:RiskMeasure, <:VecRM}

Union type accepting a single RiskMeasure or a vector of them.

Related

source
PortfolioOptimisers.RkRtBounds Type
julia
const RkRtBounds = Union{<:Num_VecNum, <:Frontier}

Union type for risk-measure upper bound specifications.

Accepts either a scalar/vector numeric bound or a Frontier sweep configuration. Used in RiskMeasureSettings to set the upper bound field.

Related

source
PortfolioOptimisers.Front_NumVec Type
julia
const Front_NumVec = Union{<:VecNum, <:Frontier}

Union type for frontier or numeric-vector specifications used internally for risk bounds.

Related

source
PortfolioOptimisers.bigger_is_better Function
julia
bigger_is_better(r::AbstractBaseRiskMeasure) -> Bool

Return whether a larger value of risk measure r is preferred over a smaller one.

The default implementation returns false (lower risk is better) for all AbstractBaseRiskMeasure subtypes. Ratio-based or return-like measures that should be maximised may override this method to return true.

Returns

  • Bool: true if a higher value of r is preferred; false otherwise.

Related

source