SSRN 4383184
SSRN 4383184
SSRN 4383184
Predictnow.ai, Inc.
ABSTRACT
Conditional Portfolio Optimization is a portfolio optimization technique that adapts to market
regimes via machine learning. Traditional portfolio optimization methods take summary statistics
of historical constituent returns as input and produce a portfolio that was optimal in the past, but
may not be optimal going forward. Machine learning can condition the optimization on a large
number of market features and propose a portfolio that is optimal under the current market
regime. We call this Conditional Portfolio Optimization (CPO). Applications on portfolios in vastly
different markets suggest that CPO can outperform traditional optimization methods under
varying market regimes.
To recap, traditional optimization methods involve finding the parameters that generate the best
results based on past data for a given business process, such as a trading strategy. For
instance, a stop loss of 1% may have yielded the best Sharpe ratio for a trading strategy tested
over the last 10 years, or stocking a retail shelf with sweets generate the best profit over the last
5 years. Although the numerical optimization process can be complex due to various factors
such as the number of parameters, the nonlinearity of objective functions, or the number of
constraints on the parameters, standard methods are available to handle such difficulties.
However, when the objective function is dependent on external time-varying and stochastic
conditions, traditional optimization methods may not produce optimal results. For example, in
the case of a trading strategy, the optimal stop loss may depend on the market regime, which
may not be clearly defined. In the case of retail shelf space optimization, the optimal selection
may depend whether it is a back-to-school season or a holiday season. Furthermore, even if the
exact set of conditions is specified, the outcome may not be deterministic. Machine learning is a
better alternative to solve this problem.
1
Recall that while a neural network is able to approximate almost any function (Hornik, Stinchcombe, &
White, 1989), there are other machine learning algorithms that can be used for this task as well. We
primarily use gradient-boosted regression trees, but for simplicity we will continue to call the machine
learner a “neural network”.
Assuming that the features that measure market regimes (denoted “Market features” in Table 1)
have a daily frequency, a 1-day slice of the features table nevertheless contains many rows
(samples). Each row represents a unique capital allocation – we call them “control features”. For
a portfolio that holds S&P 500 stocks, for instance, there will be up to 500 parameters (if cash is
included). In this case, we are supposed to feed into the neural network all possible
combinations of these 500 parameters, plus the market features, and find out what the resulting
forward 1-month Sharpe ratio (or whatever performance metric we want to maximize) is. All
possible combinations!"#$"%&"'&('&)&*+"+,&"-.(/+.0"%&/1,+".002-.+&3"+2"&.-,")+2-4".)"𝑤! "5"678"9:8"
Labels: Historical
portfolio n-day Sharpe
Historical ratio
market features
Intelligent
Historical features sampling
Control features
(capital allocations) ML training
Trained ML model
Trained ML model
Current features
Control features
(capital allocations)
Predicted n-day
Sharpe ratio
Constraints
Allocations Predicted
Sharpe
ratio
(0.2, 0.6, 0.2) 1.3
(0.25, 0.6, 0.15) 1.2 Intelligent
(0.3, 0.6, 0.1) 0.2 sampling
… …
(0.4, 0.5, 0.1) -0.1
(0.45, 0.5, 0.5) -2.0
Pick allocations
with highest
predicted Sharpe
ratio=1.3
Some researchers compute expected cross-sectional returns using an alpha model and then
use Markowitz's optimization by inputting these returns (Tomasz & Katarzyna, 2021). However,
in practice most alpha models do not produce expected cross-sectional returns accurately
enough as input for a quadratic optimizer. As we explained before, the beauty of our method is
that we don’t need cross-sectional returns nor cross-sectional features of any kind as input to
the neural network or the optimizer. Only “time series” market features are used.
Let’s see how our Conditional Portfolio Optimization method stacks up against these
conventional methods.
(Note that transaction costs are not included in the following comparative studies. Our goal is to
demonstrate whether CPO improves the optimal solution compared to conventional methods,
and we do not expect CPO to transact more than, for e.g., the Markowitz method. In any case,
the difference is a second order effect. Also, when CPO is applied to an actively traded portfolio,
the transaction costs are primarily due to updating the portfolio components, not to capital
reallocation. In other words, the transaction cost in that case is due to alpha generation, not to
portfolio optimization due to CPO. In fact, if the actively traded portfolio is a portfolio of trading
strategies, transaction cost analysis by us is impossible since those strategies aren’t disclosed
to the CPO algorithm.)
We test how our CPO performs for an ETF (TSX: MESH) given the constraints that we cannot
short any stock8"and the weight 𝑤! of each stock s obeys 𝑤! ∈ [0.5%, 10%], but we can allocate
a maximum of 𝑤$ =10% of the portfolio to cash, with ∑! 𝑤! + 𝑤$ =1.
In the bull market, CPO performed similarly to the Markowitz method. However, it was
remarkable that CPO was able to switch to defensive positions and outperformed the Markowitz
method in the bear market of 2022. Overall, it improved the Sharpe ratio of the Markowitz
portfolio by more than 60%. That is the whole rationale of Conditional Portfolio Optimization - it
adapts to the expected future external conditions (market regimes), instead of blindly optimizing
on what happened in the past. Because of the long-only constraint and the tight constraint on
cash allocation, the CPO portfolio still suffered negative returns. But if we had allowed the
optimizer to allocate a maximum of 50% of the portfolio NAV to cash, it would have delivered
positive returns. The dramatic effect of cash allocation will be evident in the next example.
In this example, we tested the CPO methodology on a private investor’s tech portfolio,
consisting of 7 US and 2 Canadian stocks, mostly in the tech sector. We call this the Tech
Portfolio. The constraints are that we cannot short any stock, and the weight 𝑤! of each stock s
obeys 𝑤! ∈ [0%, 25%] and we can allocate a maximum of 𝑤$ =50% of the portfolio to cash, with
∑! 𝑤! + 𝑤$ =1.
CPO performed better than both alternative methods under all market conditions. It improves
the Sharpe ratio over the Markowitz portfolio by 75% as the market experienced a regime shift
around January 2022. Here are the comparative equity curves:
We also tested how CPO performs for some non-traditional assets - a portfolio of 8 crypto
currencies, again allowing for short positions and aiming to maximize its 7-day forward Sharpe
ratio,
Markowitz 0.26
CPO 1.00
Table 4: Crypto portfolio
(These results are over an out-of-sample period from January 2020 to June 2021, and the
universe of cryptocurrencies for the portfolio are BTCUSDT, ETHUSDT, XRPUSDT, ADAUSDT,
EOSUSDT, LTCUSDT, ETCUSDT, XLMUSDT). CPO improves the Sharpe ratio over the
Markowitz method by a factor of 3.8.
Finally, to illustrate that CPO doesn’t just work on portfolios of assets, we apply it to a portfolio
of FX trading strategies managed by a FX hedge fund WSG. (WSG is our client and we
published these results with their permission.) It is a portfolio of 7 trading strategies s, and the
allocation constraints are 𝑤! ∈ [0%, 40%], 𝑤$ ∈ [0%, 100%], with ∑! 𝑤! + 𝑤$ =1.
Markowitz 2.22
CPO 2.65
Table 5: WSG’s FX strategies portfolio
(These results are over an out-of-sample period from January 2020 to July 2022). CPO
improves the Sharpe ratio over the Markowitz method by 19%. WSG has decided to deploy
CPO in production starting July 2022. Since then, CPO has added about 60bps per month to
the portfolio over their previous proprietary allocation method.
In all 4 cases, CPO outperformed both the naive Equal Weights portfolio and the Markowitz
portfolio during a market downturn, while generating similar performance during the bull market.
We do not claim that CPO can outperform all other allocation methods for all portfolios in all
periods. Some portfolios may be constructed to be so risk-neutral that CPO can’t improve on an
Equal Weights allocation. For other portfolios, CPO may underperform a conventional allocation
method for a certain period with the benefit of hindsight (ex-post), but nevertheless outperform
the best conventional allocation method selected at the beginning of the period (ex-ante). We
provide an illustration of this effect through a model portfolio below.
Table 6 shows during the out-of-sample period, CPO generates the second-highest Sharpe
ratio, trailing only the Equal Weights method. However, selecting Equal Weights ex-ante would
not have been an obvious choice, since it generated the second-lowest Sharpe ratio during the
in-sample period. If we were to choose a conventional allocation method ex-ante, Risk Parity
would have been our choice, but it underperformed CPO out-of-sample as measured by both
the Sharpe ratio and CAGR, the latter by more than threefold.
To gain more transparency into the CPO method, we can examine its allocations at various
times:
It is noteworthy that the portfolio had a high allocation to large-cap stocks beginning in July
2019, just before the market experienced a period of calm appreciation over the next six
months. The high allocation to short-term treasuries in January 2020 proved to be prescient in
light of the COVID-induced financial crisis that followed. The portfolio also had a high allocation
to gold at the beginning of 2022, which fortuitously anticipated the surge in commodity prices
due to the war in Ukraine. Finally, the allocation to small-cap stocks increased in mid-2022,
which performed better than large-cap stocks during that year.
For further interpretability, we list the most important 10 input features picked by our algorithm at
each rebalance date in Table 7. The features in this table are listed in decreasing importance
rank, as scored by the SHAP algorithm (Man & Chan, 2021). Though the top 10 features vary
CPO software-as-a-service
For clients of our CPO software-as-a-service platform, we can optimize any objective function,
not just Sharpe ratio. For example, we have been asked to minimize Expected Shortfall, UPI,
etc. We can also add specific constraints to the desired optimal portfolio, such as average ESG
rating, maximum exposure to various sectors, or maximum turnover during portfolio rebalancing.
The only other input we require from them is the historical returns of the portfolio components
(unless these components are publicly traded assets, in which case clients only need to tell us
Just like ChatGPT, our CPO product will improve in optimality regularly due to our ever-
increasing number of pre-engineered features and the ever-enlarging search space. That is the
main advantage of machine-learning-based products – they will learn to improve themselves.
Conclusion
It is intuitively obvious that the optimal solution to a problem depends on the environment in
which it occurs, whether the problem is the optimal way to stock a retail shelf (back-to-school or
Christmas sales) or optimal asset allocation (risk-on or risk-off). Unfortunately, most
conventional optimization methods cannot consider the environmental context, as it often is
often ill-defined and may involve hundreds of variables. However, machine learning algorithms
excel in dealing with big data inputs that may contain redundant and insignificant variables. Our
CPO method leverages machine learning and big data to provide an optimal solution to many
commercial problems such as portfolio optimization that adapts to the environment. We have
demonstrated in multiple use cases that it can outperform conventional portfolio optimization
methods and have shown an example in tactical asset allocation where historical allocations
were timely.
Acknowledgements
We thank Pavan Dutt, Akshay Nautiyal, and Jai Sukumar for their assistance in features
engineering and software implementation of the CPO method, and to Sergei Belov and
Guillaume Goujard for their mathematical insights. We also thank Crispin Clarke, Erik
MacDonald, and Jessica Watson for their comments on the manuscript. Finally, we appreciate
the insightful questions raised by the audiences at UBS & Cornell Financial Engineering
Manhattan AI Speaker Series, NYU Mathematical Finance and Financial Data Science seminar,
CIBC's Finance-AI seminar, Fidelity AI Asset Management group, and many other public and
private forums where we presented CPO.
References
Ang, A. (2014). Asset Management: A Systematic Approach to Factor Investing. Oxford
University Press.
Chan, E. (2014, August 18). From http://epchan.blogspot.com/2014/08/kelly-vs-markowitz-
portfolio.html