How to use cointegration for a pairs-trading strategy

Pairs-trading relies on a stationary, mean-reverting relationship between two asset prices. In other words, the ratio or difference between the two prices, also called the spread, may over time diverge but should ultimately return to the same level. Given such a pair, the strategy consists of going long (that is, purchasing) the under-performing asset because it would require a period of outperformance to close the gap. At the same time, one would short the asset that has moved away from the price anchor in the positive direction to fund the purchase.

cointegration represents precisely this type of stable relationship between two price series anchored by a common mean. Assuming cointegration persists, convergence must ultimately ensue, either by the underperforming stock rising or the outperforming stock coming down. The strategy would be profitable regardless, which has the added advantage of being hedged against general market movements either way.

However, the spread will constantly change, sometimes widening and sometimes narrowing, or remain unchanged as both assets move in unison. The challenge of pairs-trading consists of maintaining a hedged position by adjusting the relative holdings as the spread changes.

In practice, given a universe of assets, a pairs-trading strategy will search for co-integrated pairs by running a statistical test on each pair. The key challenge here is to account for multiple testing biases, as outlined in Chapter 6, Machine Learning Workflow. The statsmodels library implements both the Engle-Granger cointegration test and the Johansen test.

In order to estimate the spread, run a linear regression to get the coefficient for the linear combination of two integrated asset price series that produce a stationary combined series. As mentioned, using linear regression to estimate the coefficient is known as the Engle-Granger test of cointegration.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.11.34