Unless specific geographical region requirements apply, the base URL of Portfolio Optimizer is: https://api.portfoliooptimizer.io/.

The current version number of Portfolio Optimizer is v1.

Portfolio Optimizer can be used:

Let be:

• $T$, the number of time periods
• $P_t \in \mathbb{R}^{+,*}$, the price of an asset at the time $t$, $t=1..T$

The arithmetic return $r_{t+1}$ of the asset over the period from the time $t$ to the time $t+1$, $t=1..T-1$, is defined as $$r_{t+1} = \frac{P_{t+1} - P_{t}}{P_{t}}$$

Let be:

• $T$, the number of time periods
• $P_t \in \mathbb{R}^{+,*}$, the price of an asset at the time $t$, $t=1..T$

The logarithmic return $r_{t+1}$ of the asset over the period from the time $t$ to the time $t+1$, $t=1..T-1$, is defined as $$r_{t+1} = \log P_{t+1} - \log P_{t}$$

Let be:

• $T$, the number of time periods
• $r_1,...,r_T$, the arithmetic or logarithmic return of an asset over each time period

The mean return $\overline{r}$ of the asset over the $T$ time periods is defined as the the arithmetic mean of the returns $r_1,...,r_T$, that is $$\overline{r} = \frac{1}{T} \sum_{t=1}^{T} r_t$$

Let be:

• $n$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix
• $\sigma_1,...,\sigma_n$, the asset standard deviations
• $\sigma_1^2,...,\sigma_n^2$, the asset variances

The asset covariance matrix $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$ is defined by: $$\Sigma_{i,j} = \sigma_i \sigma_j C_{i,j}, i=1..n, j=1..n$$

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $r_i = (r_{1,i},...,r_{T,i}) \in \mathbb{R}^{T}$, the arithmetic or logarithmic return of the asset $i$, $i=1..n$ over each time period $t=1..T$
• $\overline{r} = \left ( \overline{r_1}, ..., \overline{r_n} \right ) \in \mathbb{R}^n$, the average return of the assets $1..n$ over the $T$ time periods

Alternatively, Let be:

• $n$, the number of assets
• $T+1$, the number of observations of the assets' prices over a time period $0..T$
• $C_{i,t} \in \mathbb{R}^{+,*}$, the close price of the $i$-th asset at the observation time $t$, $t=0..T$
• $r_i = (r_{1,i},...,r_{T,i}) \in \mathbb{R}^{T}$, the logarithmic close-to-close return of the $i$-th asset, $i=1..n$, over each time period $t=1..T$
• $\overline{r} = \left ( \overline{r_1}, ..., \overline{r_n} \right ) \in \mathbb{R}^n$, the average return of the assets $1..n$ over the $T$ time periods

The asset empirical covariance matrix $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$ is defined by: $$\Sigma_{i,j} = \frac{1}{T} \sum_{k=1}^T (r_{k,i} - \overline{r_i}) (r_{k,j} - \overline{r_j}), i=1..n, j=1..n$$

Notes:

