Portfolio Optimizer can be used:
 As an anonymous user
 As an authenticated user
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..T1$, 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..T1$, 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
 $T$, the number of time periods
 $r_i = (r_{1,i},...,r_{T,i}) \in \mathbb{R}^{T}$, the arithmetic or logarithmic 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
The asset 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$$
Alternatively, 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
 $\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=0}^{T1} \lambda^{k} (r_{Tk,i}  \overline{r_i}) (r_{Tk,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 halflife $\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}} $$
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 semidefinite, 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 semidefinite, 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 semidefinite 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.
Additionally let be:
 $\mathcal{N}$ the index set of the offdiagonal 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 offdiagonal 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 average 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_{T1}) \in \mathbb{R}^{T1}$, 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}^{T1} (r_{t}  \overline{r})^2 }{T1}} $$
, 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 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:
 $r_f \in \mathbb{R}$, the value of the risk free rate
 $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
The Sharpe ratio $SR$ of the portfolio is defined as: $$ SR = \frac{\overline{r}  r_f}{\sigma_p} $$
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 longshort 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 longshort 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 longshort 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 longonly 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 longshort 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 of the portfolio
The return contribution of the $i$th asset to the return of the portfolio, $i=1..n$, is defined as: $$ w_{i} \mu_i $$
Additionally, let be:
 $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 of the portfolio
The risk contribution of the $i$th asset to the risk of the portfolio, $i=1..n$, is defined as: $$ w_{i} \frac{(\Sigma w)_i}{\sqrt{w {}^t \Sigma w}} $$
Additionally, let be:
 $n_k$, the optional number of groups of assets
 $\mathcal{N}_1,...,\mathcal{N}_{n_k}$ the optional $n_k$ groups of assets
