portfolio_of_SAs
portfolio_of_SAs
Abstract
We consider the problem of managing a portfolio of moving-band statistical arbi-
trages (MBSAs), inspired by the Markowitz optimization framework. We show how
to manage a dynamic basket of MBSAs, and illustrate the method on recent historical
data, showing that it can perform very well in terms of risk-adjusted return, essentially
uncorrelated with the market.
1
Contents
1 Introduction 3
1.1 Related work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Moving-band stat-arbs 4
2.1 Midpoint price and alpha . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 MBSA lifetime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Multiple MBSAs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4 Numerical experiments 9
4.1 Data and parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.2 Simulation and metrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
5 Conclusion 17
2
1 Introduction
We consider the problem of managing a portfolio of statistical arbitrages (stat-arbs), where
each stat-arb is a mean-reverting portfolio of a subset of an n-asset universe. Trading strate-
gies based on stat-arbs have been around since the 1980s and are popular due to their
documented success in practice. The strategy is based on the idea that if the price of a
portfolio of assets is mean-reverting, we can profit by buying the portfolio when it is cheap
and selling it when it is expensive. The literature on stat-arbs is vast, and typically focuses
on one of two aspects: (i) finding a linear combination of asset prices that is mean-reverting,
or (ii) finding a trading policy that profits by exploiting the mean-reversion. To the best
of our knowledge, there exists no satisfying solution to the problem of managing a portfolio
of multiple stat-arbs, that is independent of the process of finding them. This paper aims
to fill this gap and proposes a solution based on a Markowitz optimization approach. In
particular, we focus on the case of moving-band stat-arbs (MBSAs), recently introduced
in [JSB23], where the midpoint of the price band is allowed to move over time.
Trading stat-arbs. With some exceptions, the literature on trading stat-arbs is mostly
limited to pairs trading or trading individual stat-arbs, rather than managing a portfolio
of several stat-arbs. Several methods are based on co-integration [Joh00, AD05, Gra83,
EG87, Vid04]. For example, in [ZP18, ZZWP18, ZZP19] the authors consider a (non-convex)
optimization problem for finding high variance, mean-reverting portfolios, in a co-integration
space of several stat-arb spreads. Their strategy is based on finding a portfolio of spreads,
3
defined by a co-integration subspace, and implemented using sequential convex optimization.
In [YP12a, PY18, YP18] the authors model the spread of a pair of assets as an autoregressive
process, a discretization of the Ornstein-Uhlenbeck process, and show how to trade a portfolio
of spreads under proportional transaction costs and gross exposure constraints using model
predictive control. The authors of [YP12b] use co-integration techniques to find pairs of
assets that are mean-reverting, and show how to construct optimal mean-variance portfolios
of these pairs.
Our approach differs from the above methods in that we do not assume any particular
model of the price process, and we do not use statistical analysis like co-integration tests
to find stat-arbs. Instead, we assume several stat-arbs (defined below as a portfolio and a
price signal) are given, and the problem is to find the optimal allocation to these stat-arbs.
In other words, we decouple the problem of finding stat-arbs from the problem of portfolio
construction.
1.2 Outline
The rest of this paper is structured as follows. In §2 we review MBSAs and set our notation.
In §3 we show how to manage and evaluate a dynamic basket of MBSAs. We present an
empirical study of the method on recent historical data in §4, and give conclusions in §5.
2 Moving-band stat-arbs
MBSAs were recently introduced in [JSB23]. We start with a universe of n assets, with
Pt ∈ Rn++ denoting the price (suitably adjusted) in USD, in period t = 1, 2, . . ..
where M is the rolling window memory. For a good MBSA, the difference of the price and
midpoint price, pt − µt , will oscillate in a band; we obtain a profit by buying when the price
difference is low and selling when it is high. We associate with the MBSA the ‘alpha’ value
α t = µt − pt . (2)
If αt is positive, we expect the price of the MBSA to increase, and if it is negative, we expect
the price to decrease.
4
2.2 MBSA lifetime
In [JSB23] we show how to discover MBSAs (i.e., the vector s) by approximately solving a
constrained variance maximization problem, using the convex-concave procedure [SDGB16,
LB16].
Each MBSA has a lifetime, starting at creation or discovery time t = d and ending at
time t = e > d, when we choose to decommission it. We say it is active over the periods
t = d, d + 1, . . . , e. (See [JSB23, §2.3] for details.)
Trading cost. We denote the (asset level) trades vector at time t as zt = ht − ht−1 , i.e.,
the change in asset-level holdings from time t − 1 to time t, in shares. The trading cost at
time t is given by
(κtrade
t )T |zt |,
5
where κtrade
t ∈ Rn+ is the vector of one half the bid-ask spread for each asset at time t, in
USD per share, and the absolute value is elementwise.
(κshort
t )T (−h)+ ,
where κshort
t ∈ Rn is the vector of shorting rates for each asset over period t, in USD per
share per trading period. Here (u)+ = max{u, 0} is the nonnegative part of u, and in the
expression above it is applied elementwise.
Objective. The objective is to maximize the alpha exposure, adjusted for transaction and
shorting costs,
αtT q − γ trade (κtrade
t )T (h − ht−1 ) − γ short (κshort
t )T (−h)+ ,
where γ trade and γ short are positive parameters trading off the alpha exposure, transaction
cost, and holding cost. The true values of κtrade
t and κshort
t are not known at time t, but are
estimated from historical data. This objective is a concave function of the variables h and q.
Cash-neutrality. We assume that the portfolio is cash-neutral [BJK+ 23, GK00], i.e.,
pTt q = 0. (3)
In other words, the total portfolio value is equal to the value of the cash account. (We can
also add a limit on the market exposure (or beta), but we found empirically that this makes
a small difference on top of the cash neutrality constraint.) This constraint is often used
in long-short trading strategies [GK00, Chap. 15]. The cash neutral constraint is a linear
equality constraint on the variable q.
6
times the short position. In the form above, it is not a convex constraint, but subtracting
(PtT (ht )− + (ct )− ) from both sides yields the equivalent convex constraint
c ≥ (η − 1)PtT (h)− ,
i.e., the cash account is at least (η − 1) times the short position. For example, we can set
η = 2.02 to keep a collateral of 102% of the short position, as has typically been required by
regulation [D’a02, GMR02].
Risk constraint. The traditional definition of risk of a portfolio is the variance of the
portfolio return, expressed as a quadratic form of the asset weights with an estimated asset
return covariance matrix. Taking the squareroot we obtain the standard deviation of portfolio
return, i.e., its volatility, which we can convert to USD by multiplying by the portfolio value.
Here we propose a different risk measure, which we have found empirically to work
better, and is more in line with the spirit of MBSAs. Our risk is based on fluctuation of the
portfolio value around its expected midpoint, and is directly expressed in USD. Recall that
the portfolio value is pTt qt , which we expect to fluctuate around the midpoint value µTt qt ,
both of these in USD. We take the risk to be an estimate of the short term mean square
value of the difference of the portfolio value and the midpoint value, (pt − µt )T qt . We express
this mean-square value (now using q, not qt ) as
q T Σt q,
where Σt is an average of the recent values of (pτ − µτ )(pτ − µτ )T . We limit our risk using
the constraint
1/2
∥Σt q∥2 ≤ σc,
7
where σ > 0 is a parameter setting the target risk (which is unitless) and c is the portfolio
value. This risk limit is a convex constraint in the variables q and c, specifically a second-
order cone (SOC) constraint [BV04, §4.4.2].
The covariance matrix Σt can be estimated in many ways; see, e.g., [JOP+ 23]. We express
it in terms of asset prices as
Σt = StT ΣPt St ,
where ΣPt ∈ Rn×n is an estimate of the short-term covariance matrix of the asset prices. We
estimate ΣPt as follows. First, define the centered price vectors
P̃t = Pt − P̄t , t = 1, . . . , T,
where P̄t is the M -period rolling window mean of the asset prices. (This is the same M used
to define the MBSA midpoints in (1).) Then, ΣPt is an average of the recent values of P̃τ P̃τT . If
a linear estimator, like a rolling window or exponentially weighted moving average (EWMA),
is used to estimate this expectation, then this is equivalent to estimating Σt directly using
the same method, i.e., to center the MBSA prices and then compute an average of the outer
product of the centered prices. We will use the iterated EWMA predictor [JOP+ 23, BB22],
to estimate the covariance matrix of the centered prices P̃t . (This is not equivalent to
estimating Σt directly with an iterated EWMA, but in practice very similar.)
• κtrade
t and κshort
t , (predictions of) the trading and holding costs;
8
• σ, a target risk, expressed as a fraction of the portfolio value.
The problem (4) is a convex optimization problem, more specifically one that can be trans-
formed to a second-order cone program (SOCP). The solution to this optimization problem
gives the new MBSA portfolio qt , the asset-level portfolio holdings ht , and the cash account
ct at time t.
Extensions and variations. We can add additional constraints, such as a leverage con-
straint, asset position limits, maximum market exposure, etc. [BJK+ 23]. We can also soften
some constraints, if it is not critical that they are satisfied exactly and softening improves
performance [BJK+ 23]. For example, to soften the arb-to-asset constraint, we remove the
constraint h = St q and add a penalty term γ hold ∥Pt ◦ (h − St q)∥1 to the objective. (Note
that softening the arb-to-asset constraint implicitly also softens the risk and cash-neutrality
constraints if these are expressed in terms of the arb-level portfolio q.) Softening some con-
straints allows the optimizer to choose values that violate the original hard constraints when
necessary, which can reduce unnecessary trading, and therefore transaction cost.
4 Numerical experiments
We illustrate the MBSA portfolio management strategy on recent historical data. Code to
replicate the experiments is available at
https://github.com/cvxgrp/cvxstatarb.
Monthly search for MBSAs. We search for MBSAs every 21 trading days, with the
same setup and parameters as described in detail in [JSB23, §4.1].
Dynamic management of the MBSAs. Every day we solve the Markowitz optimization
problem (4) to rebalance our portfolio. Each MBSA is kept in the portfolio for 500 trading
days. After that ξ is reduced linearly to zero over the next 21 trading days.
Σt = StT ΣPt St ,
9
where ΣPt is the short-term covariance matrix of the asset prices. The covariance matrix
ΣPt is estimated using the iterated EWMA (IEWMA) predictor (see [Eng02] and [JOP+ 23,
Ch. 2.5]) on the centered prices P̃t = Pt − P̄t , where P̄t is the 21-day rolling window mean
of the asset prices. For the IEWMA predictor, we use a 125-day half-life for volatility
estimation, and a 250-day half-life for correlation estimation. To reduce trading induced by
the risk-model, we smooth the covariances with a 250-day half-life EWMA [JOP+ 23, Chap.
9.2].
Parameters. For the MBSA problem we use the same parameters as in [JSB23, §4.1].
For the Markowitz optimization problem we use γ trade = 1, η = 1, ξ = 1, and σ tar = 10%
annualized.
Trading and shorting costs. Our numerical experiments take into account transaction
costs, i.e., we buy assets at the ask price, which is the (midpoint) price plus one-half the
bid-ask spread, and we sell assets at the bid price, which is the price minus one-half the
bid-ask spread. We use 0.5% as a proxy for the annual shorting cost of stocks, which is well
above what is typically observed in practice for liquid stocks [D’a02, GMR02, KL23, DD14].
We also note that we have tested the method with shorting costs upwards of 10% annually,
and it remains profitable.
Cash account. We initialize the portfolio with a cash account at time t = 0, c0 = 1. The
cash account evolves as
where ϕt is the transaction and holding cost, consisting of the trading cost at time t + 1 and
the holding cost over period t. (The last equality follows from the cash-neutrality constraint.)
Portfolio NAV. The net asset value (NAV) of the portfolio, including the cash account,
at time t is
Vt = ct + qtT pt = ct .
Due to the market neutrality constraint in (4) we have Vt = ct , i.e., the NAV is equal to the
cash account.
10
Return. The return at time t is
Vt − Vt−1
rt = , t = 1, . . . , T.
Vt−1
We report several standard metrics based on the returns rt . The average return is
T
1X
r= rt ,
T t=1
which we multiply by 250 to annualize. It measures the amount of trading in the port-
folio [GK00, Chap. 16]. For example, a turnover of 0.01 means that the average of total
amount bought and total amount sold is 1% of the total portfolio value.
Active return and risk. We define the active return as the return of the portfolio minus
the return of the market, which we take to be the S&P 500. The active risk is the standard
deviation of the active return.
Residual return and risk. Given the portfolio returns r1 , r2 , . . . , rT , and the correspond-
ing market returns r1m , r2m , . . . , rTm , we construct the linear model
rt = βrtm + θt , t = 1, . . . , T,
where βrtm is the return explained by the market (with β ∈ Rn ), and θt ∈ Rn is the residual
return at time t. The residual risk is the standard deviation of the residual return. The mean
residual return is often referred to as the alpha of the portfolio [GK00] (not to be confused
with the alpha of an MBSA). The information ratio is the ratio of the portfolio alpha to the
residual risk.
11
Return Volatility Sharpe ratio Turnover Drawdown
19% 12% 1.61 136 15%
Active return Active risk Residual return Residual risk Beta Information ratio
8% 20% 18% 11% 11% 1.53
4.3 Results
Portfolio performance. The portfolio performance is summarized in table 1. We attain
an average annual return of 19% at an annual volatility of 12%, corresponding to a Sharpe
ratio of 1.61, with a maximum drawdown of 15% over the roughly 10-year period. The
average turnover is 136, which corresponds to a daily turnover of roughly 50%. In com-
parison to other stat-arb strategies in the literature, this seems like a reasonable level of
turnover [GOPZ21].
Active and residual return and risk. Here we compare the MBSA strategy to the
market, represented by the S&P 500 with an initial investment of $1 and diluted with cash
to attain the same annualized risk as the MBSA strategy. Table 2 gives a numerical summary.
The MBSA strategy attains an annualized Sharpe ratio of 1.61 (compared to 0.66 for the
market) with a residual return (alpha) of 18% and a market beta of 11%. The information
ratio is 1.53.
NAV evolution. Figure 1 shows the NAV of the MBSA strategy and the market, and
the 250-day half-life EWMA correlation between the two. As seen, the MBSA strategy
outperforms the market, with very low correlation, 15% over the whole period. This suggests
mixing the MBSA strategy with the market. For example, mixing 90% of the MBSA strategy
and 10% of the market yields an annualized Sharpe ratio of 1.66, slightly better than the
MBSA strategy alone.
12
(a) NAV evolution.
Figure 1: A comparison summary of the dynamically managed portfolio of MBSAs to the market.
13
Annual performance. Here we break down the metrics reported above over the 11-year
period into the performance metrics for each year. Figure 2 shows the annual performance of
the MBSA strategy and the market. The MBSA strategy has positive return in each of the
11 years, whereas the market has negative return in 2 of the 11 years. The MBSA strategy
outperforms the market in 8 of the 11 years, and has more stable performance.
Finally, figure 3 shows the annual residual return and risk, and market beta. As seen,
most of the MBSA success is unexplained by the market.
14
(a) Annual returns.
15
(a) Annual residual returns (alphas).
16
5 Conclusion
We have shown how to manage a dynamic basket of moving-band stat-arbs, based on a
long-short Markowitz optimization strategy. We presented an empirical study of the method
on recent historical data, showing that it can to outperform the market with low correlation.
References
[AD05] C. Alexander and A. Dimitriu. Indexing and statistical arbitrage. The Journal
of Portfolio Management, 31(2):50–63, 2005.
[AL10] M. Avellaneda and J. Lee. Statistical arbitrage in the US equities market. Quan-
titative Finance, 10(7):761–782, 2010.
[BB22] S. Barratt and S. Boyd. Covariance prediction via convex optimization. Opti-
mization and Engineering, 2022.
[Bol92] J. Bollinger. Using Bollinger bands. Stocks & Commodities, 10(2):47–51, 1992.
[D’a02] G. D’avolio. The market for borrowing stock. Journal of financial economics,
66(2-3):271–306, 2002.
[DD14] I. Drechsler and Q. Drechsler. The shorting premium and asset pricing anomalies.
Technical report, National Bureau of Economic Research, 2014.
[DGLR10] C. Dunis, G. Giorgioni, J. Laws, and J. Rudy. Statistical arbitrage and high-
frequency data with an application to Eurostoxx 50 equities. Liverpool Business
School, 2010.
17
[FKD19] T. Fischer, C. Krauss, and A. Deinert. Statistical arbitrage in cryptocurrency
markets. Journal of Risk and Financial Management, 12(1):31, 2019.
[FP16] Y. Feng and D. Palomar. A signal processing perspective on financial engineering.
Foundations and Trends® in Signal Processing, 9(1–2):1–231, 2016.
[GGR06] E. Gatev, W. Goetzmann, and G. Rouwenhorst. Pairs trading: Performance of
a relative-value arbitrage rule. The Review of Financial Studies, 19(3):797–827,
2006.
[GK00] R. Grinold and R. Kahn. Active portfolio management. McGraw Hill, 2000.
[GMR02] C. Geczy, D. Musto, and A. Reed. Stocks are special too: An analysis of the
equity lending market. Journal of Financial Economics, 66(2-3):241–269, 2002.
[GOPZ21] J. Guijarro-Ordonez, M. Pelger, and G. Zanotti. Deep learning statistical arbi-
trage. arXiv preprint arXiv:2106.04028, 2021.
[Gra83] C. Granger. Co-integrated variables and error-correcting models. PhD thesis,
Discussion Paper 83-13. Department of Economics, University of California, 1983.
[HJTW04] S. Hogan, R. Jarrow, M. Teo, and M. Warachka. Testing market efficiency using
statistical arbitrage with applications to momentum and value strategies. Journal
of Financial economics, 73(3):525–565, 2004.
[Huc19] N. Huck. Large data sets and machine learning: Applications to statistical arbi-
trage. European Journal of Operational Research, 278(1):330–342, 2019.
[Joh00] S. Johansen. Modelling of co-integration in the vector autoregressive model.
Economic Modelling, 17(3):359–373, 2000.
[JOP+ 23] K. Johansson, M. Ogut, M. Pelger, T. Schmelzer, and S. Boyd. A simple method
for predicting covariance matrices of financial returns. Foundations and Trends®
in Econometrics, 12(4):324–407, 2023.
[JSB23] K. Johansson, T. Schmelzer, and S. Boyd. Finding moving-band statistical arbi-
trages via convex-concave optimization, 2023. Working Paper, Stanford Univer-
sity.
[KDH17] C. Krauss, X. Do, and N. Huck. Deep neural networks, gradient-boosted trees,
random forests: Statistical arbitrage on the S&P 500. European Journal of
Operational Research, 259(2):689–702, 2017.
[KL23] D. Kim and B. Lee. Shorting costs and profitability of long–short strategies.
Accounting & Finance, 63(1):277–316, 2023.
[Kra17] C. Krauss. Statistical arbitrage pairs trading strategies: Review and outlook.
Journal of Economic Surveys, 31(2):513–545, 2017.
18
[LB16] T. Lipp and S. Boyd. Variations and extension of the convex–concave procedure.
Optimization and Engineering, 17:263–287, 2016.
[Pol11] A. Pole. Statistical arbitrage: algorithmic trading insights and techniques. John
Wiley & Sons, 2011.
[PY18] J. Primbs and Y. Yamada. Pairs trading under transaction costs using model
predictive control. Quantitative Finance, 18(6):885–895, 2018.
[Vid04] G. Vidyamurthy. Pairs Trading: quantitative methods and analysis, volume 217.
John Wiley & Sons, 2004.
[YP12a] Y. Yamada and J. Primbs. Model predictive control for optimal portfolios with
co-integrated pairs of stocks. In 2012 IEEE 51st IEEE Conference on Decision
and Control (CDC), pages 5705–5710. IEEE, 2012.
[YP12b] Y. Yamada and J. Primbs. Optimal trading with cointegrated pairs of stocks. In
Recent Advances In Financial Engineering 2011, pages 183–202. World Scientific,
2012.
[YP18] Y. Yamada and J. Primbs. Model predictive control for optimal pairs trading
portfolio with gross exposure and transaction cost constraints. Asia-Pacific Fi-
nancial Markets, 25:1–21, 2018.
19
[ZP18] Z. Zhao and D. Palomar. Mean-reverting portfolio with budget constraint. IEEE
Transactions on Signal Processing, 66(9):2342–2357, 2018.
[ZZP19] Z. Zhao, R. Zhou, and D. Palomar. Optimal mean-reverting portfolio with lever-
age constraint for statistical arbitrage in finance. IEEE Transactions on Signal
Processing, 67(7):1681–1695, 2019.
[ZZWP18] Z. Zhao, R. Zhou, Z. Wang, and D. Palomar. Optimal portfolio design for statis-
tical arbitrage in finance. In 2018 IEEE Statistical Signal Processing Workshop
(SSP), pages 801–805. IEEE, 2018.
20