• The asset empirical covariance matrix is also called the asset sample covariance matrix.
• The covariance between two series of asset returns is estimated in terms of deviation from these assets average return; unfortunately, assets' average returns are notoriously difficult to estimate, so that it is possible to make the assumption $\overline{r} = 0$, which is made by default when assets' close prices are used.
• The asset empirical covariance matrix as computed by this endpoint is biaised when $\overline{r} \ne 0$.

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $r_i = (r_{1,i},...,r_{T,i}) \in \mathbb{R}^{T}$, the arithmetic or logarithmic return of the asset $i$, $i=1..n$ over each time period $t=1..T$
• $\overline{r} = \left ( \overline{r_1}, ..., \overline{r_n} \right ) \in \mathbb{R}^n$, the average return of the assets $1..n$ over the $T$ time periods
• $\lambda \in ]0,1[$ the decay factor

Alternatively, Let be:

• $n$, the number of assets
• $T+1$, the number of observations of the assets' prices over a time period $0..T$
• $C_{i,t} \in \mathbb{R}^{+,*}$, the close price of the $i$-th asset at the observation time $t$, $t=0..T$
• $r_i = (r_{1,i},...,r_{T,i}) \in \mathbb{R}^{T}$, the logarithmic close-to-close return of the $i$-th asset, $i=1..n$, over each time period $t=1..T$
• $\overline{r} = \left ( \overline{r_1}, ..., \overline{r_n} \right ) \in \mathbb{R}^n$, the average return of the assets $1..n$ over the $T$ time periods
• $\lambda \in ]0,1[$ the decay factor

The exponentially weighted asset covariance matrix $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$ is defined by: $$\Sigma_{i,j} = \frac{1 - \lambda}{1 - \lambda^{T}} \sum_{k=1}^{T} \lambda^{T-k} (r_{k,i} - \overline{r_i}) (r_{k,j} - \overline{r_j}), i=1..n, j=1..n$$

Notes:

• The decay factor $\lambda$ determines the weights applied to the returns, as well as the effective amount of time periods used in computing the covariance matrix
• The decay factor $\lambda$ can also be defined in terms of the half-life $\tau$, which is the time taken by the weights to decay by $\frac{1}{2}$, through the relationship $$\tau = -\frac{\ln 2}{\ln \lambda} \Leftrightarrow \lambda = \left ( \frac{1}{2} \right )^{\frac{1}{\tau}}$$
• The exponentially weighted covariance between two series of asset returns is estimated in terms of deviation from these assets average return; unfortunately, assets' average returns are notoriously difficult to estimate, so that it is possible to make the assumption $\overline{r} = 0$, which is made by default when assets' close prices are used.

Let $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$ be a matrix.

$\Sigma$ is an asset covariance matrix if and only if:

• $\Sigma$ is symmetric, i.e. $\Sigma {}^t = \Sigma$
• $\Sigma$ is positive semi-definite, i.e. $x {}^t \Sigma x \geqslant 0, \forall x \in\mathbb{R}^n$

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $r_i = (r_{1,i},...,r_{T,i}) \in \mathbb{R}^{T}$, the arithmetic or logarithmic return of the asset $i$, $i=1..n$ over each time period $t=1..T$
• $\overline{r} = \left ( \overline{r_1}, ..., \overline{r_n} \right ) \in \mathbb{R}^n$, the average return of the assets $1..n$ over the $T$ time periods
• $\sigma_1,...,\sigma_n$, the asset standard deviations

The asset correlation matrix $C \in \mathcal{M}(\mathbb{R}^{n \times n})$ is defined by: $$C_{i,j} = \frac{1}{T} \sum_{k=1}^T \frac{(r_{k,i} - \overline{r_i}) (r_{k,j} - \overline{r_j})}{\sigma_i \sigma_j}, i=1..n, j=1..n$$

Notes:

• The asset correlation matrix $C$ is called the asset Pearson correlation matrix.

Alternatively, let be:

• $n$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $\sigma_1,...,\sigma_n$, the asset standard deviations

The asset correlation matrix $C \in \mathcal{M}(\mathbb{R}^{n \times n})$ extracted from the asset covariance matrix $\Sigma$ is defined by: $$C_{i,j} = \frac{\Sigma_{i,j}}{\sigma_i \sigma_j}, i=1..n, j=1..n$$

Let $C \in \mathcal{M}(\mathbb{R}^{n \times n})$ be a matrix.

$C$ is an asset correlation matrix if and only if:

• $C$ is symmetric, i.e. $C {}^t = C$
• $C$ is unit diagonal, i.e. $C_{i,i} = 1, i=1..n$
• $C$ is positive semi-definite, i.e. $x {}^t C x \geqslant 0, \forall x \in\mathbb{R}^n$

Let $n$ be the number of assets and $A \in \mathcal{M} \left( \mathbb{R}^{n \times n} \right)$ be an approximate asset correlation matrix (i.e., a matrix with no specific requirements)

Let be:

• $\mathcal{S}_n = \{ X \in \mathcal{M} \left( \mathbb{R}^{n \times n} \right)$ such that $X {}^t = X$ and $X$ is semi-definite positive, that is, $x {}^t X x \geqslant 0, \forall x \in \mathbb{R}^n \}$
• $\mathcal{E}_n = \{ X \in \mathcal{M} \left( \mathbb{R}^{n \times n} \right)$ such that $X {}^t = X$ and $x_{ii} = 1, i = 1,...,n \}$

The nearest correlation matrix $C$ to the matrix $A$ is the solution of the problem: $$C = \operatorname{argmin} \left\Vert X - A \right\Vert_F \text{ s.t. } X \in S_n \cap \mathcal{E}_n$$

Notes:

• The algorithm used internally to solve the optimization problem above is an alternating projection algorithm, similar to the algorithm described in the reference, with an additional constraint on the minimum eigenvalue of the matrix $C$ about $10^{-4}$ in order to ensure that it is strictly positive definite.

• $\mathcal{N}$ the index set of the off-diagonal elements of the approximate correlation matrix $A$ that should be kept fixed
• $\mathcal{U}_n = \{ X \in \mathcal{M} \left( \mathbb{R}^{n \times n} \right)$ such that $x_{ij}=a_{ij}$ for $(i,j) \in \mathcal{N} \}$

The nearest correlation matrix $C$ to the matrix $A$, with fixed off-diagonal elements of indexes $\mathcal{N}$, is the solution of the problem: $$C = \operatorname{argmin} \left\Vert X - A \right\Vert_F \text{ s.t. }X \in S_n \cap \mathcal{E}_n \cap U_n$$

Notes:

• The algorithm used internally to solve the optimization problem above is an alternating projection algorithm, similar to the algorithm described in the reference, with an additional constraint on the minimum eigenvalue of the matrix $C$ about $10^{-4}$ in order to ensure that it is strictly positive definite.
• Depending on the set $\mathcal{N}$, the optimization problem above might not have any solution, which will typically manifest by a response time out of this endpoint.

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the mean return of the assets
• $n_p$, the number of portfolios
• $w_p \in [0,1]^{n}$, the vector of portfolio weights of the $p$-th portfolio, $p=1..n_p$

The arithmetic return of the $p$-th portfolio, $p=1..n_p$, is defined as: $$\mu {}^t w_p$$

Alternatively, let be:

• $n$, the number of assets
• $n_p$, the number of portfolios
• $T_p$, the number of time periods of the $p$-th portfolio, $p=1..n_p$
• $V_{t, p} \in \mathbb{R}^{+,*}$, the value of the $p$-th portfolio at the time $t$, $p=1..n_p$, $t=1..T_p$

The arithmetic return of the $p$-th portfolio, $p=1..n_p$, is defined as:$$\frac{V_{T_p,p} - V_{1,p}}{V_{1,p}}$$

Let be:

• $n$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $w \in [0,1]^{n}$, the vector of portfolio weights

The volatility $\sigma$ of the portfolio is defined as: $$\sigma = \sqrt{ w {}^t \Sigma w}$$

Alternatively, let be:

• $T$, the number of time periods of the portfolio
• $r = (r_{1},...,r_{T-1}) \in \mathbb{R}^{T-1}$, the arithmetic or logarithmic returns of the portfolio associated to the $T$ time periods

The volatility $\sigma$ of the portfolio is defined as the standard deviation of the returns $r$: $$\sigma = \sqrt{\frac{\sum_{t=1}^{T-1} (r_{t} - \overline{r})^2 }{T-1}}$$

, with $\overline{r}$ the average return of the portfolio.

Notes:

• In line with the second reference, the volatility of a portfolio is defined through the standard deviation and not through the sample standard deviation.

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $r_f \in \mathbb{R}$, the value of the arithmetic risk free rate
• $w \in [0,1]^{n}$, the vector of portfolio weights

The Sharpe ratio $SR$ of theportfolio is defined as: $$SR = \frac{ \mu{}^t w - r_f}{\sqrt{ w {}^t \Sigma w }}$$

Alternatively, let be:

• $T$, the number of time periods
• $V_{t} \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$
• $\overline{r}$, the average return of the portfolio
• $\sigma_p$, the volatility of the portfolio
• $r_f \in \mathbb{R}$, the value of the arithmetic risk free rate

The Sharpe ratio $SR$ of the portfolio is defined as: $$SR = \frac{\overline{r} - r_f}{\sigma_p}$$

Notes:

• The risk-free rate represents the theoretical return on an investment with zero risk
• The risk-free rate should be expressed in the same frequency as the asset returns or the portfolio values series (e.g. a monthly risk free rate in case monthly asset returns or monthly portfolio values are provided)

Let be:

• $n$, the number of assets
• $\sigma = (\sigma_1,...,\sigma_n)$ the vector of the assets standard deviation
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $w \in [0,1]^{n}$, the vector of portfolio weights

The diversification ratio $DR$ of the portfolio is defined as: $$DR = \frac{ \sigma{}^t w}{\sqrt{ w {}^t \Sigma w }}$$

Alternatively, let be:

• $n$, the number of assets
• $T$, the number of time periods
• $P_{t,i} \in \mathbb{R}^{+,*}$, the price of the asset $i$ at the time $t$, $i=1..n$, $t=1..T$
• $V_{t} \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$

The diversification ratio $DR$ of the portfolio is defined as: $$DR = \overline{DR} \; \rho_{P, \overline{P}}$$

, with

• $\overline{DR}$, the diversification ratio of the long-short most diversified portfolio computed over the universe of the $n$ assets using the covariance matrix of the assets arithmetic returns
• $\overline{P}_{t,i} \in \mathbb{R}^{+,*}$, the value of the long-short most diversified portfolio at the time $t$, $t=1..T$
• $\rho_{P, \overline{P}}$, the correlation between the arithmetic returns of the portfolio and the arithmetic returns of the long-short most diversified portfolio

Notes:

• The second formulation allows to compute the (realized) diversification ratio of a portfolio with unknown composition in terms of asset weights, but in this case, it might happen that the diversification ratio of the portfolio is lower than 1. If so, this either means that the portfolio is not long-only or that the portfolio is invested in other assets than the assets for which prices are provided.
• The second formulation makes the assumption that the portfolio and the long-short most diversified portfolio are constantly rebalanced to maintain their respective assets weights.

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $w \in [0,1]^{n}$, the vector of portfolio weights

The return contribution of the $i$-th asset to the return of the portfolio, $i=1..n$, is defined as: $$w_{i} \mu_i$$

• $n_k$, the optional number of groups of assets
• $\mathcal{N}_1,...,\mathcal{N}_{n_k}$ the optional $n_k$ groups of assets

The return contribution of the group of assets $\mathcal{N}_k$ to the return of the portfolio, $k=1..n_k$, is defined as: $$\sum_{j \in \mathcal{N}_k} w_{j} \mu_j$$

Notes:

• Return contribution analysis is also known as absolute return attribution analysis, because there is no reference to a benchmark
• In contribution analysis, a group of assets is also known as a segment, and is usually made of assets sharing common characteristics such as the asset class, the country, the industrial sector, etc.

Let be:

• $n$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $w \in [0,1]^{n}$, the vector of portfolio weights
• $\sigma(w) = \sqrt{ w^t \Sigma w }$, the standard deviation of the portfolio returns, that is, the portfolio volatility

The marginal contribution to risk $MCTR_i(w)$ of the $i$-th asset, $i=1..n$, to the risk of the portfolio $\sigma(w)$ is defined as: $$MCTR_i(w) = \frac{(\Sigma w)_i}{\sqrt{w {}^t \Sigma w}}$$

The total contribution to risk $TCTR_i(w)$ of the $i$-th asset, $i=1..n$, to the risk of the portfolio $\sigma(w)$ is defined as: $$TCTR_i(w) = w_{i} MCTR_i(w)$$

• $n_k$, the optional number of groups of assets
• $\mathcal{N}_1,...,\mathcal{N}_{n_k}$ the optional $n_k$ groups of assets

The total contribution to risk $TCTR_{\mathcal{N}_k}(w)$ of the $k$-th group of assets $\mathcal{N}_k$, $k=1..n_k$, to the risk of the portfolio $\sigma(w)$ is defined as: $$TCTR_{\mathcal{N}_k}(w) = \sum_{j \in \mathcal{N}_k} w_{j} \frac{(\Sigma w)_j}{\sqrt{w {}^t \Sigma w}}$$

The marginal contribution to risk $MCTR_{\mathcal{N}_k}(w)$ of the $k$-th group of assets $\mathcal{N}_k$, $k=1..n_k$, to the risk of the portfolio $\sigma(w)$ is defined by the relationship: $$TCTR_{\mathcal{N}_k}(w) = \left( \sum_{j \in \mathcal{N}_k} w_{j} \right) MCTR_{\mathcal{N}_k}(w)$$

Notes:

• The risk of the portfolio is defined in terms of portfolio volatility
• The risk of the portfolio $\sigma(w)$ is the sum of the total contributions to risk $TCTR_i(w)$, $i=1..n$
• The total contributions to risk $TCTR_i(w)$, $i=1..n$, are also known as total risk contributions
• In contribution analysis, a group of assets is also known as a segment, and is usually made of assets sharing common characteristics such as the asset class, the country, the industrial sector, etc.

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The continuous mean-variance efficient frontier is the (infinite) set of portfolios whose weights $w \in [0,1]^{n}$ satisfy: $$w = \operatorname{argmin} \frac{1}{2} w {}^t \Sigma w - \lambda \mu {}^t w \newline \textrm{s.t. } \begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$ with $\lambda$ a parameter varying in $[0, +\infty[$.

• $n_p$, the number of portfolios to compute on the mean-variance efficient frontier

The discretized mean-variance efficient frontier is the (finite) set of $n_p$ portfolios belonging to the continuous mean-variance efficient frontier with equally spaced arithmetic returns.

Notes:

• The parameter $\lambda$ is usually called the risk tolerance parameter, and its inverse $1/\lambda$ is usually called the risk aversion parameter

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The continuous mean-variance minimum variance frontier is the (infinite) set of portfolios whose weights $w \in [0,1]^{n}$ satisfy: $$w = \operatorname{argmin} \frac{1}{2} w {}^t \Sigma w - \lambda \mu {}^t w \newline \textrm{s.t. } \begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$ with $\lambda$ a parameter varying in $]-\infty, +\infty[$.

• $n_p$, the number of portfolios to compute on the mean-variance minimum variance frontier

The discretized mean-variance minimum variance frontier is the (finite) set of $n_p$ portfolios belonging to the continuous mean-variance minimum variance frontier with equally spaced arithmetic returns.

Notes:

• The parameter $\lambda$ is usually called the risk tolerance parameter, and its inverse $1/\lambda$ is usually called the risk aversion parameter

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\mu_l \in \mathbb{R}^{n}$ and $\mu_u \in \mathbb{R}^{n}$ such that $(\mu_l)_i \leq \mu_i \leq (\mu_u)_i$, $i=1..n$, two vectors representing uncertainty intervals around the asset arithmetic returns
• $\sigma = \left(\sigma_1,...,\sigma_n\right) \in \mathbb{R}^{n}$, the asset standard deviations
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix with $\Sigma = Diag(\sigma) C Diag(\sigma)$
• $\sigma_l \in \mathbb{R}^{n}$ and $\sigma_u \in \mathbb{R}^{n}$ such that $(\sigma_l)_i \leq \sigma_i \leq (\sigma_u)_i$, $i=1..n$, two vectors representing uncertainty intervals around the asset standard deviations
• $\delta \in [0, 2]$, representing the uncertainty level around the asset correlations
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

• $n_p$, the number of portfolios to compute on the resampling-based mean-variance efficient frontier

The discretized resampling-based mean-variance efficient frontier is computed through the following procedure:

1. Determine the number of efficient frontiers to simulate $n_B$, with $n_B \ge 1$
2. For $b = 1..n_B$ do:
1. Generate a vector of asset arithmetic returns $\mu' \in \mathbb{R}^{n}$ uniformly at random over the $n$-dimensional box $\left[(\mu_l)_1, (\mu_u)_1\right] \times ... \times \left[(\mu_l)_n, (\mu_u)_n\right]$
2. Generate a vector of asset standard deviations $\sigma' \in \mathbb{R}^{n}$ uniformly at random over the $n$-dimensional box $\left[(\sigma_l)_1, (\sigma_u)_1\right] \times ... \times \left[(\sigma_l)_n, (\sigma_u)_n\right]$
3. Generate an asset correlation matrix $C' \in \mathcal{M}(\mathbb{R}^{n \times n})$ asymptotically uniformly at random over the space of positive definite correlation matrices whose distance in terms of max norm to $C$ is at most equal to $\delta$
4. Generate an asset covariance matrix $\Sigma'\in \mathcal{M}(\mathbb{R}^{n \times n})$ with $\Sigma' = Diag(\sigma') C' Diag(\sigma')$
5. Compute the mean-variance efficient frontier associated to the asset arithmetic returns $\mu'$ and covariance matrix $\Sigma'$, taking into account the applicable constraints
6. Discretize the computed efficient frontier into a (finite) set of portfolios:
• If the discretization is based on the portfolio returns (return rank-association), the computed efficient frontier is discretized into $n_p$ portfolios with equally spaced arithmetic returns
• If the discretization is based on the risk tolerance parameter ($\lambda$-association) (default), the computed efficient frontier is discretized into an automatically determined number of portfolios
3. Aggregate the portfolios belonging to each of the $n_B$ efficient frontiers into $n_p$ aggregated portfolios:
• If the discretization is based on the portfolio returns (return rank-association), the weights of the $r$-th aggregated portfolio are obtained by averaging the weights of each of the $r$-th return ranked portfolio over the $n_B$ efficient frontiers, $r = 1..n_p$
• If the discretization is based on the risk tolerance parameter ($\lambda$-association) (default), the weights of the $r$-th aggregated portfolio are obtained by averaging the weights of each mean-variance efficient portfolio belonging to each of the $n_B$ efficient frontiers with a target return automatically determined so as to result in $n_p$ aggregated portfolios with equally spaced arithmetic returns

Notes:

• The resampling method as described above is a mix of the resampling method described in the first and the second references.
• The procedure used to generate the asset correlation matrix $C'$ is the same procedure as in the endpoint Perturbed Correlation Matrix
• In case there is no uncertainty around the $i$-th asset arithmetic return $\mu_i$ (resp. standard deviation $\sigma_i$), it is possible to set $(\mu_l)_i = (\mu_u)_i = \mu_i$ (resp. $(\sigma_l)_i = (\sigma_u)_i = \sigma_i$); similarly, in case there is no uncertainty around the asset correlations, it is possible to set $\delta = 0$
• It is possible to aggregate the portfolios belonging to each of the $n_B$ efficient frontiers by using a robust location estimator - the geometric median - instead of the average; this procedure is described in Peter Bühlmann, Bagging, Subagging and Bragging for Improving some Prediction Algorithms.

Let be:

• $n$, the number of assets
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

A random portfolio is a portfolio whose asset weights $w \in [0,1]^{n}$ are generated at random and satisfy: $$\begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_{i} \leqslant w_{max} \end{cases}$$

Notes:

• Random portfolios are generated uniformly at random in case there are no constraints apart from exposure constraints and approximately uniformly at random otherwise

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $P_{t,i} \in \mathbb{R}^{+,*}$, the price of the asset $i$ at the time $t$, $i=1..n$, $t=1..T$
• $w_i \in [0,1]^{n}$, a vector of initial portfolio asset weights generated at random
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The evolution of the value of a random portfolio over time is defined as the portfolio values $V_{t} \in \mathbb{R}^{+,*}$, $t=1..T$, simulated from:

• An initial portfolio of value $V_1 = 100$ invested in the $n$ assets in proportion to their respective initial weights $w_i$
• A portfolio rebalancing method

Notes:

• Random portfolios are generated uniformly at random in case there are no constraints apart from exposure constraints and approximately uniformly at random otherwise
• There are 3 possible choices for the portfolio rebalancing method:
• No portfolio rebalancing - Buy and hold (default)
• Continuous portfolio rebalancing - At each time $t=2..T$, rebalancing toward the portfolio invested in the $n$ assets in proportion to their respective initial weights $w_i$
• Random portfolio rebalancing - At each time $t=2..T$, rebalancing toward the portfolio invested in the $n$ assets in proportion to their respective weights $w_t$, with $w_t \in [0,1]^{n}$ a vector of portfolio weights generated at random

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $P_{t,i} \in \mathbb{R}^{+,*}$, the price of the asset $i$ at the time $t$, $i=1..n$, $t=1..T$
• $w \in [0,1]^{n}$, the vector of the portfolio asset weights

The evolution of the value of the portfolio over time is defined as the portfolio values $V_{t} \in \mathbb{R}^{+,*}$, $t=1..T$, simulated from:

• An initial portfolio of value $V_1 = 100$ invested in the $n$ assets in proportion to their respective weights $w$
• A portfolio rebalancing method

Notes:

• There are 3 possible choices for the portfolio rebalancing method:
• No portfolio rebalancing - Buy and hold (default)
• Continuous portfolio rebalancing - At each time $t=2..T$, rebalancing toward the portfolio invested in the $n$ assets in proportion to their respective weights $w$
• Threshold-based portfolio rebalancing - At each time $t=2..T$, if the current portfolio asset weights $w_t \in [0,1]^{n}$ are too "distant" - w.r.t. a threshold $thresh \geq 0$ - from the portfolio asset weights $w$, rebalancing toward the portfolio invested in the $n$ assets in proportion to their respective weights $w$
• There are 3 possible choices for the interpretation of the threshold $thresh$ when the portfolio rebalancing method is threshold-based:
• Absolute threshold - Portfolio rebalancing occurs when one asset $i \in [1..n]$ satisfies $w_{t,i} < w_i - thresh$ or $w_{t,i} > w + thresh$, c.f. the first reference (default)
• Relative threshold - Portfolio rebalancing occurs when one asset $i \in [1..n]$ satisfies $w_{t,i} < w_i (1 - thresh)$ or $w_{t,i} > w (1 + thresh)$, c.f. the second reference
• Turnover threshold - Portfolio rebalancing occurs when the turnover distance $\frac{1}{2} \left\Vert w_t - w \right\Vert_1$ satisfies $\frac{1}{2} \left\Vert w_t - w \right\Vert_1 > thresh$

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $X \in \mathbb{R}^{T \times n}$, the matrix of the arithmetic returns of the assets for each of the $T$ time periods
• $r_b \in \mathbb{R}^{T}$, the arithmetic returns of the benchmark for each of the $T$ time periods
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The index-tracking portfolio weights $w \in [0,1]^{n}$ satisfy: $$w = \operatorname{argmin} \frac{1}{T} \lVert X w - r_b \rVert_2^2 \newline \textrm{s.t. } \begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$

Notes:

• The performance measure minimized above is called the empirical tracking error

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $X \in \mathcal{R}^{T \times n}$, the matrix of the arithmetic returns of the assets for each of the $T$ time periods
• $r_b \in \mathbb{R}^{T}$, the arithmetic returns of the benchmark for each of the $T$ time periods
• $n_{max}$, the optional maximum number of assets present in the portfolio
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The sparse index-tracking portfolio weights $w \in [0,1]^{n}$ satisfy: $$w \approx \operatorname{argmin} \frac{1}{T} \lVert X w - r_b \rVert_2^2 \newline \textrm{s.t. } \begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \newline \lvert \{ i=1..n, w_i \ne 0 \} \rvert \le n_{max} \end{cases}$$

Notes:

• The performance measure minimized above is called the empirical tracking error
• This endpoint is similar to the Index Tracking Portfolio endpoint, except that an additional constraint on the number of assets present in the portfolio can be imposed; in the absence of such constraint, a different portfolio is computed by both endpoints
• Due to the nature of the underlying mathematical problem, which is NP-hard c.f. the second reference, the computed portfolio is not guaranteed to be a portfolio which minimizes the empirical tracking error

Let be:

• $n$, the number of assets

The equal-weighted portfolio weights $w \in [0,1]^{n}$ satisfy: $$w_i = \frac{1}{n}, i=1..n$$

Let be:

• $n$, the number of assets
• $\sigma_1^2,...,\sigma_n^2$, the assets variances

The inverse variance-weighted portfolio weights $w \in [0,1]^{n}$ satisfy: $$w_i = \frac{1/\sigma_i^2}{\sum_{j=1}^{n} 1/\sigma_j^2}, i=1..n$$

Let be:

• $n$, the number of assets
• $\sigma_1,...,\sigma_n$, the assets volatilities

The inverse volatility-weighted portfolio weights $w \in [0,1]^{n}$ satisfy: $$w_i = \frac{1/\sigma_i}{\sum_{j=1}^{n} 1/\sigma_j}, i=1..n$$

Notes:

• The inverse volatility-weighted portfolio is also known as the naive-risk parity portfolio

Let be:

• $n$, the number of assets
• $mktcap_1,...,mktcap_n$ the assets market capitalizations

The market capitalization-weighted portfolio weights $w \in [0,1]^{n}$ satisfy: $$w_i = \frac{mktcap_i}{\sum_{j=1}^{n} mktcap_j}, i=1..n$$

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $r_f \in \mathbb{R}$, the value of the arithmetic risk free rate

The equal Sharpe ratio contributions portfolio weights $w \in [0,1]^{n}$ satisfy:

• $\forall i,j$ such that $\mu_i - r_f > 0$ and $\mu_j - r_f > 0$ $$w_i \frac{\mu_i - r_f}{\sqrt{ w {}^t \Sigma w}} = w_j \frac{\mu_j - r_f}{\sqrt{ w {}^t \Sigma w}}$$
• $\forall i$ such that $\mu_i - r_f \leq 0$ $$w_i = 0$$

Notes:

• The risk-free rate represents the theoretical return on an investment with zero risk
• The risk-free rate should be expressed in the same frequency as the asset returns (e.g. a monthly risk free rate in case monthly asset returns are provided)

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The maximum return portfolio weights $w^* \in [0,1]^{n}$ satisfy: $$w^* = \operatorname{argmax} w {}^t \mu \newline \textrm{s.t. } \begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$

Notes:

• If some assets have identical returns, the maximum return portfolio will usually not be unique
• If some assets have identical returns, the maximum return portfolio will usually not be mean-variance efficient; in order to enforce mean-variance efficiency, it is possible to provide the asset covariance matrix $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$

Let be:

• $n$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The minimum variance portfolio weights $w^* \in [0,1]^{n}$ satisfy: $$w^* = \operatorname{argmin} w {}^t \Sigma w \newline \textrm{s.t. } \begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$

Notes:

• If the asset covariance matrix is not positive definite, the minimum variance portfolio will usually not be unique
• If the asset covariance matrix is not positive definite, the minimum variance portfolio will usually not be mean-variance efficient; in order to enforce mean-variance efficiency, it is possible to provide the asset arithmetic returns $\mu \in \mathbb{R}^{n}$

Let be:

• $n$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights

The equal risk contributions portfolio weights $w^* \in [0,1]^{n}$ satisfy: $$w^* = \operatorname{argmin} \sqrt{ w {}^t \Sigma w} - \frac{\lambda}{n} \sum_{i=1}^{n} \ln(w_i) \newline \textrm{s.t. }l \leqslant w \leqslant u$$ with $\lambda \in \mathbb{R}^{+,*}$ a parameter to be determined such that $\sum_{i=1}^{n} w_i = 1$.

Notes:

• In case asset weights constraints $l$ or $u$ are provided, such a $\lambda$ might not exist, in which case the optimization problem is not feasible and the vector $w$ is undefined

Let be:

• $n$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $\mathcal{N}_1,...,\mathcal{N}_{k}$ $k$ groups of assets, representing a partition of the $n$ assets
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights

The clustering-based equal risk contributions portfolio weights $w^* \in [0,1]^{n}$ are computed through the following procedure:

1. For $i = 1..k$ do
1. Compute the weights $w_{i}^* \in [0,1]^{n}$ of the equal risk contributions portfolio within each group of assets $\mathcal{N}_{i}$, without taking into account asset weight constraints
2. Compute the weights $w_c^* \in [0,1]^{k}$ of the equal risk contributions portfolio across all groups of assets $\mathcal{N}_1,...,\mathcal{N}_{k}$ - each considered as a synthetic asset whose weights in terms of the original assets are $w_{i}^*$, $i=1..k$ -, taking into account asset weight constraints
3. Compute the weights $w^*$ as the matrix-vector product $$w^* = \begin{pmatrix} w_1^* \\ w_2^* \\ ... \\ w_k^* \end{pmatrix}^t w_c^*$$

Notes:

• The clustering-based equal risk contributions portfolio is also called the cluster risk parity portfolio

Let be:

• $n$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The maximum decorrelation portfolio weights $w^* \in [0,1]^{n}$ satisfy: $$w^* = \operatorname{argmax} 1 - w {}^t C w \newline \textrm{s.t. } \begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $r_f \in \mathbb{R}$, the value of the arithmetic risk free rate
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The maximum Sharpe ratio portfolio weights $w^* \in [0,1]^{n}$ satisfy: $$w^* = \operatorname{argmax} \frac{w {}^t \mu - r_f }{\sqrt{ w {}^t \Sigma w}} \newline \textrm{s.t. } \begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$

Notes:

• The risk-free rate represents the theoretical return on an investment with zero risk
• The risk-free rate should be expressed in the same frequency as the asset returns (e.g. a monthly risk free rate in case monthly asset returns are provided)
• The maximum Sharpe ratio portfolio is mean-variance efficient

Let be:

• $n$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix
• $\sigma_1,...,\sigma_n$, the assets volatilities

The minimum correlation portfolio is a portfolio where the assets are weighted proportionally to their average correlation with each other.

In more details:

• The correlation matrix of the assets $C$ is converted to an adjusted correlation matrix $C'$ that does not have negative values, penalizing high correlation and rewarding low correlation
• The assets that act as portfolio diversifiers are then initially weighted more heavily than the others, using the adjusted correlation matrix $C'$
• The initial weights are then normalized by the assets inverse volatilities $1/\sigma_i, i=1..n$, to ensure that each asset contributes to the same level of portfolio risk

Let be:

• $n$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The most diversified portfolio weights $w^* \in [0,1]^{n}$ satisfy: $$w^* = \operatorname{argmax} \frac{w {}^t \sigma }{\sqrt{ w {}^t \Sigma w}} \newline \textrm{s.t. } \begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

A mean-variance efficient portfolio is a portfolio whose weights $w^* \in [0,1]^{n}$ satisfy: $$\exists \lambda \in [0, +\infty[, w^* = \operatorname{argmin} \frac{1}{2} w {}^t \Sigma w - \lambda \mu {}^t w \newline \textrm{s.t. } \begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$

The parameter $\lambda$ is usually called the risk tolerance parameter, and is uniquely determined by an additional constraint on the portfolio:

• A return constraint $r_c$, in which case $\lambda$, if it exists, is determined such that the portfolio has a return equal to $r_c$
• A volatility constraint $v_c \geq 0$, in which case $\lambda$, if it exists, is determined such that the portfolio has a volatility equal to $v_c$
• A maximum volatility constraint $mv_c \geq 0$, in which case $\lambda$, if it exists, is determined such that the portfolio has the highest volatility lower than or equal to $mv_c$
• A risk tolerance constraint $\lambda_c \geq 0$, in which case $\lambda$ always exist and is equal to $\lambda_c$

Notes:

• The parameter $1/\lambda$ is usually called the risk aversion parameter

Let be:

• $n$, the number of assets
• $w_t \in [0,1]^{n}$, the desired portfolio weights, with $\sum_{i=1}^{n} w_{t,i} = 1$
• $TV$, the desired portfolio monetary value
• $P_1,...,P_n$, the prices of the assets $1,...,n$
• $nl_1,...,nl_n$, the number of shares by which to purchase the assets $1,...,n$
• $ml_1,...,ml_n$, the minimum number of shares to purchase for the assets $1,...,n$
• $mv_1,...,mv_n$, the minimum monetary amount to purchase for the assets $1,...,n$

The investable portfolio weights $w \in [0,1]^{n}$ closest to the desired portfolio weights $w_t$ satisfy: $$w = \operatorname{argmin} \frac{1}{2} \lVert w - w_t \rVert_2^2 \newline \textrm{s.t. } \begin{cases} \sum_{i=1}^{n} w_i \leq 1 \newline w_i = \frac{k_i nl_i P_i}{TV}, k_i \in \mathbb{N}, i=1,...,n \newline k_i \neq 0 \implies k_i nl_i \geq ml_i, i=1,...,n \newline k_i \neq 0 \implies k_i nl_i P_i \geq mv_i, i=1,...,n \end{cases}$$

Unfortunately, the above optimization problem is computationally intractable due to the integer constraints, so that it is only possible to compute an approximate solution.

Notes:

• In case the desired portfolio weights $w_t$ do not satisfy $\sum_{i=1}^{n} w_{t,i} = 1$, the optimization problem above is reformulated to try to best accommodate the situation
• In case at least one group of assets is present, the investable portfolio weights $w \in [0,1]^{n}$ satisfy a more complex optimization problem than above, additionally involving:
• An assets groups matrix that identifies the membership of each asset within each assets group
• The desired portfolio groups weights
• The desired portfolio maximum groups weights
• In case at least one group of assets is present and the desired asset weights, assets groups weights and maximum assets groups weights are incompatible, the optimization problem above is reformulated to try to best accommodate the situation

Let be:

• $n$, the number of assets
• $w^* \in [0,1]^{n}$, the original portfolio weights with $\sum_{i=1}^{n} w_i^* = 1$
• $inc \in ]0,1]$, the desired post-processed portfolio weight increment, in percentage
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The post-processed portfolio weights $w^{**}$ with rounding increment $inc$ satisfy: $$w^{**} = \operatorname{argmin} \lVert w - w^* \rVert_{\infty} \newline \textrm{s.t. } \begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \newline w_i = k_i inc, k_i \in \mathbb{N}, i=1..n \end{cases}$$

Notes:

• In case the original portfolio weights $w$ do not satisfy $\sum_{i=1}^{n} w_i = 1$, an error is returned by this endpoint.
• In case the different constraints are infeasible, an error is returned by this endpoint.
• Typical values for the post-processed portfolio weight increment $inc$ are 0.01 (= increments of 1%) (default) or 0.05 (= increments of 5%).

Let be:

The empirical tracking error $ETE$ of the portfolio is defined as the mean of the squared differences between the returns of the portfolio and the returns of the benchmark over the $T$ time periods: $$ETE = \frac{1}{T} \sum_{t=1}^{T} \left( r_{b,t} - r_{t} \right)^2$$

Alternatively, let be:

• $n$, the number of assets
• $T$, the number of time periods
• $r_b = (r_{b,1},...,r_{b,T}) \in \mathbb{R}^{T}$, the arithmetic returns of the benchmark
• $X \in \mathcal{R}^{T \times n}$, the matrix of the arithmetic returns of the $n$ assets for each of the $T$ time periods
• $w \in \mathbb{R}^{n}$, the vector of portfolio weights

The empirical tracking error $ETE$ of the portfolio of weights $w$ is defined as the mean of the squared differences between the returns of the portfolio and the returns of the benchmark over the $T$ time periods: $$ETE = \frac{1}{T} \lVert X w - r_b \rVert_2^2$$

Notes:

• The empirical tracking error is also called the mean squared tracking error
• The tracking error is sometimes defined differently in the literature, for example in lieu of the tracking error variance

Let be:

• $T$, the number of time periods
• $r_b = (r_{b,1},...,r_{b,T}) \in \mathbb{R}^{T}$, the arithmetic returns of the benchmark over each time period $t=1..T$
• $r = (r_{1},...,r_{T}) \in \mathbb{R}^{T}$, the arithmetic returns of the portfolio over each time period $t=1..T$

The tracking error variance $TEV$ of the portfolio is defined as the variance of the differences between the returns of the portfolio and the returns of the benchmark over the $T$ time periods: $$TEV = \frac{1}{T} \sum_{t=1}^{T} \left( \left( r_{b,t} - r_{t} \right) - \left( \mu_{r_b} - \mu_{r} \right) \right)^2$$, with $\mu_{r_b} = \frac{1}{T} \sum_{t=1}^T r_{b,t}$ and $\mu_{r} = \frac{1}{T} \sum_{t=1}^T r_{t}$.

Alternatively, let be:

• $n$, the number of assets
• $T$, the number of time periods
• $r_b = (r_{b,1},...,r_{b,T}) \in \mathbb{R}^{T}$, the arithmetic returns of the benchmark
• $X \in \mathbb{R}^{T \times n}$, the matrix of the arithmetic returns of the $n$ assets for each of the $T$ time periods
• $w \in \mathbb{R}^{n}$, the vector of portfolio weights

The tracking error variance $TEV$ of the portfolio of weights $w$ is defined as the variance of the differences between the returns of the portfolio and the returns of the benchmark over the $T$ time periods: $$TEV = Var \left( \sum_{i=1}^n w_i X_{i,1} - r_{b,1}, ..., \sum_{i=1}^n w_i X_{i,T} - r_{b,T} \right)$$

Let be:

• $m$, the number of factors
• $T$, the number of time periods
• $X \in \mathbb{R}^{m \times T}$, the matrix of the factors returns

The returns $R_{res, i} \in \mathbb{R}^{T}$ of the residualized factor $i \in {1..m}$ are defined as: $$R_{res, i} {}^t = X_i - \alpha - \beta {}^t X_{-i}$$ where:

• $X_i$ represents the row $i$ of the matrix $X$
• $X_{-i}$ represents the matrix $X$ after removing the row $i$
• $(\alpha, \beta)$ is the unique solution of minimum euclidean norm of the linear least squares problem $$\operatorname{argmin_{(\alpha \in \mathbb{R}, \beta \in \mathbb{R}^{m})}} \lVert X_i - \alpha - \beta {}^t X_{-i} \rVert_2^2$$

Let be:

• $T$, the number of time periods
• $r_p = (r_{p,1},...,r_{p,T}) \in \mathbb{R}^{T}$, the returns of the portfolio
• $m$, the number of factors
• $r_{F_i} = (r_{{F_i},1},...,r_{{F_i},T})\in \mathbb{R}^{T}$, $i=1..m$, the returns of the $m$ factors $F_1,...,F_m$

The exposures of the portfolio to the $m$ factors $F_1,...,F_m$ are defined as the coefficients $\beta_1, ..., \beta_m \in \mathbb{R}$ in the linear regression equation: $$r_p = \alpha + \sum_{i=1}^m \beta_i r_{F_i} + \epsilon$$, where $\epsilon \in \mathbb{R}^{T}$ is an error term.

Notes:

• The coefficient $\alpha$ represents the portion of the portfolio returns that cannot be attributed to the portfolio exposure to the $m$ factors
• The coefficients $\beta_1, ..., \beta_m$ represent the magnitude of the portfolio exposure to each of the $m$ factors
• The coefficients $\alpha, \beta_1, ..., \beta_m$ are estimated through the resolution of the linear least squares problem $$\operatorname{argmin_{(\alpha \in \mathbb{R}, \beta \in \mathbb{R}^{m})}} \lVert r_p - \alpha - \sum_{i=1}^m \beta_i r_{F_i} \rVert_2^2$$
• There are 2 possible choices for the source of the factor returns:
• External factor model - The number of factors $m$ and their returns are provided
• Internal factor model - The number of factors $m$ and their returns are selected from one of the following public factor models:
• Fama-French equity factor models (returns calendar frequency: end-of-month monthly, returns currency: USD):
• The capital asset pricing model, using the Fama-French market factor (MKT-RF)
• The Fama-French three factor model, using the Fama-French market, size and value factors (MKT-RF, SMB, HML)
• The Fama-French-Carhart four factor model, using the Fama-French market, size, value, and momentum factors (MKT-RF, SMB, HML, MOM or WML depending on the region)
• The Fama-French five factor model, using the Fama-French market, size, value, profitability and investment factors (MKT-RF, SMB5, HML, RMW, CMA)
• In case an internal factor model is used
• The associated risk free rate series is automatically substracted from the portfolio returns series $r_p$, so that $r_p$ becomes the returns of the portfolio in excess of that factor model risk free rate
• The portfolio returns $r_p$ must be consistent with both the internal factor model returns calendar frequency (usually end-of-month monthly) and returns currency (usually USD)

Let be:

• $T$, the number of time periods
• $r_p = (r_{p,1},...,r_{p,T}) \in \mathbb{R}^{T}$, the returns of the portfolio
• $r_b = (r_{b,1},...,r_{b,T}) \in \mathbb{R}^{T}$, the returns of the benchmark
• $r_f = (r_{f,1},...,r_{f,T})\in \mathbb{R}^{T}$, the risk free returns

The Jensen's alpha $\alpha \in \mathbb{R}$ of the portfolio is defined as the intercept of the regression equation in the Capital Asset Pricing Model: $$r_p - r_f = \alpha + \beta \left( r_b - r_f \right) + \epsilon$$, where $\epsilon \in \mathbb{R}^{T}$ is an error term.

Notes:

• The Jensen's alpha $\alpha$ of the portfolio corresponds to the excess return of the portfolio adjusted for its systematic risk.

Let be:

• $T$, the number of time periods
• $r_p = (r_{p,1},...,r_{p,T}) \in \mathbb{R}^{T}$, the returns of the portfolio
• $r_b = (r_{b,1},...,r_{b,T}) \in \mathbb{R}^{T}$, the returns of the benchmark
• $r_f = (r_{f,1},...,r_{f,T})\in \mathbb{R}^{T}$, the risk free returns

The beta $\beta \in \mathbb{R}$ of the portfolio is defined as the slope of the regression equation in the Capital Asset Pricing Model: $$r_p - r_f = \alpha + \beta \left( r_b - r_f \right) + \epsilon$$, where $\epsilon \in \mathbb{R}^{T}$ is an error term.

Notes:

• The beta $\beta$ of the portfolio corresponds to the systematic risk of the portfolio.

Let be:

• $n$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix
• $C_T \in \mathcal{M}(\mathbb{R}^{n \times n})$ a target correlation matrix
• $\lambda \in [0,1]$ a real number

The correlation matrix $C_S$ defined by $$C_S = (1-\lambda) C + \lambda C_T$$ corresponds to the (linear) shrinkage of the matrix $C$ toward the matrix $C_T$ with parameter $\lambda$.

Notes:

• The matrices $C$ and $C_T$ are not required to be positive semi-definite, because the linear shrinkage operator is defined for any $n$ by $n$ matrix; in that case, though, the matrix $C_S$ might not be positive semi-definite.
• The parameter $\lambda$ is usually called the shrinkage factor, or the shrinkage intensity, or the shrinkage constant.
• This endpoint provides 4 predefined target equicorrelation matrices $C_T$:
• The equicorrelation matrix made of $-\frac{1}{n-1}$, representing the minimum negative correlation matrix $$\begin{pmatrix} 1 & -\frac{1}{n-1} & ... & -\frac{1}{n-1} \\ -\frac{1}{n-1} & 1 & ... & -\frac{1}{n-1} \\ ... & ... & ... & ... \\ -\frac{1}{n-1} & -\frac{1}{n-1} & ... & 1 \end{pmatrix}$$
• The equicorrelation matrix made of 0, representing the minimum non-negative correlation matrix $$\begin{pmatrix} 1 & 0 & ... & 0 \\ 0 & 1 & ... & 0 \\ ... & ... & ... & ... \\ 0 & 0 & ... & 1 \end{pmatrix}$$
• The equicorrelation matrix made of the average correlation of the elements of $C$, $\bar{\rho} = \frac{2}{n \left(n-1\right)}\sum_{i=1}^{n-1} \sum_{j=i+1}^n C_{i,j}$ $$\begin{pmatrix} 1 & \bar{\rho} & ... & \bar{\rho} \\ \bar{\rho} & 1 & ... & \bar{\rho} \\ ... & ... & ... & ... \\ \bar{\rho} & \bar{\rho} & ... & 1 \end{pmatrix}$$
• The equicorrelation matrix made of 1, representing the maximum correlation matrix $$\begin{pmatrix} 1 & 1 & ... & 1 \\ 1 & 1 & ... & 1 \\ ... & ... & ... & ... \\ 1 & 1 & ... & 1 \end{pmatrix}$$

Let be:

• $n$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset empirical covariance matrix
• $\Sigma_T \in \mathcal{M}(\mathbb{R}^{n \times n})$ a target covariance matrix
• $\lambda \in [0,1]$ a real number

A (linearly) shrunk empirical asset covariance matrix is the asset covariance matrix $\Sigma_S$ defined by $$\Sigma_S = (1-\lambda) \Sigma + \lambda \Sigma_T$$.

Notes:

• This endpoint provides 2 predefined target covariance matrices $\Sigma_T$:
• A multiple of the identity matrix (default), corresponding to the common variance shrinkage method described in the first reference: $$\Sigma_T = \begin{pmatrix} \bar{\sigma}^2 & 0 & ... & 0 \\ 0 & \bar{\sigma}^2 & ... & 0 \\ ... & ... & ... & ... \\ 0 & 0 & ... & \bar{\sigma}^2 \end{pmatrix}$$, with $\bar{\sigma}^2 = \frac{1}{n} \sum_{i=1}^n \Sigma_{i,i}$
• A multiple of the identity matrix and a multiple of the off-diagonal matrix with ones everywhere, corresponding to the common variance covariance shrinkage method described in the second reference: $$\Sigma_T = \begin{pmatrix} \bar{\sigma}^2 & \bar{\sigma}_{i,j} & ... & \bar{\sigma}_{i,j} \\ \bar{\sigma}_{i,j} & \bar{\sigma}^2 & ... & \bar{\sigma}_{i,j} \\ ... & ... & ... & ... \\ \bar{\sigma}_{i,j} & \bar{\sigma}_{i,j} & ... & \bar{\sigma}^2 \end{pmatrix}$$, with $\bar{\sigma}^2 = \frac{1}{n} \sum_{i=1}^n \Sigma_{i,i}$ and $\bar{\sigma}_{i,j} = \frac{2}{n (n-1)} \sum_{i=1}^{n-1}\sum_{j=i+1}^{n} \Sigma_{i,j}$
• The shrinkage parameter $\lambda$ is usually called the shrinkage factor, or the shrinkage intensity, or the shrinkage constant; if not provided, it is automatically computed using the asymptotically optimal formulas described in the references

Let be:

• $n$, the number of assets
• $\mathcal{N}_1,...,\mathcal{N}_{k}$ $k$ groups of assets, representing a partition of the $n$ assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset empirical covariance matrix
• $\Sigma_T \in \mathcal{M}(\mathbb{R}^{n \times n})$ a clustering-based target covariance matrix
• $\lambda \in [0,1]$ a real number

A clustering-based (linearly) shrunk empirical asset covariance matrix is the asset covariance matrix $\Sigma_S$ defined by $$\Sigma_S = (1-\lambda) \Sigma + \lambda \Sigma_T$$.

Notes:

• This endpoint provides 2 predefined clustering-based target covariance matrices $\Sigma_T$:
• A diagonal matrix (default), corresponding to the extension of the common variance shrinkage method described in the first reference to a clustering-based context: $$\Sigma_T = \begin{pmatrix} \Phi_{1,1} & 0 & ... & 0 \\ 0 & \Phi_{2,2} & ... & 0 \\ ... & ... & ... & ... \\ 0 & 0 & ... & \Phi_{k,k} \end{pmatrix}$$, with (up to a permutation):
• $\Phi_{i,i} = \begin{pmatrix} \bar{\sigma}_i^2 & 0 & ... & 0 \\ 0 & \bar{\sigma}_i^2 & ... & 0 \\ ... & ... & ... & ... \\ 0 & 0 & ... & \bar{\sigma}_i^2 \end{pmatrix} \in \mathcal{M}(\mathbb{R}^{\mathcal{N}_i \times \mathcal{N}_i})$ and $\bar{\sigma}_i^2 = \frac{1}{\left| \mathcal{N}_i \right|} \sum_{j \in \mathcal{N}_i} \Sigma_{j,j}$, $i=1..k$
• A dense matrix, corresponding to the generalized common variance covariance shrinkage method described in the second reference: $$\Sigma_T = \begin{pmatrix} \Phi_{1,1} & \Phi_{1,2} & ... & \Phi_{1,k} \\ \Phi_{2,1} & \Phi_{2,2} & ... & \Phi_{2,k} \\ ... & ... & ... & ... \\ \Phi_{k,1} & \Phi_{k,2} & ... & \Phi_{k,k} \end{pmatrix}$$, with (up to a permutation):
• $\Phi_{i,i} = \begin{pmatrix} \bar{\sigma}_i^2 & \bar{\sigma}_{\mathcal{N}_i} & ... & \bar{\sigma}_{\mathcal{N}_i} \\ \bar{\sigma}_{\mathcal{N}_i} & \bar{\sigma}_i^2 & ... & \bar{\sigma}_{\mathcal{N}_i} \\ ... & ... & ... & ... \\ \bar{\sigma}_{\mathcal{N}_i} & \bar{\sigma}_{\mathcal{N}_i} & ... & \bar{\sigma}_i^2 \end{pmatrix} \in \mathcal{M}(\mathbb{R}^{\mathcal{N}_i \times \mathcal{N}_i})$, $\bar{\sigma}_i^2 = \frac{1}{\left| \mathcal{N}_i \right|} \sum_{j \in \mathcal{N}_i} \Sigma_{j,j}$ and $\bar{\sigma}_{\mathcal{N}_i} = \frac{1}{\left| \mathcal{N}_i \right| \left( \left| \mathcal{N}_i \right| - 1 \right)} \sum_{l \in \mathcal{N}_i} \sum_{m \in \mathcal{N}_i, m \ne l} \Sigma_{l,m}$ , $i=1..k$
• $\Phi_{i,j} = \begin{pmatrix} \bar{\sigma}_{\mathcal{N}_i,\mathcal{N}_j} & \bar{\sigma}_{\mathcal{N}_i,\mathcal{N}_j} & ... & \bar{\sigma}_{\mathcal{N}_i,\mathcal{N}_j} \\ \bar{\sigma}_{\mathcal{N}_i,\mathcal{N}_j} & \bar{\sigma}_{\mathcal{N}_i,\mathcal{N}_j} & ... & \bar{\sigma}_{\mathcal{N}_i,\mathcal{N}_j} \\ ... & ... & ... & ... \\ \bar{\sigma}_{\mathcal{N}_i,\mathcal{N}_j} & \bar{\sigma}_{\mathcal{N}_i,\mathcal{N}_j} & ... & \bar{\sigma}_{\mathcal{N}_i,\mathcal{N}_j} \end{pmatrix} \in \mathcal{M}(\mathbb{R}^{\mathcal{N}_i \times \mathcal{N}_j})$, $\bar{\sigma}_{\mathcal{N}_i,\mathcal{N}_j} = \frac{1}{\left| \mathcal{N}_i \right| \left| \mathcal{N}_j \right| } \sum_{l \in \mathcal{N}_i} \sum_{m \in \mathcal{N}_j} \Sigma_{l,m}$, $i=1..k$, $j=1..k$, $j \ne i$
• The shrinkage parameter $\lambda$ is usually called the shrinkage factor, or the shrinkage intensity, or the shrinkage constant; if not provided, it is automatically computed using the asymptotically optimal formulas described in the references

Let be:

• $n$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure

The hierarchical risk parity portfolio is a portfolio blending graph theory and machine learning techniques where similar assets are first grouped together thanks to a hierarchical clustering algorithm and asset weights are then computed through a recursive top-down bisection of the resulting hierarchical tree.

Notes:

• The matrix $\Sigma$ is not required to be invertible, that is, positive definite.
• There are 4 possible choices for the hierarchical clustering algorithm, influencing the way assets are grouped together:
• There are 2 possible choices for the order to impose on the hierarchical clustering tree leaves, also influencing the way assets are grouped together:
• The management of minimum and maximum asset weight constraints is a proprietary adaptation of the method described in the second reference. The general idea is that constraints are enforced at the lowest possible level of the hierarchical tree.

Let be:

• $n$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure

The hierarchical clustering-based risk parity portfolio is a portfolio building on the hierarchical risk parity portfolio, where similar assets are first grouped together thanks to an early stopped hierarchical clustering algorithm and asset weights are then computed through a recursive top-down division into two parts of the resulting hierarchical tree.

Notes:

• The matrix $\Sigma$ is not required to be invertible, that is, positive definite.
• Early stopping the hierarchical clustering algorithm produces a hierarchical tree that is cut at a certain height, with assets partitioned into clusters. The number of such clusters can either be provided or can be automatically computed thanks to the gap statistic method described in the references using the uniform distribution over the set of positive definite correlation matrices as the null reference distribution. The latter is done by default.
• There are 4 possible choices for the hierarchical clustering algorithm, influencing the way assets are grouped together:
• There are 2 possible choices for the order to impose on the hierarchical clustering tree leaves, also influencing the way assets are grouped together:
• There are 3 possible choices for the within cluster allocation method and for the across cluster allocation method:
• Equal weighting (default)
• Inverse volatility
• Inverse variance
Using Equal weighting for both cluster allocation methods corresponds to the Hierarchical Clustering-Based Asset Allocation (HCAA) of Thomas Raffinot.
• The management of minimum and maximum asset weight constraints is a proprietary adaptation of the method described in the fourth reference. The general idea is that constraints are enforced at the lowest possible level of the hierarchical tree.

Let be:

• $n$, the number of assets

A random correlation matrix is a matrix $C \in \mathcal{M}(\mathbb{R}^{n \times n})$ generated uniformly at random over the space of positive definite correlation matrices, which is defined as $$\mathcal{E}_n = \{ C \in \mathcal{M}(\mathbb{R}^{n \times n}) : C {}^t = C, C_{i,i} = 1, i=1..n, x {}^t C x > 0, \forall x \in\mathbb{R}^n \}$$

Notes:

• This endpoint uses a computationally more efficient algorithm than the one described in the reference.

Let be:

• $n$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, an asset correlation matrix

A randomly perturbed version of the asset correlation matrix $C$ is an asset correlation matrix $C^{'}$ whose coefficients are "close" to those of $C$, the meaning of "close" being described in the reference.

Alternatively, let be:

• $n$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, an asset correlation matrix
• $\epsilon_{max} \in ]0, 2]$, a maximum noise level

A randomly perturbed version of the asset correlation matrix $C$ with maximum noise level $\epsilon_{max}$ is an asset correlation matrix $C^{'}$ whose coefficients satisfy $$\left| C_{i,j} - C^{'}_{i,j} \right| \leq \epsilon_{max}, i=1..n, j=1..n$$

Alternatively, let be:

• $n$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, an asset correlation matrix
• $\epsilon \in ]0, 2]$, a noise level

A randomly perturbed version of the asset correlation matrix $C$ with (exact) noise level $\epsilon$ is an asset correlation matrix $C^{'}$ whose coefficients satisfy $$\left| C_{i,j} - C^{'}_{i,j} \right| \leq \epsilon, i=1..n, j=1..n$$, with equality for at least one pair of coefficients.

Notes:

• In case a maximum noise level $\epsilon_{max}$ (resp. an exact noise level $\epsilon$) is specified, a proprietary algorithm is used in order to perturb the asset correlation matrix $C$ asymptotically uniformly at random over the space of positive definite correlation matrices whose distance in terms of max norm to $C$ is at most equal to $\epsilon_{max}$ (resp. exactly equal to $\epsilon$).
• In case a too high maximum noise level $\epsilon_{max}$ (resp. a too high exact noise level $\epsilon$) is specified, it might be numerically difficult to perturb the asset correlation matrix $C$, which will typically manifest by a response time out of this endpoint.

Let be:

• $n \ge 2$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $\lambda_1 \ge \lambda_2 \ge ... \ge \lambda_n \ge 0$ the eigenvalues of the matrix $\Sigma$
• $\rho_1 \ge \rho_2 \ge ... \ge \rho_n \ge 0$ the standardized eigenvalues of the matrix $\Sigma$ defined by $\rho_i = \frac{\lambda_i}{\sum_{i=1}^{n} \lambda_i}$, $i=1..n$

The effective rank of the matrix $\Sigma$ is defined as $$\textrm{erank}(\Sigma) = e^{- \sum_{i=1}^{n} \rho_i \ln(\rho_i)}$$

Notes:

• In case of a null standardized eigenvalue, the convention taken is $0 ln(0) = 0$.

Let be:

• $n \ge 2$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix
• $\lambda_1 \ge \lambda_2 \ge ... \ge \lambda_n \ge 0$ the eigenvalues of the matrix $C$
• $\rho_1 \ge \rho_2 \ge ... \ge \rho_n \ge 0$ the standardized eigenvalues of the matrix $C$ defined by $\rho_i = \frac{\lambda_i}{\sum_{i=1}^{n} \lambda_i}$, $i=1..n$

The effective rank of the matrix $C$ is defined as $$\textrm{erank}(C) = e^{- \sum_{i=1}^{n} \rho_i \ln(\rho_i)}$$

Notes:

• In case of a null standardized eigenvalue, the convention taken is $0 ln(0) = 0$.

Let be:

• $T$, the number of time periods
• $r = (r_{1},...,r_{T}) \in \mathbb{R}^{T}$, the arithmetic or logarithmic returns of the portfolio associated to the $T$ time periods

The average return $\overline{r}$ of the portfolio is defined as the arithmetic average of the returns $r$: $$\overline{r} = \frac{1}{T} \sum_{t=1}^{T} r_{t}$$

Let be:

• $T$, the number of time periods
• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$

The Ulcer Index $UI$ of the portfolio is defined as: $$UI = \sqrt{\frac{\sum_{t=1}^{T} \left(100 * \left(\frac{V_{t}}{\max_{t'=1..t} V_{t'}} - 1\right)\right)^2 }{T}}$$

Let be:

• $T$, the number of time periods
• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$
• $r_f \in \mathbb{R}$, the value of the arithmetic risk free rate
• $\overline{r}$, the average return of the portfolio
• $UI$, the Ulcer Index of the portfolio

The Ulcer Performance Index $UPI$ of the portfolio is defined as: $$UPI = \frac {\overline{r} - r_f}{UI}$$

Notes:

• The Ulcer Performance Index is also called the Martin Index, the Martin Ratio or the Return-to-Ulcer Ratio

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $P_{t,i} \in \mathbb{R}^{+,*}$, the price of the asset $i$ at the time $t$, $i=1..n$, $t=0..T$
• $r_i = (r_{1,i},...,r_{T,i}) \in \mathbb{R}^{T}$, the arithmetic return of the asset $i$, $i=1..n$ over each time period $t=1..T$
• $\overline{r} = \left ( \overline{r_1}, ..., \overline{r_n} \right ) \in \mathbb{R}^n$, the average return of the assets $1..n$ over the $T$ time periods
• $y_t = \left ( y_{t,1}, ..., y_{t,n} \right ) \in \mathbb{R}^n$ the vector of the $n$ assets uncompounded cumulative return up to the time period $t$, defined by $y_{t,i} = \sum_{k=1}^{t} r_{k,i}$, $i=1..n$, $t=1..T$
• $r_f \in \mathbb{R}$, the value of the arithmetic risk free rate
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The maximum Ulcer Performance Index portfolio weights $w^* \in [0,1]^{n}$ satisfy: $$w^* = \operatorname{argmax} \frac{w {}^t \overline{r} - r_f }{UI(w)} \newline \textrm{s.t. } \begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$

With $UI(w)$ the Ulcer Index of the portfolio with returns $\langle w , y_t \rangle$, $t=1..T$, that is:

$$\text{UI}(w) =\sqrt{\frac{1}{T}\sum_{k=1}^{T} \left ( \max_{j = 1..k} \left ( \langle w , y_j \rangle \right ) - \langle w , y_k \rangle \right ) ^2}$$

Notes:

• The risk-free rate represents the theoretical return on an investment with zero risk
• The risk-free rate should be expressed in the same frequency as the asset prices series or the asset returns series (e.g. a monthly risk free rate in case monthly asset prices or monthly asset returns are provided)
• The Ulcer Performance Index is also called the Martin Index, the Martin Ratio or the Return-to-Ulcer Ratio

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $P_{t,i} \in \mathbb{R}^{+,*}$, the price of the asset $i$ at the time $t$, $i=1..n$, $t=0..T$
• $r_i = (r_{1,i},...,r_{T,i}) \in \mathbb{R}^{T}$, the arithmetic return of the asset $i$, $i=1..n$ over each time period $t=1..T$
• $\overline{r} = \left ( \overline{r_1}, ..., \overline{r_n} \right ) \in \mathbb{R}^n$, the average return of the assets $1..n$ over the $T$ time periods
• $y_t = \left ( y_{t,1}, ..., y_{t,n} \right ) \in \mathbb{R}^n$ the vector of the $n$ assets uncompounded cumulative return up to the time period $t$, defined by $y_{t,i} = \sum_{k=1}^{t} r_{k,i}$, $i=1..n$, $t=1..T$
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The minimum Ulcer Index portfolio weights $w^* \in [0,1]^{n}$ satisfy: $$w^* = \operatorname{argmin} UI(w) \newline \textrm{s.t. } \begin{cases} l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$

With $UI(w)$ the Ulcer Index of the portfolio with returns $\langle w , y_t \rangle$, $t=1..T$, that is:

$$\text{UI}(w) =\sqrt{\frac{1}{T}\sum_{k=1}^{T} \left ( \max_{j = 1..k} \left ( \langle w , y_j \rangle \right ) - \langle w , y_k \rangle \right ) ^2}$$

Let be:

• $T$, the number of time periods
• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$
• $r = (r_1,...,r_{T-1}) \in \mathbb{R}^{T-1}$, the arithmetic returns of the portfolio
• $\alpha \in ]0,1[$, the confidence level, in percentage

The empirical conditional value at risk at a confidence level $\alpha$% of the portfolio, $CVaR_{\alpha}$, is the opposite of the average of the distribution of the portfolio returns $r$ over the worst $(1 - \alpha)$% portfolio returns.

When the distribution of the portfolio returns is continuous $$CVaR_{\alpha} = - \textrm{E} [ r | r \leq - VaR_{\alpha} ]$$ , where $VaR_{\alpha}$ is the the empirical value at risk of the portfolio.

Notes:

• The empirical conditional value at risk at a confidence level $\alpha$% answers to the question What is the expected portfolio loss incurred with probability $(1 - \alpha)$%?
• The conditional value at risk is also known as the expected shortfall, the tail conditional expectation, the worst conditional expectation, the expected tail loss...
• Typical values for the confidence level $\alpha$ are 0.99 (= 99%) or 0.95 (= 95%).
• The empirical conditional value at risk is a non-parametric approach to computing the conditional value at risk.
• When the distribution of the portfolio returns is not continuous, a similar formula exists involving the lower and upper $(1 - \alpha)$%-quantiles of $r$, c.f. the references.

Let be:

• $T$, the number of time periods
• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$
• $r = (r_1,...,r_{T-1}) \in \mathbb{R}^{T-1}$, the arithmetic returns of the portfolio
• $\alpha \in ]0,1[$, the confidence level, in percentage

The empirical value at risk at a confidence level $\alpha$% of the portfolio, $VaR_{\alpha}$, is the $\alpha$%-quantile of the distribution of the portfolio losses $-r$, or equivalently the opposite of the $(1 - \alpha)$%-quantile of the distribution of the portfolio returns $r$, that is $$VaR_{\alpha} = - \inf_{x} \left\{ x \in \mathbb{R}, P(r \leq x)\geq 1-\alpha \right\}$$

Notes:

• The empirical value at risk at a confidence level $\alpha$% answers to the question What is the minimum portfolio loss incurred with probability $(1 -\alpha)$%?.
• Typical values for the confidence level $\alpha$ are 0.99 (= 99%) or 0.95 (= 95%).
• The empirical value at risk is a non-parametric approach to computing the value at risk.

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The diversified maximum return portfolio weights $w^* \in [0,1]^{n}$ satisfy: $$w^* = \operatorname{argmin} \sum_{i=1}^{n} w_i^2 \newline \textrm{s.t. } \begin{cases} \sqrt{ w {}^t \Sigma w} \leqslant \sigma^* (1 + \delta_{\sigma}) \newline \mu^* (1 - \delta_{\mu}) \leqslant w {}^t \mu \newline l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$

where:

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $r_f \in \mathbb{R}$, the value of the arithmetic risk free rate
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The diversified maximum Sharpe ratio portfolio weights $w^* \in [0,1]^{n}$ satisfy: $$w^* = \operatorname{argmin} \sum_{i=1}^{n} w_i^2 \newline \textrm{s.t. } \begin{cases} \sqrt{ w {}^t \Sigma w} \leqslant \sigma^* (1 + \delta_{\sigma}) \newline \mu^* (1 - \delta_{\mu}) \leqslant w {}^t \mu \newline l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$

where:

Notes:

• The risk-free rate represents the theoretical return on an investment with zero risk
• The risk-free rate should be expressed in the same frequency as the asset returns (e.g. a monthly risk free rate in case monthly asset returns are provided)

Let be:

• $n$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The diversified minimum variance portfolio weights $w^* \in [0,1]^{n}$ satisfy: $$w^* = \operatorname{argmin} \sum_{i=1}^{n} w_i^2 \newline \textrm{s.t. } \begin{cases} \sqrt{ w {}^t \Sigma w} \leqslant \sigma^* (1 + \delta_{\sigma}) \newline \mu^* (1 - \delta_{\mu}) \leqslant w {}^t \mu \newline l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$

where:

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The weights $w^* \in [0,1]^{n}$ of a diversified mean-variance efficient portfolio satisfy:

$$w^* = \operatorname{argmin} \sum_{i=1}^{n} w_i^2 \newline \textrm{s.t. } \begin{cases} \sqrt{ w {}^t \Sigma w} \leqslant \sigma^* (1 + \delta_{\sigma}) \newline \mu^* (1 - \delta_{\mu}) \leqslant w {}^t \mu \newline l \leqslant w \leqslant u \newline Gw \leqslant u_g \newline w_{min} \leqslant \sum_{i=1}^{n} w_i \leqslant w_{max} \end{cases}$$

where:

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the mean return of each asset over a reference period $T'$
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the covariance matrix of the asset returns over the same reference period $T'$
• $r \in \mathbb{R}^{n}$, the vector of the asset returns over a period $T \ne T'$

The turbulence index $d$ of the assets over the period $T$, using the period $T'$ as reference, is defined as:

$$d = \frac{1}{n} (r - \mu) {}^t \Sigma^{-1} (r - \mu)$$

Notes:

• The turbulence index $d$ represents a statistical measure of financial turbulence based on the Mahalanobis distance, c.f. the first reference.
• The turbulence index $d$ is normalized by the number of assets $n$ so that its expected value is equal to 1, c.f. the second reference.
• The asset covariance matrix $\Sigma$ is supposed to be invertible, that is, positive definite.
• The vector of the asset returns $r$ and the vector of the average asset returns $\mu$ must be consistent; for example, if $r$ is a vector of daily asset returns, $\mu$ should be a vector of average daily asset returns.

Let be:

• $n$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $E_1,...,E_n$, the eigenvectors of $\Sigma$ ordered such that $\sigma_{E_1}^2 \geq ... \geq \sigma_{E_n}^2$, with $\sigma_{E_i}^2$ the variance of the eigenvector $E_i$, $i=1..n$
• $1\leq N \leq n$, the number of eigenvectors $E_1,...,E_N$ to retain in the computation of the absorption ratio

The absorption ratio $AR$ of the assets is defined as:

$$AR = \frac{\sum_{i=1}^N \sigma_{E_i}^2}{\sum_{i=1}^n \sigma_{E_i}^2}$$

Notes:

• The absorption ratio $AR$ is an indicator of financial risk, representing the fraction of the total variance of the assets explained (or absorbed, hence its name) by a finite set of eigenvectors, c.f. the first reference.
• The denominator of the absorption ratio $AR$ is also equal to $\sum_{i=1}^n \sigma_{A_i}^2$, with $\sigma_{A_i}^2$ the variance of the $i$-th asset, $i=1..n$, which is its usual definition.

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The subset resampling-based maximum return portfolio weights $w^* \in [0,1]^{n}$ are computed through the following procedure:

1. Determine the number of assets $n_S$ to include in each subset, with $2 \le n_S \le n$
2. Determine the number of portfolios to simulate $n_B$, with $n_B \ge 1$
3. For $b = 1..n_B$ do
1. Generate uniformly at random without replacement a subset of $n_S$ assets from the original set of $n$ assets
2. Compute the weights $w_b^*$ of the maximum return portfolio associated to the generated subset of $n_S$ assets, taking into account the applicable constraints
4. Aggregate the $n_B$ portfolio weights $w_1^*,..,w_{n_B}^*$ by averaging them through the formula:
5. $$w^* = \frac{1}{n_B} \sum_{b=1}^{n_B} w_b^*$$

Notes:

• The subset resampling method as described above is actually the random subspace method, an ensemble learning technique, applied to mean-variance portfolio optimization.
• It is possible to generate all the subsets of the original set of $n$ assets containing $n_B$ assets; in this case, the subset generation procedure becomes non-random.
• In case too many subset optimization problems are infeasible, typically due to weight constraints, an error is returned by this endpoint.
• It is possible to aggregate the $n_B$ portfolio $w_1^*,..,w_{n_B}^*$ by using a robust location estimator - the geometric median - instead of the average; this procedure is described in Peter Bühlmann, Bagging, Subagging and Bragging for Improving some Prediction Algorithms.

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\mu_l \in \mathbb{R}^{n}$ and $\mu_u \in \mathbb{R}^{n}$ such that $(\mu_l)_i \leq \mu_i \leq (\mu_u)_i$, $i=1..n$, two vectors representing uncertainty intervals around the asset arithmetic returns
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The resampling-based maximum return portfolio weights $w^* \in [0,1]^{n}$ are computed through the following procedure:

1. Determine the number of portfolios to simulate $n_B$, with $n_B \ge 1$
2. For $b = 1..n_B$ do
1. Generate a vector of asset arithmetic returns $\mu' \in \mathbb{R}^{n}$ uniformly at random over the $n$-dimensional box $\left[(\mu_l)_1, (\mu_u)_1\right] \times ... \times \left[(\mu_l)_n, (\mu_u)_n\right]$
2. Compute the weights $w_b^*$ of the maximum return portfolio associated to the asset arithmetic returns $\mu'$, taking into account the applicable constraints
3. Aggregate the $n_B$ portfolio weights $w_1^*,..,w_{n_B}^*$ by averaging them through the formula:
4. $$w^* = \frac{1}{n_B} \sum_{b=1}^{n_B} w_b^*$$

Notes:

• The resampling method as described above is a mix of the resampling method described in the first and the second references.
• In case there is no uncertainty around the $i$-th asset arithmetic return $\mu_i$, it is possible to set $(\mu_l)_i = (\mu_u)_i = \mu_i$
• It is possible to aggregate the $n_B$ portfolio $w_1^*,..,w_{n_B}^*$ by using a robust location estimator - the geometric median - instead of the average; this procedure is described in Peter Bühlmann, Bagging, Subagging and Bragging for Improving some Prediction Algorithms.

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\mu_l \in \mathbb{R}^{n}$ and $\mu_u \in \mathbb{R}^{n}$ such that $(\mu_l)_i \leq \mu_i \leq (\mu_u)_i$, $i=1..n$, two vectors representing uncertainty intervals around the asset arithmetic returns
• $\sigma = \left(\sigma_1,...,\sigma_n\right) \in \mathbb{R}^{n}$, the asset standard deviations
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix with $\Sigma = Diag(\sigma) C Diag(\sigma)$
• $\sigma_l \in \mathbb{R}^{n}$ and $\sigma_u \in \mathbb{R}^{n}$ such that $(\sigma_l)_i \leq \sigma_i \leq (\sigma_u)_i$, $i=1..n$, two vectors representing uncertainty intervals around the asset standard deviations
• $\delta \in [0, 2]$, representing the uncertainty level around the asset correlations
• $r_f \in \mathbb{R}$, the value of the arithmetic risk free rate
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The resampling-based maximum Sharpe ratio portfolio weights $w^* \in [0,1]^{n}$ are computed through the following procedure:

1. Determine the number of portfolios to simulate $n_B$, with $n_B \ge 1$
2. For $b = 1..n_B$ do
1. Generate a vector of asset arithmetic returns $\mu' \in \mathbb{R}^{n}$ uniformly at random over the $n$-dimensional box $\left[(\mu_l)_1, (\mu_u)_1\right] \times ... \times \left[(\mu_l)_n, (\mu_u)_n\right]$
2. Generate a vector of asset standard deviations $\sigma' \in \mathbb{R}^{n}$ uniformly at random over the $n$-dimensional box $\left[(\sigma_l)_1, (\sigma_u)_1\right] \times ... \times \left[(\sigma_l)_n, (\sigma_u)_n\right]$
3. Generate an asset correlation matrix $C' \in \mathcal{M}(\mathbb{R}^{n \times n})$ asymptotically uniformly at random over the space of positive definite correlation matrices whose distance in terms of max norm to $C$ is at most equal to $\delta$
4. Generate an asset covariance matrix $\Sigma'\in \mathcal{M}(\mathbb{R}^{n \times n})$ with $\Sigma' = Diag(\sigma') C' Diag(\sigma')$
5. Compute the weights $w_b^*$ of the maximum Sharpe ratio portfolio associated to the asset arithmetic returns $\mu'$ and covariance matrix $\Sigma'$, taking into account the applicable constraints
3. Aggregate the $n_B$ portfolio weights $w_1^*,..,w_{n_B}^*$ by averaging them through the formula:
4. $$w^* = \frac{1}{n_B} \sum_{b=1}^{n_B} w_b^*$$

Notes:

• The resampling method as described above is a mix of the resampling method described in the first and the second references.
• The procedure used to generate the asset correlation matrix $C'$ is the same procedure as in the endpoint Perturbed Correlation Matrix
• In case there is no uncertainty around the $i$-th asset arithmetic return $\mu_i$ (resp. standard deviation $\sigma_i$), it is possible to set $(\mu_l)_i = (\mu_u)_i = \mu_i$ (resp. $(\sigma_l)_i = (\sigma_u)_i = \sigma_i$); similarly, in case there is no uncertainty around the asset correlations, it is possible to set $\delta = 0$
• It is possible to aggregate the $n_B$ portfolio $w_1^*,..,w_{n_B}^*$ by using a robust location estimator - the geometric median - instead of the average; this procedure is described in Peter Bühlmann, Bagging, Subagging and Bragging for Improving some Prediction Algorithms.

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $r_f \in \mathbb{R}$, the value of the arithmetic risk free rate
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The subset resampling-based maximum Sharpe ratio portfolio weights $w^* \in [0,1]^{n}$ are computed through the following procedure:

1. Determine the number of assets $n_S$ to include in each subset, with $2 \le n_S \le n$
2. Determine the number of portfolios to simulate $n_B$, with $n_B \ge 1$
3. For $b = 1..n_B$ do
1. Generate uniformly at random without replacement a subset of $n_S$ assets from the original set of $n$ assets
2. Compute the weights $w_b^*$ of the maximum Sharpe ratio portfolio associated to the generated subset of $n_S$ assets, taking into account the applicable constraints
4. Aggregate the $n_B$ portfolio weights $w_1^*,..,w_{n_B}^*$ by averaging them through the formula:
5. $$w^* = \frac{1}{n_B} \sum_{b=1}^{n_B} w_b^*$$

Notes:

• The subset resampling method as described above is actually the random subspace method, an ensemble learning technique, applied to mean-variance portfolio optimization.
• It is possible to generate all the subsets of the original set of $n$ assets containing $n_B$ assets; in this case, the subset generation procedure becomes non-random.
• In case too many subset optimization problems are infeasible, typically due to weight constraints, an error is returned by this endpoint.
• It is possible to aggregate the $n_B$ portfolio $w_1^*,..,w_{n_B}^*$ by using a robust location estimator - the geometric median - instead of the average; this procedure is described in Peter Bühlmann, Bagging, Subagging and Bragging for Improving some Prediction Algorithms.
• The risk-free rate represents the theoretical return on an investment with zero risk
• The risk-free rate should be expressed in the same frequency as the asset returns (e.g. a monthly risk free rate in case monthly asset returns are provided)

Let be:

• $n$, the number of assets
• $\sigma = \left(\sigma_1,...,\sigma_n\right) \in \mathbb{R}^{n}$, the asset standard deviations
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix with $\Sigma = Diag(\sigma) C Diag(\sigma)$
• $\sigma_l \in \mathbb{R}^{n}$ and $\sigma_u \in \mathbb{R}^{n}$ such that $(\sigma_l)_i \leq \sigma_i \leq (\sigma_u)_i$, $i=1..n$, two vectors representing uncertainty intervals around the asset standard deviations
• $\delta \in [0, 2]$, representing the uncertainty level around the asset correlations
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The resampling-based minimum variance portfolio weights $w^* \in [0,1]^{n}$ are computed through the following procedure:

1. Determine the number of portfolios to simulate $n_B$, with $n_B \ge 1$
2. For $b = 1..n_B$ do
1. Generate a vector of asset standard deviations $\sigma' \in \mathbb{R}^{n}$ uniformly at random over the $n$-dimensional box $\left[(\sigma_l)_1, (\sigma_u)_1\right] \times ... \times \left[(\sigma_l)_n, (\sigma_u)_n\right]$
2. Generate an asset correlation matrix $C' \in \mathcal{M}(\mathbb{R}^{n \times n})$ asymptotically uniformly at random over the space of positive definite correlation matrices whose distance in terms of max norm to $C$ is at most equal to $\delta$
3. Generate an asset covariance matrix $\Sigma'\in \mathcal{M}(\mathbb{R}^{n \times n})$ with $\Sigma' = Diag(\sigma') C' Diag(\sigma')$
4. Compute the weights $w_b^*$ of the minimum variance portfolio associated to the asset covariance matrix $\Sigma'$, taking into account the applicable constraints
3. Aggregate the $n_B$ portfolio weights $w_1^*,..,w_{n_B}^*$ by averaging them through the formula:
4. $$w^* = \frac{1}{n_B} \sum_{b=1}^{n_B} w_b^*$$

Notes:

• The resampling method as described above is a mix of the resampling method described in the first and the second references.
• The procedure used to generate the asset correlation matrix $C'$ is the same procedure as in the endpoint Perturbed Correlation Matrix
• In case there is no uncertainty around the $i$-th asset standard deviation $\sigma_i$, it is possible to set $(\sigma_l)_i = (\sigma_u)_i = \sigma_i$; similarly, in case there is no uncertainty around the asset correlations, it is possible to set $\delta = 0$
• It is possible to aggregate the $n_B$ portfolio $w_1^*,..,w_{n_B}^*$ by using a robust location estimator - the geometric median - instead of the average; this procedure is described in Peter Bühlmann, Bagging, Subagging and Bragging for Improving some Prediction Algorithms.

Let be:

• $n$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The subset resampling-based minimum variance portfolio weights $w^* \in [0,1]^{n}$ are computed through the following procedure:

1. Determine the number of assets $n_S$ to include in each subset, with $2 \le n_S \le n$
2. Determine the number of portfolios to simulate $n_B$, with $n_B \ge 1$
3. For $b = 1..n_B$ do
1. Generate uniformly at random without replacement a subset of $n_S$ assets from the original set of $n$ assets
2. Compute the weights $w_b^*$ of the minimum variance portfolio associated to the generated subset of $n_S$ assets, taking into account the applicable constraints
4. Aggregate the $n_B$ portfolio weights $w_1^*,..,w_{n_B}^*$ by averaging them through the formula:
5. $$w^* = \frac{1}{n_B} \sum_{b=1}^{n_B} w_b^*$$

Notes:

• The subset resampling method as described above is actually the random subspace method, an ensemble learning technique, applied to mean-variance portfolio optimization.
• It is possible to generate all the subsets of the original set of $n$ assets containing $n_B$ assets; in this case, the subset generation procedure becomes non-random.
• In case too many subset optimization problems are infeasible, typically due to weight constraints, an error is returned by this endpoint.
• It is possible to aggregate the $n_B$ portfolio $w_1^*,..,w_{n_B}^*$ by using a robust location estimator - the geometric median - instead of the average; this procedure is described in Peter Bühlmann, Bagging, Subagging and Bragging for Improving some Prediction Algorithms.

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\mu_l \in \mathbb{R}^{n}$ and $\mu_u \in \mathbb{R}^{n}$ such that $(\mu_l)_i \leq \mu_i \leq (\mu_u)_i$, $i=1..n$, two vectors representing uncertainty intervals around the asset arithmetic returns
• $\sigma = \left(\sigma_1,...,\sigma_n\right) \in \mathbb{R}^{n}$, the asset standard deviations
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix with $\Sigma = Diag(\sigma) C Diag(\sigma)$
• $\sigma_l \in \mathbb{R}^{n}$ and $\sigma_u \in \mathbb{R}^{n}$ such that $(\sigma_l)_i \leq \sigma_i \leq (\sigma_u)_i$, $i=1..n$, two vectors representing uncertainty intervals around the asset standard deviations
• $\delta \in [0, 2]$, representing the uncertainty level around the asset correlations
• A return constraint $r_c$, a volatility constraint $v_c \geq 0$ or a risk tolerance constraint $\lambda_c \geq 0$
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The resampling-based mean-variance efficient portfolio weights $w^* \in [0,1]^{n}$ are computed through the following procedure:

1. Determine the number of portfolios to simulate $n_B$, with $n_B \ge 1$
2. For $b = 1..n_B$ do
1. Generate a vector of asset arithmetic returns $\mu' \in \mathbb{R}^{n}$ uniformly at random over the $n$-dimensional box $\left[(\mu_l)_1, (\mu_u)_1\right] \times ... \times \left[(\mu_l)_n, (\mu_u)_n\right]$
2. Generate a vector of asset standard deviations $\sigma' \in \mathbb{R}^{n}$ uniformly at random over the $n$-dimensional box $\left[(\sigma_l)_1, (\sigma_u)_1\right] \times ... \times \left[(\sigma_l)_n, (\sigma_u)_n\right]$
3. Generate an asset correlation matrix $C' \in \mathcal{M}(\mathbb{R}^{n \times n})$ asymptotically uniformly at random over the space of positive definite correlation matrices whose distance in terms of max norm to $C$ is at most equal to $\delta$
4. Generate an asset covariance matrix $\Sigma'\in \mathcal{M}(\mathbb{R}^{n \times n})$ with $\Sigma' = Diag(\sigma') C' Diag(\sigma')$
5. Compute the weights $w_b^*$ of the mean-variance efficient portfolio associated to the asset arithmetic returns $\mu'$ and covariance matrix $\Sigma'$, taking into account the applicable constraints
3. Aggregate the $n_B$ portfolio weights $w_1^*,..,w_{n_B}^*$ by averaging them through the formula:
4. $$w^* = \frac{1}{n_B} \sum_{b=1}^{n_B} w_b^*$$

Notes:

• The resampling method as described above is a mix of the resampling method described in the first and the second references.
• The procedure used to generate the asset correlation matrix $C'$ is the same procedure as in the endpoint Perturbed Correlation Matrix
• In case there is no uncertainty around the $i$-th asset arithmetic return $\mu_i$ (resp. standard deviation $\sigma_i$), it is possible to set $(\mu_l)_i = (\mu_u)_i = \mu_i$ (resp. $(\sigma_l)_i = (\sigma_u)_i = \sigma_i$); similarly, in case there is no uncertainty around the asset correlations, it is possible to set $\delta = 0$
• It is possible to aggregate the $n_B$ portfolio $w_1^*,..,w_{n_B}^*$ by using a robust location estimator - the geometric median - instead of the average; this procedure is described in Peter Bühlmann, Bagging, Subagging and Bragging for Improving some Prediction Algorithms.

Let be:

• $n$, the number of assets
• $\mu \in \mathbb{R}^{n}$, the vector of the asset arithmetic returns
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• A return constraint $r_c$, a volatility constraint $v_c \geq 0$ or a risk tolerance constraint $\lambda_c \geq 0$
• $l \in [0,1]^{n}$, the optional minimum asset weights
• $u \in [0,1]^{n}$, the optional maximum asset weights
• $w_{min} \in [0,1]$, the optional minimum portfolio exposure
• $w_{max} \in [0,1]$, the optional maximal portfolio exposure
• $G \in \mathcal{M}(\mathbb{R}^{k \times n})$, the optional assets groups matrix defining $k$ group(s) of assets
• $u_g \in \mathbb{R}^{k}$, the optional maximum assets groups weights

The weights $w^* \in [0,1]^{n}$ of the subset resampling-based mean-variance efficient portfolio are computed through the following procedure:

1. Determine the number of assets $n_S$ to include in each subset, with $2 \le n_S \le n$
2. Determine the number of portfolios to simulate $n_B$, with $n_B \ge 1$
3. For $b = 1..n_B$ do
1. Generate uniformly at random without replacement a subset of $n_S$ assets from the original set of $n$ assets
2. Compute the weights $w_b^*$ of the mean-variance efficient portfolio associated to the generated subset of $n_S$ assets, taking into account the applicable constraints
4. Combine the $n_B$ portfolio weights $w_1^*,..,w_{n_B}^*$ by averaging them through the formula:
5. $$w^* = \frac{1}{n_B} \sum_{b=1}^{n_B} w_b^*$$

Notes:

• The subset resampling method as described above is actually the random subspace method, an ensemble learning technique, applied to mean-variance portfolio optimization.
• It is possible to generate all the subsets of the original set of $n$ assets containing $n_B$ assets; in this case, the subset generation procedure becomes non-random.
• In case too many subset optimization problems are infeasible, typically due to return, volatility or weight constraints, an error is returned by this endpoint.
• It is possible to combine the $n_B$ portfolio $w_1^*,..,w_{n_B}^*$ by using a robust location estimator - the geometric median - instead of the average; this procedure is described in Peter Bühlmann, Bagging, Subagging and Bragging for Improving some Prediction Algorithms.

Let be:

• $n$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix
• $\mathcal{B} \subseteq \left\{ 1,...,n \right\}$, with $\left| \mathcal{B} \right| \geq 2$, the index set of a selected group of assets whose correlations need to be altered

The lower bounds $L \in \mathcal{M}(\mathbb{R}^{n \times n})$ and the upper bounds $U \in \mathcal{M}(\mathbb{R}^{n \times n})$ of the asset correlation matrix $C$ associated to the selected group of assets $\mathcal{B}$ are correlation matrices containing respectively the lowest and the highest possible values among which the correlations of the selected group of assets can linearly vary together while both keeping the correlations between all the other assets fixed and ensuring that the resulting correlation matrix is a valid correlation matrix.

Notes:

• It is usually needed to alter correlations for a selected group of assets in order to perform stress tests.

Let be:

• $n \ge 2$, the number of assets
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $\mathring{l} \in \mathcal{M}(\mathbb{R}^{n \times n})$, a matrix representing an invertible linear transformation such that $\mathring{l} \Sigma \mathring{l} {}^t$ is a diagonal matrix
• $n_p$, the number of portfolios
• $w_p \in \mathbb{R}^{n}$, the vector of portfolio weights of the $p$-th portfolio, $p=1..n_p$

The effective number of bets of the $p$-th portfolio, $p=1..n_p$, is defined as $$\mathcal{N}_{Ent,p} = e^{- \sum_{i=1}^{n} {d_p}_i \ln({d_p}_i)}$$, where $d_p \in [0,1]^{n}$ is the diversification distribution of the $p$-th portfolio defined as $$d_p = \frac{ \left( \left( \mathring{l} {}^t \right)^{-1} w_p \right) \circ \left( \mathring{l} \Sigma w_p \right) }{w_p {}^t \Sigma w_p}$$

Notes:

• The matrix $\mathring{l}$ it called a decorrelating torsion matrix.
• There are 2 possible choices for the computation of the matrix $\mathring{l}$:
• The minimum torsion transformation described in the reference, leading to the effective number of minimum torsion bets (default)
• The matrix of the principal components of the matrix $\Sigma$, leading to the effective number of principal components bets

Let be:

• $n$, the number of assets
• $\mathcal{H}_1,...,\mathcal{H}_{n}$, a theoretical hierarchical classification of the assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, an empirical asset correlation matrix

The theory-implied correlation matrix associated with a theoretical hierarchical classification of a universe of assets - like the MSCI Global Industry Classification Standard for stocks - and an empirical asset correlation matrix is computed thanks to a machine learning technique. Similar assets are first grouped together thanks to a hierarchical clustering algorithm constrained to match the hierarchical classification of the assets and theory-implied asset correlations are then derived from the resulting hierarchical tree.

Notes:

• The empirical asset correlation matrix $C$ does not need to be positive semi-definite.
• There are 4 possible choices for the hierarchical clustering algorithm, influencing the way assets are grouped together:
• The computed theory-implied asset correlation matrix is not guaranteed to be positive semi-definite.

Let be:

• $n$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix
• $C_R \in \mathcal{M}(\mathbb{R}^{n \times n})$, a reference correlation matrix

The Euclidean distance $\mathcal{d}_F$ between the matrices $C$ and $C_R$ is defined as: $$\mathcal{d}_F \left( C, C_R \right) = \left\Vert C - C_R \right\Vert_F$$

The correlation matrix distance $\mathcal{d}_{corr}$ between the matrices $C$ and $C_R$ is defined as: $$\mathcal{d}_{corr}\left( C, C_R \right) = 1 - \frac{< C, C_R>}{\left\Vert C \right\Vert_F \left\Vert C_R \right\Vert_F }$$

The Bures distance $\mathcal{d}_{Bures}$ between the matrices $C$ and $C_R$ is defined as: $$\mathcal{d}_{Bures}^2\left( C, C_R \right) = \mathrm{tr} \left( C \right) + \mathrm{tr} \left( C_R \right) -2 \mathrm{tr} \left( C^{\frac{1}{2}} C_R C^{\frac{1}{2}} \right)^{\frac{1}{2}}$$

Notes:

• The matrices $C$ and $C_R$ are not required to be positive semi-definite for the distances $\mathcal{d}_F$ and $\mathcal{d}_{corr}$, as these distances are defined for any $n$ by $n$ matrix.

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $r_{t,i}, i=1..n, t=1..T$, the arithmetic or logarithmic return of the asset $i$ over each time period $t$

A bootstrap simulation of the original $n$ asset returns over $T'$ time periods is defined as the sampling with replacement of $T'$ cross-sectional returns from the returns $r_{t,i}, i=1..n, t=1..T$ using one of the bootstrap methods described in the references.

Notes:

• There are 3 possible choices for the bootstrap method:
• IID bootstrap
• Circular block bootstrap
• Stationary block bootstrap (default)
• The IID bootstrap is theoretically applicable to independent data only, and does not require the selection of any additional parameter
• The circular block bootstrap is theoretically applicable to dependent data, and requires the selection of an integer block length $b \geq 2$
• The stationary block bootstrap is theoretically applicable to dependent data, and requires the selection of an average block length $\bar{b} \geq 1$ corresponding to the inverse probability of the geometric distribution associated with the bootstrap method internals
• The default value for the parameter $b$ of the circular block bootstrap is the same as in the R package tseries, that is, the integer part of $3.15 n^{\frac{1}{3}}$
• The default value for the parameter $\bar{b}$ of the stationary block bootstrap is the same as in the R package tseries, that is, $\frac{1}{3.15 n^{\frac{1}{3}}}$

Let be:

• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at time $t$, $t=1..T+1$
• $r_t \in \mathbb{R}, t=1..T$, the arithmetic returns of the portfolio over each time period
• $1 - \alpha \in ]0,1[$, the confidence level, in percentage

Then, if $SR^* \in \mathbb{R}$ is a benchmark Sharpe ratio, the minimum track record length $MinTRL(SR^*)$ of the portfolio is defined as the (floating point) number of arithmetic returns $T^*$ that are required to ensure that the probabilistic Sharpe ratio of the portfolio $PSR(SR^*)$ is greater than or equal to $(1 - \alpha)$%, that is $$MinTRL(SR^*) = T^* \textrm{ such that } PSR(SR^*) \geq 1 - \alpha$$

Alternatively, if $B_t \in \mathbb{R}^{+,*}$ is the value of a benchmark at time $t$, $t=1..T+1$, the minimum track record length $MinTRL(B)$ of the portfolio is defined as the (floating point) number of arithmetic returns $T^*$ that are required to ensure that $PSR(B)$ is greater than or equal to $(1 - \alpha)$%, that is $$MinTRL(B) = T^* \textrm{ such that } PSR(B) \geq 1 - \alpha$$

Notes:

• The minimum track record length is not guaranteed to exist.
• The minimum track record length might be less than $T$, which means that the current number of observed arithmetic returns is already sufficient to ensure that the probabilistic Sharpe ratio of the portfolio is greater than or equal to $(1 - \alpha)$%.

Let be:

• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at time $t$, $t=1..T+1$
• $r_t \in \mathbb{R}, t=1..T$, the arithmetic returns of the portfolio over each time period
• $\kappa \in \mathbb{R}$, the skewness of the arithmetic returns $r_1,...,r_T$
• $\gamma \in \mathbb{R}$, the kurtosis of the arithmetic returns $r_1,...,r_T$
• $SR \in \mathbb{R}$, the Sharpe ratio of the portfolio

Then, if $SR^* \in \mathbb{R}$ is a benchmark Sharpe ratio, the probabilistic Sharpe ratio $PSR(SR^*)$ of the portfolio is defined as the probability that $SR$, considered as a statistical estimator subject to estimation error, is greater than or equal to $SR^*$, with formula $$PSR(SR^*) = \Phi\left( \frac{SR - SR^*}{ \sqrt{\frac{1 - \kappa SR + (\gamma - 1) \frac{SR^2}{4}}{T}} } \right )$$

Alternatively, if $B_t \in \mathbb{R}^{+,*}$ is the value of a benchmark at time $t$, $t=1..T+1$, the probabilistic Sharpe ratio $PSR(B)$ of the portfolio is defined as the probability that $SR$, considered as a statistical estimator subject to estimation error, is greater than or equal to the Sharpe ratio of the benchmark $SR_B \in \mathbb{R}$, also considered as a statistical estimator subject to estimation error, with formula $$PSR(B) = \Phi\left( \frac{SR - SR_B}{ \sqrt{\frac{1 - \kappa SR + (\gamma - 1) \frac{SR^2}{4} + 1 - \kappa_B SR_B + (\gamma_B - 1) \frac{SR_B^2}{4} + ...}{T} } } \right )$$, where $\kappa_B \in \mathbb{R}$ is the skewness of the arithmetic returns of the benchmark, $\gamma_B \in \mathbb{R}$ is the kurtosis of the arithmetic returns of the benchmark and $...$ depends on the multivariate central moments of the arithmetic returns of the portfolio and of the benchmark as described in the first reference.

In both cases, $\Phi$ is the cumulative distribution function of the standard normal distribution.

Let be:

• $V_t \in \mathbb{R}^{+,*}, t=1..T+1$, the value of the portfolio at time $t$
• $r_t \in \mathbb{R}, t=1..T$, the arithmetic returns of the portfolio over each time period
• $\gamma \in \mathbb{R}$, the kurtosis of the arithmetic returns $r_1,...,r_T$
• $SR \in \mathbb{R}$, the Sharpe ratio of the portfolio

The Sharpe ratio adjusted for small sample bias of the portfolio is defined as $\frac{SR}{\left( 1 + \frac{1}{4} \frac{\gamma - 1}{T} \right)}$.

Let be:

• $V_t \in \mathbb{R}^{+,*}, t=1..T+1$, the value of the portfolio at time $t$
• $r_t \in \mathbb{R}, t=1..T$, the arithmetic returns of the portfolio over each time period
• $\kappa \in \mathbb{R}$, the skewness of the arithmetic returns $r_1,...,r_T$
• $\gamma \in \mathbb{R}$, the kurtosis of the arithmetic returns $r_1,...,r_T$
• $SR \in \mathbb{R}$, the Sharpe ratio of the portfolio
• $1 - \alpha \in ]0,1[$, the confidence level, in percentage

A confidence interval at a confidence level $(1 - \alpha)$% for the Sharpe ratio of a portfolio, considered as a statistical estimator subject to estimation error, is a real interval whose values are not statistically significantly different from $SR$ at a confidence level $(1 - \alpha)$%.

Notes:

• There are 3 possible choices for the type of confidence interval:
• A two-sided confidence interval (default), with formula $$\left[ SR - z_{1-\frac{\alpha}{2}} SE(SR), SR + z_{1-\frac{\alpha}{2}} SE(SR) \right]$$
• An upper one-sided confidence interval, with formula $$\left] -\infty, SR + z_{1-\alpha} SE(SR) \right]$$
• A lower one-sided confidence interval, with formula $$\left[SR - z_{1-\alpha} SE(SR) , +\infty \right[$$

where $SE(SR)$ is defined by $$SE(SR) = \sqrt{\frac{1 - \kappa SR + (\gamma - 1) \frac{SR^2}{4}}{T}}$$

Let be:

• $n$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, an empirical asset correlation matrix, determined using $T$ observations per asset
• $q$, the aspect ratio of $C$ defined by $q = \frac{n}{T}$

The denoised asset correlation matrix is computed by altering the empirical asset correlation matrix $C$ using one of the methods described in the references.

Notes:

• There is 1 possible choice for the denoising method:
• The eigenvalues clipping method, which consists in first finding the Marchenko-Pastur eigenvalue density that best matches the eigenvalue density of $C$ and then in replacing all the eigenvalues of $C$ below the upper edge of the Marchenko-Pastur eigenvalue density, which are considered to represent eigenvalues associated to noise, by their average.

Let be:

• $n$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix
• $\mathcal{N} \subset \mathcal{M}(\mathbb{R}^{n \times n})$, the set of equicorrelation matrices

The informativeness of $C$ is defined as its normalized distance - belonging to the interval $[0,1]$ - to the set of equicorrelation matrices $\mathcal{N}$, c.f. the first reference.

Notes:

• There are 3 possible choices for the distance metric, with 3 associated values for the informativeness:
• The Euclidean distance, with $$\textrm{informativeness}(\textup{C}) = \frac{1}{n} \min_{N \in \mathcal{N}} \mathcal{d}_F \left( C, N \right)$$
• The correlation matrix distance, with $$\textrm{informativeness}(\textup{C}) = \min_{N \in \mathcal{N}} \mathcal{d}_{corr} \left( C, N \right)$$
• The Bures distance, with $$\textrm{informativeness}(\textup{C}) = \frac{1}{2n} \min_{N \in \mathcal{N}} \mathcal{d}_{Bures}^2 \left( C, N \right)$$
• The matrix $C$ is not required to be positive semi-definite for the Euclidean and correlation matrix distance.

Let be:

• $n$, the number of assets
• $\sigma_1,...,\sigma_n$, the assets volatilities

The equal volatility-weighted portfolio weights $w \in [0,1]^{n}$ satisfy: $$w_i = \frac{\sigma_i}{\sum_{j=1}^{n} \sigma_j}, i=1..n$$

Let be:

• $n$, the number of assets
• $\sigma = (\sigma_1,...,\sigma_n)$ the vector of the assets volatilities
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
• $w \in [0,1]^{n}$, the vector of portfolio weights
• $\sigma_p$, the volatility of the portfolio

The correlation spectrum of the portfolio is defined as the vector $\rho(w) \in [-1,1]^{n}$ with components $$\rho(w)_i = \frac{ \left( \Sigma{} w \right)_i }{\sigma_p \sigma_i}$$

Alternatively, let be:

• $n$, the number of assets
• $T$, the number of time periods
• $P_{t,i} \in \mathbb{R}^{+,*}$, the price of the asset $i$ at the time $t$, $i=1..n$, $t=1..T$
• $V_{t} \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$

The correlation spectrum of the portfolio is defined as the vector $\rho(w) \in [-1,1]^{n}$ with components $$\rho(w)_i = \rho_{p,i}$$

, with $\rho_{p,i} \in [-1,1]$ the correlation of the arithmetic returns of the portfolio with the arithmetic returns of the asset $i, i=1..n$.

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $r_t \in \mathbb{R}^{n}, t=1..T$, the vector of the arithmetic or logarithmic return of each asset over the time period $t$
• $\mu \in \mathbb{R}^{n}$, the vector of the mean return of each asset over the $T$ periods
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the covariance matrix of the asset returns over the $T$ periods

Now, let be:

• $tt_1, tt_2 , ..., tt_m \in ]0,1[, 1 \le m \le 4$, $m$ turbulence thresholds satisfying $tt_1 < tt_2 < ... < tt_m$, in percentage

The asset returns $r_t, t=1..T$ are partitioned into $m+1$ partitions using the following thresholding procedure:

1. Convert the turbulence thresholds $tt_i$ into turbulence scores $ts_i$, $i=1..m$
2. For each asset return vector $r_t$, $t=1..T$
1. Compute the unnormalized turbulence index value $d(r_t) = n d_t$
2. For each turbulence score $ts_i$, $i=1..m$
• If $d(r_t) \leq ts_i$, $r_t$ is classified as belonging to the $i$-th partition of asset returns
3. If $d(r_t) > ts_i, \forall i=1..m$, $r_t$ is classified as belonging to the default $m+1$-th partition of asset returns

Alternatively, let be:

• $2 \le m \le 5$, a number of partitions

The asset returns $r_t, t=1..T$ are partitioned into $m$ partitions using the following clustering procedure:

1. Compute the unnormalized turbulence index values $d(r_t) = n d_t$, $t=1..T$, for all asset return vectors $r_t$
2. Perform an exact 1d k-means clustering algorithm on the turbulence index values $d(r_t)$, $t=1..T$, with $k = m$
3. For each asset return vector $r_t$, $t=1..T$
1. $r_t$ is classified as belonging to the partition of asset returns corresponding to the k-means partition of its turbulence index value $d(r_t)$

Notes:

• Turbulence thresholding is the default partitioning procedure.
• It is possible to constrain the partitioning procedure so that each partition contains a minimum number of asset returns.
• In case of turbulence thresholding partitioning:
• The default number of turbulence thresholds is 1, with $tt_1$ equal to 75%. This single turbulence threshold is interpreted as the percentage of asset returns desired to be classified as belonging to a calm market risk regime.
• There are 2 possible choices for the method to convert the turbulence thresholds $tt_i$ into their associated turbulence scores $ts_i$, $i=1..m$:
• Usage of the $tt_i$-th percentile of the chi-square distribution with $n$ degrees of freedom, that is, $ts_i = \left( \mathcal{X}^2(n) \right)^{-1} (tt_i)$ (default)
• Usage of the $tt_i$-th empirical percentile of the unnormalized turbulence index distribution $$ts_i = CDF^{-1}_{ n d_t, t=1..T }(tt_i)$$
• Some of the partitions might be empty.
• If the partitioning is constrained with a minimum number of asset returns per partition, and if the turbulence thresholds do not allow to satisfy this constraint, an error is returned by this endpoint.
• In case of turbulence clustering partitioning:
• The number of partitions needs to be provided.
• If the partitioning is constrained with a minimum number of asset returns per partition, a constrained 1d k-means clustering is performed instead of an exact 1d k-means clustering.

Let be:

A Monte Carlo simulation of a Gaussian distribution over $T$ time periods is defined as the generation of $T$ independent and identically distributed random variables $X_i, i=1..T$ each following a Gaussian distribution with a mean equal to $\mu$ and a variance equal to $\sigma^2$, that is $$X_i \sim \mathcal{N} \left( \mu, \sigma^2 \right), i = 1..T$$

Additionally, if an exact sample mean and (biased) sample variance constraint is enforced, the i.i.d. random variables $X_i = 1..T$ are generated so that:

• Their sample mean $\mu_X = \frac{1}{T} \sum_{i = 1}^T X_i$ exactly equals $\mu$
• Their (biased) sample variance $\sigma^2_X = \frac{1}{T} \sum_{i = 1}^T \left(X_i - \bar{X} \right)^2$ exactly equals $\sigma^2$

Notes:

Let be:

• $T$, the number of time periods
• $r_1,...,r_T$, the arithmetic or logarithmic return of an asset over each time period $1,..,T$
• $\mu \in \mathbb{R}$, the arithmetic average of the asset returns $r_t$, $t=1..T$
• $\sigma \in \mathbb{R}^{+,*}$, the standard deviation of the asset returns $r_t$, $t=1..T$

A Gaussian distribution fitting the asset returns $r_t$, $t=1..T$ is a Gaussian distribution $\mathcal{N} \left( \mu, \sigma^2 \right)$ with a mean equal to $\mu$ and a variance equal to $\sigma^2$.

Let be:

• $T$, the number of time periods
• $2 \le m \le 5$, the number of components of the Gaussian mixture, each following a Gaussian distribution
• $p_1, ..., p_m \in [0,1]$ such that $\sum_{j=1}^m p_j = 1$, the weight of each Gaussian component
• $\mu_1, ..., \mu_m \in \mathbb{R}$, the mean of each Gaussian component
• $\sigma_1, ..., \sigma_m \in \mathbb{R}^{+,*}$, the standard deviation of each Gaussian component

A Monte Carlo simulation of a Gaussian mixture distribution over $T$ time periods is defined as the generation of $T$ independent and identically distributed random variables $X_i, i=1..T$ each following a Gaussian mixture distribution made of $m$ Gaussian components, each with weight $p_j$ and with Gaussian distribution $\mathcal{N} \left( \mu_j, \sigma_j^2 \right)$, $j=1..m$.

Notes:

Let be:

• $T$, the number of time periods
• $r_1,...,r_T$, the arithmetic or logarithmic return of an asset over each time period $1,..,T$

A Gaussian mixture distribution fitting the asset returns $r_t$, $t=1..T$ is a Gaussian mixture distribution made of $m$ Gaussian components, each with weight $p_j$ and with Gaussian distribution $\mathcal{N} \left( \mu_j, \sigma_j^2 \right)$ with a mean equal to $\mu_j$ and a variance equal to $\sigma_j^2$, $j=1..m$, where:

• The number of components $m$ of the Gaussian mixture needs to be determined, with $2 \le m \le 5$
• The weight of each Gaussian component $p_1,...,p_m \in [0,1]$ needs to be determined, with all weights satisfying $\sum_{j=1}^m p_j = 1$
• The mean of each Gaussian component $\mu_1, ..., \mu_m \in \mathbb{R}$ needs to be determined
• The standard deviation of each Gaussian component $\sigma_1, ..., \sigma_m \in \mathbb{R}^{+,*}$ needs to be determined

Notes:

• There are 2 possible choices for fitting a Gaussian mixture distribution of $m$ Gaussian components to the asset returns:
• Turbulence partitioning (default)
1. The asset returns $r_1,...,r_T$ are partitioned into $m$ partitions, with a minimum number of 2 returns per partition, based on their turbulence values, using the same procedure as in the Turbulence-Partitioned Returns endpoint.
2. The weight of each Gaussian component $p_i$, $i = 1..m$, is computed as the proportion of asset returns belonging to each partition.
3. The mean of each Gaussian component $\mu_i$, $i = 1..m$, is computed as the mean of the asset returns belonging to each partition.
4. The standard deviation of each Gaussian component $\sigma_i$, $i = 1..m$, is computed as the standard deviation of the asset returns belonging to each partition.
• Expectation-maximization
• With both choices, the number of Gaussian components $m$ can either be provided or automatically computed thanks to a proprietary algorithm (default).

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $\mu \in \mathbb{R}^{n}$, the vector of the arithmetic average return of the assets returns
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the covariance matrix of the assets returns
• $T$, the number of time periods to simulate

A Monte Carlo simulation of a multivariate Gaussian distribution over $T$ time periods is defined as the generation of $T$ independent and identically distributed $n$-dimensional random variables $X_i, i=1..T$ each following a multivariate Gaussian distribution with a mean vector equal to $\mu$ and a covariance matrix equal to $\Sigma$, that is $$X_i \sim \mathcal{N} \left( \mu, \Sigma \right), i = 1..T$$

Additionally, if an exact sample mean vector and (biased) sample covariance variance matrix constraint is enforced, the i.i.d. random variables $X_i = 1..T$ are generated so that:

• Their sample mean vector $\mu_X = \frac{1}{T} \sum_{i = 1}^T X_i$ exactly equals $\mu$
• Their (biased) sample covariance matrix $\Sigma_X = \frac{1}{T} \sum_{i = 1}^T \left(X_i - \bar{X} \right) \left(X_i - \bar{X} \right) {}^t$ exactly equals $\Sigma$

Notes:

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $r_i = (r_{1,i},...,r_{T,i}) \in \mathbb{R}^{T}$, the vector of arithmetic or logarithmic returns of the asset $i$, $i=1..n$ over each time period $t=1..T$
• $\mu \in \mathbb{R}^{n}$, the vector of the arithmetic average of the assets returns
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the covariance matrix of the assets returns

A multivariate Gaussian distribution fitting the vectors of asset returns $r_i$, $i=1..n$ is a multivariate Gaussian distribution $\mathcal{N} \left( \mu, \Sigma \right)$ with a mean vector equal to $\mu$ and a covariance matrix equal to $\Sigma$.

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $2 \le m \le 5$, the number of components of the Gaussian mixture, each following a multivariate Gaussian distribution
• $p_1, ..., p_m \in [0,1]$ such that $\sum_{j=1}^m p_j = 1$, the weight of each multivariate Gaussian component
• $\mu_1, ..., \mu_m \in \mathbb{R}^{n}$, the mean vector of each multivariate Gaussian component
• $\Sigma_1, ..., \Sigma_m \in \mathcal{M}(\mathbb{R}^{n \times n})$, the covariance matrix of each multivariate Gaussian component

A Monte Carlo simulation of a multivariate Gaussian mixture distribution over $T$ time periods is defined as the generation of $T$ independent and identically distributed random variables $X_i, i=1..T$ each following a multivariate Gaussian mixture distribution made of $m$ multivariate Gaussian components whose multivariate Gaussian distribution is $\mathcal{N} \left( \mu_j, \Sigma_j \right)$, $j=1..m$.

Notes:

Let be:

• $T$, the number of time periods
• $\mu \in \mathbb{R}$, an arithmetic average return parameter
• $\sigma \in \mathbb{R}^{+,*}$, a standard deviation parameter
• $\kappa \in \mathbb{R}$, a skewness parameter
• $\gamma \in \mathbb{R}$, an excess kurtosis parameter

A Monte Carlo simulation of a Cornish-Fisher distribution over $T$ time periods is defined as the generation of $T$ independent and identically distributed random variables $X_i, i=1..T$ each following a Cornish-Fisher distribution with a mean parameter equal to $\mu$, a variance parameter equal to $\sigma^2$, a skewness parameter equal to $\kappa$ and an excess kurtosis parameter equal to $\gamma$, that is $$X_i \sim \mu + \sigma \left( Z + (Z^2 - 1) \frac{\kappa}{6} + (Z^3-3Z) \frac{\gamma}{24} -(2Z^3-5Z)\frac{\kappa^2}{36} \right), i = 1..T$$, where $Z$ follows a Gaussian distribution with zero mean and unit variance, that is, $Z \sim \mathcal{N} \left(0, 1\right)$, c.f. the references.

Notes:

• $\mu$, $\sigma^2$, $\kappa$ and $\gamma$ are parameters of the Cornish-Fisher distribution, not to be confused with the mean, the variance, the skewness and the excess kurtosis of the Cornish-Fisher distribution, c.f. the references.
• Depending on the values of the Cornish-Fisher parameters $\kappa$ and $\gamma$, the Cornish-Fisher distribution might not be a proper probability distribution, c.f. the references.
• This endpoint is typically used after fitting a Cornish-Fisher distribution to the returns of an asset.

Let be:

• $T$, the number of time periods
• $r_1,...,r_T$, the arithmetic or logarithmic return of an asset over each time period $1,..,T$
• $\mu \in \mathbb{R}$, the arithmetic average of the asset returns $r_t$, $t=1..T$
• $\sigma \in \mathbb{R}^{+,*}$, the standard deviation of the asset returns $r_t$, $t=1..T$
• $\kappa \in \mathbb{R}$, the skewness of the asset returns $r_t$, $t=1..T$
• $\gamma \in \mathbb{R}$, the excess kurtosis of the asset returns $r_t$, $t=1..T$

A Cornish-Fisher distribution fitting the asset returns $r_t$, $t=1..T$ is a Cornish-Fisher distribution with a mean parameter equal to $\mu$, a variance parameter equal to $\sigma^2$, a skewness parameter equal to $\kappa$ and an excess kurtosis parameter equal to $\gamma$.

Let be:

• $T$, the number of time periods
• $\mu \in \mathbb{R}$, the arithmetic average of the asset returns
• $\sigma \in \mathbb{R}^{+,*}$, the standard deviation of the asset returns
• $\kappa \in \mathbb{R}$, the skewness of the asset returns
• $\gamma \in \mathbb{R}$, the excess kurtosis of the asset returns

A Monte Carlo simulation of a corrected Cornish-Fisher distribution over $T$ time periods is defined as the generation of $T$ independent and identically distributed random variables $X_i, i=1..T$ each following a Cornish-Fisher distribution with a mean parameter equal to $\mu_*$, a variance parameter equal to ${\sigma_*}^2$, a skewness parameter equal to $\kappa_*$ and an excess kurtosis parameter equal to $\gamma_*$, that is $$X_i \sim \mu_* + \sigma_* \left( Z + (Z^2 - 1) \frac{\kappa_*}{6} + (Z^3-3Z) \frac{\gamma_*}{24} -(2Z^3-5Z)\frac{{\kappa_*}^2}{36} \right), i = 1..T$$, where:

• $\mu_*, {\sigma_*}^2, \kappa_*, \gamma_*$ are defined such that the mean, the variance, the skewness and the excess kurtosis of the Cornish-Fisher distribution are exactly equal to $\mu, {\sigma}^2, \kappa, \gamma$
• $Z$ follows a Gaussian distribution with zero mean and unit variance, that is, $Z \sim \mathcal{N} \left(0, 1\right)$
, c.f. the references.

Notes:

• The determination of the Cornish-Fisher parameters $\mu_*, {\sigma_*}^2, \kappa_*, \gamma_*$ is made using a proprietary algorithm.
• Depending on the values of $\kappa$ and $\gamma$, it might not be possible to determine the Cornish-Fisher parameters $\kappa_*$ and $\gamma_*$, in which case an error is returned by this endpoint.
• Depending on the values of the Cornish-Fisher parameters $\kappa_*$ and $\gamma_*$, the Cornish-Fisher distribution might not be a proper probability distribution, c.f. the references.
• This endpoint is typically used after fitting a corrected Cornish-Fisher distribution to the returns of an asset.

Let be:

• $T$, the number of time periods
• $r_1,...,r_T$, the arithmetic or logarithmic return of an asset over each time period $1,..,T$
• $\mu \in \mathbb{R}$, the arithmetic average of the asset returns $r_t$, $t=1..T$
• $\sigma \in \mathbb{R}^{+,*}$, the standard deviation of the asset returns $r_t$, $t=1..T$
• $\kappa \in \mathbb{R}$, the skewness of the asset returns $r_t$, $t=1..T$
• $\gamma \in \mathbb{R}$, the excess kurtosis of the asset returns $r_t$, $t=1..T$

A corrected Cornish-Fisher distribution fitting the asset returns $r_t$, $t=1..T$ is a Cornish-Fisher distribution with a mean parameter equal to $\mu_*$, a variance parameter equal to ${\sigma_*}^2$, a skewness parameter equal to $\kappa_*$ and an excess kurtosis parameter equal to $\gamma_*$, where $\mu_*, {\sigma_*}^2, \kappa_*, \gamma_*$ are defined such that the mean, the variance, the skewness and the excess kurtosis of the Cornish-Fisher distribution are exactly equal to $\mu, {\sigma}^2, \kappa, \gamma$, c.f. the references.

Notes:

• The determination of the Cornish-Fisher parameters $\mu_*, {\sigma_*}^2, \kappa_*, \gamma_*$ is made using a proprietary algorithm.
• Depending on the values of $\kappa$ and $\gamma$, it might not be possible to determine the Cornish-Fisher parameters $\kappa_*$ and $\gamma_*$, in which case an error is returned by this endpoint.

Let be:

• $T$, the number of time periods
• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$
• $r = (r_1,...,r_{T-1}) \in \mathbb{R}^{T-1}$, the logarithmic returns of the portfolio
• $\mu \in \mathbb{R}$, the average return, computed from the portfolio logarithmic returns $r$
• $\sigma \in \mathbb{R}^{+,*}$, the portfolio standard deviation, computed from the portfolio logarithmic returns $r$
• $\alpha \in ]0,1[$, the confidence level, in percentage

The Gaussian conditional value at risk at a confidence level $\alpha$% of the portfolio, $GCVaR_{\alpha}$, is defined as $$GCVaR_{\alpha} = - \mu + \sigma \frac{1}{1-\alpha} \Phi \left( z_{1-\alpha} \right)$$ , where:

• $\Phi$ is the cumulative distribution function of the standard normal distribution.
• $z_{1-\alpha}$ is the $1 - \alpha$%-quantile of the standard Gaussian distribution

Notes:

• C.f. empirical conditional value at risk for additional background information on the conditional value at risk.
• The Gaussian conditional value at risk is a parametric approach to computing the conditional value at risk assuming that the portfolio logarithmic returns follow a Gaussian distribution, which is fitted using the same procedure as exposed through the associated endpoint.

Let be:

• $T$, the number of time periods
• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$
• $r = (r_1,...,r_{T-1}) \in \mathbb{R}^{T-1}$, the logarithmic returns of the portfolio
• $2 \le m \le 5$, the number of components of a Gaussian mixture fitted to the portfolio logarithmic returns $r$, each following a Gaussian distribution
• $p_1, ..., p_m \in [0,1]$ such that $\sum_{i=1}^m p_i = 1$, the weight of each Gaussian component
• $\mu_1, ..., \mu_m \in \mathbb{R}$, the mean of each Gaussian component
• $\sigma_1, ..., \sigma_m \in \mathbb{R}^{+,*}$, the standard deviation of each Gaussian component
• $\alpha \in ]0,1[$, the confidence level, in percentage

The Gaussian mixture conditional value at risk at a confidence level $\alpha$% of the portfolio, $GmCVaR_{\alpha}$, is defined as $$GmCVaR_{\alpha} = - \frac{1}{1-\alpha} \sum_{i=1}^m p_i \left( \mu_i \Phi \left( - h_i \right) - \sigma_i \phi \left( - h_i \right) \right)$$ , where:

• $\Phi$ is the cumulative distribution function of the standard normal distribution
• $\phi$ is the probability distribution function of the standard normal distribution
• $h_i = \frac{ GmVaR_{\alpha} + \mu_i }{\sigma_i}$, $i = 1..m$, with $GmVaR_{\alpha}$ the Gaussian mixture value at risk at a confidence level $\alpha$% of the portfolio

Notes:

• C.f. empirical conditional value at risk for additional background information on the conditional value at risk.
• The Gaussian mixture conditional value at risk is a parametric approach to computing the conditional value at risk assuming that the portfolio logarithmic returns follow a Gaussian mixture distribution, which is fitted using the same procedure as exposed through the associated endpoint.

Let be:

• $T$, the number of time periods
• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$
• $r = (r_1,...,r_{T-1}) \in \mathbb{R}^{T-1}$, the logarithmic returns of the portfolio
• $\mu \in \mathbb{R}$, the portfolio average return, computed from the portfolio logarithmic returns $r$
• $\sigma \in \mathbb{R}^{+,*}$, the portfolio standard deviation, computed from the portfolio logarithmic returns $r$
• $\kappa \in \mathbb{R}$, the portfolio skewness, computed from the portfolio logarithmic returns $r$
• $\gamma \in \mathbb{R}$, the portfolio excess kurtosis, computed from the portfolio logarithmic returns $r$
• $\alpha \in ]0,1[$, the confidence level, in percentage

The Cornish-Fisher conditional value at risk at a confidence level $\alpha$% of the portfolio, $CFCVaR_{\alpha}$, is defined as $$CFCVaR_{\alpha} = -\mu + \sigma y_{\alpha} \left[ 1 - \nu_{\alpha} \frac{\kappa}{6} + (1 - 2 \nu_{\alpha}^2) \frac{\kappa^2}{36} + (-1 + \nu_{\alpha}^2) \frac{\gamma}{24} \right]$$ , where:

• $y_{\alpha} = \frac{1}{1 - \alpha} \Phi(z_{1-\alpha})$ is the Gaussian conditional value at risk of a centered and reduced Gaussian distribution
• $\nu_{\alpha} = - z_{1-\alpha}$ is the Gaussian value at risk of a centered and reduced Gaussian distribution
• $\Phi$ is the cumulative distribution function of the standard normal distribution.
• $z_{1-\alpha}$ is the $1 - \alpha$%-quantile of the standard Gaussian distribution

Notes:

• The Cornish-Fisher conditional value at risk is also called the modified conditional value at risk, or modified expected shortfall.
• C.f. empirical conditional value at risk for additional background information on the conditional value at risk.
• The Cornish-Fisher conditional value at risk is a parametric approach to computing the conditional value at risk assuming that the portfolio logarithmic returns follow a Cornish-Fisher distribution, which is fitted using the same procedure as exposed through the associated endpoint and which uses higher moments (skewness and kurtosis) compared to the Gaussian distribution in order to adjust for the non-normality of the portfolio logarithmic returns.

Let be:

• $T$, the number of time periods
• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$
• $r = (r_1,...,r_{T-1}) \in \mathbb{R}^{T-1}$, the logarithmic returns of the portfolio
• $\mu \in \mathbb{R}$, the portfolio average return, computed from the portfolio logarithmic returns $r$
• $\sigma \in \mathbb{R}^{+,*}$, the portfolio standard deviation, computed from the portfolio logarithmic returns $r$
• $\kappa \in \mathbb{R}$, the portfolio skewness, computed from the portfolio logarithmic returns $r$
• $\gamma \in \mathbb{R}$, the portfolio excess kurtosis, computed from the portfolio logarithmic returns $r$
• $\alpha \in ]0,1[$, the confidence level, in percentage

The corrected Cornish-Fisher conditional value at risk at a confidence level $\alpha$% of the portfolio, $cCFCVaR_{\alpha}$, is defined as $$cCFCVaR_{\alpha} = -\mu_* + \sigma_* y_{\alpha} \left[ 1 - \nu_{\alpha} \frac{\kappa_*}{6} + (1 - 2 \nu_{\alpha}^2) \frac{\kappa_*^2}{36} + (-1 + \nu_{\alpha}^2) \frac{\gamma_*}{24} \right]$$ , where:

• $\mu_*, {\sigma_*}^2, \kappa_*, \gamma_*$ are the Cornish-Fisher parameters defined such that the mean, the variance, the skewness and the excess kurtosis of the Cornish-Fisher distribution are exactly equal to $\mu, {\sigma}^2, \kappa, \gamma$
• $y_{\alpha} = \frac{1}{1 - \alpha} \Phi(z_{1-\alpha})$ is the Gaussian conditional value at risk of a centered and reduced Gaussian distribution
• $\nu_{\alpha} = - z_{1-\alpha}$ is the Gaussian value at risk of a centered and reduced Gaussian distribution
• $\Phi$ is the cumulative distribution function of the standard normal distribution.
• $z_{1-\alpha}$ is the $1 - \alpha$%-quantile of the standard Gaussian distribution

Notes:

• C.f. empirical conditional value at risk for additional background information on the conditional value at risk.
• The determination of the Cornish-Fisher parameters $\mu_*, {\sigma_*}^2, \kappa_*, \gamma_*$ is made using a proprietary algorithm.
• Depending on the values of $\kappa$ and $\gamma$, it might not be possible to determine the Cornish-Fisher parameters $\kappa_*$ and $\gamma_*$, in which case an error is returned by this endpoint.
• The corrected Cornish-Fisher conditional value at risk is a parametric approach to computing the conditional value at risk assuming that the portfolio logarithmic returns follow a Cornish-Fisher distribution, which is fitted using the same procedure as exposed through the associated endpoint and which uses higher moments (skewness and kurtosis) compared to the Gaussian distribution in order to adjust for the non-normality of the portfolio logarithmic returns.

Let be:

• $T$, the number of time periods
• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$
• $r = (r_1,...,r_{T-1}) \in \mathbb{R}^{T-1}$, the logarithmic returns of the portfolio
• $\mu \in \mathbb{R}$, the average return, computed from the portfolio logarithmic returns $r$
• $\sigma \in \mathbb{R}^{+,*}$, the portfolio standard deviation, computed from the portfolio logarithmic returns $r$
• $\alpha \in ]0,1[$, the confidence level, in percentage

The Gaussian value at risk at a confidence level $\alpha$% of the portfolio, $GVaR_{\alpha}$, is defined as $$GVaR_{\alpha} = - \mu - \sigma z_{1-\alpha}$$ , where $z_{1-\alpha}$ is the $1 - \alpha$%-quantile of the standard Gaussian distribution.

Notes:

• C.f. empirical value at risk for additional background information on the value at risk.
• The Gaussian value at risk is a parametric approach to computing the value at risk assuming that the portfolio logarithmic returns follow a Gaussian distribution, which is fitted using the same procedure as exposed through the associated endpoint.

Let be:

• $T$, the number of time periods
• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$
• $r = (r_1,...,r_{T-1}) \in \mathbb{R}^{T-1}$, the logarithmic returns of the portfolio
• $2 \le m \le 5$, the number of components of a Gaussian mixture distribution fitted to the portfolio logarithmic returns $r$, each following a Gaussian distribution
• $p_1, ..., p_m \in [0,1]$ such that $\sum_{i=1}^m p_i = 1$, the weight of each Gaussian component
• $\mu_1, ..., \mu_m \in \mathbb{R}$, the mean of each Gaussian component
• $\sigma_1, ..., \sigma_m \in \mathbb{R}^{+,*}$, the standard deviation of each Gaussian component
• $\alpha \in ]0,1[$, the confidence level, in percentage

The Gaussian mixture value at risk at a confidence level $\alpha$% of the portfolio, $GmVaR_{\alpha}$, is defined as the solution of the equation $$\sum_{i=1}^m p_i \Phi \left( - \frac{ GmVaR_{\alpha} + \mu_i }{\sigma_i} \right) = 1 - \alpha$$ , where $\Phi$ is the cumulative distribution function of the standard normal distribution.

Notes:

• C.f. empirical value at risk for additional background information on the value at risk.
• The Gaussian mixture value at risk is a parametric approach to computing the value at risk assuming that the portfolio logarithmic returns follow a Gaussian mixture distribution, which is fitted using the same procedure as exposed through the associated endpoint.

Let be:

• $T$, the number of time periods
• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$
• $r = (r_1,...,r_{T-1}) \in \mathbb{R}^{T-1}$, the logarithmic returns of the portfolio
• $\mu \in \mathbb{R}$, the portfolio average return, computed from the portfolio logarithmic returns $r$
• $\sigma \in \mathbb{R}^{+,*}$, the portfolio standard deviation, computed from the portfolio logarithmic returns $r$
• $\kappa \in \mathbb{R}$, the portfolio skewness, computed from the portfolio logarithmic returns $r$
• $\gamma \in \mathbb{R}$, the portfolio excess kurtosis, computed from the portfolio logarithmic returns $r$
• $\alpha \in ]0,1[$, the confidence level, in percentage

The Cornish-Fisher value at risk at a confidence level $\alpha$% of the portfolio, $CFVaR_{\alpha}$, is defined as $$CFVaR_{\alpha} = - \left( \mu +\sigma \left[ z_{1-\alpha} + (z_{1-\alpha}^2 - 1) \frac{\kappa}{6} + (z_{1-\alpha}^3-3z_{1-\alpha}) \frac{\gamma}{24} -(2z_{1-\alpha}^3-5z_{1-\alpha})\frac{{\kappa}^2}{36} \right] \right)$$ , where $z_{1-\alpha}$ is the $1 - \alpha$%-quantile of the standard Gaussian distribution.

.

Notes:

• The Cornish-Fisher value at risk is also called the modified value at risk.
• C.f. empirical value at risk for additional background information on the value at risk.
• The Cornish-Fisher value at risk is a parametric approach to computing the value at risk assuming that the portfolio logarithmic returns follow a Cornish-Fisher distribution, which is fitted using the same procedure as exposed through the associated endpoint and which uses higher moments (skewness and kurtosis) compared to the Gaussian distribution in order to adjust for the non-normality of the portfolio logarithmic returns.

Let be:

• $T$, the number of time periods
• $V_t \in \mathbb{R}^{+,*}$, the value of the portfolio at the time $t$, $t=1..T$
• $r = (r_1,...,r_{T-1}) \in \mathbb{R}^{T-1}$, the logarithmic returns of the portfolio
• $\mu \in \mathbb{R}$, the portfolio average return, computed from the portfolio logarithmic returns $r$
• $\sigma \in \mathbb{R}^{+,*}$, the portfolio standard deviation, computed from the portfolio logarithmic returns $r$
• $\kappa \in \mathbb{R}$, the portfolio skewness, computed from the portfolio logarithmic returns $r$
• $\gamma \in \mathbb{R}$, the portfolio excess kurtosis, computed from the portfolio logarithmic returns $r$
• $\alpha \in ]0,1[$, the confidence level, in percentage

The corrected Cornish-Fisher value at risk at a confidence level $\alpha$% of the portfolio, $cCFVaR_{\alpha}$, is defined as $$cCFVaR_{\alpha} = - \left( \mu_* +\sigma_* \left[ z_{1-\alpha} + (z_{1-\alpha}^2 - 1) \frac{\kappa_*}{6} + (z_{1-\alpha}^3-3z_{1-\alpha}) \frac{\gamma_*}{24} -(2z_{1-\alpha}^3-5z_{1-\alpha})\frac{{\kappa_*}^2}{36} \right] \right)$$ , where

• $\mu_*, {\sigma_*}^2, \kappa_*, \gamma_*$ are the Cornish-Fisher parameters defined such that the mean, the variance, the skewness and the excess kurtosis of the Cornish-Fisher distribution are exactly equal to $\mu, {\sigma}^2, \kappa, \gamma$
• $z_{1-\alpha}$ is the $1 - \alpha$%-quantile of the standard Gaussian distribution

Notes:

• C.f. empirical value at risk for additional background information on the value at risk.
• The determination of the Cornish-Fisher parameters $\mu_*, {\sigma_*}^2, \kappa_*, \gamma_*$ is made using a proprietary algorithm.
• Depending on the values of $\kappa$ and $\gamma$, it might not be possible to determine the Cornish-Fisher parameters $\kappa_*$ and $\gamma_*$, in which case an error is returned by this endpoint.
• The corrected Cornish-Fisher value at risk is a parametric approach to computing the value at risk assuming that the portfolio logarithmic returns follow a Cornish-Fisher distribution, which is fitted using the same procedure as exposed through the associated endpoint and which uses higher moments (skewness and kurtosis) compared to the Gaussian distribution in order to adjust for the non-normality of the portfolio logarithmic returns.

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $r_i = (r_{1,i},...,r_{T,i}) \in \mathbb{R}^{T}$, the vector of arithmetic or logarithmic return of the asset $i$, $i=1..n$ over each time period $t=1..T$
• $\sigma_1,...,\sigma_n$, the asset standard deviations
• $c \in [0,1]$, the Gerber threshold

The asset Gerber correlation matrix $G \in \mathcal{M}(\mathbb{R}^{n \times n})$ is defined by: $$G_{i,j} = \frac{n_{i,j}^{UU} + n_{i,j}^{DD} - n_{i,j}^{UD} -n_{i,j}^{DU}}{T - n_{i,j}^{NN}}, i=1..n, j=1..n$$, where:

• $n_{i,j}^{P_iQ_j}$ is the number of observations for which the returns of assets $i$ and $j$ lie respectively in the sets $P_i$ and $Q_j$, with $P_i \in \{U_i,N_i,D_i\}$ and $Q_j \in \{U_j,N_j,D_j\}$
• $U_i,N_i,D_i$ and $U_j,N_j,D_j$, formaly defined in the first reference, are related to the asset volatilities $\sigma_i$ and $\sigma_j$ and to the Gerber threshold $c$

Notes:

• The default value of the Gerber threshold $c$ is 0.5, as suggested in the first reference.

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $r_i = (r_{1,i},...,r_{T,i}) \in \mathbb{R}^{T}$, the arithmetic or logarithmic return of the asset $i$, $i=1..n$ over each time period $t=1..T$
• $\sigma_1,...,\sigma_n$, the asset standard deviations
• $c \in [0,1]$, the Gerber threshold

The asset Gerber covariance matrix $\Sigma_G \in \mathcal{M}(\mathbb{R}^{n \times n})$ is defined by: $$\left( \Sigma_{G} \right)_{i,j} = g_{i,j} \, \sigma_i \, \sigma_j, i=1..n, j=1..n$$, where $g_{i,j}$ is the Gerber correlation between assets $i$ and $j$.

Notes:

• The default value of the Gerber threshold $c$ is 0.5, as suggested in the first reference.

Let be:

• $n$, the number of assets
• $T=T_1,...,T_n$, the number of time periods over which the returns of asset $i=1..n$ are observed, with the assets arranged so that $T = T_1 > T_2 > ... > T_n \geq 1$
• $r_i = (r_{T - T_i + 1,i},...,r_{T,i}) \in \mathbb{R}^{T_i}$, the arithmetic or logarithmic return of the asset $i$, $i=1..n$ over each time period $t=T - T_i + 1..T$

Under this arrangement of the assets, missing asset returns are backfilled (i.e., simulated) as follows:

1. The assets are grouped into $1 \leq J \leq n$ groups whose length of returns history differ, as described in the second reference, with asset 1 belonging to the 1st group and asset $n$ belonging to the $J$-th group
2. The procedure described in the first reference is first applied to the group 1 and 2:
1. The average return of each asset belonging to the 2nd group is estimated by maximum-likelihood over the $T$ time periods $1..T$
2. The covariance matrix between assets belonging to the 2nd group and assets belonging to the 1st group is estimated by maximum-likelihood over the $T$ time periods $1..T$
3. Based on these maximum-likelihood estimates, missing returns for the assets belonging to the 2nd group are inferred through a backfilling procedure
3. The procedure described in the first reference is applied next to the union of the groups 1 and 2 (which includes backfilled asset returns) and to the group 3
4. ...
5. The procedure described in the first reference is applied last to the union of the groups $1,2,...,J-1$ (which includes backfilled asset returns) and to the group $J$

Notes:

• In practical terms, the arrangement of assets described above simply means that:
• The assets are ordered by decreasing length of their returns history
• The returns of asset 1 have been observed oved $T_1 - T_2$ more past time periods than the returns of asset 2, etc.
• The returns of all assets have been observed over the $T_n + 1$ most recent time periods $T - T_n + 1,...,T$
• The arrangement of assets described above is sometimes called a nested arrangement, a monotone arrangement or a monotone missingness arrangement.
• The arrangement of assets described above is automatically computed by this endpoint.
• There are 3 possible choices for the backfilling procedure, all described in the first reference:
• Beta adjustment: deterministic transformation of non-missing asset returns
• Conditional sampling: simulation from a univariate or multivariate Gaussian distribution, conditional on non-missing asset returns
• Residuals recycling (default): mix of the beta adjustment procedure and of the conditional sampling procedure in that the residuals coming from the conditional sampling procedure are selected uniformly at random to be added to the deterministic transformation of non-missing asset returns

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$

The asset close-to-close volatility $\sigma_{cc} \left( T \right)$ over the time period is defined as the (unbiased) sample standard deviation of the asset close-to-close logarithmic returns, that is $$\sigma_{cc} \left( T \right) = \sqrt{\frac{1}{T-2} \sum_{i=2}^T \left( \ln \frac{C_i}{C_{i-1}} - \mu_{cc} \right)^2}$$, where $\mu_{cc} = \frac{1}{T-1} \sum_{i=2}^T \ln \frac{C_i}{C_{i-1}}$ is the arithmetic average of these returns.

Additionally, the asset close-to-close volatility assuming a zero average (log) return $\sigma_{cc,0} \left( T \right)$ over the time period is defined as the standard deviation of the asset close-to-close logarithmic returns with a mean assumed to be equal to zero, that is $$\sigma_{cc,0} \left( T \right) = \sqrt{\frac{1}{T-1} \sum_{i=2}^T \left( \ln \frac{C_i}{C_{i-1}} \right)^2}$$

Notes:

• The volatility computed by this endpoint is not annualized.

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$

The asset Parkinson volatility $\sigma_{P} \left( T \right)$ over the time period is defined as $$\sigma_{P} \left( T \right) = \sqrt{\frac{1}{T}} \sqrt{\frac{1}{4 \ln 2} \sum_{i=1}^T \left( \ln \frac{H_i}{L_i} \right) ^2}$$

Notes:

• The volatility computed by this endpoint is not annualized.

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $O_t \in \mathbb{R}^{+,*}$, the open price of the asset at the observation time $t$, $t=1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$

The asset jump-adjusted Parkinson volatility $\sigma_{P,a} \left( T \right)$ over the time period is defined as $$\sigma_{P,a} \left( T \right) = \sqrt{ \sigma_{co}^2 + \sigma_{P}^2 }$$, where

• $\sigma_{co}$ is the close-to-open volatility, defined as the standard deviation of the asset close-to-open logarithmic returns with a mean assumed to be equal to zero, that is $$\sigma_{co} = \sqrt{\frac{1}{T-1} \sum_{i=2}^T \left( \ln \frac{O_i}{C_{i-1}} \right)^2}$$
• $\sigma_{P}$ is the asset Parkinson volatility over the time period $2..T$

Notes:

• The volatility computed by this endpoint is not annualized.

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $O_t \in \mathbb{R}^{+,*}$, the open price of the asset at the observation time $t$, $t=1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$

The asset Garman-Klass volatility $\sigma_{GK} \left( T \right)$ over the time period is defined as $$\sigma_{GK} \left( T \right) = \sqrt{\frac{1}{T}} \sqrt{ \sum_{i=1}^T \frac{1}{2} \left( \ln\frac{H_i}{L_i} \right) ^2 - \left( 2 \ln2 - 1 \right) \left( \ln\frac{C_i}{O_i} \right )^2 }$$

Notes:

• The volatility computed by this endpoint is not annualized.

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $O_t \in \mathbb{R}^{+,*}$, the open price of the asset at the observation time $t$, $t=1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$

The asset jump-adjusted Garman-Klass volatility $\sigma_{GK,a} \left( T \right)$ over the time period is defined as $$\sigma_{GK,a} \left( T \right) = \sqrt{ \sigma_{co}^2 + \sigma_{GK}^2 }$$, where

• $\sigma_{co}$ is the close-to-open volatility, defined as the standard deviation of the asset close-to-open logarithmic returns with a mean assumed to be equal to zero, that is $$\sigma_{co} = \sqrt{\frac{1}{T-1} \sum_{i=2}^T \left( \ln \frac{O_i}{C_{i-1}} \right)^2}$$
• $\sigma_{GK}$ is the asset Garman-Klass volatility over the time period $2..T$

Notes:

• The volatility computed by this endpoint is not annualized.

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $O_t \in \mathbb{R}^{+,*}$, the open price of the asset at the observation time $t$, $t=1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$

The asset original Garman-Klass volatility $\sigma_{GKo} \left( T \right)$ over the time period is defined as $$\sigma_{GKo} \left( T \right) = \sqrt{\frac{1}{T}} \sqrt{ \sum_{i=1}^T 0.511 \left( \ln\frac{H_i}{L_i} \right) ^2 - 0.019 \left[ \ln\frac{C_i}{O_i} \left( \ln\frac{H_i}{O_i} + \ln\frac{L_i}{O_i} \right) - 2 \ln\frac{H_i}{O_i} \ln\frac{L_i}{O_i} \right] - 0.383 \left( \ln\frac{C_i}{O_i} \right )^2 }$$

Notes:

• The original Garman-Klass volatility estimator is a slightly more efficient, but more complex, variation of the Garman-Klass volatility estimator.
• The volatility computed by this endpoint is not annualized.

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $O_t \in \mathbb{R}^{+,*}$, the open price of the asset at the observation time $t$, $t=1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$

The asset jump-adjusted original Garman-Klass volatility $\sigma_{GKo,a} \left( T \right)$ over the time period is defined as $$\sigma_{GKo,a} \left( T \right) = \sqrt{ \sigma_{co}^2 + \sigma_{GKo}^2 }$$, where

• $\sigma_{co}$ is the close-to-open volatility, defined as the standard deviation of the asset close-to-open logarithmic returns with a mean assumed to be equal to zero, that is $$\sigma_{co} = \sqrt{\frac{1}{T-1} \sum_{i=2}^T \left( \ln \frac{O_i}{C_{i-1}} \right)^2}$$
• $\sigma_{GK}$ is the asset original Garman-Klass volatility over the time period $2..T$

Notes:

• The jump-adjusted original Garman-Klass volatility estimator is a slightly more efficient, but more complex, variation of the jump-adjusted Garman-Klass volatility estimator.
• The volatility computed by this endpoint is not annualized.

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $O_t \in \mathbb{R}^{+,*}$, the open price of the asset at the observation time $t$, $t=1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$

The asset Rogers-Satchell volatility $\sigma_{RS} \left( T \right)$ over the time period is defined as $$\sigma_{RS} \left( T \right) = \sqrt{\frac{1}{T}} \sqrt{ \sum_{i=1}^T \ln\frac{H_i}{C_i} \ln\frac{H_i}{O_i} - \ln\frac{L_i}{C_i} \ln\frac{L_i}{O_i} }$$

Notes:

• The volatility computed by this endpoint is not annualized.

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $O_t \in \mathbb{R}^{+,*}$, the open price of the asset at the observation time $t$, $t=1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$

The asset jump-adjusted Rogers-Satchell volatility $\sigma_{RS,a} \left( T \right)$ over the time period is defined as $$\sigma_{RS,a} \left( T \right) = \sqrt{ \sigma_{co}^2 + \sigma_{RS}^2 }$$, where

• $\sigma_{co}$ is the close-to-open volatility, defined as the sample standard deviation of the asset close-to-open logarithmic returns, that is $$\sigma_{co} = \sqrt{\frac{1}{T-2} \sum_{i=2}^T \left( \ln \frac{O_i}{C_{i-1}} - \mu_{co} \right)^2}$$, with $\mu_{co} = \frac{1}{T-1} \sum_{i=2}^T \ln \frac{O_i}{C_{i-1}}$
• $\sigma_{RS}$ is the asset Rogers-Satchell volatility over the time period $2..T$

Notes:

• The volatility computed by this endpoint is not annualized.

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $O_t \in \mathbb{R}^{+,*}$, the open price of the asset at the observation time $t$, $t=1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$

The asset Yang-Zhang volatility $\sigma_{YZ} \left( T \right)$ over the time period is defined as $$\sigma_{YZ} \left( T \right) = \sqrt{ \sigma_{ov}^2 + k \sigma_{oc}^2 + (1-k) \sigma_{RS}^2 }$$, where:

• $\sigma_{co}$ is the close-to-open volatility, defined as the sample standard deviation of the asset close-to-open logarithmic returns, that is $$\sigma_{co} = \sqrt{\frac{1}{T-2} \sum_{i=2}^T \left( \ln \frac{O_i}{C_{i-1}} - \mu_{co} \right)^2}$$, with $\mu_{co} = \frac{1}{T-1} \sum_{i=2}^T \ln \frac{O_i}{C_{i-1}}$
• $\sigma_{oc}$ is the open-to-close volatility, defined as the sample standard deviation of the asset open-to-close logarithmic returns, that is $$\sigma_{oc} = \sqrt{\frac{1}{T-2} \sum_{i=2}^T \left( \ln \frac{O_i}{C_{i}} - \mu_{oc} \right)^2}$$, with $\mu_{oc} = \frac{1}{T-1} \sum_{i=2}^T \ln \frac{C_i}{O_{i}}$
• $\sigma_{RS}$ is the asset Rogers-Satchell volatility over the time period $2..T$
• $k = \frac{0.34}{1.34 + \frac{T}{T-2}}$

Notes:

• The volatility computed by this endpoint is not annualized.
• The close-to-open volatility is also called the overnight volatility.
• The first open, high, low and high prices $\left(O_1, H_1, L_1, C_1 \right)$ are only used in the computation of the close-to-open volatility $\sigma_{co}$, through $C_1$

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $O_t \in \mathbb{R}^{+,*}$, the open price of the asset at the observation time $t$, $t=1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$
• $\tilde{\sigma}^2_t$, a variance proxy for the asset at the observation time $t$, constructed from asset prices up to the observation time $t$
• $w \in [1 .. T]$, a window size, corresponding to the number of variance proxy observations to take into account in the computation of the simple moving average
• $h \geq 1$, a forecast horizon, corresponding to the number of multi-step-ahead volatility forecasts to compute

The asset one-step-ahead simple moving average volatility forecast $\hat{\sigma}_{T+1}$ is defined as $$\hat{\sigma}_{T+1} = \sqrt{ \frac{1}{w} \sum_{i=0}^{w-1} \tilde{\sigma}^2_{T-i} }$$

The asset $h$-step-ahead simple moving average volatility forecast $\hat{\sigma}_{T+h}, h \geq 2$ is defined by recursive substitution as $$\hat{\sigma}_{T+h} = \sqrt{ \frac{ \sum_{i=1}^{k-h+1} \tilde{\sigma}^2_{T+1-i} + \sum_{i=1}^{h-1} \hat{\sigma}^2_{T+h-i}}{k} }$$

The asset aggregated volatility forecast over the forecast horizon $h$, $\hat{\sigma}_{T+1:T+h}, h \geq 1$, is defined as $$\hat{\sigma}_{T+1:T+h} = \sqrt{ \sum_{i=1}^h \hat{\sigma}_{T+i}^2 }$$

Notes:

• There are 4 possible choices for the variance proxies:
• The volatility forecasts computed by this endpoint are not annualized.

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $O_t \in \mathbb{R}^{+,*}$, the open price of the asset at the observation time $t$, $t=1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$
• $\tilde{\sigma}^2_t$, a variance proxy for the asset at the observation time $t$, constructed from asset prices up to the observation time $t$
• $\lambda \in ]0,1[$, a decay factor, corresponding to the decay factor to use in the computation of the exponential moving average
• $h \geq 1$, a forecast horizon, corresponding to the number of multi-step-ahead volatility forecasts to compute

The asset one-step-ahead exponentially weighted moving average volatility forecast $\hat{\sigma}_{T+1}$ is defined as $$\hat{\sigma}_{T+1} = \sqrt{ \frac{1 - \lambda}{1 - \lambda^{T}} \sum_{k=1}^{T} \lambda^{T-k} \tilde{\sigma}^2_{k} }$$

The asset $h$-step-ahead exponentially weighted moving average volatility forecast $\hat{\sigma}_{T+h}, h \geq 2$ is defined as $$\hat{\sigma}_{T+h} = \hat{\sigma}_{T+1}$$

The asset aggregated volatility forecast over the forecast horizon $h$, $\hat{\sigma}_{T+1:T+h}, h \geq 1$, is defined as $$\hat{\sigma}_{T+1:T+h} = \sqrt{ \sum_{i=1}^h \hat{\sigma}_{T+i}^2 }$$

Notes:

• There are 4 possible choices for the variance proxies:
• The volatility forecasts computed by this endpoint are not annualized.
• The decay factor $\lambda$ determines the weights applied to the variance proxies, as well as the effective amount of time periods used for volatility forecasting.
• The decay factor $\lambda$ can also be defined in terms of the half-life $\tau$, which is the time taken by the weights to decay by $\frac{1}{2}$, through the relationship $$\tau = -\frac{\ln 2}{\ln \lambda} \Leftrightarrow \lambda = \left ( \frac{1}{2} \right )^{\frac{1}{\tau}}$$
• The formula above is different from the more usual recursive definition of the exponentially weighted moving average volatility forecast $\hat{\sigma}_{T+1} = \sqrt{ \lambda \hat{\sigma}_{T}^2 + \left( 1 - \lambda \right) \tilde{\sigma}^2_{T} }$, with $\hat{\sigma}_{0}^2 = \tilde{\sigma}^2_0$; this is due to the presence of a normalization constant; differences between the two formulas become neglictible as $T \to +\infty$.
• J.P.Morgan recommends a decay factor $\lambda$ equals to 0.94 for daily observations or a daily forecast horizon and a decay factor $\lambda$ equals to 0.97 for monthly observations or a monthly forecast horizon.
• It is possible to let this endpoint automatically determine the "best" decay factor, using a procedure similar to the one described in the second reference.

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $O_t \in \mathbb{R}^{+,*}$, the open price of the asset at the observation time $t$, $t=1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$
• $\tilde{\sigma}^2_t$, a variance proxy for the asset at the observation time $t$, constructed from asset prices up to the observation time $t$
• $h \geq 1$, a forecast horizon, corresponding to the number of multi-step-ahead volatility forecasts to compute

The asset one-step-ahead GARCH(1,1) volatility forecast $\hat{\sigma}_{T+1}$ is defined recursively as $$\hat{\sigma}_{T+1} = \sqrt{ \gamma \tilde{\sigma}^2 + \alpha \tilde{\sigma}^2_{T} + \beta \hat{\sigma}_{T}^2 }$$, with:

• $\alpha \in [0,1]$, $\beta \in [0,1]$ and $\gamma \in [0,1]$ parameters satisfying $\alpha + \beta + \gamma = 1$; these parameters are automatically determined using a procedure based on the close prices of the asset
• $\tilde{\sigma}^2 = \frac{1}{T} \sum_{t=1}^{T} \tilde{\sigma}^2_t$, the average of the asset variance proxy values, corresponding to the unconditional variance of the asset
• $\hat{\sigma}_{0}^2 = \tilde{\sigma}^2_0$

The asset $h$-step-ahead GARCH(1,1) volatility forecast $\hat{\sigma}_{T+h}, h \geq 2$ is defined as $$\hat{\sigma}_{T+h} = \sqrt{ \tilde{\sigma}^2 + \left( \alpha + \beta \right)^{h-1} \left( \hat{\sigma}_{T+1} - \tilde{\sigma}^2 \right) }$$

The asset aggregated volatility forecast over the forecast horizon $h$, $\hat{\sigma}_{T+1:T+h}, h \geq 1$, is defined as $$\hat{\sigma}_{T+1:T+h} = \sqrt{ \sum_{i=1}^h \hat{\sigma}_{T+i}^2 }$$

Notes:

• There are 4 possible choices for the variance proxies:
• The volatility forecasts computed by this endpoint are not annualized.

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $O_t \in \mathbb{R}^{+,*}$, the open price of the asset at the observation time $t$, $t=1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$
• $\tilde{\sigma}^2_t$, a variance proxy for the asset at the observation time $t$, constructed from asset prices up to the observation time $t$
• $h \geq 1$, a forecast horizon, corresponding to the number of multi-step-ahead volatility forecasts to compute

The asset one-step-ahead HAR volatility forecast $\hat{\sigma}_{T+1}$ is defined as $$\hat{\sigma}_{T+1} = \sqrt{ \beta + \beta_d \tilde{\sigma}^2_{T} + \frac{\beta_w}{5} \sum_{i=1}^5 \tilde{\sigma}^2_{T+1-i} + \frac{\beta_m}{22} \sum_{i=1}^{22} \tilde{\sigma}^2_{T+1-i} }$$, with:

• $\beta$, $\beta_d$, $\beta_w$ and $\beta_m$ parameters automatically determined using a least squares estimator

The asset $h$-step-ahead HAR volatility forecast $\hat{\sigma}_{T+h}, h \geq 2$ is defined by recursive substitution as $$\hat{\sigma}_{T+h} = \sqrt{ \beta + \beta_d \hat{\sigma}_{T+h-1}^2 + \frac{\beta_w}{5} \left( \sum_{i=1}^{5-h+1} \tilde{\sigma}^2_{T+1-i} + \sum_{i=1}^{h-1} \hat{\sigma}^2_{T+h-i} \right) + \frac{\beta_m}{22} \left( \sum_{i=1}^{22-h+1} \tilde{\sigma}^2_{T+1-i} + \sum_{i=1}^{h-1} \hat{\sigma}^2_{T+h-i} \right) }$$

The asset aggregated volatility forecast over the forecast horizon $h$, $\hat{\sigma}_{T+1:T+h}, h \geq 1$, is defined as $$\hat{\sigma}_{T+1:T+h} = \sqrt{ \sum_{i=1}^{h} \hat{\sigma}^2_{T+i} }$$

Notes:

• There are 4 possible choices for the variance proxies:
• There are 3 possible choices for the least squares estimator
• Ordinary least squares (default)
• Weighted least squares, using the inverse of the variance proxies as weights
• Robust least squares, using Tukey's biweight loss function
• There are 2 possible choices for the type of least squares estimator
• Individual-based least squares estimator (default), with per-asset estimates of the parameters $\beta$, $\beta_d$, $\beta_w$ and $\beta_m$
• Panel-based least squares estimator, with common estimates of the parameters $\beta_d$, $\beta_w$ and $\beta_m$ across all input assets and per-asset estimate of the parameter $\beta$, as described in the fourth reference
• It is possible to transform the variance proxies into log variance proxies before determining the parameters $\beta$, $\beta_d$, $\beta_w$ and $\beta_m$, in which case the associated variance forecasts are unbiased thanks to the formulas established in the references.
• It is possible to use other lag indexes for the variance proxies than the default [1, 5, 22] lag indexes, in which case the HAR volatility forecasting formulas above are automatically adapted.
• It is possible to center the variance proxies around their long term average, as described in the fourth reference; to be noted that this is automatically done in case the type of least squares estimator is panel-based.
• The volatility forecasts computed by this endpoint are not annualized.

Let be:

• $T$, the number of observations of the asset prices over a time period $1..T$
• $O_t \in \mathbb{R}^{+,*}$, the open price of the asset at the observation time $t$, $t=1..T$
• $H_t \in \mathbb{R}^{+,*}$, the high(est) price of the asset at the observation time $t$, $t=1..T$
• $L_t \in \mathbb{R}^{+,*}$, the low(est) price of the asset at the observation time $t$, $t=1..T$
• $C_t \in \mathbb{R}^{+,*}$, the close price of the asset at the observation time $t$, $t=1..T$
• $\tilde{\sigma}^2_t$, a variance proxy for the asset at the observation time $t$, constructed from asset prices up to the observation time $t$
• $h \geq 1$, a forecast horizon, corresponding to the number of multi-step-ahead volatility forecasts to compute

The asset one-step-ahead HExp volatility forecast $\hat{\sigma}_{T+1}$ is defined as $$\hat{\sigma}_{T+1} = \sqrt{ \beta + \beta_d ExpVP_T^{\lambda(1)} + \beta_w ExpVP_T^{\lambda(5)} + \beta_mExpVP_T^{\lambda(25)} }$$, with:

• $ExpVP_T^{\lambda(CoM)} = \sum_{i=1}^T \frac{e^{-i \lambda(CoM)}}{\sum_{j=1}^T e^{-j \lambda(CoM)}} \tilde{\sigma}^2_{T+1-i}$
• $\lambda \left(CoM\right) = \log \left( 1 + \frac{1}{CoM} \right)$
• $\beta$, $\beta_d$, $\beta_w$ and $\beta_m$ parameters automatically determined using a least squares estimator

The asset $h$-step-ahead HExp volatility forecast $\hat{\sigma}_{T+h}, h \geq 2$ is defined by recursive substitution as $$\hat{\sigma}_{T+h} = \sqrt{ \beta + \beta_d ExpVP_{T+h-1}^{\lambda(1)} + \beta_w ExpVP_{T+h-1}^{\lambda(5)} + \beta_m ExpVP_{T+h-1}^{\lambda(25)} }$$, with:

• $ExpVP_{T+h-1}^{\lambda(CoM)} = \sum_{i=1}^T \frac{e^{-i \lambda(CoM)}}{\sum_{j=1}^{T+h-1} e^{-j \lambda(CoM)}} \tilde{\sigma}^2_{T+1-i} + \sum_{i=1}^{h-1} \frac{e^{-i \lambda(CoM)}}{\sum_{j=1}^{T+h-1} e^{-j \lambda(CoM)}} \hat{\sigma}^2_{T+h-i}$

The asset aggregated volatility forecast over the forecast horizon $h$, $\hat{\sigma}_{T+1:T+h}, h \geq 1$, is defined as $$\hat{\sigma}_{T+1:T+h} = \sqrt{ \sum_{i=1}^{h} \hat{\sigma}^2_{T+i} }$$

Notes:

• There are 4 possible choices for the variance proxies:
• There are 3 possible choices for the least squares estimator
• Ordinary least squares (default)
• Weighted least squares, using the inverse of the variance proxies as weights
• Robust least squares, using Tukey's biweight loss function
• There are 2 possible choices for the type of least squares estimator
• Individual-based least squares estimator (default), with per-asset estimates of the parameters $\beta$, $\beta_d$, $\beta_w$ and $\beta_m$
• Panel-based least squares estimator, with common estimates of the parameters $\beta_d$, $\beta_w$ and $\beta_m$ across all input assets and per-asset estimate of the parameter $\beta$, as described in the first reference
• It is possible to use other centers of mass (CoM) for the variance proxies than the default [1, 5, 25] centers of mass, in which case the HExp volatility forecasting formulas above are automatically adapted; in particular, the default centers of mass suggested in the first reference are [1, 5, 25, 125], but these require more data than the default centers of mass of this endpoint.
• It is possible to transform the variance proxies into log variance proxies before determining the parameters $\beta$, $\beta_d$, $\beta_w$ and $\beta_m$, in which case the associated variance forecasts are unbiased thanks to the formulas established in the references.
• It is possible to center the variance proxies around their long term average, as described in the first reference; to be noted that this is automatically done in case the type of least squares estimator is panel-based.
• The volatility forecasts computed by this endpoint are not annualized.

Let be:

• $n$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix
• $\rho \in [-1,1]$, the correlation threshold

Fast threshold clustering group similar assets together using the average correlation of each asset to all other assets.

Notes:

• The asset correlation matrix $C$ is not required to be positive semi-definite.

• The correlation threshold $\rho$ controls the number of clusters produced by the algorithm; its default value of 0.5 is "approximately the level of statistical significance", c.f. the reference.
• .
• The fast threshold clustering algorithm is similar in spirit to the minimum correlation portfolio optimization algorithm.

Let be:

• $n$, the number of assets
• $C \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset correlation matrix

Hierarchical clustering group similar assets together thanks to a hierarchical tree, cut at a certain height, computed from the asset correlation matrix $C$.

Notes:

• The asset correlation matrix $C$ is not required to be positive semi-definite.
• The number of clusters can either be provided or can be automatically computed thanks to the gap statistic method described in the references (default), using the uniform distribution over the set of positive definite correlation matrices as the null reference distribution.
• There are 4 possible choices for the hierarchical clustering algorithm, influencing the way assets are grouped together:
• Hierarchical clustering as implemented by this endpoint is also the first step of the clustering-based hierarchical risk parity portfolio optimization algorithm.

Let be:

• $n$, the number of assets
• $D \in \mathcal{M}(\mathbb{R}^{m \times n})$, $m \geq 1$, a belief matrix on asset returns ordering

Asset returns estimates $\mu_1,...,\mu_n$ consistent with ordering information about these assets returns - as provided in the matrix $D$ - corresponds to the geometric centroid $\mu \in \mathbb{R}^n$ of the consistent cone $\{ r \in \mathbb{R}^n, Dr \geq 0 \}$ under any probability distribution radially symmetric about the origin, c.f. the reference.

Notes:

• The belief matrix $D$ encodes homogeneous linear relationships among all the asset returns like complete sorts, sector sorts, sorts with long-short beliefs, performance relative to an index..., with no constant terms.
• The asset returns estimates $\mu_1,...,\mu_n$ is defined up to a scalar constant; if desired, it is possible to scale these estimates by the typical magnitude of the asset returns under consideration (e.g. 5%, 10%, ...).
• The radially symmetric probability distribution implemented by this endpoint is a standard multivariate Gaussian distribution.

Let be:

• $n$, the number of assets
• $T$, the number of time periods
• $R \in \mathbb{R}^{T \times n}$, the matrix of arithmetic or logarithmic returns of the assets, with $R_{t,i}$ the return of the asset $i=1..n$ for the time period $t=1..T$
• $\mu \in \mathbb{R}^{n}$, the vector of the mean return of each asset over the $T$ periods
• $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the covariance matrix of the asset returns over the $T$ periods
• $\bar{\mu} \in \mathbb{R}^{n}$ a vector
• $\bar{\Sigma} \in \mathcal{M} \left( \mathbb{R}^{n \times n} \right)$ a positive semi-definite matrix

The moment-matched asset returns $\tilde{R} \in \mathbb{R}^{T \times n}$ are defined as:

$$\tilde{R} = \begin{pmatrix} 1 \\ 1 \\ ... \\ 1 \end{pmatrix} \bar{\mu}^t + \left( R - \begin{pmatrix} 1 \\ 1 \\ ... \\ 1 \end{pmatrix} \mu^t \right) A_*$$, with $A_* = { \bar{\Sigma}^{\frac{1}{2}} }^t \left( { \bar{\Sigma}^{\frac{1}{2}} } \Sigma { \bar{\Sigma}^{\frac{1}{2}} }^t \right)^{-\frac{1}{2}} { \bar{\Sigma}^{\frac{1}{2}} }$

Notes:

• The moment-matched asset returns $\tilde{R}$ represent the "minimal distortion" of the original asset returns $R$ such that:
• The sample mean vector of $\tilde{R}$ is equal to $\bar{\mu}$: $\frac{1}{T} \sum_{t=1}^{T} \tilde{R}_{t,i} = \bar{\mu}_i$, $i=1..n$
• The sample covariance matrix of $\tilde{R}$ is equal to $\bar{\Sigma}$: $\frac{1}{T} \sum_{k=1}^T \left( \tilde{R}\_{k,i} - \bar{\mu}_i \right) \left( \tilde{R}\_{k,j} - \bar{\mu}_j \right) = \bar{\Sigma}\_{i,j}$, $i=1..n$, $j=1..n$
• The "minimal distortion" is to be understood in the sense that:

$$\argmin_{\tilde{R} \in \mathcal{M}(\mathbb{R}^{T \times n}), \frac{1}{n}\tilde{R}^t R = \bar{\Sigma}} \left\Vert R - \tilde{R} \right\Vert^2_F = R A_*$$

• In case the asset covariance matrix $\Sigma$ is not positive definite but only positive semi-definite, subsequent calls to this endpoint with the same input data will result in different output data.