Category | Badge |
---|---|
Docs | |
Examples | |
CI | |
Coverage |
PortfolioOptimiser is a library for portfolio optimisation. It was written with composability and extensibility in mind. It offers a broad range of functionality out of the box. It wraps a lot of external functionality in types for dispatch purposes and to allow easy development and extensibility.
These only apply to covariance, correlation, and cokurtosis estimators. Dissimilarity and similarity matrices use the results of correlation estimators, so they are indirectly used there.
- Local/Global parsimonious estimator (LoGo),
LoGo
.
- Nearest correlation matrix,
PosdefNearest
.
- Fixed,
DenoiseFixed
. - Spectral,
DenoiseSpectral
. - Shrink,
DenoiseShrink
.
- Simple mean,
MuSimple
. - James-Stein (JS),
JS
. - Bayes-Stein (BS),
BS
. - Bodnar-Okhrin-Parolya (BOP),
BOP
.
The JS, BS and BOP estimators also use a target for correcting their estimates.
- Grand mean (GM),
GM
. - Volatility-weighted grand mean (VW),
VW
. - Mean square error of sample mean (SE),
SE
.
- Full,
CovFull
. - Semi,
CovSemi
. - Mutual information,
CorMutualInfo
. - Brownian distance,
CorDistance
. - Lower tail dependence,
CorLTD
. - Gerber type 0,
CorGerber0
. - Gerber type 1,
CorGerber1
. - Gerber type 2,
CorGerber2
. - Smyth-Broby modification of Gerber type 0,
CorSB0
. - Smyth-Broby modification of Gerber type 1,
CorSB1
. - Smyth-Broby-Gerber modification of Gerber type 0,
CorGerberSB0
. - Smyth-Broby-Gerber modification of Gerber type 1,
CorGerberSB1
.
All covariance estimators can be used for correlation estimation.
- Spearman rank,
CorSpearman
. - Kendall rank,
CorKendall
.
- Marcos Lรณpez de Prado,
DistanceMLP
. - Marcos Lรณpez de Prado distance of distance,
DistanceSqMLP
. - Negative log,
DistanceLog
. - Variation of information,
DistanceVarInfo
.
- Exponential decay,
DBHTExp
. - Square distance from maximum,
DBHTMaxDist
.
- Knuth, require
PyCall
andastropy
to be installed,Knuth
. - Freedman, require
PyCall
andastropy
to be installed,Freedman
. - Scott, require
PyCall
andastropy
to be installed,Scott
. - Hacine-Gharbi and Ravier,
HGR
.
- Two different gap statistic,
TwoDiff
. - Standardised silhouette scores,
StdSilhouette
.
- Betweenness,
BetweennessCentrality
. - Closeness,
ClosenessCentrality
. - Degree,
DegreeCentrality
. - Eigenvector,
EigenvectorCentrality
. - Katz,
KatzCentrality
. - Pagerank,
PagerankCentrality
. - Radiality,
RadialityCentrality
. - Stress,
StressCentrality
.
- Kruskal,
KruskalTree
. - Boruvka,
BoruvkaTree
. - Prim,
PrimTree
.
-
ARCH methods, require
PyCall
andARCH
to be installed,ArchWC
.- Stationary bootstrap,
StationaryBS
. - Circular bootstrap,
CircularBS
. - Moving bootstrap,
MovingBS
.
- Stationary bootstrap,
-
Normal,
NormalWC
. -
Delta,
DeltaWC
.
- Normal,
KNormalWC
. - General,
KGeneralWC
-
p-value threshold,
PVal
. -
Model quality indicators.
-
Principal component analysis (PCA) based regression,
PCAReg
.- PCA target,
PCATarget
. - Probabilistic PCA target,
PPCATarget
.
- PCA target,
- Black Litterman,
BLType
.
- Normalised constant relative risk aversion coefficients,
CRRA
. - Maximum entropy,
MaxEntropy
. - Minimum Sum of Squares,
MinSumSq
. - Minimum Square Distance,
MinSqDist
.
These types of optimisations act on instances of Portfolio
.
Traditional, Trad
This type of optimisation is the traditional efficient frontier optimisation.
Classes, PortClass
- Arithmetic returns,
NoKelly
. - Approximate logarithmic mean returns,
AKelly
. - Exact logarithmic mean returns,
EKelly
.
- Minimum risk,
MinRisk
. - Maximum utility,
Utility
. - Maximum risk adjusted return ratio,
Sharpe
. - Maximum return,
MaxRet
.
- Maximum expected risk constraints.
- Minimum expected return constraint.
- Linear weight constraints.
- Connected asset centrality constraints.
- Asset network constraints.
- Leverage constraints.
- Maximum number of assets constraint.
- Minimum number of effective assets constraint.
- Tracking error (weights or returns) constraint.
- Turnover constraint.
- Rebalancing penalty.
-
Full dispersion.
-
Downside dispersion.
- Worst case realisation (Minimax),
WR
. - Conditional value at risk (CVaR),
CVaR
. - Entropic value at risk (EVaR),
EVaR
. - Relativistic value at risk (RLVaR),
RLVaR
. - Tail Gini,
TG
.
- Maximum drawdown (Calmar ratio) for uncompounded cumulative returns,
MDD
. - Average drawdown for uncompounded cumulative returns,
ADD
. - Ulcer index for uncompounded cumulative returns,
UCI
. - Conditional drawdown at risk for uncompounded cumulative returns (CDaR),
CDaR
. - Entropic drawdown at risk for uncompounded cumulative returns (EDaR),
EDaR
. - Relativistic drawdown at risk for uncompounded cumulative returns (RLDaR),
RLDaR
.
- L-moment ordered weight array,
OWA
.
Worst case mean variance, WC
This type of optimisation requires worst case sets for the covariance and expected returns. The optimisation uses these sets to perform a mean variance optimisation.
- Maximum expected worst case standard deviation constraint.
- Minimum expected worst case return constraint.
- Linear weight constraints.
- Connected asset centrality constraints.
- Asset network constraints.
- Leverage constraints.
- Maximum number of assets constraint.
- Minimum number of effective assets constraint.
- Tracking error (weights or returns) constraint.
- Turnover constraint.
- Rebalancing penalty.
Risk parity, RP
This type of optimisation requires a risk budget per asset or factor. The optimisation attempts to minimise the difference between the risk budget and risk contribution of the asset or factor in the optimised portfolio.
Classes, PortClass
- Minimum expected return constraint.
- Linear weight constraints.
-
Full dispersion.
-
Downside dispersion.
- Worst case realisation (Minimax),
WR
. - Conditional value at risk (CVaR),
CVaR
. - Entropic value at risk (EVaR),
EVaR
. - Relativistic value at risk (RLVaR),
RLVaR
. - Tail Gini,
TG
.
- Maximum drawdown (Calmar ratio) for uncompounded cumulative returns,
MDD
. - Average drawdown for uncompounded cumulative returns,
ADD
. - Ulcer index for uncompounded cumulative returns,
UCI
. - Conditional drawdown at risk for uncompounded cumulative returns (CDaR),
CDaR
. - Entropic drawdown at risk for uncompounded cumulative returns (EDaR),
EDaR
. - Relativistic drawdown at risk for uncompounded cumulative returns (RLDaR),
RLDaR
.
- L-moment ordered weight array,
OWA
.
Relaxed risk parity mean variance, RRP
This type of optimisation requires a risk budget per asset. The optimisation attempts to minimise the difference between the risk budget and relaxed formulation of the standard deviation risk measure.
Classes, PortClass
- Minimum expected return constraint.
- Linear weight constraints.
Near Optimal Centering, NOC
Near optimal centering utilise the weights of an optimised portfolio. It computes a region of near optimality using the bounds of the efficient frontier, the expected risk and return of the optimal portfolio, and a user-provided parameter. It then optimises for a portfolio that best describes the region. It provides more diversification and robustness than Trad
and smooths out the weight transitions as the efficient frontier is traversed.
Classes, PortClass
- Minimum expected return constraint.
- Linear weight constraints.
Classes, PortClass
- Arithmetic returns,
NoKelly
. - Approximate logarithmic mean returns,
AKelly
. - Exact logarithmic mean returns,
EKelly
.
- Maximum expected risk constraints.
- Minimum expected return constraint.
-
Full dispersion.
-
Downside dispersion.
- Worst case realisation (Minimax),
WR
. - Conditional value at risk (CVaR),
CVaR
. - Entropic value at risk (EVaR),
EVaR
. - Relativistic value at risk (RLVaR),
RLVaR
. - Tail Gini,
TG
.
- Maximum drawdown (Calmar ratio) for uncompounded cumulative returns,
MDD
. - Average drawdown for uncompounded cumulative returns,
ADD
. - Ulcer index for uncompounded cumulative returns,
UCI
. - Conditional drawdown at risk for uncompounded cumulative returns (CDaR),
CDaR
. - Entropic drawdown at risk for uncompounded cumulative returns (EDaR),
EDaR
. - Relativistic drawdown at risk for uncompounded cumulative returns (RLDaR),
RLDaR
.
- L-moment ordered weight array,
OWA
.
These types of optimisations act on instances of HCPortfolio
.
Hierarchical risk parity, HRP
Hierarchical risk parity optimisations use the hierarchical clustering of assets to assign risk contributions by iteratively splitting the dendrogram in half and assigning weights to each half according to the relative risk each half represents with respect to the other. It does this until it splits the dendrogram all the way down to single leaves.
Hierarchical equal risk parity, HERC
Hierarchical equal risk parity optimisations use the hierarchical clustering relationships between assets to assign risk contributions by splitting the dendrogram into k
clusters. It starts with the full dendrogram and progressively cuts it into k-1
levels (since the comparison for each side belongs to the k
-th level). At each step, it loops through the clusters and checks to which side of the sub-dendrogram the cluster belongs. It accumulates the risk of that cluster to the risk of the side it belongs to. The weights for the assets on each side of the dendrogram are assigned based on the relative (with respect to the other side) aggregate risk from all clusters belonging to it, these are the inter-cluster weights. It then computes the risk for each cluster, assigning weights to each asset according to the relative risk it represents with respect to other assets, these are the intra-cluster weights. It then elementwise multiplies both weights to get the final asset weights.
HERC
can make use of two risk measure arguments, one for the intra-cluster and one for the inter-cluster risk calculation. They can take linear combinations of risk measures.
- Minimum and maximum weights per asset.
-
Full dispersion.
- Variance,
Variance
. - Standard deviation,
SD
. - Mean absolute deviation (MAD),
MAD
. - Square root kurtosis,
Kurt
. - Range,
RG
. - Conditional value at risk range (CVaR range),
CVaRRG
. - Tail Gini range,
TGRG
. - Gini mean difference (GMD),
GMD
. - Quadratic negative skewness,
Skew
. - Brownian distance variance (dVar),
dVar
.
- Variance,
-
Downside dispersion.
- Worst case realisation (Minimax),
WR
. - Value at risk (VaR),
VaR
. - Conditional value at risk (CVaR),
CVaR
. - Entropic value at risk (EVaR),
EVaR
. - Relativistic value at risk (RLVaR),
RLVaR
. - Tail Gini,
TG
.
- Maximum drawdown (Calmar ratio) for uncompounded cumulative returns,
MDD
. - Average drawdown for uncompounded cumulative returns,
ADD
. - Ulcer index for uncompounded cumulative returns,
UCI
. - Drawdown at for uncompounded cumulative returns risk (DaR),
DaR
. - Conditional drawdown at risk for uncompounded cumulative returns (CDaR),
CDaR
. - Entropic drawdown at risk for uncompounded cumulative returns (EDaR),
EDaR
. - Relativistic drawdown at risk for uncompounded cumulative returns (RLDaR),
RLDaR
. - Maximum drawdown (Calmar ratio) for compounded cumulative returns,
MDD_r
. - Average drawdown for compounded cumulative returns,
ADD_r
. - Ulcer index for compounded cumulative returns,
UCI_r
. - Drawdown at for compounded cumulative returns risk (DaR),
DaR_r
. - Conditional drawdown at risk for compounded cumulative returns (CDaR),
CDaR_r
. - Entropic drawdown at risk for compounded cumulative returns (EDaR),
EDaR_r
. - Relativistic drawdown at risk for compounded cumulative returns (RLDaR),
RLDaR_r
.
- L-moment ordered weight array,
OWA
.
Nested clustered optimisation, NCO
Nested clustered optimisation combines the ideas of hierarchical equal risk parity optimisations and portfolio optimisations. They use the hierarchical clustering relationships between assets and splitting the dendrogram into k
clusters. It then treats each cluster as its own isntance of Portfolio
which is optimised in the usual way. The weights of each cluster are saved in a matrix, these are the intra-cluster weights. Then each cluster as a whole is treated as a synthetic asset, it statistics are internally computed from the fields in the NCO
type. An instance of Portfolio
is created from these synthetic assets and then optimised, these are the inter-cluster weights. The inter-cluster and intra-cluster weights are multiplied to give the asset weights.
NCO
can make use of two risk measure arguments, one for the intra-cluster and one for the inter-cluster risk calculation. They can take linear combinations of risk measures.
NCO
can take keyword arguments that define the supported by optimisations of Portfolio
. Since there are intra- and inter-cluster optimisations, it can take individual arguments for both. This means it can perform any combination of Portfolio
optimisations, except for WC
.
- Minimum risk,
MinRisk
. - Maximum utility,
Utility
. - Maximum risk adjusted return ratio,
Sharpe
. - Maximum return,
MaxRet
.
When applied to the intra-cluster optimisation the same constraint will be applied to all every cluster.
- Maximum expected risk constraints.
- Minimum expected return constraint.
- Leverage constraints.
When applied to the intra-cluster optimisation the same constraint will be applied to all every cluster.
- Minimum expected return constraint.