# 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 trade are set in t=0 as

buy signal (spread below its mean)->    buying   shares X  and selling   beta  shares Y
sell signal (spread above its mean) ->  selling   shares X  and buying    beta  shares Y


I know the Prices for X=100 and Y=80 at t=0.

The signal is generated just by looking at spread in relation to its mean. My confusion comes at scaling when it needs to be converted into share quantities, the portfolio value and returns need to be calculated.

For example:
initial spread is $X - \beta Y = 100 - 0.7 * 80 = 44$

Should this be looked at as buying/selling a structured portfolio with the price 44? How should it be seized then? Initial capital / the portfolio price? or accounting should be done separately for short and long position and then aggregated?

Going forward the prices of X,Y will change (spread change), how the shares quantities, Market Value and returns should be calculated then? I presume the relation in quantity between A and B will stay constant (determined by beta) but the shares quantities will be changing.
Could somebody demonstrate how this should be calculated on this example?

## 1 Answer

Spread (e) = Y - bX - this is the synthetic instrument that you are trading. If e is low you go long e, that means you long 1 share of Y and short bX* shares. Same for the short of e, short 1 share of Y long bX* shares. These are the standard theoretical assumptions. I assume you can calculate PNL from this.

Now I did a lot of tests with pair trading and would propose to you a different methodology, since if you have a lot of pairs you will eventually run into several problems:

1) First do not use 1 share per Y and b share per X, use 100. Example: long 100 Y shares, short b*100 X shares, since if b < 1 you can't trade less that 1 share.

2) There will be pairs where beta is very small and alpha is very big but since you use only beta, that will suggest putting all your capital in Y, which is wrong. The work around that I used was not using beta to calculate the amount of shares (only use it compute the spread). I have calculated the amount of shares per each side by dividing the total capital (C) allocated to a pair trade by 2 and the dividing that part by the price of a stock. Example: Number of Y shares to trade = (C/2)/(Price of Y stock); number of X shares to trade = (C/2)/(Price of X stock). This approach actually yielded better returns on a lot of tests and it's still is a good approximation.