The risk contribution of the group of assets $\mathcal{N}_k$ to the risk of the portfolio, $k=1..n_k$, is defined as: $$ \sum_{j \in \mathcal{N}_k} w_{j} \frac{(\Sigma w)_j}{\sqrt{w {}^t \Sigma w}} $$
Notes:
 The risk is defined in terms of standard deviation of the returns (i.e., volatility)
 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 meanvariance 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[$.
Additionally, let be:
 $n_p$, the number of portfolios to compute on the meanvariance efficient frontier
The discretized meanvariance efficient frontier is the (finite) set of $n_p$ portfolios belonging to the continuous meanvariance efficient frontier with equally spaced arithmetic returns.
Notes:
 The parameter $1/\lambda$ is usually called the risk aversion parameter
 When no group weights constraints are present, and if numerically possible, the algorithm used internally to solve the linearly constrained quadratic optimization problem above is the Critical Line Method from Harry_Markowitz
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 meanvariance 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[$.
Additionally, let be:
 $n_p$, the number of portfolios to compute on the meanvariance minimum variance frontier
The discretized meanvariance minimum variance frontier is the (finite) set of $n_p$ portfolios belonging to the continuous meanvariance minimum variance frontier with equally spaced arithmetic returns.
Notes:
 The parameter $1/\lambda$ is usually called the risk aversion parameter
 When no group weights constraints are present, and if numerically possible, the algorithm used internally to solve the linearly constrained quadratic optimization problem above is the Critical Line Method from Harry_Markowitz
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 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:
 Buy and hold  No portfolio rebalancing (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 portfolio 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 2 possible choices for the portfolio rebalancing method:
 Buy and hold  No portfolio rebalancing (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$
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 indextracking 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 indextracking 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 NPhard 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 equalweighted 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 varianceweighted 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 volatilityweighted 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 volatilityweighted portfolio is also known as the naiverisk parity portfolio
Let be:
 $n$, the number of assets
 $mktcap_1,...,mktcap_n$ the assets market capitalizations
The market capitalizationweighted 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 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 $$
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 meanvariance efficient
To enforce meanvariance efficiency, the covariance matrix of the assets $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$ must be 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 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 meanvariance efficient
To enforce meanvariance efficiency, the arithmetic returns of the assets $\mu \in \mathbb{R}^{n}$ must be 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
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
 The algorithm used internally to solve the optimization problem above is a cyclical coordinate descent algorithm, similar to the algorithm described in the reference
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 clusteringbased equal risk contributions portfolio weights $w^* \in [0,1]^{n}$ are computed through the following procedure:
 For $i = 1..k$ do
 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
 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}$  represented by $k$ synthetic assets of weights $w_{1}^*,...,w_k^*$ , taking into account asset weight constraints
 Compute the weights $w^*$ as the matrixvector product $$ w^* = \begin{pmatrix}
w_1^* \\
w_2^* \\
... \\
w_k^*
\end{pmatrix}^t w_c^* $$
Notes:
 The clusteringbased 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 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 value of the risk free rate $r_f$ is usually either taken as the interest rate on a riskless asset like cash or as the interest rate on borrowings
 The maximum Sharpe ratio portfolio is meanvariance 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 meanvariance 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 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
 When no group weights constraints are present, and if numerically possible, the algorithm used internally to solve the linearly constrained quadratic optimization problem above is the Critical Line Method from Harry_Markowitz
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:
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 \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 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 \mathcal{R}^{m \times T}$, the matrix of the factors returns
The returns $R_{res, i} \in \mathcal{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 \mathcal{R}, \beta \in \mathcal{R}^{m})}} \lVert X_i  \alpha  \beta {}^t X_{i} \rVert_2^2 $$
Let be:
 $m$, the number of factors
 $T$, the number of time periods
 $X \in \mathcal{R}^{m \times T}$, the matrix of the factors returns
 $n_p$, the number of portfolios
 $r_p = (r_{p,1},...,r_{p,T}) \in \mathbb{R}^{T}$, the returns of the portfolio $p$, $p=1..n_p$
The exposures $\beta_p \in \mathcal{R}^{m}$ of the $p$th portfolio to the $m$ factors, $p=1..n_p$, are defined as the unique solution of minimum euclidean norm of the linear least squares problem:
$$ \operatorname{argmin_{(\alpha_p \in \mathcal{R}, \beta_p \in \mathcal{R}^{m})}} \lVert r_p {}^t  \alpha_p  \beta_p {}^t X \rVert_2^2 $$
Notes:
 $\alpha_p$ represents the portion of the portfolio $p$ returns that cannot be attributed to the portfolio exposure to the $m$ factors
 $\beta_{p}$ represents the magnitude of the portfolio $p$ exposure to the $m$ factors
Let be:
 $T$, the number of time periods
 $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
 $n$, the number of portfolios
 $r_p = (r_{p,1},...,r_{p,T}) \in \mathbb{R}^{T}$, the returns of the portfolio
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,t}  r_{f,t} = \alpha + \beta (r_{b,t}  r_{f,t}) + \epsilon_t $$, with $t=1..T$
Notes:
Let be:
 $T$, the number of time periods
 $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
 $n_p$, the number of portfolios
 $r_p = (r_{p,1},...,r_{p,T}) \in \mathbb{R}^{T}$, the returns of the portfolio
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,t}  r_{f,t} = \alpha + \beta (r_{b,t}  r_{f,t}) + \epsilon_t $$, with $t=1..T$
Notes:
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_T + \lambda 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 semidefinite, as the linear shrinkage operator is defined for any $n$ by $n$ matrix, but in this case, the matrix $C_S$ might not be positive semidefinite.
 The parameter $\lambda$ is usually called the shrinkage factor, or the shrinkage intensity, or the shrinkage constant.
 This endpoint provides 3 predefined target equicorrelation matrices $C_T$:
 The equicorrelation matrix made of 1, representing the maximum correlation matrix $$ \begin{pmatrix}
1 & 1 & ... & 1 \\
1 & 1 & ... & 1 \\
... & ... & ... & ... \\
1 & 1 & ... & 1
\end{pmatrix} $$
 The equicorrelation matrix made of 0, representing the minimum nonnegative correlation matrix $$ \begin{pmatrix}
