Capability catalogue
Everything PortfolioOptimisers.jl can do, grouped by the job it does rather than by the file it lives in. Each entry links to its docstring.
This page is generated (see docs/generate_capability_catalogue.jl): the grouping is curated in docs/capability_catalogue.jl, and every description is the first sentence of the corresponding docstring, so the two can never disagree. A test asserts that every estimator and algorithm in the package appears here, so the page cannot fall behind the code.
For the same types arranged by subtyping rather than by capability, see the type hierarchy.
Core abstractions
Every component is an Estimator (a configuration encoding a method and its hyperparameters), an Algorithm (a behaviour selector consumed through an Estimator), or a Result (computed output). Estimators and Algorithms are what you choose; Results are what you get back.
Because every struct is immutable, runtime values are propagated down a composed estimator tree by rebuilding it.
- No-op factory function for constructing objects with a uniform interface.
factory
Preprocessing
Convert
TimeSeries.TimeArrayprice data to returns.prices_to_returnsandReturnsResultA container for aligned, time-indexed price-level data.
PricesResultPreprocessing estimator converting price-level data into returns-level data.
PricesToReturns,fit_preprocessing, andapply_preprocessingPreprocessing estimator dropping assets and observations with excessive missing data from price-level data.
MissingDataFilterandMissingDataFilterResultPreprocessing estimator imputing missing price observations from per-asset statistics fitted on the training window.
ImputerandImputerResult
Asset selection
Asset selector that scores every asset with a risk measure and keeps the assets a rule admits.
ScoreSelector,ZeroVarianceFilter, andCompleteAssetSelectorAsset selector that discards assets which duplicate information already carried by others.
RedundancySelectorFitted result of any
AbstractAssetSelector.AssetSelectorResultSelection rules
RankRulewith the tail sizes given as fractions of the asset universe.QuantileRuleTake
bestand/orworstassets from the tails of the score ordering, then keep or drop them.RankRuleKeep assets whose score falls strictly inside the band
(lo, hi).ThresholdRule
Cut price- or returns-level data into a training window (the head) and a held-out test window (the tail).
train_test_split,TrainTestSplit, andTrainTestSplitResultReturn a
ReturnsResultappropriate for benchmark-tracking optimisations.returns_result_picker
Matrix processing
Projects a matrix to the nearest positive definite matrix, typically used for co-moment matrices.
Posdef,posdef!, andposdefConfigures and applies denoising algorithms to covariance or correlation matrices.
Denoise,denoise!, anddenoiseDenoises by setting the smallest
num_factorseigenvalues to zero.SpectralDenoiseDenoises by replacing the smallest
num_factorseigenvalues with their average.FixedDenoiseDenoises by shrinking the smallest
num_factorseigenvalues towards the diagonal.ShrunkDenoise
Removes the largest
nprincipal components (market modes) from a covariance or correlation matrix.Detone,detone!, anddetoneConfigures and applies matrix processing routines.
MatrixProcessing,matrix_processing!,matrix_processing_step!, andmatrix_processing
Regression models
Factor prior models and implied volatility use regression in their estimation, which return a Regression object.
Regression targets
Regression target type for standard linear models.
LinearModelRegression target type for generalised linear models (GLMs).
GeneralisedLinearModel
Regression types
Estimator for stepwise regression-based moment estimation.
StepwiseRegressionAlgorithms
Stepwise regression algorithm: forward selection.
ForwardSelectionStepwise regression algorithm: backward elimination.
BackwardElimination
Selection criteria
Stepwise regression criterion based on p-value thresholding.
PValueAkaike Information Criterion (AIC) for stepwise regression.
AICCorrected Akaike Information Criterion (AICC) for stepwise regression.
AICCBayesian Information Criterion (BIC) for stepwise regression.
BICCoefficient of determination (R²) for stepwise regression.
RSquaredAdjusted coefficient of determination (Adjusted R²) for stepwise regression.
AdjustedRSquared
Estimator for dimension reduction regression-based moment estimation.
DimensionReductionRegression
Moment estimation
Expected returns
Overloads Statistics.mean.
A simple expected returns estimator for
PortfolioOptimisers.jl, representing the sample mean with optional observation weights.SimpleExpectedReturnsContainer type for equilibrium expected returns estimators.
EquilibriumExpectedReturnsContainer type for excess expected returns estimators.
ExcessExpectedReturnsContainer type for shrinkage-based expected returns estimators.
ShrunkExpectedReturnsAlgorithms
James-Stein
JamesSteinBayes-Stein
BayesSteinBodnar-Okhrin-Parolya
BodnarOkhrinParolya
Targets: all algorithms can have any of the following targets
Grand Mean
GrandMeanVolatility Weighted
VolatilityWeightedMean Squared Error
MeanSquaredError
Expected returns estimator that returns the asset standard deviations.
StandardDeviationExpectedReturnsExpected returns estimator that returns the asset variances.
VarianceExpectedReturnsExpected returns estimator that returns the optionally weighted asset medians.
MedianExpectedReturnsExpected returns estimator that returns custom values for each asset.
CustomValueExpectedReturnsExpected returns estimator that restricts computation to a rolling or indexed observation window.
WindowedExpectedReturns
Variance and standard deviation
Overloads Statistics.var and Statistics.std.
A flexible variance estimator for
PortfolioOptimisers.jlsupporting optional expected returns estimators, observation weights, and bias correction.SimpleVarianceVariance estimator that restricts computation to a rolling or indexed observation window.
WindowedVariance
Covariance and correlation
Overloads Statistics.cov and Statistics.cor.
A simple wrapper around a
StatsBase.CovarianceEstimator, optionalStatsBase.AbstractWeights, and an optional index.GeneralCovarianceEstimates the covariance matrix of asset returns from a centring estimator, a covariance estimator, and a moment algorithm.
CovarianceFullMomentis used to indicate that all deviations are included in the moment estimation process.FullMomentSemiMomentis used for semi-moment estimators, where only observations below a target are considered.SemiMoment
Configures and applies Gerber covariance estimators.
GerberCovarianceConfigures and applies Smyth-Broby covariance estimators.
SmythBrobyCovarianceImplements the original Smyth-Broby covariance algorithm.
SmythBroby0Implements the first variant of the Smyth-Broby covariance algorithm.
SmythBroby1Implements the second variant of the Smyth-Broby covariance algorithm.
SmythBroby2Implements the original Smyth-Broby covariance algorithm scaled by vote counts.
SmythBrobyGerber0Implements the first variant of the Smyth-Broby covariance algorithm scaled by vote counts.
SmythBrobyGerber1Implements the second variant of the Smyth-Broby covariance algorithm scaled by vote counts.
SmythBrobyGerber2Implements the original Smyth-Broby covariance algorithm using vote counts only.
SmythBrobyCount0Implements the first variant of the Smyth-Broby covariance algorithm using vote counts only.
SmythBrobyCount1Implements the second variant of the Smyth-Broby covariance algorithm using vote counts only.
SmythBrobyCount2
Gerber Information Quality
GerberIQCovariancewith custom variance, demeaning, temporal decay and numerator + denominator estimatorsImplements the basic Gerber IQ covariance template.
BasicGerberIQGerber Information Quality template with asymmetric thresholds.
PartialGerberIQGerber Information Quality template with fine-grained asymmetric thresholds.
FullGerberIQExponential Gerber IQ temporal decay.
ExpGerberIQDecayScales the threshold parameters using the individual asset volatilities.
AssetVolatilityGerberIQScaler
Configures and applies distance-based covariance estimators.
DistanceCovarianceLower tail dependence covariance estimator.
LowerTailDependenceCovarianceRank covariances
Robust covariance estimator based on Kendall's tau rank correlation.
KendallCovarianceRobust covariance estimator based on Spearman's rho rank correlation.
SpearmanCovariance
Covariance estimator based on mutual information.
MutualInfoCovarianceAbstract supertype for all histogram binning algorithms based on a bin width selection rule.
BinWidthBinsKnuth's optimal bin width
KnuthFreedman Diaconis bin width
FreedmanDiaconisScott's bin width
Scott
Histogram binning algorithm using the Hacine-Gharbi–Ravier rule.
HacineGharbiRavierPredefined number of bins
Convenience constructor.
DenoiseCovarianceConvenience constructor.
DetoneCovarianceConvenience constructor.
ProcessedCovarianceCovariance estimator based on implied volatility scaling.
ImpliedVolatilityImplied volatility algorithm that scales implied volatility by a user-supplied premium factor.
ImpliedVolatilityPremiumImplied volatility algorithm that predicts realised volatility via regression on implied volatility.
ImpliedVolatilityRegression
Composite covariance estimator with post-processing.
PortfolioOptimisersCovarianceA covariance estimator that returns the correlation matrix as both the covariance and correlation.
CorrelationCovarianceCovariance estimator that restricts computation to a rolling or indexed observation window.
WindowedCovarianceRegime-adjusted covariance and variance
Online exponentially weighted covariance estimator with regime-state adjustment.
RegimeAdjustedExpWeightedCovarianceOnline exponentially weighted variance estimator with regime-state adjustment.
RegimeAdjustedExpWeightedVarianceRegime adjustment methods
Regime adjustment method that scales variance by the ratio of the mean absolute deviation of standardised returns to the first-moment normalisation constant
x.FirstMomentRegimeAdjustedRegime adjustment method that scales variance exponentially with the smoothed log-deviation of standardised squared returns from its expected value under stationarity.
LogRegimeAdjustedRegime adjustment method that scales variance by the square root of the mean of the standardised squared returns.
RootMeanSquaredAdjusted
Shrinkage targets
Regime-adjustment target that uses a diagonal baseline covariance structure.
DiagonalTargetRegime-adjustment target that uses a Mahalanobis-distance-based baseline covariance structure.
MahalanobisTargetRegime-adjustment target that uses a portfolio-weighted baseline covariance structure.
PortfolioTarget
Demeaning
Centres the returns series using the (weighted) mean before computing the Median Absolute Deviation.
MeanCenteringCentres the returns series using the (weighted) median before computing the Median Absolute Deviation.
MedianCentering
Correlation smoothing
Greedy pairwise correlation pruning: drop assets until no surviving pair exceeds
t.PairwiseCorrelationGroup assets by connected component of the over-threshold correlation graph, and keep the best-scoring member of each.
CorrelationComponents
Coskewness
Implements coskewness.
Container type for coskewness estimators.
CoskewnessFullMomentis used to indicate that all deviations are included in the moment estimation process.FullMomentSemiMomentis used for semi-moment estimators, where only observations below a target are considered.SemiMoment
Coskewness estimator that restricts computation to a rolling or indexed observation window.
WindowedCoskewness
Cokurtosis
Implements cokurtosis.
Container type for cokurtosis estimators.
CokurtosisFullMomentis used to indicate that all deviations are included in the moment estimation process.FullMomentSemiMomentis used for semi-moment estimators, where only observations below a target are considered.SemiMoment
Cokurtosis estimator that restricts computation to a rolling or indexed observation window.
WindowedCokurtosis
Windowed moments
Every windowed estimator wraps a base moment estimator and recomputes it over a trailing window, so a moment can vary across the folds of a cross-validation scheme. The window is set by a fixed length or by a WindowSizeEstimator.
- Abstract supertype for estimators that determine the rolling window size.
WindowSizeEstimator
Distance matrices
Implements distance and cor_and_dist.
If power is not
nothing, computes the generalised distance estimator.DistanceDistance-of-distances estimator for portfolio optimization.
DistanceDistance
The distance estimators are used together with various distance matrix algorithms.
Simple distance algorithm for portfolio optimization.
SimpleDistanceSimple absolute distance algorithm for portfolio optimization.
SimpleAbsoluteDistanceLogarithmic distance algorithm for portfolio optimization.
LogDistanceCorrelation distance algorithm for portfolio optimization.
CorrelationDistanceVariation of Information (VI) distance algorithm for portfolio optimization.
VariationInfoDistanceAbstract supertype for all histogram binning algorithms based on a bin width selection rule.
BinWidthBinsKnuth's optimal bin width
KnuthFreedman Diaconis bin width
FreedmanDiaconisScott's bin width
Scott
Histogram binning algorithm using the Hacine-Gharbi–Ravier rule.
HacineGharbiRavierPredefined number of bins
Canonical distance algorithm for portfolio optimization.
CanonicalDistance
Phylogeny
PortfolioOptimisers.jl can make use of asset relationships to perform optimisations, define constraints, and compute relatedness characteristics of portfolios.
Clustering
Phylogeny constraints and clustering optimisations make use of clustering algorithms via ClustersEstimator, Clusters, and clusterise. Most clustering algorithms come from Clustering.jl.
Estimator type for selecting the optimal number of clusters.
OptimalNumberClustersandVectorToScalarMeasureAlgorithm type for estimating the optimal number of clusters using the second-order difference method.
SecondOrderDifferenceAlgorithm type for estimating the optimal number of clusters using the standardised silhouette score.
SilhouetteScorePredefined number of clusters.
Select the optimal number of clusters for a hierarchical clustering tree.
optimal_number_clusters
Get the vector of cluster indices for each point.
assignments
Hierarchical
Algorithm type for hierarchical clustering.
HClustAlgorithmDirect Bubble Hierarchical Trees
DBHTand Local Global sparsification of the covariance matrixLoGo,logo!, andlogoRoot selection
A DBHT root selection method that enforces a unique root in the hierarchy.
UniqueRootA DBHT root selection method that creates a root from the adjacency tree of all root candidates.
EqualRoot
Non-hierarchical
Non-hierarchical clustering algorithms are incompatible with hierarchical clustering optimisations, but they can be used for phylogeny constraints and NestedClustered optimisations.
- K-means clustering algorithm configuration for non-hierarchical clustering.
KMeansAlgorithm
Networks
Adjacency matrices
Adjacency matrices encode asset relationships either with clustering or graph theory via phylogeny_matrix and PhylogenyResult.
Network adjacency
NetworkEstimatorwith custom tree algorithms, covariance, and distance estimatorsAlgorithm type for Kruskal's minimum spanning tree (MST).
KruskalTree,BoruvkaTree, andPrimTreeTriangulated Maximally Filtered Graph with various similarity matrix estimators
Maximum distance similarity
MaximumDistanceSimilarityExponential similarity
ExponentialSimilarityGeneral exponential similarity
GeneralExponentialSimilarity
Estimator type for clustering.
ClustersEstimatorandClustersEstimator type for network-based phylogeny analysis.
NetworkClustersEstimatorGroup assets by clustering them, and keep the best-scoring member of each cluster.
ClusterGroups
Centrality and phylogeny measures
Centrality estimator
CentralityEstimatorwith custom adjacency matrix estimators (clustering and network) and centrality measuresBetweenness
BetweennessCentralityCloseness
ClosenessCentralityDegree
DegreeCentralityEigenvector
EigenvectorCentralityKatz
KatzCentralityPagerank
PagerankRadiality
RadialityCentralityStress
StressCentrality
Fallback no-op for returning a validated centrality vector result as-is.
centrality_vectorCompute the weighted average centrality for a network and centrality algorithm.
average_centralityCompute the asset phylogeny score for a set of weights and a phylogeny matrix.
asset_phylogeny
Cluster trees
Hierarchical clustering produces a tree of ClusterNodes, walked by to_tree, pre_order, and is_leaf.
- Preorder traversal strategy that visits nodes by their ID.
PreorderTreeByID
Optimisation constraints
Non clustering optimisers support a wide range of constraints, while naive and clustering optimisers only support weight bounds. Furthermore, entropy pooling prior supports a variety of views constraints. It is therefore important to provide users with the ability to generate constraints manually and/or programmatically. We therefore provide a wide, robust, and extensible range of types such as AbstractEstimatorValueAlgorithm and UniformValues, and functions that make this easy, fast, and safe.
Constraints can be defined via their estimators or directly by their result types. Some using estimators need to map key-value pairs to the asset universe, this is done by defining the assets and asset groups in AssetSets. Internally, PortfolioOptimisers.jl uses all the information and calls group_to_val!, and replace_group_by_assets to produce the appropriate arrays.
Equation parsing
parse_equationandParsingResultNo-op fallback for returning an existing
LinearConstraintobject ornothing.linear_constraints,LinearConstraintEstimator,PartialLinearConstraint, andLinearConstraintNo-op fallback for risk budget constraint generation.
risk_budget_constraints,RiskBudgetEstimator, andRiskBudgetGenerate phylogeny-based portfolio constraints from an estimator or result.
phylogeny_constraints,centrality_constraints,SemiDefinitePhylogenyEstimator,SemiDefinitePhylogeny,IntegerPhylogenyEstimator,IntegerPhylogeny, andCentralityConstraintGenerate portfolio weight bounds constraints from a
WeightBoundsEstimatorand asset set.weight_bounds_constraints,WeightBoundsEstimator, andWeightBoundsContainer for asset set and group information used in constraint generation.
AssetSetsBudget constraints
BudgetEstimatorandBudgetRangeBudget constraint that accounts for linear transaction costs.
BudgetCostsBudget constraint that accounts for non-linear (power-law) market impact costs.
BudgetMarketImpact
Constraint values
AbstractEstimatorValueAlgorithmWhere a constraint takes one value per asset or group, these algorithms say how to derive it from data rather than stating it outright.
Custom weight bounds constraint for uniformly distributing asset weights,
1/Nfor lower bounds and1for upper bounds, whereNis the number of assets.UniformValuesReturn value for assets or groups, based on a mapping and asset sets.
estimator_to_valAlgorithm for reducing a vector of real values to its minimum.
MinValueAlgorithm for reducing a vector of real values to its maximum.
MaxValueAlgorithm for reducing a vector of real values to its optionally weighted mean.
MeanValueAlgorithm for reducing a vector of real values to its optionally weighted median.
MedianValueAlgorithm for reducing a vector of real values to its mode.
ModeValueAlgorithm for reducing a vector of real values to its sum.
SumValueAlgorithm for reducing a vector of real values to its product.
ProdValueAlgorithm for reducing a vector of real values to its optionally weighted standard deviation.
StdValueAlgorithm for reducing a vector of real values to its optionally weighted variance.
VarValueAlgorithm for reducing a vector of real values to its optionally weighted mean divided by its optionally weighted standard deviation.
StandardisedValueMarker for "no default here", used in the two places a fold-less value may be missing.
NoDefault
Time-dependent constraint: an optimiser input whose value changes across the folds of a cross-validation scheme.
TimeDependentA time-dependent input takes a different value in each fold of a cross-validation scheme, and is inert outside one.
Abstract supertype for callable structs used as time-dependent constraint values.
TimeDependentCallableAbstract supertype for callable structs whose per-fold value is an optimiser.
TimeDependentOptimiserCallablePer-fold context handed to time-dependent constraints when they are resolved.
TimeDependentContextWrapper marking a callable time-dependent constraint entry as requiring the previous optimisation's weights.
PreviousWeightsFunction
Construct a binary asset-group membership matrix from asset set groupings.
asset_sets_matrixandAssetSetsMatrixEstimatorPropagate or pass through buy-in threshold portfolio constraints.
threshold_constraints,ThresholdEstimator, andThreshold
Prior statistics
Many optimisations and constraints use prior statistics computed via prior.
Container type for low order prior results.
LowOrderPriorEmpirical prior estimator for asset returns.
EmpiricalPriorFactor-based prior estimator for asset returns.
FactorPriorBlack-Litterman
Unified interface for constructing or passing through Black-Litterman investor views.
black_litterman_viewsBlack-Litterman prior estimator for asset returns.
BlackLittermanPriorBayesian Black-Litterman prior estimator for asset returns.
BayesianBlackLittermanPriorFactor Black-Litterman prior estimator for asset returns.
FactorBlackLittermanPriorAugmented Black-Litterman prior estimator for asset returns.
AugmentedBlackLittermanPrior
Entropy pooling prior estimator for asset returns.
EntropyPoolingPriorEntropy pooling reweights the observations so that the posterior satisfies the stated views while staying as close as possible to the prior.
Container for Black-Litterman investor views in canonical matrix form.
BlackLittermanViewsView constraint algorithms
One-shot entropy pooling.
H0_EntropyPoolingUses the initial probabilities to optimise the posterior probabilities at every step.
H1_EntropyPoolingUses the previous step's probabilities to optimise the next step's probabilities.
H2_EntropyPoolingConditional Value-at-Risk (CVaR) entropy pooling optimiser.
CVaREntropyPooling
Divergence formulations
Exponential entropy pooling optimisation algorithm.
ExpEntropyPoolingLogarithmic entropy pooling optimisation algorithm.
LogEntropyPooling
Optimisers
Optim.jl-based entropy pooling optimiser.OptimEntropyPoolingJuMP.jl-based entropy pooling optimiser.JuMPEntropyPooling
Opinion pooling prior estimator for asset returns.
OpinionPoolingPriorLinear opinion pooling algorithm for consensus prior estimation.
LinearOpinionPoolingLogarithmic opinion pooling algorithm for consensus prior estimation.
LogarithmicOpinionPooling
Container type for high order prior results.
HighOrderPriorHigh order prior estimator for asset returns.
HighOrderPriorEstimatorRepresents the High Order Factor Prior Estimator.
HighOrderFactorPriorEstimator
Uncertainty sets
In order to make optimisations more robust to noise and measurement error, it is possible to define uncertainty sets on the expected returns and covariance. These can be used in optimisations which use either of these two quantities. These are implemented via ucs, mu_ucs, and sigma_ucs.
PortfolioOptimisers.jl implements two types of uncertainty sets.
Represents a box uncertainty set for risk or prior statistics in portfolio optimisation.
BoxUncertaintySetandBoxUncertaintySetAlgorithmEllipsoidalUncertaintySetandEllipsoidalUncertaintySetAlgorithmwith various algorithms for computing the scaling parameter viak_ucsAlgorithm for computing the scaling parameter
kfor ellipsoidal uncertainty sets under the assumption of normally distributed returns in portfolio optimisation.NormalKUncertaintyAlgorithmComputes the ellipsoidal uncertainty set scaling parameter
kassqrt((1 - q) / q).GeneralKUncertaintyAlgorithmAlgorithm for computing the scaling parameter
kfor ellipsoidal uncertainty sets using the chi-squared distribution in portfolio optimisation.ChiSqKUncertaintyAlgorithmPredefined scaling parameter
It also implements various estimators for the uncertainty sets, the following two can generate box and ellipsoidal sets.
Estimator for box or ellipsoidal uncertainty sets under the assumption of normally distributed returns in portfolio optimisation.
NormalUncertaintySetBootstrapping via Autoregressive Conditional Heteroscedasticity
ARCHUncertaintySetviaarchCircular
CircularBootstrapMoving
MovingBootstrapStationary
StationaryBootstrap
The following estimator can only generate box sets.
- Estimator for box uncertainty sets using delta bounds on mean and covariance statistics in portfolio optimisation.
DeltaUncertaintySet
Quintile portfolios are expressed as an uncertainty set on the characteristic vector rather than as an optimiser of their own (ADR 0032).
Estimator for
uncertainty sets on the characteristic vector. CharacteristicUncertaintySet(cross-polytope) uncertainty set on the characteristic vector.
L1UncertaintySetandL1UncertaintySetAlgorithmSigned
uncertainty set on the characteristic vector, with a separate error budget per sign. SignedL1UncertaintySetandSignedL1UncertaintySetAlgorithmRadius algorithm that calibrates the
uncertainty radius to a target number of active assets. ActiveAssetsUncertaintyAlgorithm
Ellipsoidal set classes
Represents the class identifier for mean ellipsoidal uncertainty sets in portfolio optimisation.
MuEllipsoidalUncertaintySetRepresents the class identifier for covariance ellipsoidal uncertainty sets in portfolio optimisation.
SigmaEllipsoidalUncertaintySet
Turnover
The turnover is defined as the element-wise absolute difference between the vector of current weights and a vector of benchmark weights. It can be used as a constraint, method for fee calculation, and risk measure. These are all implemented using turnover_constraints, TurnoverEstimator, and Turnover.
Fees
Fees are a non-negligible aspect of active investing. As such PortfolioOptimiser.jl has the ability to account for them in all optimisations but the naive ones. They can also be used to adjust expected returns calculations via calc_fees and calc_asset_fees.
Generate portfolio transaction fee constraints from a
FeesEstimatorand asset set.fees_constraintsCompute the fixed portfolio fees for assets that have been allocated.
calc_fixed_feesandcalc_asset_fixed_feesEstimator for portfolio transaction fees constraints.
FeesEstimatorandFeesProportional long
Proportional short
Fixed long
Fixed short
Turnover
Portfolio returns and drawdowns
Various risk measures and analyses require the computation of simple and cumulative portfolio returns and drawdowns both in aggregate and per-asset. These are computed by calc_net_returns, calc_net_asset_returns, cumulative_returns, drawdowns.
Tracking
It is often useful to create portfolios that track the performance of an index, indicator, or another portfolio.
Compute the benchmark portfolio returns for a weights-based tracking algorithm.
tracking_benchmarkandTrackingErrorReturns-based tracking algorithm.
ReturnsTrackingAsset weights-based tracking algorithm.
WeightsTracking
The error can be computed using different algorithms using norm_error.
Norm tracking algorithms
Norm-one (NOC) error formulation.
L1NormSecond-order cone (SOC) norm-based error formulation.
L2NormSecond-order cone (SOC) squared norm-based error formulation.
SquaredL2NormL-p norm error estimator.
LpNormL-infinity norm (maximum absolute deviation) error estimator.
LInfNorm
It is also possible to track the error in with risk measures RiskTrackingError using WeightsTracking, which allows for two approaches.
Dependent variable-based tracking formulation.
DependentVariableTrackingIndependent variable-based tracking formulation.
IndependentVariableTracking
Risk measures
PortfolioOptimisers.jl provides a wide range of risk measures. These are broadly categorised into two types based on the type of optimisations that support them.
Risk measures for traditional optimisation
These are all subtypes of RiskMeasure, and are supported by all optimisation estimators.
Represents the portfolio variance using a covariance matrix.
VarianceTraditional optimisations also support:
Risk contribution
Formulations
Direct quadratic risk expression optimisation formulation for variance-like risk measures.
QuadRiskExprSquared second-order cone risk expression optimisation formulation for applicable risk measures.
SquaredSOCRiskExpr
Represents the portfolio standard deviation using a covariance matrix.
StandardDeviationUncertainty set variance
UncertaintySetVariance(same as variance when used in non-traditional optimisation)Represents a low-order moment risk measure.
LowOrderMomentRepresents the first lower moment risk measure algorithm.
FirstLowerMomentRepresents the mean absolute deviation risk measure algorithm.
MeanAbsoluteDeviationRepresents a second moment (variance or standard deviation) risk measure algorithm.
SecondMomentSecond squared moments
FullMomentis used to indicate that all deviations are included in the moment estimation process.FullMomentSemiMomentis used for semi-moment estimators, where only observations below a target are considered.SemiMomentTraditional optimisation formulations
Direct quadratic risk expression optimisation formulation for variance-like risk measures.
QuadRiskExprSquared second-order cone risk expression optimisation formulation for applicable risk measures.
SquaredSOCRiskExprRotated second-order cone risk expression optimisation formulation for applicable risk measures.
RSOCRiskExpr
Second-order cone risk expression optimisation formulation for applicable risk measures.
SOCRiskExprFullMomentis used to indicate that all deviations are included in the moment estimation process.FullMomentSemiMomentis used for semi-moment estimators, where only observations below a target are considered.SemiMoment
Represents the square root kurtosis risk measure.
KurtosisActual kurtosis
FullMoment and semi-kurtosis are supported in traditional optimisers via the
ktfield. Risk calculation usesFullMomentis used to indicate that all deviations are included in the moment estimation process.FullMomentSemiMomentis used for semi-moment estimators, where only observations below a target are considered.SemiMoment
Traditional optimisation formulations
Direct quadratic risk expression optimisation formulation for variance-like risk measures.
QuadRiskExprSquared second-order cone risk expression optimisation formulation for applicable risk measures.
SquaredSOCRiskExprRotated second-order cone risk expression optimisation formulation for applicable risk measures.
RSOCRiskExpr
Second-order cone risk expression optimisation formulation for applicable risk measures.
SOCRiskExprFullMomentis used to indicate that all deviations are included in the moment estimation process.FullMomentSemiMomentis used for semi-moment estimators, where only observations below a target are considered.SemiMoment
Represents the Negative Skewness risk measure.
NegativeSkewnessSquared negative skewness
FullMoment and semi-skewness are supported in traditional optimisers via the
skandVfields. Risk calculation usesFullMomentis used to indicate that all deviations are included in the moment estimation process.FullMomentSemiMomentis used for semi-moment estimators, where only observations below a target are considered.SemiMoment
Traditional optimisation formulations
Direct quadratic risk expression optimisation formulation for variance-like risk measures.
QuadRiskExprSquared second-order cone risk expression optimisation formulation for applicable risk measures.
SquaredSOCRiskExpr
Second-order cone risk expression optimisation formulation for applicable risk measures.
SOCRiskExpr
Represents the Value-at-Risk (VaR) risk measure.
ValueatRiskTraditional optimisation formulations
Mixed-integer programming (MIP) formulation for Value-at-Risk.
MIPValueatRiskDistribution-based formulation for Value-at-Risk.
DistributionValueatRisk
Represents the Value-at-Risk Range risk measure.
ValueatRiskRangeTraditional optimisation formulations
Mixed-integer programming (MIP) formulation for Value-at-Risk.
MIPValueatRiskDistribution-based formulation for Value-at-Risk.
DistributionValueatRisk
Represents the Drawdown-at-Risk (DaR) risk measure.
DrawdownatRiskRepresents the Conditional Value-at-Risk (CVaR) risk measure, also known as Expected Shortfall (ES).
ConditionalValueatRiskDistributionally Robust Conditional Value at Risk
DistributionallyRobustConditionalValueatRisk(same as conditional value at risk when used in non-traditional optimisation)Represents the Conditional Value-at-Risk Range (CVaR Range) risk measure.
ConditionalValueatRiskRangeDistributionally Robust Conditional Value at Risk Range
DistributionallyRobustConditionalValueatRiskRange(same as conditional value at risk range when used in non-traditional optimisation)Represents the Conditional Drawdown-at-Risk (CDaR) risk measure, also known as Expected Maximum Drawdown.
ConditionalDrawdownatRiskDistributionally Robust Conditional Drawdown at Risk
DistributionallyRobustConditionalDrawdownatRisk(same as conditional drawdown at risk when used in non-traditional optimisation)Represents the Entropic Value-at-Risk (EVaR) risk measure.
EntropicValueatRiskRepresents the Entropic Value-at-Risk Range (EVaR Range) risk measure.
EntropicValueatRiskRangeRepresents the Entropic Drawdown-at-Risk (EDaR) risk measure.
EntropicDrawdownatRiskRepresents the Relativistic Value-at-Risk (RVaR) risk measure.
RelativisticValueatRiskRepresents the Relativistic Value-at-Risk Range (RVaR Range) risk measure.
RelativisticValueatRiskRangeRepresents the Relativistic Drawdown-at-Risk (RLDaR) risk measure.
RelativisticDrawdownatRiskOrdered Weights Array
Risk measures
Ordered Weights Array (OWA) risk measure.
OrderedWeightsArrayOrdered Weights Array Range (OWA Range) risk measure.
OrderedWeightsArrayRange
Traditional optimisation formulations
OWA formulation that computes exact OWA weights by solving a linear programme.
ExactOrderedWeightsArrayOWA formulation that approximates OWA weights using a set of p-norm parameters.
ApproxOrderedWeightsArrayEstimator type for OWA weights using JuMP-based optimization.
OWAJuMP
One-call OWA measures
Callable OWA weight estimator for the Conditional Value at Risk (CVaR) risk measure.
OrderedWeightsArrayConditionalValueatRiskCallable OWA weight estimator for the Conditional Value at Risk Range risk measure.
OrderedWeightsArrayConditionalValueatRiskRangeCallable OWA weight estimator for the tail Gini risk measure.
OrderedWeightsArrayTailGiniCallable OWA weight estimator for the tail Gini range risk measure.
OrderedWeightsArrayTailGiniRange
Array functions
Gini Mean Difference
owa_gmdWorst Realisation
owa_wrRange
owa_rgConditional Value at Risk
owa_cvarWeighted Conditional Value at Risk
owa_wcvarConditional Value at Risk Range
owa_cvarrgWeighted Conditional Value at Risk Range
owa_wcvarrgTail Gini
owa_tgTail Gini Range
owa_tgrgLinear moments (L-moments)
Compute the linear moment weights for the linear moments convex risk measure (CRM).
owa_l_momentCompute Ordered Weights Array (OWA) linear moment convex risk measure (CRM) weights using various estimation methods.
owa_l_moment_crmL-moment combination formulations
Represents the Maximum Entropy algorithm for Ordered Weights Array (OWA) estimation.
MaximumEntropyEntropy formulation for
MaximumEntropyOWA that uses the exponential cone entropy constraint in JuMP.ExponentialConeEntropyEntropy formulation for
MaximumEntropyOWA that uses the relative entropy cone constraint in JuMP.RelativeEntropy
Represents the Minimum Squared Distance algorithm for Ordered Weights Array (OWA) estimation.
MinimumSquaredDistanceRepresents the Minimum Sum of Squares algorithm for Ordered Weights Array (OWA) estimation.
MinimumSumSquares
Represents the Average Drawdown risk measure.
AverageDrawdownRepresents the Ulcer Index risk measure.
UlcerIndexRepresents the Maximum Drawdown risk measure.
MaximumDrawdownRepresents the Brownian Distance Variance (BDVar) risk measure.
BrownianDistanceVarianceTraditional optimisation formulations
Distance matrix constraint formulations
Norm-one cone formulation for the Brownian Distance Variance optimisation constraint.
NormOneConeBrownianDistanceVarianceInequality formulation for the Brownian Distance Variance optimisation constraint.
IneqBrownianDistanceVariance
Risk formulation
Direct quadratic risk expression optimisation formulation for variance-like risk measures.
QuadRiskExprRotated second-order cone risk expression optimisation formulation for applicable risk measures.
RSOCRiskExpr
Represents the Worst Realisation risk measure.
WorstRealisationRepresents the Range risk measure.
RangeRepresents the Turnover risk measure.
TurnoverRiskMeasureRepresents the Tracking Error risk measure.
TrackingRiskMeasureNorm-one (NOC) error formulation.
L1NormSecond-order cone (SOC) norm-based error formulation.
L2NormSecond-order cone (SOC) squared norm-based error formulation.
SquaredL2NormL-p norm error estimator.
LpNormL-infinity norm (maximum absolute deviation) error estimator.
LInfNorm
Risk Tracking Risk Measure
Dependent variable-based tracking formulation.
DependentVariableTrackingIndependent variable-based tracking formulation.
IndependentVariableTracking
Represents the Power Norm Value-at-Risk (PNVaR) risk measure.
PowerNormValueatRiskRepresents the Power Norm Value-at-Risk Range (PNVaRRange) risk measure.
PowerNormValueatRiskRangeRepresents the Power Norm Drawdown-at-Risk (PNDDaR) risk measure.
PowerNormDrawdownatRiskRepresents a generic Value-at-Risk range risk measure that combines any pair of XatRisk-type measures applied to the loss and gain sides of the return distribution.
GenericValueatRiskRangeRepresents the Risk Tracking risk measure.
RiskTrackingRiskMeasureRisk measure that contributes no risk.
NoRiskRisk measure settings
Every risk measure carries a settings object saying how it enters the problem: as the objective, as a constraint with an upper bound, and with what scale.
Settings type for configuring risk measure estimators.
RiskMeasureSettingsSettings type for configuring hierarchical risk measure estimators.
HierarchicalRiskMeasureSettingsSettings type for configuring risk measures that expose a lower bound (maximisation direction).
MaxRiskMeasureSettings
Risk measures for hierarchical optimisation
These are all subtypes of HierarchicalRiskMeasure, and are only supported by hierarchical optimisation estimators.
Represents a high-order moment risk measure.
HighOrderMomentRepresents the unstandardised semi-skewness risk measure algorithm.
ThirdLowerMomentRepresents a standardised high-order moment risk measure algorithm.
StandardisedHighOrderMomentandThirdLowerMomentRepresents the unstandardised fourth moment (kurtosis or semi-kurtosis) risk measure algorithm.
FourthMomentFullMomentis used to indicate that all deviations are included in the moment estimation process.FullMomentSemiMomentis used for semi-moment estimators, where only observations below a target are considered.SemiMoment
Represents a standardised high-order moment risk measure algorithm.
StandardisedHighOrderMomentandFourthMomentFullMomentis used to indicate that all deviations are included in the moment estimation process.FullMomentSemiMomentis used for semi-moment estimators, where only observations below a target are considered.SemiMoment
Represents the Relative Drawdown-at-Risk risk measure for hierarchical optimisation.
RelativeDrawdownatRiskRepresents the Relative Conditional Drawdown-at-Risk risk measure for hierarchical optimisation.
RelativeConditionalDrawdownatRiskRepresents the Relative Entropic Drawdown-at-Risk (Relative EDaR) risk measure for hierarchical optimisation.
RelativeEntropicDrawdownatRiskRepresents the Relative Relativistic Drawdown-at-Risk (Relative RLDaR) risk measure for hierarchical optimisation.
RelativeRelativisticDrawdownatRiskRepresents the Relative Average Drawdown risk measure for hierarchical optimisation.
RelativeAverageDrawdownRepresents the Relative Ulcer Index risk measure for hierarchical optimisation.
RelativeUlcerIndexRepresents the Relative Maximum Drawdown risk measure for hierarchical optimisation.
RelativeMaximumDrawdownRepresents the Relative Power Norm Drawdown-at-Risk (Relative PNDDaR) risk measure for hierarchical optimisation.
RelativePowerNormDrawdownatRiskRepresents a risk ratio risk measure for hierarchical portfolio optimisation.
RiskRatioRepresents the Equal Risk Measure for hierarchical portfolio optimisation.
EqualRiskRepresents the Median Absolute Deviation (MAD) risk measure for hierarchical portfolio optimisation.
MedianAbsoluteDeviationComposite risk measure combining variance, skewness, and kurtosis into a single expression.
VarianceSkewKurtosisRepresents an even-order moment risk measure algorithm.
EvenMomentCallable estimator that generates OWA linear moment convex risk measure (CRM) weights for a given number of observations.
LinearMoment
Non-optimisation risk measures
These risk measures are unsuitable for optimisation because they can return negative values. However, they can be used for performance metrics.
Represents a simple mean return measure for use in non-optimisation contexts.
MeanReturnRepresents the Third Central Moment risk measure.
ThirdCentralMomentRepresents the standardised Skewness risk measure.
SkewnessReturn-based risk measure.
ExpectedReturnRatio-based risk measure.
ExpectedReturnRiskRatioRepresents a mean return to risk ratio measure.
MeanReturnRiskRatioRepresents a non-optimisation risk ratio measure.
NonOptimisationRiskRatio
Performance metrics
Compute the expected value of a risk measure.
expected_riskCompute the effective number of assets (Herfindahl-Hirschman inverse index).
number_effective_assetsRisk contribution
Compute the risk contribution of each asset to the total portfolio risk using numerical differentiation.
risk_contributionCompute the risk contribution of each factor (and the idiosyncratic component) to the total portfolio risk using a factor regression.
factor_risk_contribution
Compute the expected portfolio return using the specified return estimator.
expected_returnArithmetic
ArithmeticReturnLogarithmic
LogarithmicReturn
Compute the expected risk of a measure from a precomputed net-return series.
expected_risk_from_returnsCompute the expected risk of a risk measure over rolling windows of the returns data.
rolling_window_measureSort the successful paths in a
PopulationPredictionResultby their expected risk underr.sort_by_measureCompute the expected risk-adjusted return ratio for a portfolio.
expected_ratioandexpected_risk_ret_ratioCompute the risk-adjusted ratio information criterion (SRIC) for a portfolio.
expected_sricandexpected_risk_ret_sricCompute Brinson performance attribution aggregated per asset class [1].
brinson_attribution
Portfolio optimisation
Optimisations are implemented via optimise. Optimisations consume an estimator and return a result.
Naive
These return a NaiveOptimisationResult.
Inverse Volatility portfolio optimiser.
InverseVolatilityEqual-weighted portfolio optimiser.
EqualWeightedRandom-weighted portfolio optimiser.
RandomWeighted
Naive optimisation features
Estimator for portfolio weight bounds constraints.
WeightBoundsEstimator,UniformValues, andWeightBoundsWeight finalisers
Iteratively projects weights into the feasible region defined by weight bounds.
IterativeWeightFinaliserUses a JuMP optimisation model to enforce weight bounds.
JuMPWeightFinaliserMinimises the L1 norm of relative weight deviations when enforcing weight bounds.
RelativeErrorWeightFinaliserMinimises the L2 norm (squared) of relative weight deviations when enforcing weight bounds.
SquaredRelativeErrorWeightFinaliserMinimises the L1 norm of absolute weight deviations when enforcing weight bounds.
AbsoluteErrorWeightFinaliserMinimises the L2 norm (squared) of absolute weight deviations when enforcing weight bounds.
SquaredAbsoluteErrorWeightFinaliser
Traditional
These optimisations are implemented as JuMP problems and make use of JuMPOptimiser, which encodes all supported constraints.
Objective function optimisations
These optimisations support a variety of objective functions.
Container for configuring a JuMP solver and its settings.
SolverMain JuMP-based portfolio optimiser configuration.
JuMPOptimiserObjective functions
Minimum risk
MinimumRiskMaximum utility
MaximumUtilityMaximum return over risk ratio
MaximumRatioMaximum return
MaximumReturn
Mean-Risk portfolio optimiser.
MeanRiskandNearOptimalCenteringDefines the number of points on the efficient frontier (Pareto Front).
FrontierReturn based
Risk based
Bound spacing
FrontierBoundEstimatorPasses bound values through unchanged (identity transformation).
LinearBoundApplies a square-root transformation to bound values before enforcing them.
SquareRootBoundApplies a squaring transformation to bound values before enforcing them.
SquaredBound
Optimisation estimators
Mean-Risk
MeanRiskreturns aMeanRiskResultNear Optimal Centering
NearOptimalCenteringreturns aNearOptimalCenteringResultFactor Risk Contribution
FactorRiskContributionreturns aFactorRiskContributionResult
Near Optimal Centering formulations
NearOptimalCenteringConstrained Near Optimal Centering algorithm.
ConstrainedNearOptimalCenteringUnconstrained Near Optimal Centering algorithm.
UnconstrainedNearOptimalCenteringIntermediate result type storing the setup data for Near Optimal Centering.
NearOptimalSetup
Risk budgeting optimisations
These optimisations attempt to achieve weight values according to a risk budget vector. This vector can be provided on a per asset or per factor basis.
Budget targets
Asset-level Risk Budgeting algorithm.
AssetRiskBudgetingFromulations
Log-barrier formulation for Risk Budgeting.
LogRiskBudgetingMixed-integer formulation for Risk Budgeting.
MixedIntegerRiskBudgeting
Factor-level Risk Budgeting algorithm.
FactorRiskBudgeting
Optimisation estimators
Risk Budgeting
RiskBudgetingreturns aRiskBudgetingResultRelaxed Risk Budgeting
RelaxedRiskBudgetingreturns aRiskBudgetingResultBasic Relaxed Risk Budgeting formulation.
BasicRelaxedRiskBudgetingRegularised Relaxed Risk Budgeting formulation.
RegularisedRelaxedRiskBudgetingRegularised and penalised Relaxed Risk Budgeting formulation.
RegularisedPenalisedRelaxedRiskBudgeting
Traditional optimisation features
Abstract supertype for custom JuMP objective implementations.
CustomJuMPObjectiveAbstract supertype for custom JuMP constraint implementations.
CustomJuMPConstraintEstimator for portfolio weight bounds constraints.
WeightBoundsEstimator,UniformValues, andWeightBoundsBudget
Directionality
Long
Short
Type
Exact
Specifies the portfolio budget constraint as a closed interval
on the sum of weights. BudgetRange
Estimator for buy-in threshold portfolio constraints.
ThresholdEstimatorandThresholdDirectionality
Long
Short
Type
Asset
Estimator for constructing asset set membership matrices from asset groupings.
AssetSetsMatrixEstimator
Container for one or more linear constraint equations to be parsed and converted into constraint matrices.
LinearConstraintEstimatorandLinearConstraintEstimator type for centrality-based analysis.
CentralityEstimatorCardinality
Asset
Container for one or more linear constraint equations to be parsed and converted into constraint matrices.
LinearConstraintEstimatorandLinearConstraintSet(s)
Container for one or more linear constraint equations to be parsed and converted into constraint matrices.
LinearConstraintEstimatorandLinearConstraint
Estimator for turnover portfolio constraints.
TurnoverEstimatorandTurnoverEstimator for portfolio transaction fees constraints.
FeesEstimatorandFeesTracking error result type.
TrackingErrorEstimator for generating integer phylogeny-based constraints.
IntegerPhylogenyEstimatorandSemiDefinitePhylogenyEstimatorPortfolio returns
Arithmetic
ArithmeticReturnRepresents a box uncertainty set for risk or prior statistics in portfolio optimisation.
BoxUncertaintySet,BoxUncertaintySetAlgorithm,EllipsoidalUncertaintySet, andEllipsoidalUncertaintySetAlgorithmCustom expected returns vector
Logarithmic
LogarithmicReturn
Risk vector scalarisation
Scalariser that combines multiple risk measures using a weighted sum.
SumScalariserScalariser that selects the risk expression whose scaled value is the largest.
MaxScalariserScalariser that aggregates multiple risk measures using the log-sum-exp function.
LogSumExpScalariser
Custom constraint
Number of effective assets
Regularisation penalty
L1
L2-norm regularisation term added to the optimisation objective.
L2RegularisationLp-norm regularisation term added to the optimisation objective.
LpRegularisationL-Inf
Weight-norm constraints
Where a regularisation penalty prices a norm in the objective, these bound it instead.
L2 (
l2c)Lp (
lpc)L-Inf (
linfc)
Estimator type for normalised constant relative risk aversion (CRRA) OWA weights.
NormalisedConstantRelativeRiskAversionScalariser that selects the risk expression whose scaled value is the largest.
MinScalariser
Clustering optimisation
Clustering optimisations make use of asset relationships to either minimise the risk exposure by breaking the asset universe into subsets which are hierarchically or individually optimised.
- Base configuration for hierarchical clustering-based portfolio optimisers.
HierarchicalOptimiser
Hierarchical clustering optimisation
These optimisations minimise risk by hierarchically splitting the asset universe into subsets, computing the risk of each subset, and combining them according to their hierarchy.
Hierarchical Risk Parity
HierarchicalRiskParityreturns aHierarchicalResultHierarchical Equal Risk Contribution
HierarchicalEqualRiskContributionreturns aHierarchicalResult
Hierarchical clustering optimisation features
Estimator for portfolio weight bounds constraints.
WeightBoundsEstimator,UniformValues, andWeightBoundsEstimator for portfolio transaction fees constraints.
FeesEstimatorandFeesRisk vector scalarisation
Scalariser that combines multiple risk measures using a weighted sum.
SumScalariserScalariser that selects the risk expression whose scaled value is the largest.
MaxScalariserScalariser that aggregates multiple risk measures using the log-sum-exp function.
LogSumExpScalariser
Weight finalisers
Iteratively projects weights into the feasible region defined by weight bounds.
IterativeWeightFinaliserUses a JuMP optimisation model to enforce weight bounds.
JuMPWeightFinaliserMinimises the L1 norm of relative weight deviations when enforcing weight bounds.
RelativeErrorWeightFinaliserMinimises the L2 norm (squared) of relative weight deviations when enforcing weight bounds.
SquaredRelativeErrorWeightFinaliserMinimises the L1 norm of absolute weight deviations when enforcing weight bounds.
AbsoluteErrorWeightFinaliserMinimises the L2 norm (squared) of absolute weight deviations when enforcing weight bounds.
SquaredAbsoluteErrorWeightFinaliser
Schur complementary optimisation
Schur complementary hierarchical risk parity provides a bridge between mean variance optimisation and hierarchical risk parity by using an interpolation parameter. It converges to hierarchical risk parity, and approximates mean variance by adjusting this parameter. It uses the Schur complement to adjust the weights of a portfolio according to how much more useful information is gained by assigning more weight to a group of assets.
Schur Complementary Hierarchical Risk Parity
SchurComplementHierarchicalRiskParityreturns aSchurComplementHierarchicalRiskParityResultParameters for the Schur Complement step of SCHRP.
SchurComplementParamsMonotonic Schur Complement algorithm variant for SCHRP.
MonotonicSchurComplementNon-monotonic Schur Complement algorithm variant for SCHRP.
NonMonotonicSchurComplement
Schur complementary optimisation features
Estimator for portfolio weight bounds constraints.
WeightBoundsEstimator,UniformValues, andWeightBoundsEstimator for portfolio transaction fees constraints.
FeesEstimatorandFeesWeight finalisers
Iteratively projects weights into the feasible region defined by weight bounds.
IterativeWeightFinaliserUses a JuMP optimisation model to enforce weight bounds.
JuMPWeightFinaliserMinimises the L1 norm of relative weight deviations when enforcing weight bounds.
RelativeErrorWeightFinaliserMinimises the L2 norm (squared) of relative weight deviations when enforcing weight bounds.
SquaredRelativeErrorWeightFinaliserMinimises the L1 norm of absolute weight deviations when enforcing weight bounds.
AbsoluteErrorWeightFinaliserMinimises the L2 norm (squared) of absolute weight deviations when enforcing weight bounds.
SquaredAbsoluteErrorWeightFinaliser
Nested clusters optimisation
Nested clustered optimisation breaks the asset universe of size N into C smaller subsets and treats every subset as an individual portfolio. The weights assigned to each asset are placed in an N × C matrix. In each column, non-zero values correspond to assets assigned to that subset, this means that assets only contribute to the column (and therefore synthetic asset) corresponding to their assigned subset. In other words, each row of the matrix contains a single non-zero value and each row contains as many non-zero values as there are assets in that subset.
From here there are two options: 2. Compute the returns matrix of the synthetic assets directly by multiplying the original T × N matrix by the N × C matrix of asset weights to produce a T × C matrix of predicted returns, where T is the number of observations.
- For each subset perform a cross validation prediction, yielding a vector of returns for that subset. These vectors are then horizontally concatenated into a
Y × Cmatrix of cross-validation predicted returns, whereY ≤ Tbecause the cross validation may not use the full history.
This matrix of predicted returns is then used by the outer optimisation estimator to generate an optimisation of the synthetic assets. This produces a C × 1 vector, essentially optimising a portfolio of asset clusters. The final weights are the product of the original N × C matrix of asset weights per cluster by the C × 1 vector of optimal synthetic asset weights to produce the final N × 1 vector of asset weights.
- Nested Clustered
NestedClusteredreturns aNestedClusteredResult
Nested clusters optimisation features
Any features supported by the inner and outer estimators.
Estimator for portfolio weight bounds constraints.
WeightBoundsEstimator,UniformValues, andWeightBoundsEstimator for portfolio transaction fees constraints.
FeesEstimatorandFeesWeight finalisers
Iteratively projects weights into the feasible region defined by weight bounds.
IterativeWeightFinaliserUses a JuMP optimisation model to enforce weight bounds.
JuMPWeightFinaliserMinimises the L1 norm of relative weight deviations when enforcing weight bounds.
RelativeErrorWeightFinaliserMinimises the L2 norm (squared) of relative weight deviations when enforcing weight bounds.
SquaredRelativeErrorWeightFinaliserMinimises the L1 norm of absolute weight deviations when enforcing weight bounds.
AbsoluteErrorWeightFinaliserMinimises the L2 norm (squared) of absolute weight deviations when enforcing weight bounds.
SquaredAbsoluteErrorWeightFinaliser
Cross validation predictor for the outer estimator
Ensemble optimisation
This works similarly to the Nested Clustered estimator, only instead of breaking the asset universe into subsets, a list of inner estimators is provided. The procedure is then exactly the same as the nested clusters optimisation, only instead of an N × C matrix of asset weights where each column corresponds to a subset of assets, each column corresponds to a completely independent and isolated inner estimator, which also means there is no enforced sparsity pattern on this matrix.
- Stacking
Stackingreturns aStackingResult
Ensemble optimisation features
Any features supported by the inner and outer estimators.
Estimator for portfolio transaction fees constraints.
FeesEstimatorandFeesEstimator for portfolio weight bounds constraints.
WeightBoundsEstimator,UniformValues, andWeightBoundsWeight finalisers
Iteratively projects weights into the feasible region defined by weight bounds.
IterativeWeightFinaliserUses a JuMP optimisation model to enforce weight bounds.
JuMPWeightFinaliserMinimises the L1 norm of relative weight deviations when enforcing weight bounds.
RelativeErrorWeightFinaliserMinimises the L2 norm (squared) of relative weight deviations when enforcing weight bounds.
SquaredRelativeErrorWeightFinaliserMinimises the L1 norm of absolute weight deviations when enforcing weight bounds.
AbsoluteErrorWeightFinaliserMinimises the L2 norm (squared) of absolute weight deviations when enforcing weight bounds.
SquaredAbsoluteErrorWeightFinaliser
Cross validation predictor for the outer estimator
Subset resampling optimisation
This optimiser takes ideas from MultipleRandomised cross validation to randomly sample the asset universe and optimise each sample individually using a given optimiser. The final asset weights are the average weight per asset across all samples, if an asset does not appear in a sample, it is taken to be zero.
SubsetResamplingreturns aSubsetResamplingResult
Subset resampling optimisation features
Any features supported by the inner estimator.
Estimator for portfolio transaction fees constraints.
FeesEstimatorandFeesEstimator for portfolio weight bounds constraints.
WeightBoundsEstimator,UniformValues, andWeightBoundsWeight finalisers
Iteratively projects weights into the feasible region defined by weight bounds.
IterativeWeightFinaliserUses a JuMP optimisation model to enforce weight bounds.
JuMPWeightFinaliserMinimises the L1 norm of relative weight deviations when enforcing weight bounds.
RelativeErrorWeightFinaliserMinimises the L2 norm (squared) of relative weight deviations when enforcing weight bounds.
SquaredRelativeErrorWeightFinaliserMinimises the L1 norm of absolute weight deviations when enforcing weight bounds.
AbsoluteErrorWeightFinaliserMinimises the L2 norm (squared) of absolute weight deviations when enforcing weight bounds.
SquaredAbsoluteErrorWeightFinaliser
Finite allocation optimisation
Unlike all other estimators, finite allocation does not yield an "optimal" value, but rather the optimal attainable solution based on a finite amount of capital. They use the result of other estimations, the latest prices, and a cash amount.
Discrete Allocation portfolio optimiser.
DiscreteAllocationWeight finalisers
Iteratively projects weights into the feasible region defined by weight bounds.
IterativeWeightFinaliserUses a JuMP optimisation model to enforce weight bounds.
JuMPWeightFinaliserMinimises the L1 norm of relative weight deviations when enforcing weight bounds.
RelativeErrorWeightFinaliserMinimises the L2 norm (squared) of relative weight deviations when enforcing weight bounds.
SquaredRelativeErrorWeightFinaliserMinimises the L1 norm of absolute weight deviations when enforcing weight bounds.
AbsoluteErrorWeightFinaliserMinimises the L2 norm (squared) of absolute weight deviations when enforcing weight bounds.
SquaredAbsoluteErrorWeightFinaliser
Greedy Allocation portfolio optimiser.
GreedyAllocationProblem data fed to a finite allocation optimiser.
FiniteAllocationInput
Cross validation
Prediction on unseen data
PredictionReturnsResult,PredictionResult,MultiPeriodPredictionResult,PopulationPredictionResultviapredict(res::NonFiniteAllocationOptimisationResult, rd::ReturnsResult),fit_and_predictUnion of concrete
PredictionScorersubtypes and plain functions that score aPopulationPredictionResult.PredictionCrossValScorer,NearestQuantilePrediction, andquantile_by_measureRun cross-validated portfolio optimisation and return predictions over all folds.
cross_val_predictFit optimisation estimator
opton returns datardand immediately produce aPredictionResultfor the same data.fit_predictReturn the number of cross-validation splits (folds) that would be produced by
cvfor the given returns datard.n_splitsFind the optimal
(n_folds, n_test_folds)pair for combinatorial cross-validation by minimising a weighted cost that balances the average training size against the number of test paths.optimal_number_foldsSplit
strinto an array of substrings on occurrences of the delimiter(s)dlm.splitandfit_and_predictK-Fold
KFoldreturns aKFoldResultCombinatorial
CombinatorialCrossValidationreturns aCombinatorialCrossValidationResultWalk forward
WalkForwardEstimatorreturn aWalkForwardResult- Implements index-based walk-forward cross-validation for time series, supporting purging and flexible train/test windowing.
IndexWalkForwardandDateWalkForward
- Implements index-based walk-forward cross-validation for time series, supporting purging and flexible train/test windowing.
Multiple randomised
MultipleRandomisedreturns aMultipleRandomisedResult
Performs grid search cross-validation for portfolio optimisation estimators.
search_cross_validationPerforms grid search cross-validation for portfolio optimisation estimators.
GridSearchCrossValidationRandomised search cross-validation estimator for portfolio optimisation.
RandomisedSearchCrossValidationScoring a parameter set
CrossValidationSearchScorer- A
CrossValidationSearchScorerthat selects the parameter set with the highest mean score across cross-validation splits.HighestMeanScore
- A
Wraps a cross-validation scheme and an optional scorer to form a complete optimisation cross-validation pipeline.
OptimisationCrossValidationAbstract supertype for estimators that determine the number of random subsets to draw.
NumberSubsetsEstimatorandSubsetSizeEstimator
Pipeline
A Pipeline reifies an end-to-end workflow as data: an ordered list of steps run left-to-right over a PipelineContext, so preprocessing, priors, and the optimiser travel together as one estimator and can be cross-validated or tuned as a unit.
A reified end-to-end portfolio workflow: an ordered list of steps executed left-to-right over a
PipelineContext.PipelineandPipelineResultExplicit pipeline step wrapper — used when a step's slots or its routing intent must be stated rather than inferred.
PipelineStepThe accumulating blackboard threaded through a pipeline's steps.
PipelineContextThe mu/sigma pair held by the
uncertaintyslot of aPipelineContext.PipelineUncertaintySets
Plotting
Visualising the results is quite a useful way of summarising the portfolio characteristics or evolution. To this extent we provide a few plotting functions with more to come.
Simple or compound cumulative returns.
Plot the cumulative returns of a portfolio.
plot_portfolio_cumulative_returnsPlot the cumulative returns of individual assets, selecting the most relevant via
N.plot_asset_cumulative_returns
Portfolio composition.
Plot portfolio composition as a bar chart of asset weights.
plot_compositionMulti portfolio.
Plot portfolio composition as a stacked bar chart.
plot_stacked_bar_compositionPlot portfolio composition as a stacked area chart.
plot_stacked_area_composition
Risk contribution.
Plot per-asset risk contribution as a bar chart.
plot_risk_contributionPlot per-factor risk contribution as a bar chart, including the constant (idiosyncratic) term.
plot_factor_risk_contribution
Plot a hierarchical clustering dendrogram with coloured cluster regions.
plot_dendrogramPlot a reordered correlation/covariance heatmap with flanking dendrograms and coloured cluster boxes.
plot_clustersPlot portfolio drawdown over time.
plot_drawdownsLine plot of the rolling maximum drawdown over a sliding window.
plot_rolling_drawdownsPlot a histogram of portfolio returns with vertical risk-measure lines and an optional fitted Normal distribution.
plot_histogramScatter plot of risk/return measures across a collection of portfolio weight vectors.
plot_measuresLine plot of a risk or return measure evaluated over a rolling window of portfolio returns.
plot_rolling_measureSort a collection of portfolio results by risk (
x), connect them with a line to trace the efficient frontier, and optionally annotate the minimum-risk and maximum-score portfolios.plot_efficient_frontierBox plot of per-asset weight distributions across cross-validation folds or population members.
plot_weight_stabilityLine plot of portfolio turnover (L1 weight change) over time.
plot_turnoverOverlay portfolio cumulative returns against one or more benchmark return series from
rd.B.plot_benchmarkMoments and priors
Bar chart of per-asset expected returns (μ vector).
plot_muBar chart of per-asset volatility (√diag(Σ)).
plot_sigmaStandalone correlation (or covariance) heatmap without clustering or dendrograms.
plot_correlationHeatmap of the coskewness matrix (N × N²) from a
HighOrderPrior.plot_coskewnessEigenvalue spectrum of the cokurtosis matrix (N² × N²) from a
HighOrderPrior.plot_cokurtosisBar chart of eigenvalues of the covariance/correlation matrix, sorted in descending order.
plot_eigenspectrumThree-panel composite plot summarising a prior result:
plot_prior
Factor models
Bar chart of per-factor expected returns (the
f_muvector from a factor model prior).plot_factor_muCorrelation/covariance heatmap of the factor covariance matrix (
pr.f_sigma).plot_factor_sigmaHeatmap of the factor loadings matrix B (assets × factors) from a prior with a regression model.
plot_factor_loadings
Phylogeny
Plot the asset network (MST, PMFG, TMFG, or adjacency) as a graph using
GraphRecipes.graphplot.plot_networkBar chart of asset centrality scores, sorted in descending order.
plot_centrality
Cross validation
Bar chart of cross-validation scores (one bar per fold or population member).
plot_cv_scoresFour-panel composite plot for a walk-forward cross-validation result:
plot_cv_dashboard
Dashboards
Four-panel composite plot for a single optimisation result:
plot_portfolio_dashboardBar chart of annualised portfolio performance metrics: annualised return, annualised volatility, Sharpe ratio, Sortino ratio, Calmar ratio, maximum drawdown %, and CVaR %.
plot_performance_summary