Skip to content
5

Base Risk Measures

PortfolioOptimisers.RiskMeasure Type
julia
abstract type RiskMeasure <: OptimisationRiskMeasure end

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 end

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{T1, T2, T3} <: AbstractAlgorithm
    N::T1
    factor::T2
    flag::T3
end

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).

Constructor

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

julia
Frontier(; N::Integer = 20)

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::Real, flag::Bool)

Keyword arguments correspond to the fields above.

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{T1, T2, T3} <: AbstractRiskMeasureSettings
    scale::T1
    ub::T2
    rke::T3
end

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::Real = 1.0,
                    ub::Union{Nothing, <:Real, <:AbstractVector, <:Frontier} = nothing,
                    rke::Bool = true)

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{T1} <: AbstractRiskMeasureSettings
    scale::T1
end

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()

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 <: Scalariser end

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 <: Scalariser end

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.LogSumExpScalariser Type
julia
struct LogSumExpScalariser{T1} <: Scalariser
    gamma::T1
end

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::Real = 1.0)

Keyword arguments correspond to the fields above.

Validation

  • gamma > 0.

Examples

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

Related

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

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.NoOptimisationRiskMeasure Type
julia
abstract type NoOptimisationRiskMeasure <: AbstractBaseRiskMeasure end

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 end

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 end

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 end

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, such as weighted sum, maximum, or log-sum-exp. These strategies are used in portfolio optimisation routines that require a single risk value from multiple risk measures.

Related Types

source
PortfolioOptimisers.nothing_scalar_array_factory Function
julia
nothing_scalar_array_factory(risk_variable::Nothing, prior_variable::Nothing)
nothing_scalar_array_factory(risk_variable::Union{<:Real, <:AbstractArray, <:VecScalar},
                             ::Any)
nothing_scalar_array_factory(risk_variable::Nothing,
                             prior_variable::Union{<:Real, <:AbstractArray, <:VecScalar})

Utility to select 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