exchange-api icon indicating copy to clipboard operation
exchange-api copied to clipboard

[Suggestion] API v2

Open RaptaG opened this issue 1 year ago • 9 comments

The Problem

In the current version, even though it works, there are many flaws and problems which should be fixed on the side of this API (not the developer side).

Just to name a few:

  • Storage space of the repo is too big
  • The daily currency fetching takes more than 5 hours to complete
  • There is no categorization in national currencies, obsolete national currencies and cryptocurrencies
  • There is few (and often missing) information about each currency

Solution

There are many fixes about these issues:

Efficiency

  1. Host the project on NPM
  2. Do not generate .min.jsons (see jsDelivr docs)
  3. Use the purge cache jsDelivr API for faster user access to the new data

Organization

  1. Use a new JSON format:

currencies.json

{
  "date": "YYYY-MM-DD",
  "national": {
    "currency-id-in-the-api": {
      "id": "id-here",
      "name": "name-here",
      "symbol": "symbol-here",
      "country": "country-here"
    }
  },
  "obsolete": {
    "currency-id-in-the-api": {
      "id": "id-here",
      "name": "name-here",
      "symbol": "symbol-here",
      "country": "country-here"
    }
  },
  "crypto": {
    "currency-id-in-the-api": {
      "id": "id-here",
      "name": "name-here",
      "symbol": "symbol-here"
    }
  }
}

Description:

  • date: The date when the data updated, in YYYY-MM-DD format.
    • Example: 2024-1-1
  • national: National currencies.
    • Example: Euro
  • obsolete: National currencies that don't exist anymore.
    • Example: Greek Drahma
  • crypto: Cryptocurrencies.
    • Example: Bitcoin
  • currency-id-in-the-api: The same as the each value's key currently
    • Example: US Dollar -> usd
  • id: The ISO-4271 currency code, or if it's a cryptocurrency, the standard ID. Examples:
    • US Dollar -> USD
    • Bitcoin -> BTC
  • name: The full name of each currency. Example: eur -> Euro
  • symbol: The symbol for each currency (if none then it should have the same value as id) Examples:
    • Euro ->
    • Bitcoin ->
  • country (national and obsolete only): The country (or area) this currency was/is used. Example:
    • US Dollar -> United States Of America
    • Greek Drahma -> Greece
  1. Using the Calver versioning system instead of putting historical data to folders
  2. Cleanup and remove useless files from the repo

Other

A cleanup of the API currency IDs would be a useful, yet optional, addition as well.

References

fawazahmed0/currency-api#104 fawazahmed0/exchange-api#83 fawazahmed0/exchange-api#81 fawazahmed0/exchange-api#78 fawazahmed0/exchange-api#73 fawazahmed0/exchange-api#72 fawazahmed0/exchange-api#53 fawazahmed0/exchange-api#42

RaptaG avatar Feb 14 '24 14:02 RaptaG

It is sad that the developer ignores this

RaptaG avatar Feb 24 '24 11:02 RaptaG

Hey @fawazahmed0, how likely is it for this to be implemented? I can provide my assistance if you want me to.

RaptaG avatar Feb 26 '24 14:02 RaptaG

Thanks for assistance @RaptaG , I will let you know when I start implementing v2 of this api.

fawazahmed0 avatar Feb 26 '24 15:02 fawazahmed0

Thanks for assistance @RaptaG , I will let you know when I start implementing v2 of this api.

Do you plan it anytime soon and if yes, when? Thanks for replying @fawazahmed0 , too

RaptaG avatar Feb 26 '24 16:02 RaptaG

I don't have an exact date, but v2 of this api is something I am considering from long time. To be more precise, I am not intending to start this in next coming days because there are more high priority tasks in my backlog.

fawazahmed0 avatar Feb 26 '24 16:02 fawazahmed0

Btw, I suggest removing obsolete currencies altogether, they are of no real value

RaptaG avatar Feb 26 '24 19:02 RaptaG

why did you close all these issues man?

RaptaG avatar Mar 04 '24 19:03 RaptaG

Most of these things are not relevant now, the project has been migrated to npm and cloudflare. For example:

Storage space of the repo is too big

Currently the data is not stored in git repo, its stored in npm.

Host the project on NPM

This is already done now

fawazahmed0 avatar Mar 05 '24 05:03 fawazahmed0

Most of these things are not relevant now, the project has been migrated to npm and cloudflare. For example:

Storage space of the repo is too big

Currently the data is not stored in git repo, its stored in npm.

Host the project on NPM

This is already done now

What about the proposed json format?

RaptaG avatar Mar 05 '24 06:03 RaptaG