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?
-
$\begingroup$ 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. $\endgroup$– AKdemyJan 18, 2022 at 20:44
-
3$\begingroup$ Does this answer your question? Latency and Delays across Exchanges $\endgroup$– AKdemyJan 18, 2022 at 21:38
-
$\begingroup$ @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. $\endgroup$– RLaszloJan 19, 2022 at 10:40
-
$\begingroup$ @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. $\endgroup$– LazyCatJan 24, 2022 at 18:49
-
$\begingroup$ @LazyCat I have just amended it. I hope it is better now. $\endgroup$– RLaszloJan 24, 2022 at 21:24
1 Answer
Time Lagged Cross Correlation seems to do the job perfectly.
https://towardsdatascience.com/four-ways-to-quantify-synchrony-between-time-series-data-b99136c4a9c9