# 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?