Replication of the DAX with global Smart Beta / Factor ETFs
Most investment products are disadvantageous (too expensive or capital inefficient) repackagings of elementary portfolio components, such as global equity & fixed income exposure. To check this, I have compiled this Jupyter Notebook, which works as follows:
First, I defined a function weight_optimization
that determines a parameter vector
Here are four common loss
functions available:
- Mean Squared Error (
mse
):
- Mean Absolute Error (
mae
):
- Tracking Error (
te
):
- Quantile Loss (
q
):
Here, the following self-explanatory optimization constraints can be specified:
-
Long-Only Constraint (if
long_only_constraint
isTrue
):$$\beta_j \geq 0 \quad \forall j \in{1,2, \ldots, m}$$ -
Leverage Constraint (if
leverage_constraint
isTrue
):$$0 \leq \sum_{j=1}^m \beta_j \leq 1$$
It's possible to limit the number of considered assets by the paramater max_assets
. This means that a large number of potential assets can be provided, and the function will use the subset of the desired cardinality that produces the best result. However, since the function accomplishes this through iterative combinatorial means, the runtime may potentially be slightly extended.
The optimization is performed using the Sequential Least Squares Programming (SLSQP
) method or any other multivariate method from the scipy
library specified by the optimizer
parameter. However, not all methods reliably find the global optimum. I recommend sticking with SLSQP
.
Here, the respective tickers assets
and target
of the securities of interest, as they are listed on Yahoo Finance, can be specified, and the above-defined function can be applied. The results are Portfolio Weights
If the fund cannot be well replicated, the notebook includes both a bootstrap test of the fund's Sharpe ratio relative to the Sharpe ratio of the replicating portfolio and a 1-factor regression to determine the alpha. This can be used to examine how statistically significant the differences are.
The bootstrap test produces the following plot and a p-value for the right-side alternative hypothesis
Null Distribution of Replication Portfolio Sharpe Ratios for the DAX
This notebook can also be used to find an appropriate benchmark, for example, by passing an extensive list of potential alternatives to the weight_optimization
function and setting the max_assets
parameter to 1
.