Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [pairs-trading]

Pairs trading is a market-neutral trading strategy enabling traders to profit from virtually any market conditions: uptrend, downtrend, or sideways movement. This strategy is categorized as a statistical arbitrage and convergence trading strategy.

2
votes
3answers
73 views

Calculating Sharpe Ratio with dynamic position sizing

I'm currently backtesting a mean reversion pairs trading strategy. However, instead of simple long or short trading signals, I'm using multiple "levels", where the further away the spread is from the ...
0
votes
0answers
49 views

Pair trading cointegration

When looking for cointegrated pairs, you assume that times series are integrated of order one and try to find a linear relationship using a regression that makes them integrated of order 0 (I(0)). Now ...
1
vote
0answers
67 views

Pair trading strategies in fixed income

We usually hear about finding cointegrated pairs of stocks in pair trading, but it seems it is not as developed in fixed income despite the fact that the spectrum of securities is large (different ...
2
votes
1answer
582 views

How to calculate Sharpe Ratio from $ returns?

I have a pairs strategy that I am trying to calculate the sharpe ratio for. Currently I am using python for my analysis and calculation. I have a dataframe that contains the cumulative returns in $'s ...
0
votes
0answers
86 views

Price Series vs Returns series for pairs trading

Consider two stocks A and B. Suppose we regress their price series and find a coefficient β. Specifically, Pi = βQi + Ei And we find that the Error is mean reverting. So the strategy ...
0
votes
0answers
42 views

What is the value for Δt term in an Ornstein Uhlenbeck process?

I am looking at O-U processes for the first time and I was wondering what is the Δt term value. To become more specific I have a daily dataset with daily prices ...
0
votes
0answers
54 views

looking for mathematical technique to predict reversion or trend at the end of a cycle

I have a pairs trading algorithm, and at the end of the cycle, the pair is either going to revert or diverge to/from the trend line. When the cycle is smooth, it reverts, when there is some ...
-1
votes
1answer
180 views
1
vote
0answers
33 views

When constructing a cointegrating series, does choosing the linear regression with the lowest ADF test statistic yield the optimal hedging ratio?

Multiple sources say that you should find the optimal hedging ratio between two stocks in a pairs trade by conducting 2 linear regressions (with each stock as the independent variable), and using ...
0
votes
0answers
38 views

Cointegration code for Ruby?

Does anyone know if there is a dickey Fuller or other co integration library for Ruby?? This is a simple question but stack overflow requires more filler to post.
0
votes
2answers
111 views

Standard deviation of a long-short portfolio with net position zero

I've come across the following question and I'm slightly stuck in answering it: Suppose you have a two-stock portfolio that is long one stock of asset A, and short one stock of asset B, with A ...
1
vote
2answers
193 views

Cointegration vs combination of returns

Hi Quantitative Finance, I understand that there are a wealth of pairs trading models out there. Recently, it got me thinking as to why we go through the trouble to find cointegrated pairs while we ...
6
votes
3answers
430 views

Why isn't it appropriate to use correlation between prices in a pairs trade strategy?

I've already seen this question and read through all the answers, but I'm still confused about why you shouldn't use price correlation in a pairs trade strategy. For example, if I'm looking at the ...
3
votes
1answer
157 views

Is this the correct way to hedge two securities against each other?

Let's say I believe that $ts_1$ and $ts_2$ move together and I would like to pairs trade them. Am I correct in understanding that to hedge them against each other I would get their $Var_1$, $Var_2$, ...
1
vote
1answer
575 views

How to “Standard Beta Hedge”?

Let's say I have 2 time-series, how would I "standard beta hedge" them against each other? For example, what if the position in 1 timeseries is 100 shares at 16 USD per share. Another time-series is ...
1
vote
0answers
218 views

Cointegration and pairs trading

I have intuition that cointegration between elements of pair of equities somehow contradicts pairs trading strategies. Because the better is linear fit of the model the less opportunities we have for ...
1
vote
1answer
2k views

Calculating the returns of a long/short strategy

I feel like an idiot asking this but i haven't found the answer anywhere. I have backtestest a paris trading strategy, while calculating the returns of the strategy I run into some problems when the ...
2
votes
0answers
120 views

Relative Value Trading of American Style Options on Futures, Calcuating hedging ratios?

I am interested in Relative Value Trading of American style options on futures and have not found a whole lot of literature on it. The best resource I have discovered so far is a few pages in Colin ...
1
vote
0answers
115 views

pair trading - rolling adf test

I am testing a pair trading strategy. Every day I recalculate the hedge ratio using the past N prices of the 2 underlying. With the hedge ratio, I calculate the past N spreads and do an ADF test to ...
1
vote
1answer
463 views

calculating the pair weights from log price hedge ratio

I am calculating the hedge ratio using log prices: $$ \ln(A) = \text{hedge_ratio} \cdot \ln(B) $$ How do I convert the hedge_ratio into a number of shares of A vs....
3
votes
1answer
197 views

How do you decide what time frame you're going to use when testing for cointegration?

I've been fiddling around with different time frames when doing tests for cointegration between two timeseries, and I've realized that the dates that you use for your start/stop of the test will ...
0
votes
1answer
190 views

How can I apply error correction model in pairs trading?

I have read Vidyamurthy and others, but did not find clear example of error correction model (ECM) application in pairs trading. How should I use the ECM model in the pairs trading? How to use ECM ...
0
votes
2answers
2k views

Close or Adjusted Prices when Backtesting

I've been doing this for some years now, but recently, since I started fiddling around with an old pairs trading strat of mine again, when updating the databases before running the tests, I was ...
-1
votes
1answer
473 views

pair trading cointegration - calculating shares quantities traded, portfolio value and returns

I have a trading strategy based on the cointegration of X and Y where beta derived from the regression is 0.7. My initial capital to invest is 1000. My understanding that the quantities of X and Y to ...
1
vote
1answer
276 views

What causes poor returns in pair trading of very cointegrated securities?

I've been running some backtests of a pair trading strategy on 1 year worth of 5 min bars of two securities and I've noticed pretty poor returns, especially once transaction costs are taken into ...
0
votes
1answer
137 views

How buying/selling pairs and entering/exiting trade works in pairs trading?

Lets say I have two stocks x and y and their corresponding stock price p(x) and p(y). consider HR as hedge ratio. Then we can calculate the spread using this equation. $spread=p(x)-HR*p(y)$ from ...
4
votes
1answer
1k views

What is the pseudo code for a pairs trading strategy?

I am trying to learn about pairs trading strategy. I know that we have to long and short cointegrated assests simultaneously. But I still have some confusion in how the strategy works. I wrote the ...
2
votes
0answers
315 views

cointegration strategy

If it can be proved that two time series $$S_t^1=\alpha + \beta S_t^2 + \xi_t$$ representing stocks are correlated, with $\beta=-2$ and then are proved to be cointegrated, how a portfolio should be ...
5
votes
0answers
832 views

How to trade the Ornstein-Uhlenbeck process?

My question comes from this paper, which is a short version of Avellaneda's paper The picture bellow provides a summary of the equations. Do I understand correctly that in order to trade OU process ...
2
votes
1answer
405 views

Mean reversion and adjusted beta for pairs trading

Trying to evaluate model for pairs trading. Consider classic formula: $\frac{dP}{P} = adt+b\frac{dQ}{Q}+dX$, where $P$ and $Q$ are stock prices, and $X$ is a mean reverting process (MRP) and $a$ is ...
1
vote
4answers
118 views

Where can I get json currency data feeds every millisecond?

I have been looking for free or paid json data feeds on currencies for long. I have come across: currencylayer.com Oanda XE The problem is that I really need millisecond based updates. Can someone ...
1
vote
2answers
612 views

Pairs Trading Signals and Positioning

I am currently working on a research project for a pairs trading strategy and would like to know the correct positions to take when a signal has been triggered. Say we are using this equation to ...
1
vote
0answers
218 views

Calculating PnL from log prices

I'm backtesting a statistical arbitrage strategy. To calculate the PnL I simply use $Y(t)-Y(t+n)$ for the profit on the first leg and $\beta*X(t) - \beta*X(t+n)$ for the profit on the second leg, ...
2
votes
1answer
133 views

what are the criteria to select pairs?

I'm new to this forum, this is the first question I posted. I have many candidate pairs and I've used ADF test to make a first selection. There are more than 800 selected. The pairs are absolutely too ...
8
votes
2answers
1k views

What does the cointegration coefficient represent in pairs trading when cointegrating log stock prices?

In Pairs Trading by Vidyamurthy, on page 83 (and throughout the book), the author describes an elementary example of trading with log prices. The long run equilibrium of the basic portfolio is given ...
2
votes
1answer
330 views

Pair trading based on cointegration - equity line

I'm preparing a project at my Uni where I have to make a simple pair trading strategy using cointegration between two stocks. I'm stuck on the equity line calculation. I have prepared opening and ...
0
votes
1answer
222 views

What P&L netting should one use when a strategy has trades in two different geographic locations?

I am familiar with the FIFO methodology of netting buys and sells to obtain a realized P&L and outstanding position. Suppose there's a strategy which runs in two different places A, and B and ...
3
votes
2answers
878 views

How to select optimal look back period for statistical arbitrage?

Is it possible to estimate the optimal look back period for OLS from which we test if residuals are stationary? Almost all papers that I read use random look back periods of 100 days, 252 days, 500 ...
5
votes
1answer
590 views

Mean reversion time estimation

I am new to mean reversion trading, and I would like to get some good references about how to estimate the time it takes to a mean reverting process to cross its long term mean.
4
votes
3answers
550 views

References on Statistical Arbitrages

Is there any basic materials (books, papers) to read on Statistical Arbitrage? I certainly understand much of the useful information is in the industry. I just want to get some understanding on the ...
3
votes
1answer
947 views

The meaning of Ornstein-Uhlenbeck parameters

I am trying to understand theOrnstein-Uhlenbeck process $dX_t = \kappa(\theta-X_t)dt + \sigma dW_t$ my question is what is the meaning of the parameters? and assuming that we know those parameters ...
4
votes
2answers
4k views

How can I estimate the Ornstein-Uhlenbeck paramters of some mean reverting data that I have on R?

I have mean reverting data (Difference of 2 stock prices, that I want to do pairs trading on). I want to simulate my own mean reverting data as similar as possible to the real data that I have. The ...
2
votes
3answers
1k views

Dou you have an example of implementing Engle-Granger 2-step cointegration?

Does anyone know where to find an example of implementing Engle-Granger 2-step cointegration? Python's ideal, but any language will do. I've skimmed and read many articles, but understand little ...
3
votes
1answer
3k views

Calculate spread for pairs trading

What is the best way to begin calculations for pairs trading? I have seen two ways: 1) Start from the price ratio StockAPrice/StockBPrice and calculate mean, ...
1
vote
0answers
869 views

