Base Risk Measures
PortfolioOptimisers.RiskMeasure Type
abstract type RiskMeasure <: OptimisationRiskMeasure endAbstract 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
sourcePortfolioOptimisers.HierarchicalRiskMeasure Type
abstract type HierarchicalRiskMeasure <: OptimisationRiskMeasure endAbstract 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
sourcePortfolioOptimisers.Frontier Type
struct Frontier{T1, T2, T3} <: AbstractAlgorithm
N::T1
factor::T2
flag::T3
endDefines 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.
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.
PortfolioOptimisers._Frontier(; N::Integer = 20, factor::Real, flag::Bool)Keyword arguments correspond to the fields above.
Validation
N > 0.isfinite(factor)andfactor > 0.
Examples
julia> Frontier(; N = 15)
Frontier
N ┼ Int64: 15
factor ┼ Int64: 1
flag ┴ Bool: trueRelated
sourcePortfolioOptimisers.RiskMeasureSettings Type
struct RiskMeasureSettings{T1, T2, T3} <: AbstractRiskMeasureSettings
scale::T1
ub::T2
rke::T3
endSettings 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 theJuMPmodel's risk expression. Iffalse, a risk measure can be used to constrain the risk of an optimisation, without including it in the risk expression.
Constructors
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
isfinite(scale).ubis validated withassert_nonneg_finite_val.
Examples
julia> RiskMeasureSettings()
RiskMeasureSettings
scale ┼ Float64: 1.0
ub ┼ nothing
rke ┴ Bool: trueRelated
sourcePortfolioOptimisers.HierarchicalRiskMeasureSettings Type
struct HierarchicalRiskMeasureSettings{T1} <: AbstractRiskMeasureSettings
scale::T1
endSettings 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
HierarchicalRiskMeasureSettings()Creates a HierarchicalRiskMeasureSettings instance with the specified scaling factor.
Validation
scalemust be finite.
Examples
julia> HierarchicalRiskMeasureSettings()
HierarchicalRiskMeasureSettings
scale ┴ Float64: 1.0Related
sourcePortfolioOptimisers.SumScalariser Type
struct SumScalariser <: Scalariser endScalariser 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.
Where:
: number of risk measures. : subscript denoting the i'th risk measure.: i'th risk measure value.: weight of the i'th risk measure.
Related
sourcePortfolioOptimisers.MaxScalariser Type
struct MaxScalariser <: Scalariser endScalariser 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.
Where:
: number of risk measures. : subscript denoting the i'th risk measure.: i'th risk measure value.: weight of the i'th risk measure.
Related
sourcePortfolioOptimisers.LogSumExpScalariser Type
struct LogSumExpScalariser{T1} <: Scalariser
gamma::T1
endScalariser 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.
Where:
: number of risk measures. : subscript denoting the i'th risk measure.: i'th risk measure value.: 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
LogSumExpScalariser(; gamma::Real = 1.0)Keyword arguments correspond to the fields above.
Validation
gamma > 0.
Examples
julia> LogSumExpScalariser()
LogSumExpScalariser
gamma ┴ Float64: 1.0Related
sourcePortfolioOptimisers.AbstractBaseRiskMeasure Type
abstract type AbstractBaseRiskMeasure <: AbstractEstimator endAbstract 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
sourcePortfolioOptimisers.NoOptimisationRiskMeasure Type
abstract type NoOptimisationRiskMeasure <: AbstractBaseRiskMeasure endAbstract 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
sourcePortfolioOptimisers.OptimisationRiskMeasure Type
abstract type OptimisationRiskMeasure <: AbstractBaseRiskMeasure endAbstract 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
sourcePortfolioOptimisers.AbstractRiskMeasureSettings Type
abstract type AbstractRiskMeasureSettings <: AbstractEstimator endAbstract 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
sourcePortfolioOptimisers.Scalariser Type
abstract type Scalariser <: AbstractEstimator endAbstract 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
sourcePortfolioOptimisers.nothing_scalar_array_factory Function
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
nothingreturnsnothing.If
risk_variableis notnothing, returnsrisk_variable.If
risk_variableisnothingandprior_variableis notnothing, returnsprior_variable.