Live Crypto Exchange Latencies Around The World
Powered by 23 AWS EC2 Instances + 1 Dell Poweredge to create 142 informative, real-time graphs.
TigerHacks2022
Inspiration
To provide a live, comprehensive view of the latencies between all possible (23) AWS EC2 instance locations and cryptocurrency exchanges. This provides traders with a clear view of what location(s) are best for trading cryptocurrencies with low latency depending on the exchange they are using. This information can be used to ensure you are enjoying the best trade execution speed possible.
Back End (24 seperate computers run our website, 23 EC2 instances and a Dell Poweredge Server)
23 AWS EC2 Instances
- EC2 Instances at every possible location are constantly pinging multiple different cryptocurrency exchanges across the world. These latencies are then sent to our main server.
- Our main server listens to messages from all 23 instances. This server handles sending the data to the front end.
- Each instance is running Ubuntu release 22.04. ### Websockets
- Websockets are used to communicate between each piece. ### Dynamic DNS
- Dynamic DNS is used to access our main server. It is currently using an old domain I had registered for another project, cuppong.hessdevelopments.com. Google DNS is used for this and CRON jobs on my router are being used to constantly update this domain so it can always be accessed.
Front End
Language and Framework
- The front end was done using the framework Svelte.
- Languages include: Javascript, HTML, and CSS ### Charting Library
- Pancake library was used. This is a highly customizable and very barebones charting library.
- Using SVG lines, live data is easily mapped in and updated in real time on the screen. ### Live Cryptocurrency Data
- Using free websockets provided by Binance, the top of our page includes 4 graphs showing prices of popular cryptocurrencies at the granularity of each trade. This is not a common form of granularity accessible to the public.
To run:
For the time being, this is not finished and not available to the public. Future plans include hosting this project for the public.
Front end
- install npm
- cd to FrontEnd folder
- run 'npm install'
- run 'npm run dev' ### AWS Servers
- install python3
- pip install web sockets and ccxt
What it does
Calculates and displays latencies between all 23 different AWS datacenter locations and multiple different cryptocurrency exchanges.
How we built it
- We spun up 23 AWS Instances each in a different location to accurately get the latency time differences of each cryptocurrency based on the crypto exchange.
- Each of these 23 instances send the data in real time to a central server. The data is then aggregated and sent to our front end website for visualization.
Challenges we ran into
- The AWS instances did not have pings enabled. The underlying Python Websockets implementation uses pings to ensure connection. If a pong is not received, the Websocket times out. This was a valuable lesson to learn and cost us much time.
- Getting the data from our instances to present the data in the UI
- Creating all 23 AWS instances -Time. We did this in just under 20 hours. We started yesterday around 3pm.
- We had a team of two.
- SSHing into 23 separate instances to change something small is a pain and very time consuming.
Accomplishments that we're proud of
- creating 23 different AWSs
- self hosting a central server to aggregate the data from all 23 instances
- creating 2 server programs - one for the AWS instances and one for the central server
- populating 142 separate, live, real-time updating charts on the same webpage
- working all night
- we did this in just under 20 hours
What we learned
-how to create and manage 23 AWS Instances -mass data aggregation -configuring systems in command line only -remote development -deployment of a live, accessible from the internet, server -methods of load balancing calculations across multiple machines
What's next for Crypto Exchange Latencies Around The World
-Hosting for the world to use. -More charts and complex derived data about exchange latencies. -Official domain name. -More exchanges. This was created to scale easily.
Built With
- amazon-web-services
- javascript
- live-data-charting
- python
- realtime-data
- ssh
- svelte
- websockets
Log in or sign up for Devpost to join the conversation.