Hierarchical Risk Parity
PortfolioOptimisers.HierarchicalRiskParity Type
struct HierarchicalRiskParity{__T_opt, __T_r, __T_sca, __T_fb} <: ClusteringOptimisationEstimatorHierarchical Risk Parity (HRP) portfolio optimiser.
HierarchicalRiskParity implements the Hierarchical Risk Parity algorithm of López de Prado (2016). It clusters assets using hierarchical clustering, then allocates weights by recursively bisecting the dendrogram and applying inverse-risk weighting within each cluster.
Fields
opt: Base hierarchical optimiser configuration (prior, clustering, bounds, fees, etc.).r: Risk measure or vector of risk measures used to define the inter-cluster risk budget.sca: Scalariser for combining multiple risk measures.fb: Fallback optimiser.
Constructors
HierarchicalRiskParity(;
opt::HierarchicalOptimiser = HierarchicalOptimiser(),
r::OptRM_VecOptRM = Variance(),
sca::Scalariser = SumScalariser(),
fb::Option{<:OptE_Opt} = nothing
) -> HierarchicalRiskParityKeywords correspond to the struct's fields.
Validation
- If
ris a vector:!isempty(r).
Examples
julia> HierarchicalRiskParity()
HierarchicalRiskParity
opt ┼ HierarchicalOptimiser
│ pe ┼ EmpiricalPrior
│ │ ce ┼ PortfolioOptimisersCovariance
│ │ │ ce ┼ Covariance
│ │ │ │ me ┼ SimpleExpectedReturns
│ │ │ │ │ w ┴ nothing
│ │ │ │ ce ┼ GeneralCovariance
│ │ │ │ │ ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)
│ │ │ │ │ w ┴ nothing
│ │ │ │ alg ┴ Full()
│ │ │ mp ┼ DenoiseDetoneAlgMatrixProcessing
│ │ │ │ pdm ┼ Posdef
│ │ │ │ │ alg ┼ UnionAll: NearestCorrelationMatrix.Newton
│ │ │ │ │ kwargs ┴ @NamedTuple{}: NamedTuple()
│ │ │ │ dn ┼ nothing
│ │ │ │ dt ┼ nothing
│ │ │ │ alg ┼ nothing
│ │ │ │ order ┴ DenoiseDetoneAlg()
│ │ me ┼ SimpleExpectedReturns
│ │ │ w ┴ nothing
│ │ horizon ┴ nothing
│ cle ┼ ClustersEstimator
│ │ ce ┼ PortfolioOptimisersCovariance
│ │ │ ce ┼ Covariance
│ │ │ │ me ┼ SimpleExpectedReturns
│ │ │ │ │ w ┴ nothing
│ │ │ │ ce ┼ GeneralCovariance
│ │ │ │ │ ce ┼ StatsBase.SimpleCovariance: StatsBase.SimpleCovariance(true)
│ │ │ │ │ w ┴ nothing
│ │ │ │ alg ┴ Full()
│ │ │ mp ┼ DenoiseDetoneAlgMatrixProcessing
│ │ │ │ pdm ┼ Posdef
│ │ │ │ │ alg ┼ UnionAll: NearestCorrelationMatrix.Newton
│ │ │ │ │ kwargs ┴ @NamedTuple{}: NamedTuple()
│ │ │ │ dn ┼ nothing
│ │ │ │ dt ┼ nothing
│ │ │ │ alg ┼ nothing
│ │ │ │ order ┴ DenoiseDetoneAlg()
│ │ de ┼ Distance
│ │ │ power ┼ nothing
│ │ │ alg ┴ CanonicalDistance()
│ │ alg ┼ HClustAlgorithm
│ │ │ linkage ┴ Symbol: :ward
│ │ onc ┼ OptimalNumberClusters
│ │ │ max_k ┼ nothing
│ │ │ alg ┼ SecondOrderDifference
│ │ │ │ alg ┼ StandardisedValue
│ │ │ │ │ mv ┼ MeanValue
│ │ │ │ │ │ w ┴ nothing
│ │ │ │ │ sv ┼ StdValue
│ │ │ │ │ │ w ┼ nothing
│ │ │ │ │ │ corrected ┴ Bool: true
│ slv ┼ nothing
│ wb ┼ WeightBounds
│ │ lb ┼ Float64: 0.0
│ │ ub ┴ Float64: 1.0
│ fees ┼ nothing
│ sets ┼ nothing
│ wf ┼ IterativeWeightFinaliser
│ │ iter ┴ Int64: 100
│ brt ┼ Bool: false
│ cle_pr ┼ Bool: true
│ strict ┴ Bool: false
r ┼ Variance
│ settings ┼ RiskMeasureSettings
│ │ scale ┼ Float64: 1.0
│ │ ub ┼ nothing
│ │ rke ┴ Bool: true
│ sigma ┼ nothing
│ chol ┼ nothing
│ rc ┼ nothing
│ alg ┴ SquaredSOCRiskExpr()
sca ┼ SumScalariser()
fb ┴ nothingRelated
PortfolioOptimisers.optimise Function
optimise(hrp::HierarchicalRiskParity{<:Any, <:Any, <:Any, <:Nothing},
rd::ReturnsResult = ReturnsResult(); dims::Int = 1, kwargs...) -> HierarchicalResultArguments
hrp: The hierarchical risk parity optimiser to use.rd: The returns result to use. Ifisa(hrp.opt.pe, AbstractPriorResult),rdis not necessary if doing a standalone optimisation, but may be required/desired by fallbacks and/or clusterisation.dims: The dimension along which observations advance in time.kwargs: Additional keyword arguments passed to the optimisation function.