Cointegration Test: Residual is stationary but not random?

I am testing cointegration relationship on various pairs of stocks by this following these steps. Test for I(1) on a pair of stocks, says X and Y, using Dickey-Fuller test. If both time series are ...
1
vote
1answer
223 views

use synthetics for a pairs trading strategy

Let us say I want to pursue a pair trading strategy between stock A(long) and stock B(short). Can I replace this stocks with their synthetic option equivalents and have the same risk reward profile ...
2
votes
2answers
757 views

What is a canonical book or article to learn pair trading?

Can someone suggest a resource with a clean cut explanation of pair trading?
4
votes
0answers
76 views

Is it important to equalize the minimum price fluctuation in pairs trading?

For example, suppose we were trading a strategy which buys one Brent contract and sells one Gasoil contract. The minimum price fluctuation for a Brent contract is \$10, and the minimum price ...
-1
votes
1answer
364 views

If I am very fast (less than 10 microseconds latency) what would be the first strategy to execute? [closed]

Let's assume I found the holy grail of low-latency trading (which I didn't). For educational purposes, what would be the first strategy I would direct my trading code?
2
votes
1answer
1k views

How does Volatility Pairs Trading work?

I've read some material related to pairs trading for equities and I understand the process of finding non-stationary pairs price series that can be cointegrated to form a stationary series. The basic ...