Introduction
An All-Weather Portfolio is a long-term portfolio-level strategy aiming to provide investors with a diversified and well-balanced mix of asset classes that can deliver consistent returns with low volatility in any market environment, hence the name "all-weather." Since Futures provide Futures exposure to a large variety of assets, they are a great investment vehicle to deliver such a strategy.
In this tutorial, we create an all-weather portfolio with high diversification using Futures, stepwise optimal selections, and position sizing. This algorithm is a re-creation of strategy #4 from Advanced Futures Trading Strategies (Carver, 2023).
Universe
A wide range of Future contracts consisting of various asset classes can deepen the diversity and reduce the risk of concentration in the strategy. We take reference with the classification proposed by Craver to manually organize the Futures into a hierarchy of asset classes and categories. The universe then consists of the front-month contract of all the Futures.
Methods
Asset Selection
Our aim for an all-weather asset is to obtain the best risk-adjusted return with controllable risk exposure, making Sharpe Ratio a perfect candidate for optimization. However, as we adopt a risk-premia positional sizing approach, the weights are subjected to so many constraints that the problem is no longer convex nor solvable by quadratic programming or any other general solver. Instead, we use a greedy algorithm to perform stepwise optimization, where in each iteration, an extra contract is added to the existing portfolio with risk-premia allocation.
Initial Portfolio
To build up such a portfolio, a baseline portfolio is required. The author of the book suggests using the contract with the lowest risk-adjusted cost, which is defined as the difference between the pre-cost and post-cost Sharpe Ratio:
\[
\begin{aligned}
\text{Post-cost SR} &= \text{Pre-cost SR} - \text{risk-adjusted cost} \\
\Rightarrow\;
\frac{E(r_p - \text{cost ratio} - r_m)}{\sigma_p}
&= \frac{E(r_p - r_m)}{\sigma_p} - \text{risk-adjusted cost} \\
\Rightarrow\;
\text{risk-adjusted cost} &= \frac{\text{cost ratio}}{\sigma_p}
\end{aligned}
\]
where \(r_p\) is the return of the contract, \(r_m\) is the market return, \(\sigma_p\) is the volatility of the contract, and the cost ratio equals to
\[\text{cost ratio} = \frac{2\times\text{transaction fee per contract}}{p_{0}\times\text{contract multiplier}}\]
where \(p_0\) is the price of the contract at \(t=0\).
The lowest risk-adjusted cost is equivalent to the least volatile asset after fees. This fulfills the criteria of a good benchmark portfolio, which we can build on as we aim to build a stable portfolio with a good return.
Stepwise Optimization
As stated in the previous section, we use maximizing the Sharpe Ratio as the objective function of stepwise optimization. In each iteration, we add one extra contract to the existing portfolio. Trial portfolios consisting of the selected contracts and one of the remaining contracts will have their Sharpe Ratio calculated. Post-cost Sharpe Ratio of an individual contract is already given above. We can use that to obtain its expected risk-adjusted return by
\[
\begin{aligned}
r_{i} &= w_{i} \times \tau \times \text{Post-cost SR} \\
r_{p} &= \sum_{i} r_{i}
\end{aligned}
\]
where \(r_{i}\) is the risk-adjusted return of the contract, \(w_{i}\) is the weight of the contract in the trial portfolio, and \(\tau\) is the risk target or risk averse level. The expected return of the trial portfolio \(r_{p}\) is the sum of all individual expected returns.
The traditional Sharpe ratio is calculated using the covariance matrix of the returns of the individual assets in the portfolio. However, using the correlation matrix instead of the covariance matrix can sometimes lead to better risk estimates, particularly in cases where the individual assets in the portfolio are generally not distributed or have different volatility scales. The correlation matrix is a standardized measure of the linear relationship between the returns of the assets, which is independent of the scale of the individual assets and can be a better indicator of the diversification benefits of the portfolio. reducing the impact of extreme events or outliers. Here, we calculate the portfolio volatility \(\sigma_p\) by
\[\sigma_p = \tau \times \sqrt{w^{T}\Sigma w}\]
where \(\tau\) is the risk target, \(w\) is the weight vector, and \(\Sigma\) is the correlation matrix. Note that we can factor out \(\tau\) as it is constant for all individual contracts. Finally, the Sharpe Ratio of a trial portfolio is calculated by
\[SR_p = \frac{r_p}{\sigma_p}\]
The trial portfolio with the highest Sharpe Ratio replaces the existing portfolio, and the process is repeated until the maximum Sharpe Ratio is obtained. In this algorithm, we continue to add contracts to the portfolio until they fail to boost the Sharpe Ratio of the portfolio by at least 10%.
Position Sizing
In this strategy, we equally dissipate our risk capital to each risk group by equally splitting the capital into each asset class. Then, within each asset class, we equally allocate to each subcategory. Finally, we equally allocate the capital to each contract in that subcategory.
\[w_{C_i} = \frac{1}{A} \frac{1}{S_{A}} \frac{1}{C_{S}}\]
where \(w_{C_i}\) is the allocated weight of the contract, \(A\) is the number of selected asset classes, \(S_{A}\) is the number of selected subcategories within the asset class of the contract, and \(C_{S}\) is the number of selected contracts within the subcategory of the contract.
In fact, it is equivalent to maximizing the Gini Index, which translates to maximizing the "impurity" of the risk capital. We can interpret that as maximizing the portfolio's diversity and maximally dissipating the risk of that. Any gain from such a portfolio could be claimed as "risk premia".
Results
The following tables shows the results over a 4.5-year period from 1/1/2019 to 7/1/2023:
Considering the entire backtest period, the strategy underperformed the SPY benchmark. However, there are periods of time during the backtest in which the strategy outperformed. For example, during the COVID crash of 2020, the strategy experienced a 7% drawdown while the SPY experienced a 34% drawdown.
To improve the strategy, consider expanding the universe of Futures to further diversify the portfolio. Just note that the more "exotic" the contract, the higher the uncertainty and friction as the market agreement on the contract price is less likely to be established. Besides, this is a very crude approach to portfolio optimization using generalized risk premia allocation. A more systematic way to dissipate risk could be using risk parity optimization.
References
- R. Carver. (2023). Buy and hold portfolio with variable risk position sizing. Advanced Futures Trading Strategies. Harriman House Limited. p100-126.
- J. Chen. (2022). All Weather Fund: What it is, How it Works, Strategies. Investopedia. Available via https://www.investopedia.com/terms/a/allweatherfund.asp.
- J. Fernando. (2023). Futures in Stock Market: Definition, Example, and How to Trade. Investopedia. Available via https://www.investopedia.com/terms/f/futures.asp.
Louis Szeto
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!