# How to exactly calculate lag between 2 exchanges

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?

• That is a dummy example, isn't it? Unless you have a very illiquid product, that trades on two exchanges & no one knows of it, I postulate such a lag does not exist. There may be some differences (time zones, regulations, fees or the like) that do not allow for arbitrage within a window, but other than that, there will be no such thing. You can look at this for a example to see what people do to get speed. Publicly available software gives users 20,000+ orders per sec. Commented Jan 18, 2022 at 20:44
• Does this answer your question? Latency and Delays across Exchanges Commented Jan 18, 2022 at 21:38
• @AKdemy of course it is a dummy example. It is just to illustrate my problem. Your previous link is about network latency and message processing. That part is easy. This is more about predicting when will the price of exchange 2 adjust. The feed delay, matching latency, etc is a different problem and relatively easy to measure. Commented Jan 19, 2022 at 10:40
• @RLaslo then you probably need to reformulate the question. For most people the "latency between two exchanges" is the network latency to get a message for exchange A to exchange B. Predicting when the prices match depends on various other factors, like the exchanges in question, typical spread and such. Commented Jan 24, 2022 at 18:49
• @LazyCat I have just amended it. I hope it is better now. Commented Jan 24, 2022 at 21:24