NodeJS Framework Development For Cryptocurrency Data Aggregator With SailsJS

26 Jul

Blockchain powered cryptocurrencies have acquired the planet since it is the most secure and decentralized form of currency with no bank acting as an intermediary. With the world wide web being the sole resource for cryptocurrency trading, web-based cryptocurrency exchanges always produce a great deal of data for blockchain consulting businesses. This information is publicly accessible for all -- waiting patiently to be used for planned investments.

However, cryptocurrencies exchange prices remain highly volatile due to their trade volume based nature. When this raises questions about the validity of Cryptocurrencies, at present it is also creating businesses opportunities for:

  • Data aggregators,
  • Cryptocurrency exchange analysts
  • and blockchain consulting companies

Their task, to track and examine the cryptocurrencies exchange prices in order to predict its performance in the stock market. In their endeavor to innovate their business and convert cryptocurrency investors into clients, exchange analysts frequently rely on web applications that automatically aggregate data from such trades and process it into actionable form.

The CISIN lately had an opportunity to work a US-based renowned cryptocurrency company, a comparable cryptocurrency exchange rate evaluation firm. Our collaboration followed with a SailsJS based web application able to aggregate exchange information from 20 different cryptocurrency exchanges and create whitelisted market indexes to value the cryptocurrency industry.

With this article, we aim to share the adventures of our advanced JavaScript programmers together:

  1. Utilizing the SailsJS framework to come up with a NodeJS application
  2. Integrating Cryptocurrency exchange data using 20 different 3rd party services
  3. Challenges they faced during the development lifecycle

If you are planning to make cryptocurrency info aggregator net program, then read along to find out exactly what the evolution process looks like to get a similar program.

Let's start by taking a look at the essential characteristics of this web application we developed.

Key Features Of Cryptocurrency Data Aggregator

To understand the key features of this application is critical to have a fundamental understanding of a cryptocurrency exchange and what information is generated from it.

What Do We Know About Cryptocurrency Exchange?

Cryptocurrency exchange functions in the same manner as our fiat currency exchange outlets at a bank or in an airport. You walk in and exchange your native money with any other money. For Cryptocurrencies, these exchanges are performed online over a web portal site where you can convert your cryptocurrency into other people (for eg: Bitcoin to Ethereum) or change it into a fiat currency (for eg: Bitcoin to USD).

There are several cryptocurrency exchanges that can be found on the worldwide net, a few major exchanges comprise GDAX, Bittrex, CoinEgg and, Binance

The simple fact that each cryptocurrency market has its own exchange rate, it's not easy for cryptocurrency dealers to deduce the industry indicator of a money or at which exchange he can get the best rates.

This is where Totalcryptos internet application helps traders by fetching exchange information in 20 different cryptocurrency exchanges and generating cryptocurrency market index.

Method To Recover Currency Exchange Data

The most reliable approach to bring information from any 3rd party supply lawfully is by using their API's. Being money exchanges, API's are usually available since they not only offer the data about money exchange rate but also provide the capacity to perform exchanges through their API.

For our usage case, we only needed the real-time and historical exchange rate information of cryptocurrencies.

As the currency exchange data upgrades in real-time after every few minutes, we found that a custom CRON job tasked to trigger the data PULL petition from the API after every few minutes.

Whitelisting Of Raw Exchange Data Using Visualizations

The aggregated data is then utilized to make our own data sets by calculating average exchange information per money. The fetched data is assessed and assessed in tabular and chart type:

i) Displaying data in tabular form

Displaying a list of high cryptocurrencies predicated on top actors for Cryptocurrency into USD market, leading performers for Cryptocurrency into Cryptocurrency market and eventually a complete list of all of the cryptocurrencies.

All of the different columns that you see from the next screenshot are fetched from the data exchange supplier's API except that the Charts.

ii) Displaying data with Charts

We also incorporated two separate graph libraries: C3 Charts and Sparkline graphs to represent the individual cryptocurrency functionality.

C3 Charts were utilized to display the fluctuation in the purchase price of the exchange rate for a cryptocurrency.

