Pinpointing Exchange's Location
This article provides simple steps for non-engineers to identify the location of the exchange they are trading on. The methodology is written in a general way, making it adaptable for any exchange.
Introduction
Traditional and crypto exchanges often times obscure the location of their infrastructure. They use Content Delivery Networks to mask their true locations. CDN also helps them protect against DDoS attacks, and mitigate other security threats. Keeping the details of their servers and IP addresses private is in their best interest, and such information is typically shared only with selected market makers that they work with. This basically means you, as a retail customer, can not get to this information.
However, there is a way to pinpoint the exact region of an exchange's infrastructure, if you know an exchange’s cloud provider. (90% of crypto exchanges for example are hosted on them) In this article, we’ll explore one such crypto exchange and try to figure out region in which to deploy your trading or arbitrage bots, ensuring the lowest possible latency to the crypto exchange.
Methodology
First of all, before we begin, we have to think a little bit how to tackle this problem and here is how my train of thought went:
Find out what cloud provider is crypto exchange using. Most of them post this publicly and it’s not really a secret.
We need to get response from non heavily cached endpoint in order to get initial latency to the exchange. It would be best to choose un-authed endpoint, so we can geo query it.
Geo query the endpoint, get lowest latency node and find a region on a cloud provider, that this node is closest to.
We can go further and benchmark from which availability zone we get lowest time on limit order endpoint response. Usually matching engine runs in one availability zone with hot standby in another. Unfortunately if exchange is doing loadbalancing that introduces additional network hops, knowing exact AZ of matching engine doesn’t matter anymore.
Cross AZ network hop in AWS usually adds 1ms and can vary up to 2ms of additional latency.
Tracing AWS region of an exchange
Step 1
Looking at API reference of the exchange that we will try to pinpoint shows that server time endpoint is accessible here:
GET /api/v3/time
Step 2
Lets open up: https://www.site24x7.com/tools/check-website-availability.html or any similar website where you can check response times of a website from different parts of the world and fire it against our server time url:
We can clearly see that the total response time seems to be fastest in Singapore, which coresponds to the AWS region ap-southeast-1.
Ignore the failed regions, since that is called geofencing. This means, particularly crypto exchanges need to geofence and block access to their website from specific countries, usually due to regulatory reasons.
Step 3
Benchmark limit order endpoint and response times from each availability zone in that AWS region. Unfortunately particular exchange didn’t show much better performance from single AZ, but we could pinpoint that connection times from apse1-az2 are a little faster in average of ~1-2ms.
Summary
Knowing in what region exchange hosts its infrastructure is mostly important for automated trading. An example of those that are latency sensitive would be market makers. Beyond region, pinpointing actual AZ usually does not result in much better performance in speed of setting limit orders. Some exchanges do use smart routing on the ingress though and route requests directly to the matching engine, so testing limit order endpoint from each AZ still makes sense to at least try, maybe you get lucky.