1 & 0 & ... & 0 \\
0 & 1 & ... & 0 \\
... & ... & ... & ... \\
0 & 0 & ... & 1
\end{pmatrix} $$
 The equicorrelation matrix made of $\frac{1}{n1}$, representing the minimum negative correlation matrix $$ \begin{pmatrix}
1 & \frac{1}{n1} & ... & \frac{1}{n1} \\
\frac{1}{n1} & 1 & ... & \frac{1}{n1} \\
... & ... & ... & ... \\
\frac{1}{n1} & \frac{1}{n1} & ... & 1
\end{pmatrix} $$
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 topdown 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 the assets are grouped together:
 Single linkage (default)
 Average linkage
 Complete linkage
 Ward's linkage
 There are 2 possible choices for the order to impose on the hierarchical clustering tree leaves, also influencing the way the 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 clusteringbased 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 topdown 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 the assets are grouped together:
 Single linkage
 Average linkage
 Complete linkage
 Ward's linkage (default)
 There are 2 possible choices for the order to impose on the hierarchical clustering tree leaves, also influencing the way the 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 ClusteringBased 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 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 ReturntoUlcer 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 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 value of the risk free rate $r_f$ is usually either taken as the interest rate on a riskless asset like cash or as the interest rate on borrowings
 The Ulcer Performance Index is also called the Martin Index, the Martin Ratio or the ReturntoUlcer 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_{T1}) \in \mathbb{R}^{T1}$, the arithmetic returns of the portfolio
 $\alpha \in ]0,1[$, the confidence level, in percentage
The historical 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 historical value at risk of the portfolio.
Notes:
 The historical 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 historical conditional value at risk is a nonparametric 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_{T1}) \in \mathbb{R}^{T1}$, the arithmetic returns of the portfolio
 $\alpha \in ]0,1[$, the confidence level, in percentage
The historical 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 historical 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 historical value at risk is a nonparametric 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 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:
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 meanvariance 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_{T'} \in \mathbb{R}^{n}$, the vector of the average asset returns over a historical reference period $T'$
 $\Sigma_{T'} \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix over a historical reference period $T'$
 $r_T \in \mathbb{R}^{n}$, the vector of the asset returns over a period $T \ne T'$
The turbulence index $d_T$ of the assets over the period $T$ is defined as:
$$ d_T = \frac{1}{n} (r_T  \mu_{T'}) {}^t \Sigma{_{T'}}^{1} (r_T  \mu_{T'}) $$
Notes:
 The turbulence index $d_T$ represents a statistical measure of financial turbulence based on the Mahalanobis distance, c.f. the first reference.
 The turbulence index $d_T$ 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_{T'}$ is supposed to be invertible, that is, positive definite.
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 resamplingbased maximum return portfolio weights $w^* \in [0,1]^{n}$ are computed through the following procedure:
 Determine the number of assets $n_S$ to include in each subset, with $2 \le n_S \le n$
 Determine the number of subsets to generate $n_B$, with $1 \le n_B$
 For $b = 1..n_B$ do
 Generate uniformly at random without replacement a subset of $n_S$ assets from the original set of $n$ assets
 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
 Aggregate the $n_B$ portfolio weights $w_1^*,..,w_{n_B}^*$ by averaging them through the formula:
$$ 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 meanvariance 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 nonrandom.
 In case too many subset optimization problems are infeasible, typically due to weight constraints, an error is returned by this endpoint; a threshold of 5% is enforced.
 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 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 resamplingbased maximum Sharpe ratio portfolio weights $w^* \in [0,1]^{n}$ are computed through the following procedure:
 Determine the number of assets $n_S$ to include in each subset, with $2 \le n_S \le n$
 Determine the number of subsets to generate $n_B$, with $1 \le n_B$
 For $b = 1..n_B$ do
 Generate uniformly at random without replacement a subset of $n_S$ assets from the original set of $n$ assets
 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
 Aggregate the $n_B$ portfolio weights $w_1^*,..,w_{n_B}^*$ by averaging them through the formula:
$$ 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 meanvariance 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 nonrandom.
 In case too many subset optimization problems are infeasible, typically due to weight constraints, an error is returned by this endpoint; a threshold of 5% is enforced.
 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 resamplingbased minimum variance portfolio weights $w^* \in [0,1]^{n}$ are computed through the following procedure:
 Determine the number of assets $n_S$ to include in each subset, with $2 \le n_S \le n$
 Determine the number of subsets to generate $n_B$, with $1 \le n_B$
 For $b = 1..n_B$ do
 Generate uniformly at random without replacement a subset of $n_S$ assets from the original set of $n$ assets
 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
 Aggregate the $n_B$ portfolio weights $w_1^*,..,w_{n_B}^*$ by averaging them through the formula:
$$ 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 meanvariance 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 nonrandom.
 In case too many subset optimization problems are infeasible, typically due to weight constraints, an error is returned by this endpoint; a threshold of 5% is enforced.
 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 a subset resamplingbased meanvariance efficient portfolio are computed through the following procedure:
 Determine the number of assets $n_S$ to include in each random subset of assets, with $2 \le n_S \le n$
 Determine the number of random subsets of assets $n_B$ to generate, with $1 \le n_B$
 For $b = 1..n_B$ do
 Generate uniformly at random without replacement a subset of $n_S$ assets from the original set of $n$ assets
 Compute the weights $w_b^*$ of a meanvariance efficient portfolio associated to the generated subset of $n_S$ assets, taking into account the applicable constraints
 Combine the $n_B$ portfolio weights $w_1^*,..,w_{n_B}^*$ by averaging them through the formula:
$$ 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 meanvariance 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 nonrandom.
 In case too many subset optimization problems are infeasible, typically due to return, volatility or weight constraints, an error is returned by this endpoint; a threshold of 5% is enforced.
 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 theoryimplied 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 theoryimplied asset correlations are then derived
from the resulting hierarchical tree.
Notes:
 The empirical asset correlation matrix $C$ does not need to be positive semidefinite.
 There are 4 possible choices for the hierarchical clustering algorithm, influencing the way the assets are grouped together:
 Single linkage
 Average linkage (default)
 Complete linkage
 Ward's linkage
 The computed theoryimplied asset correlation matrix is not guaranteed to be positive semidefinite.
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 semidefinite 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'$ crosssectional 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 twosided 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 onesided confidence interval, with formula $$ \left] \infty, SR + z_{1\alpha} SE(SR) \right] $$
 A lower onesided 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 MarchenkoPastur 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 MarchenkoPastur 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 semidefinite for the Euclidean and correlation matrix distance.
Let be:
 $n$, the number of assets
 $\sigma_1,...,\sigma_n$, the assets volatilities
The equal volatilityweighted 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 average 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:
 Convert the turbulence thresholds $tt_i$ into turbulence scores $ts_i$, $i=1..m$
 For each asset return vector $r_t$, $t=1..T$
 Compute the unnormalized turbulence index value $ d(r_t) = n d_t$
 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
 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:
 Compute the unnormalized turbulence index values $ d(r_t) = n d_t$, $t=1..T$, for all asset return vectors $r_t$
 Perform an exact 1d kmeans clustering algorithm on the turbulence index values $ d(r_t) $, $t=1..T$, with $k = m$
 For each asset return vector $r_t$, $t=1..T$
 $r_t$ is classified as belonging to the partition of asset returns corresponding to the kmeans 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 chisquare 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 kmeans clustering is performed instead of an exact 1d kmeans 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$
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 whose Gaussian distribution is $\mathcal{N} \left( \mu_j, \sigma_j^2 \right)$, $j=1..m$.
Notes:
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
 $\Sigma \in \mathcal{M}(\mathbb{R}^{n \times n})$, the asset covariance matrix
 $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$
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 volatility parameter
 $\kappa \in \mathbb{R}$, a skewness parameter
 $\gamma \in \mathbb{R}$, an excess kurtosis parameter
A Monte Carlo simulation of a CornishFisher 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 CornishFisher 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^33Z) \frac{\gamma}{24} (2Z^35Z)\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 CornishFisher distribution, not to be confused with the mean, the variance, the skewness and the excess kurtosis of the CornishFisher distribution, c.f. the references.
 Depending on the values of the CornishFisher parameters $\kappa$ and $\gamma$, the CornishFisher distribution might not be a proper probability distribution, c.f. the references.
Let be:
A Monte Carlo simulation of a corrected CornishFisher 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 CornishFisher 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^33Z) \frac{\gamma_*}{24} (2Z^35Z)\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 CornishFisher 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 CornishFisher 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 CornishFisher parameters $\kappa_*$ and $\gamma_*$, in which case an error is returned by this endpoint.
 Depending on the values of the CornishFisher parameters $\kappa_*$ and $\gamma_*$, the CornishFisher distribution might not be a proper probability distribution, 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_{T1}) \in \mathbb{R}^{T1}$, 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. historical 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.
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_{T1}) \in \mathbb{R}^{T1}$, 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. historical 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.
 There are 2 possible choices for fitting a Gaussian mixture distribution to the portfolio logarithmic returns $r$:
 Turbulence partitioning (default)
 The portfolio logarithmic returns $r$ 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 TurbulencePartitioned Returns endpoint.
 The weight of each Gaussian component $p_i$, $i = 1..m$, is computed as the proportion of portfolio logarithmic returns belonging to each partition.
 The mean of each Gaussian component $\mu_i$, $i = 1..m$, is computed as the mean of the portfolio logarithmic returns belonging to each partition.
 The standard deviation of each Gaussian component $\sigma_i$, $i = 1..m$, is computed as the standard deviation of the portfolio logarithmic returns belonging to each partition.
 Expectationmaximization
 With both choices, the number of Gaussian components $m$ can either be provided or automatically computed thanks to a proprietary algorithm (default).
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_{T1}) \in \mathbb{R}^{T1}$, 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 CornishFisher 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 CornishFisher conditional value at risk is also called the modified conditional value at risk, or modified expected shortfall.
 C.f. historical conditional value at risk for additional background information on the conditional value at risk.
 The CornishFisher conditional value at risk is a parametric approach to computing the conditional value at risk assuming that the portfolio logarithmic returns follow a CornishFisher distribution, which uses higher moments (skewness and kurtosis) compared to the Gaussian distribution in order to adjust for the nonnormality 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_{T1}) \in \mathbb{R}^{T1}$, 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 CornishFisher 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 CornishFisher parameters defined such that the mean, the variance, the skewness and the excess kurtosis of the CornishFisher 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. historical conditional value at risk for additional background information on the conditional value at risk.
 The determination of the CornishFisher 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 CornishFisher parameters $\kappa_*$ and $\gamma_*$, in which case an error is returned by this endpoint.
 The corrected CornishFisher conditional value at risk is a parametric approach to computing the conditional value at risk assuming that the portfolio logarithmic returns follow a CornishFisher distribution, which uses higher moments (skewness and kurtosis) compared to the Gaussian distribution in order to adjust for the nonnormality 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_{T1}) \in \mathbb{R}^{T1}$, 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. historical 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.
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_{T1}) \in \mathbb{R}^{T1}$, 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. historical 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.
 There are 2 possible choices for fitting a Gaussian mixture distribution to the portfolio logarithmic returns $r$:
 Turbulence partitioning (default)
 The portfolio logarithmic returns $r$ 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 TurbulencePartitioned Returns endpoint.
 The weight of each Gaussian component $p_i$, $i = 1..m$, is computed as the proportion of portfolio logarithmic returns belonging to each partition.
 The mean of each Gaussian component $\mu_i$, $i = 1..m$, is computed as the mean of the portfolio logarithmic returns belonging to each partition.
 The standard deviation of each Gaussian component $\sigma_i$, $i = 1..m$, is computed as the standard deviation of the portfolio logarithmic returns belonging to each partition.
 Expectationmaximization
 With both choices, the number of Gaussian components $m$ can either be provided or automatically computed thanks to a proprietary algorithm (default).
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_{T1}) \in \mathbb{R}^{T1}$, 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 CornishFisher 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}^33z_{1\alpha}) \frac{\gamma}{24} (2z_{1\alpha}^35z_{1\alpha})\frac{{\kappa}^2}{36} \right] \right)$$
, where $z_{1\alpha}$ is the $1  \alpha$%quantile of the standard Gaussian distribution.
.
Notes:
 The CornishFisher value at risk is also called the modified value at risk.
 C.f. historical value at risk for additional background information on the value at risk.
 The CornishFisher value at risk is a parametric approach to computing the value at risk assuming that the portfolio logarithmic returns follow a CornishFisher distribution, which uses higher moments (skewness and kurtosis) compared to the Gaussian distribution in order to adjust for the nonnormality 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_{T1}) \in \mathbb{R}^{T1}$, 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 CornishFisher 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}^33z_{1\alpha}) \frac{\gamma_*}{24} (2z_{1\alpha}^35z_{1\alpha})\frac{{\kappa_*}^2}{36} \right] \right)$$