Sparkline graphs were used to show the TC100 index (cost of the top 100 Crypto Currencies by market cap) and the way that it varied throughout the afternoon.

Developing a Custom REST API

Ultimately, all the whitelisted market indicators generated will also be accessible as a JSON information feed through a custom constructed REST API. Total Cryptos REST API gives access to the information within their database because a JSON feed such that anybody can recreate an identical platform with any internet development platform by utilizing Total Cryptos data.

Now that we have a brief vision of everything all features were built, let's look at the tech stack that has been used.

Technology Stack: A Cryptocurrency Data Aggregator

The data aggregator program was built utilizing SailsJS (an MVC based NodeJS frame ). The front-end template was built in Bootstrap and was set up in Sails Views utilizing EJS (Embedded JavaScript) template engines.

On the database finish, CRUD operations were handled using MySQL.

SailsJS: NodeJS Framework

SailsJS is one of those very few NodeJS frameworks that employs an MVC development version. This allowed us to maintain the program logic separated from the User Interface code and managing the connections between them in a different layer.

Along with the SailsJS provides the capability to switch the storage layer through its Waterline ORM with that we could utilize Mysql and its powerful methods of producing and optimizing database queries.

The only real reason to utilize SailsJS was it has coordinated development and installation workflow whilst not cutting corners on application's functionality.

EJS: Embedded JavaScript Templates

Other than the fact that EJS is your official template engine supported by SailsJS, we utilized it because of its own HTML established syntax. Even though we had the option to utilize variously advanced UI frameworks like Angular or Jade, EJS is simply the most appropriate vocabulary for front-end templating at SailsJS.

We could utilize an off the shelf Bootstrap template to kickstart the backend advancement and within no time have been writing the controller code to show data in viewpoints.

Challenges Faced:

Preserving Uniformity Of Exchange Information

The entire crypto application has been programmed to fetch swap data in 20 different cryptocurrency exchange providers. The problem with fetching information into one application from various sources is the fact that each data exchange web support has its own terminology, data feed structure and calling nature.

This makes the raw information non-homogeneous and unusable as our front-end perspectives can only accept information from a linear form. Because of this, it's never a straightforward job to fetch the information and save it in the database.

Our Solution:

To overcome this challenge, we began with creating our own array that will handle the data of all exchanges. We defined a structure of our own that will be employed by different views across the site.

Then to conserve the fetched cryptocurrency information inside the array based on our arrangement, we created multiple SWITCH instances, each case powered using a foreach loop to convert the raw data to the structure of our array.

The Foreach loop processes the conversion for every variable supplied by the particular exchange internet service and at the end of the Switch case, we'd created a custom array of exchange information which is linear and homogeneous.

Optimization Of Data Loading Time

Maintaining the loading time in check is always one of the high priority for virtually any internet application that we develop as this directly affects the efficacy of a program. For a data-heavy web program like TotalCrypto, loading time was an anticipated concern as the website is handling a data of around 20 distinct sites.

Loading the whole exchange information on page load in a traditional manner was not the ideal way to load the information and also we experienced this firsthand. The web app immediately revealed high loading times because of the number of data being loaded on page loading.

Our Solution:

The repair was deployed utilizing asynchronous information loading mechanism with AJAX. In this manner, every time that the page was loaded, an asynchronous call was made into the database while the page has been loaded and HTML/CSS components were being left.

Therefore, at that time the page loading has been completed, the information was almost loaded and it only took a couple more seconds to fully load the data.

It was like a time direction approach for loading the web application's content which immediately resulted in an optimized loading rate for the program

Conclusion

Utilizing the Publicly developed API we also have extended the development efforts for a WordPress plugin that provides all of the cryptocurrency exchange data and unique market indicators like a WordPress widget. With the whole program developed in SailsJS where visual elements are separate from the core logic, then that Node.JS program is as adaptable as it receives.

The near future holds some exciting development opportunities for individuals working as development partners for Totalcryptos. Stay tuned to our website for more information about the most recent development.

Till then, contact us with your inquiries concerning this post or if you're looking to employ a web developer to build and establish your web application. Adios!

Share this post with your friends!