Can you arrive at a hedge ratio using a Kalman Filter and does this affect if we should use the share amount or cash value for weights?
If you estimate a hedge ratio between prices it is always for units, if you estimate a hedge ratio between log of prices (or between the returns series), it is always for dollar value.
In pair trading, the purpose of hedge ratio is to accurately track the spread. Our position should be such that for a change in the stock prices, our portfolio profit/loss should be equal to the change in the spread we are trading.
Let's say we run an OLS of raw prices, Y vs. X (say Y = b1.X + residuals). Here the spread that we are trading is S1 = Y-b1.X. Here, If you take 1 unit long position in Y and b1 unit short position is X, then for a change in price (change is usually denoted by Δ), your position profit/loss is ΔY - b1.ΔX. Note this is exactly the change in spread S1 above. That is ΔS1 = ΔY - b1.ΔX. So treating b1 as unit is the correct thing to do, as it gives us the correct hedge (that tracks the spread correctly).
Instead, if we use log prices, then we have ln(Y) = b2.ln(X). Here the spread is S2 = ln(Y) - b2.ln(X). Now if we take 1 dollar worth of position in Y and short b2 dollar worth of X, then change in portfolio for change in underlying prices is 1*ΔY/Y - b2.ΔX/X. From calculus 101, we know (roughly) Δln(Y) = ΔY/Y (and similar for X). So we can re-write the portfolio profit/loss as Δln(Y) - b2.Δln(X). This is exactly ΔS2, so the correct hedge is treating b2 as dollar value.
This is the reason why we use units for prices and dollar value for log prices. It is based on simple maths of profit/loss calculation. If you are doing OLS, Kalman filter, deep learning regression or anything else, it does not matter. The math remains the same. If you run Kalman filter on prices, you need to take it as unit of ratios, if you run Kalman filter on log prices, it will be dollar value. It is an entirely different discussion which one we should use by the way.
This kind of questions shows you are struggling to explore advanced aspects of quant finance with a shaky fundamental. I suggest you focus on making your basic understanding solid and then move on to advanced stuff afterwards. That way, your learning will be more useful and applicable and fun.
Thanks for the breakdown.
Its not an issue of either (raw price = units) or (log price = cash).
Because Im using the raw price but the weight calculation Im using is a cash ratio of my balance. And Im rebalancing.
This should not happen.
What Im trying to find out why its performing like this. I honeslty can see anything logicaly wrong. This is what Im asking help with.
Thanks again for all the help and consideration.
In "Instead, if we use log prices, then we have ln(Y) = b2.ln(X). Here the spread is S2 = ln(Y) - b2.ln(X). Now if we take 1 dollar worth of position in Y and short b2 dollar worth of X, then change in portfolio for change in underlying prices is 1*ΔY/Y - b2.ΔX/X. From calculus 101, we know (roughly) Δln(Y) = ΔY/Y (and similar for X). So we can re-write the portfolio profit/loss as Δln(Y) - b2.Δln(X). This is exactly ΔS2, so the correct hedge is treating b2 as dollar value."
Dont you mean log(Y) = b2.log(X) ?