Categories

Amazon AWS > My MacBook at Home

I enjoy using AWS and intend to run my bot for automated crypto trading from one of the AWS’ locations. Since my home machine depends on my “civilian” internet bandwidth and latency I will be using a data center to reduce this risk. Another benefit is that I can rent as many CPUs as necessary for data capture, analysis and trading.

Can’t Trade Alone…

All trading requires at least two sides: one buyer and one seller. My “chances” for trading opportunities are greater when I am also participating on exchanges that have already attracted many other traders. Earlier I mapped the geographical locations of the 40+ biggest crypto exchanges ranked based on their trading volume. I am adding AWS’ coordinates to get a ball-park idea which data center is “closest” to each crypto exchange. In theory, shorter distance between my bot and the order-matching “engine” should result in faster, more profitable trades. Since some trading strategies exploit differences in prices between exchanges I should be also able to guesstimate the “best” data centers for combinations of crypto exchanges.

Included and Excluded Exchages

Few top exchanges have choosen to conceal information about their location. I was able to find clues about their corporate registration in places like Samoa or the Seychelles. Since they are probably not hosting their servers in such exotic locations, these exchanges are excluded from the map:

This list in alphabetic order represents the top crypto exchanges on the map with the locations of the AWS data centers:

Click (Tap) Clusters to Zoom In

It’s Simple?

Asumming that my coordinates are reasonably precise and that order-matching engines are located in the vicinity of the exchange offices I can see that AWS Seoul should be an excelent host to bots for trading on bithumb, Upbit, KORBIT, GOPAX, COINNEST and coinone.

Likewise, AWS Tokyo is relatively near and equidistant to Zaif, bitbank, FISCO, bitFlyer, BTCBOX and QUOINEX.

AWS London is probably a decent choice for BTCC and CEX.IO and EXMO. If COINEGG is indeed in Manchester, it might be better served by the AWS Dublin.

Now, Wait a Millisecond!

Everything looks straightforward until I “poke” around Hong Kong. It is assumed to be the home to several prominent crypto exchanges but all AWS centers are quite far away. AWS locations in Seoul, Tokyo, and Singapore might work well. One way to find out what’s going on is to spin up a nano server in AWS Seoul and ping API endpoints for a few exchanges in Seoul and in Hong Kong. I hope that pings from AWS Seoul to exchanges in Hong Kong will be almost the same as pings to exchanges in Seoul.

Btw, crypto exchange powerhouse Binance is also assumed to be in Hong Kong and Bithumb should be in Seoul but their end-points did not respond to my pings.

Looking at the results, it appears that AwsSeoul-to-Seoul is ~32 milliseconds. Meanwhile, AwsSeoul-to-HongKong was much “slower” at 244 millis and 84 millis but also a very competitive 32 millis for Bitfinex. Perhaps my assumptions are incomplete or even flat-out wrong? I found a useful hint in COINNEST’s ping: its endpoint domain was resolved to a CNAME with the word “cloudflare” and the IP address “104.16…” looks very similar to Bitfinex’s “104.16…”. Quick IP/Geo lookup indicated that both IPs belong to the same CDN provider. In other words, the Bitfinex ping was ~32 millis because it was returned by the nearest CloudFlare edge server, probably located in the vicinity of AWS Seoul.

Another unexpected discovery was this fragment from BitMEX:64 bytes from ec2-52-212-184-113.eu-west-1.compute.amazonaws.com

“eu-west-1” is in Dublin and I am sure that AWS Dublin would be much faster and better location for bots intending to trade on BitMEX.

Considering the above findings, the next step in my data center selection process is to measure the network latency between all AWS regions and all exchange API endpoints. I will write a Java program and use AWS’ Lambda service to ping all the endpoints for a total of ~550 measurements. Stay tuned…