Oliver Fish

Developer & Bug Bounty Hunter

ExchangeScanner

ExchangeScanner is a webapp which allows users to easily view new cryptocurrecy coins and markets that have been added to a specific exchange. The tool was born due to my desire to see the adoption rate of coins on as many of the big exchanges as possible. Once I had built the backend and understood the complexities of various problems, I found that no one else seemed to have access to this data. As a result I built a simple webapp to display the data for others.

The webapp consists of two services. The first and most important, is the Data-Grabber, this is what hooks into the exchanges API and puts the changes into the database. Next we have the webapp, this is what displays the content in a digestible format for users as well as making the data filterable.

Data-Grabber Technical Details

Each exchange has an API that contains methods of interacting with the exchange. These are very useful for people who create trading bots, as it offers them access to all market data while also letting them buy and sell. However, they often don’t have a method to get all coins & markets. As a result I took the top 10 exchanges by volume and found a way to access the data I needed for each one. I wanted to avoid web-scraping wherever possible as I didn’t want my code to be affected by front-end design changes. Furthermore, I wanted to limit exchange specific code as much as possible in order to lower support requirements and also allowing for easy integration of more exchanges at a later date.

Once I knew how to get the data from all of these exchanges, I began writing my data-grabber service. I decided that the only per exchange code that I would allow was structs for the data enable me to unmarshal the JSON and a single function to convert the data into a standard format. This meant that my core logic later on only had to deal with a single data structure. I also decided that all exchange code would be in a single package. This is because I didn’t want to have to import a package per exchange. Moreover, I found that just making the methods exportable was a much cleaner route.

Since I could now access a list of each exchanges’ coins and market, writing the core logic was quite simple. The code runs as follows: check to see if stored data exists for the exchange; if it doesn’t then store it and move onto next exchange; if it does exist, it compares the stored data to the new results from the exchange and finds any differences; if it finds one, it updates the stored data and inserts the differences into the SQL database. I set this up to run in a cron job every 2 minutes on my VPS.

Now that the data was being stored in a database, I was able to easily add more exchanges to monitor. I went from my original 10 supported to 30+ without any core logic changes. At this point I tweaked the logging to make sure I wasn’t getting too much noise and only seeing useful errors and left this running to start filling my database.

Webapp Technical Details

For the webapp I decided to keep it as simple as possible. I only needed to have 3 pages comprised of the same layout except for a few minor changes inside the filter menu. In order to do this, I decided to leverage Go’s excellent templating engine. The webapp consists of 5 HTML templates: 3 templates for the core pages and 2 templates for the header and footer to allow for changes to be made in one place.

I wrote the CSS without a framework to keep it light and made use of the SASS preprocessor because it allowed me to keep my styles more manageable and maintainable. I built the UI with the mobile-first approach. This allowed for a consistent experience across all devices.

The time and date stamp on the website is created client-side. The webapp builds the HTML template with a UNIX timestamp. This allows the webapp to present the date and time in a format that makes sense to the client depending on their timezone/geographic location. The filtering is also done entirely on the client-side by hiding the items that don’t match the current filter. This was done to keep the server load light and to minimize requests.

Review

ExchangeScanner was a really interesting project to work on which allowed me to learn a lot about API design from having to deal with so many 3^rd^ party integration\’s. The user base of the site is growing daily and it seems that people in the cryptocurrecy market find ExchangeScanner useful. This is a project that I plan to continue working on and maintaining. In the future, I intend to add more exchanges in the future at the cryptocurrecy market grows. I also plan to build a public API so that people can use the data for their own tools and sites. Ideally, once this is done, I would like to rewrite the front-end in react and then open-source the entire project.

Project Link