GithubHelp home page GithubHelp logo

cryptocurrencyquery's Introduction

Crypto Currency Solution

This application first gets a list of all cryptocurrencies from CoinMarketCap using the Listings API. Since changes in the cryptocurrency list rarely happen, it caches the list for up to 2 hours and does not query that API again within that time frame (which is adjustable).

You can then select a symbol from that list, and it retrieves the price for that cryptocurrency in 5 common currencies by calling the Quotes API for each currency (the list of supported currencies is stored in the database).

Naturally, we know that it's not efficient to call an API for each currency, and I spent a lot of time finding a better solution. However, the free plan from CoinMarketCap only allows you to convert a cryptocurrency to one currency per request, but paid plans allow you to get the price for a cryptocurrency in multiple currencies with one request.

Alternative solution: There was another solution to reduce the number of API calls made. First, we can use the CoinMarketCap Quotes API above to get the price of the desired cryptocurrency in euros. Then, we can use the Exchangerates API to get the conversion rate of euros to other currencies from exchangeratesapi with one API call. (Exchangeratesapi only allows euros conversion with other currencies in the free plan)

Then, based on the result, we can calculate the price of the desired cryptocurrency in other currencies ourselves. This way, we can achieve our desired result with just two API requests. However, in my opinion, this solution has two problems. First, we become dependent on two different APIs, and if either of them encounters a problem, our site will face issues. Second, we are getting data from two different sites and do not have a specific reference for prices, which could be problematic from a business perspective, and users may not receive consistent prices.

Technologies

Getting Started

  1. Install the latest .NET 7 SDK
  2. Install the latest Node.js LTS
  3. Download this Repository
  4. Run dotnet run in WebUI folder

For testing APIs, there is the possibility to use Swagger which is accessible through the menu at the top of the application.

Overview

Domain

This will contain all entities, enums, exceptions, interfaces, types and logic specific to the domain layer.

Application

This layer contains all application logic. It is dependent on the domain layer, but has no dependencies on any other layer or project. This layer defines interfaces that are implemented by outside layers. For example, if the application need to access a notification service, a new interface would be added to application and an implementation would be created within infrastructure.

Infrastructure

This layer contains classes for accessing external resources such as file systems, web services, smtp, and so on. These classes should be based on interfaces defined within the application layer.

WebUI

This layer is a single page application based on React 18.2 and ASP.NET Core 7. This layer depends on both the Application and Infrastructure layers, however, the dependency on Infrastructure is only to support dependency injection. Therefore only Startup.cs should reference Infrastructure.

cryptocurrencyquery's People

Contributors

skamalou avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.