Jonathan ChiuDaniel Wijaya LukmanKourosh Modarresi
Avinayan Senthi Velayutham
Supervisor: Professor Peter WoehrmannMSandE 445
Stanford UniversityStanford, CA, 94305, USA
January 5, 2011
Abstract : Statistical pair trading is a strategy used by many hedge funds,
investment banks, and other investors and traders. Using two assets that have been
historically traded at a narrow range of spread, when the spread widens one opens a
position on the pair. That trading position includes shorting (selling) the asset with
price gain and going long (buying) the asset with depreciated price. When the spread
retreats to its mean or a threshold close to that, the trading position is closed and a
profit is earned. In this project, we develop a pair trading strategy using the spread
model which is an OU process.
The fundamental idea of pair trading is that knowing that a pair of financial in-struments has historically moved together and kept a specific pattern for theirspread, we could take advantage of any disturbance over this historic trend.The pair trading system is similar to the study of a steady state equilibrium inmechanical or electrical system that is expected to remain in the steady statein the absence of any perturbation or shock. When a shock or perturbation isintroduced to the system, the property of the system would dampen out these
forces and take the system back to its steady state equilibrium state. The basicunderstanding of pair trading strategy is to take advantage of a perturbation,when noise is introduced to the system, and take a trading position realizingthat the noise will be removed from the system rather shortly.
The foundation of the idea of pair trading can be attributed to Schroder Sa-lomon Smith Barney (SSSB) stating that the instruments that historically havethe same trading patterns, will have so in the future as well. Historically  pairtrading was introduced by Nunzio Tartaglia,working then for Morgan Stanley,in mid-1980s. Tartaglia believed that pair trading strategy works because ofrather psychological reasons, ie. ...Human being dont like to trade againsthuman nature, which wants to buy stocks after they go up not down.
Pair trading and in general statistical arbitrage investment shows that financialmarkets are not completely efficient. The idea of pair trading includes all assetclasses and in general the financial instrument in a pair could be of differentasset types. In this project the instruments are of a pair of the same asset type,more specifically of stocks.
2 Theory and Model
The continuous model  of the spread is a stochastic differential equation, OU(Ornstein-Uhlenbeck ) process is of the form;
dX(t) = (a bX(t))dt+ dW (t) (1)
The equivalent discrete model for the spread is,
Xk+1 Xk = (a bXk) + k+1 (2)
b+ [k1 a
b](1 b)k (3)
1 (1 b)2 [1 (1 b)2k] + 2k1(1 b)2k (4)
for |1 b | < 1.Eq. (2) can be rewritten as;
Xk+1 = A+BXk + Ck+1 (5)
whereA = a 0, 0 B = 1B < 1, and C =
There are three known methods to estimate the parameters in (2):
1. Method of Maximum Likelihood Estimation (MLE)
2. Method of Moments (MOM)
3. Least Squares Method (LSM)
In this project LSM method is used to estimate the model parameter in (2).This projects primary goals are to:
i Estimate the parameters of (2) based on 15 minute changes in the futuredata.
ii Enhance the Visual Basic (Excel) code which is given by Interactive Brokersin order to test the model by trading through the virtual account of IB.
3 Trading Strategies
Our trading Strategies are based on three different tasks of pair selection, es-tablishing trading rules and risk management;
3.1 Selection of Stock Pairs
Selection of the best possible pairs of assets is fundamental to the overall strategyof pair trading scheme. These are the principles we consider in choosing the assetpairs:
1. We choose two assets that historically (at least for 5 years) moved together.
2. We choose pairs from the same sectors.
3. We test the pairs for mean reversion and stationarity.
4. We choose pairs of assets of ideally identical ,and at most with 0.1.The s are based on one year daily data.
5. Only stocks with high liquidity (of at least one million of average dailytrading volume) are selected.
3.2 Trading Rules
Establishing trading rules that a trader or investor has to follow at all times isvery critical to a successful trading strategy. This factor has perhaps a morepronounced impact in the case of pair trading where any loosening or negligenceof the trading rules could lead to undesirable consequences. These are thetrading rules in our portfolio of pair trading assets:
1. We open a position in a pair when their spread has hit a threshold of2 for the second time. This is to keep ourselves from trading on a pairwhen the likelihood and magnitude of mean reversion is not substantialand also to invest only when the spread is moving in the direction of meanreversion and not the other way. In doing so we open a long position onthe asset that has decreased in price and a short position in the one withincreased price. Each asset of the pair would get half of the investmentdesignated for the pair.
2. In addition to the above criteria, we only want to trade in a pair whenthe rate of return we obtain is greater than the risk-free rate (3% in ourcase). This is because it is always better to invest in risk-free assets whena higher return cannot be obtained.
3. Now that we know which pairs should be considered, we use the MarkowitzModel to determine portfolio allocation since we are making a choice be-tween the 15 possible pairs and the risk-free asset. The rate of return andstandard deviation of return is calculated for each pair. We then choose atarget rate of return (in our case we arbitrarily choose it to be 2.5 times thereturn on the risk-free asset), and then choose portfolio weights to mini-mize the overall variance of our portfolio. Mathematically, the Markowitzproblem attempts to solve the following equations:
wiri = r
4. We then perform the actual trades, going short on the stock that is ex-pected to fall and going long on the stock that is expected to rise in orderto close the deviating spread.
5. Finally we close the position and cash out once the spread reaches a lowerthreshold, in our case it is 0.5. The new funds are then used to repeatthe process and reinvest in more pairs.
Figure 1: Trading positions are opened when the spread go below the upperthreshold after having crossed it previously. Trading positions are closed whenthe spread drops below the lower threshold and profits are made.
6. At any given time, we use the unused fund in risk-free interest rate invest-ment.
7. Transaction fee is assumed to be constant and applicable for both casesof selling and buying assets.
8. We update the whole trading strategy at any time point. (continuousstrategy)
3.3 Risk Management
Risk management, or lack of it, has received a lot more publicity in the recentyears, in the aftermath of 2008 crash. It seems that lack of proper risk man-agement has contributed to the crash or at least to its amplitude. Thus, weare even more mindful of considering an effective risk management strategy inthis project. There are different methods of dividing investment strategies intodifferent type of investments. From a point of view of investment risks, we couldenvision two basic types of investments.
(1) Conventional investment, where an investor take positions by assuming /predicting the future price trend of a financial instrument and/or the market ingeneral. The risk in this type of investment is the systematic market risk, andthe return depends mainly on the accuracy of the prediction of the future prices.
(2) Statistical Arbitrage investment is the second type of investment. In thistype investment there is no need of having a prediction of future assets prices.The basic idea in these type of investments/trades is that regardless of the
assets moving up or down, the investment/trade should make profits. Theseprofits are obtained by assuming that some prices or price relationships followan Ornstein-Uhlenbeck (mean-reverting) process. Thus the statistical arbitrageinvestor makes money whenever there is deviation from the mean. These devi-ations are caused by noise and investors / traders believe that the noise will begone after a short time and prices return to their equilibrium (historic mean).The main risk is that the process may change its regime and thus no longerfollows OU process. This kind of risk could be proven to be very costly for aninvestor/trader.
In this project, we have managed the risks using the following steps:
1. We try to avoid systematic market risk by making our pairs of assets with 0.1. Thus we have a very small spread with very small systematicmarket risk.
2. We avoid the sector (industry) risk by choosing our pairs from the samesectors. The main risks we face is to have a change of a regime in theirbasic features of the pairs, i.e.,
(a) The spread of the pairs is no longer following OU (mean-reversion)Process, and/or
(b) The time for mean reversion process has drastically changed.
To address the first risk (a), we enter a trade only after the spread hashit the trading threshold for the second time. To avoid the risk type (b),we make sure that we keep an open position no longer t