Geographic Latency in Crypto: How to Optimally Colocate Your AWS Trading Server to Any Exchange API
During periods of crypto market volatility and the inevitable accompanying exchange downtime, crypto Twitter revisits a topic painfully near and dear to the heart of any time-sensitive API trader:
Latency.
Aside from robust error handling — which is paramount! — there isn’t much that can be done client-side to address exchange latency. However! A related and obvious starting point for any shop / trader who does significant volume over APIs is colocation.
Colocation simply means placing your own server as close to the exchange’s servers as possible to reduce time lost communicating over wires. Additionally, many exchanges offer higher throughput and improved API services to their market makers.
That said — most exchanges do not publicly publish their API server’s location for various reasons. So one approach to ferret out that info is simply to ping the exchange from multiple AWS regions and pick the fastest one since that’s probably where the exchange is hosted.
Prop trading firms are notoriously secretive about any information that could help their competitors like this. It’s also not relevant for 99.9%+ of traders, so there isn’t much about it published online.
However, since my market making project @SQSTrading is still learning the ropes, and since it’s Day 1 type of diligence, I thought I’d share our findings publicly.
A few months back we used the (excellent!) ccxt library (CCXT) to run a simple fetch_ticker() call for each exchange, took the average time of 10 calls run in serial, and then output that result to a spreadsheet. We set up AWS servers in 8 different locations in North America, Europe, and Asia, and ran the above API calls on each exchange from each location.
So without further ado, here’s what we found!
LINK TO FULL RESULTS
Some things stand out: many of the big exchanges have reasonable roundtrip latencies regardless of where you’re located, including Binance, Bitfinex, Bitstamp, Bittrex, Coinbase Pro, FTX, and Kraken.
However, some of these exchanges are clearly replicating order book data (e.g. Coinbase Pro, which is known to be located in the Amazon US East N. Virginia us-east-1 region) to servers not located in the same region as the matching engine server, so this test would need to be re-run with a private API call if you’re actually thinking about trading on a given exchange. For the purposes of this test, I’ve left the data as-is, but you should set up an account and make some private calls before finalizing your own server’s location. In other words, use this data as a general guide, but do your own diligence!
More generally, when selecting an optimal region, Asia dominates — shocker! This is a somewhat well-known datapoint for those in the industry — and it confirms the following:
If you’re looking for a single location to set up shop for a latency-sensitive operation, the Tokyo AWS region seems to be a good spot to hang your shingle.
If you liked this, follow me on Twitter @elitwilliams.