Let's assume that there are two exchanges. One exchange is slow for various reasons.(for eg it is an open outcry versus electronic exchange) Even when there is no lag the prices will not match exactly but almost. From the data below I can see that exchange2 is around 2 minutes late compaired to exchange1, but how can I calculate the lag in excel or python? In other words by how much should I shift the graph of exchange1 to best fit the graph of exchange2? Is there a mathematical formula for it?
Time Lagged Cross Correlation seems to do the job perfectly.