Base Risk Measures
PortfolioOptimisers.RiskMeasure Type
abstract type RiskMeasure <: OptimisationRiskMeasureAbstract 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 <: OptimisationRiskMeasureAbstract 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{__T_N, __T_factor, __T_flag} <: AbstractAlgorithmDefines 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.
Frontier(;
N::Integer = 20,
) -> FrontierCreates 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::Number = 1.0,
flag::Bool = true
) -> FrontierKeywords correspond to the struct's fields.
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{__T_scale, __T_ub, __T_rke} <: AbstractRiskMeasureSettingsSettings 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::Number = 1.0,
ub::Option{<:RkRtBounds} = nothing,
rke::Bool = true,
) -> RiskMeasureSettingsCreates a RiskMeasureSettings instance with the specified scale, upper bound, and risk evaluation flag.
Validation
isfinite(scale).ubis validated withassert_nonempty_nonneg_finite_val.
Examples
julia> RiskMeasureSettings()
RiskMeasureSettings
scale ┼ Float64: 1.0
ub ┼ nothing
rke ┴ Bool: trueRelated
sourcePortfolioOptimisers.HierarchicalRiskMeasureSettings Type
struct HierarchicalRiskMeasureSettings{__T_scale} <: AbstractRiskMeasureSettingsSettings 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(;
scale::Number,
) -> HierarchicalRiskMeasureSettingsCreates 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 <: NonHierarchicalScalariserScalariser 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
PortfolioOptimisers.MaxScalariser Type
struct MaxScalariser <: NonHierarchicalScalariserScalariser 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
PortfolioOptimisers.MinScalariser Type
struct MinScalariser <: HierarchicalScalariserScalariser 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.
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
PortfolioOptimisers.LogSumExpScalariser Type
struct LogSumExpScalariser{__T_gamma} <: NonHierarchicalScalariserScalariser 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::Number = 1.0,
) -> LogSumExpScalariserKeywords correspond to the struct's fields.
Validation
gamma > 0.
Examples
julia> LogSumExpScalariser()
LogSumExpScalariser
gamma ┴ Float64: 1.0Related
sourcePortfolioOptimisers.AbstractBaseRiskMeasure Type
abstract type AbstractBaseRiskMeasure <: AbstractEstimatorAbstract 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.NonOptimisationRiskMeasure Type
abstract type NonOptimisationRiskMeasure <: AbstractBaseRiskMeasureAbstract 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 <: AbstractBaseRiskMeasureAbstract 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 <: AbstractEstimatorAbstract 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 <: AbstractEstimatorAbstract 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
sourcePortfolioOptimisers.NonHierarchicalScalariser Type
abstract type NonHierarchicalScalariser <: ScalariserAbstract 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
sourcePortfolioOptimisers.HierarchicalScalariser Type
abstract type HierarchicalScalariser <: ScalariserAbstract 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
sourcePortfolioOptimisers.nothing_scalar_array_selector Function
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
nothingreturnsnothing.If
risk_variableis notnothing, returnsrisk_variable.If
risk_variableisnothingandprior_variableis notnothing, returnsprior_variable.
PortfolioOptimisers.VecBaseRM Type
const VecBaseRM = AbstractVector{<:AbstractBaseRiskMeasure}Alias for an abstract vector of AbstractBaseRiskMeasure elements.
Related
sourcePortfolioOptimisers.VecOptRM Type
const VecOptRM = AbstractVector{<:OptimisationRiskMeasure}Alias for an abstract vector of OptimisationRiskMeasure elements.
Related
sourcePortfolioOptimisers.OptRM_VecOptRM Type
const OptRM_VecOptRM = Union{<:OptimisationRiskMeasure, <:VecOptRM}Union type accepting a single OptimisationRiskMeasure or a vector of them.
Related
sourcePortfolioOptimisers.VecRM Type
const VecRM = AbstractVector{<:RiskMeasure}Alias for an abstract vector of RiskMeasure elements.
Related
sourcePortfolioOptimisers.RM_VecRM Type
const RM_VecRM = Union{<:RiskMeasure, <:VecRM}Union type accepting a single RiskMeasure or a vector of them.
Related
sourcePortfolioOptimisers.RkRtBounds Type
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
sourcePortfolioOptimisers.Front_NumVec Type
const Front_NumVec = Union{<:VecNum, <:Frontier}Union type for frontier or numeric-vector specifications used internally for risk bounds.
Related
sourcePortfolioOptimisers.bigger_is_better Function
bigger_is_better(r::AbstractBaseRiskMeasure) -> BoolReturn 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:trueif a higher value ofris preferred;falseotherwise.
Related
source