, where
 $\mu_*, {\sigma_*}^2, \kappa_*, \gamma_*$ are the CornishFisher parameters defined such that the mean, the variance, the skewness and the excess kurtosis of the CornishFisher 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. historical value at risk for additional background information on the value at risk.
 The determination of the CornishFisher 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 CornishFisher parameters $\kappa_*$ and $\gamma_*$, in which case an error is returned by this endpoint.
 The corrected CornishFisher value at risk is a parametric approach to computing the value at risk assuming that the portfolio logarithmic returns follow a CornishFisher distribution, which uses higher moments (skewness and kurtosis) compared to the Gaussian distribution in order to adjust for the nonnormality 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 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:
 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
 The procedure described in the first reference is first applied to the group 1 and 2:
 The average return of each asset belonging to the 2nd group is estimated by maximumlikelihood over the $T$ time periods $1..T$
 The covariance matrix between assets belonging to the 2nd group and assets belonging to the 1st group is estimated by maximumlikelihood over the $T$ time periods $1..T$
 Based on these maximumlikelihood estimates, missing returns for the assets belonging to the 2nd group are inferred through a backfilling procedure
 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
 ...
 The procedure described in the first reference is applied last to the union of the groups $1,2,...,J1$ (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 nonmissing asset returns
 Conditional sampling: simulation from a univariate or multivariate Gaussian distribution, conditional on nonmissing 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 nonmissing 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 closetoclose volatility $\sigma_{cc} \left( T \right)$ over the time period is defined as the sample standard deviation of the asset closetoclose logarithmic returns, that is $$ \sigma_{cc} \left( T \right) = \sqrt{\frac{1}{T2} \sum_{i=2}^T \left( \ln \frac{C_i}{C_{i1}}  \mu_{cc} \right)^2} $$,
where $\mu_{cc} = \frac{1}{T1} \sum_{i=2}^T \ln \frac{C_i}{C_{i1}} $ is the arithmetic average of these returns.
Additionally, the asset closetoclose 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 closetoclose logarithmic returns with a mean assumed to be equal to zero, that is $$ \sigma_{cc,0} \left( T \right) = \sqrt{\frac{1}{T1} \sum_{i=2}^T \left( \ln \frac{C_i}{C_{i1}} \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 jumpadjusted 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 closetoopen volatility, defined as the standard deviation of the asset closetoopen logarithmic returns with a mean assumed to be equal to zero, that is $$\sigma_{co} = \sqrt{\frac{1}{T1} \sum_{i=2}^T \left( \ln \frac{O_i}{C_{i1}} \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 GarmanKlass 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 jumpadjusted GarmanKlass 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 closetoopen volatility, defined as the standard deviation of the asset closetoopen logarithmic returns with a mean assumed to be equal to zero, that is $$\sigma_{co} = \sqrt{\frac{1}{T1} \sum_{i=2}^T \left( \ln \frac{O_i}{C_{i1}} \right)^2}$$
 $\sigma_{GK} $ is the asset GarmanKlass 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 GarmanKlass 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 GarmanKlass volatility estimator is a slightly more efficient, but more complex, variation of the GarmanKlass 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 jumpadjusted original GarmanKlass 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 closetoopen volatility, defined as the standard deviation of the asset closetoopen logarithmic returns with a mean assumed to be equal to zero, that is $$\sigma_{co} = \sqrt{\frac{1}{T1} \sum_{i=2}^T \left( \ln \frac{O_i}{C_{i1}} \right)^2}$$
 $\sigma_{GK} $ is the asset original GarmanKlass volatility over the time period $2..T$
Notes:
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 RogersSatchell 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 jumpadjusted RogersSatchell 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 closetoopen volatility, defined as the sample standard deviation of the asset closetoopen logarithmic returns, that is $$\sigma_{co} = \sqrt{\frac{1}{T2} \sum_{i=2}^T \left( \ln \frac{O_i}{C_{i1}}  \mu_{co} \right)^2}$$, with $\mu_{co} = \frac{1}{T1} \sum_{i=2}^T \ln \frac{O_i}{C_{i1}}$
 $\sigma_{RS} $ is the asset RogersSatchell 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 YangZhang 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 + (1k) \sigma_{RS}^2 } $$,
where:
 $\sigma_{co} $ is the closetoopen volatility, defined as the sample standard deviation of the asset closetoopen logarithmic returns, that is $$\sigma_{co} = \sqrt{\frac{1}{T2} \sum_{i=2}^T \left( \ln \frac{O_i}{C_{i1}}  \mu_{co} \right)^2}$$, with $\mu_{co} = \frac{1}{T1} \sum_{i=2}^T \ln \frac{O_i}{C_{i1}}$
 $\sigma_{oc} $ is the opentoclose volatility, defined as the sample standard deviation of the asset opentoclose logarithmic returns, that is $$\sigma_{oc} = \sqrt{\frac{1}{T2} \sum_{i=2}^T \left( \ln \frac{O_i}{C_{i}}  \mu_{oc} \right)^2}$$, with $\mu_{oc} = \frac{1}{T1} \sum_{i=2}^T \ln \frac{C_i}{O_{i}}$
 $\sigma_{RS} $ is the asset RogersSatchell volatility over the time period $2..T$
 $k = \frac{0.34}{1.34 + \frac{T}{T2}}$
Notes:
 The volatility computed by this endpoint is not annualized.
 The closetoopen 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 closetoopen 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$, $t=k..T, k \geq 1$, constructed from asset prices up to the observation time $t$ (closetoclose squared returns...)
 $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 multistepahead volatility forecasts to compute
The asset onestepahead simple moving average volatility forecast $\hat{\sigma}_{T+1}$ is defined as $$ \hat{\sigma}_{T+1} = \sqrt{ \frac{1}{w} \sum_{i=0}^{w1} \tilde{\sigma}^2_{Ti} } $$
The asset $h$stepahead 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}^{kh+1} \tilde{\sigma}^2_{T+1i} + \sum_{i=1}^{h1} \hat{\sigma}^2_{T+hi}}{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:
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$, $t=k..T, k \geq 1$, constructed from asset prices up to the observation time $t$ (closetoclose squared returns...)
 $\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 multistepahead volatility forecasts to compute
The asset onestepahead exponentially weighted moving average volatility forecast $\hat{\sigma}_{T+1}$ is defined recursively as $$ \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 $.
The asset $h$stepahead 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:
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$, $t=k..T, k \geq 1$, constructed from asset prices up to the observation time $t$ (closetoclose squared returns...)
 $h \geq 1$, a forecast horizon, corresponding to the number of multistepahead volatility forecasts to compute
The asset onestepahead 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$stepahead 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)^{h1} \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:
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 semidefinite.
 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, that is cut at a certain height, computed from the asset correlation matrix $C$.
Notes:
 The asset correlation matrix $C$ is not required to be positive semidefinite.
 The number of 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 the assets are grouped together:
 Single linkage
 Average linkage
 Complete linkage
 Ward's linkage (default)
 Hierarchical clustering as implemented by this endpoint is also the first step of the clusteringbased hierarchical risk parity portfolio optimization algorithm.