Formicka / exchangerate.host

Exchange rates API is a simple and lightweight free service for current and historical foreign exchange rates & crypto exchange rates.
https://exchangerate.host
355 stars 33 forks source link

Exchange rates with source crypto is sometimes inverted #37

Open nonvex opened 3 years ago

nonvex commented 3 years ago

Firstly, thank you for your work. Much appreciated.

The issue is the rate of exchange does not respect the order: from -> to for some source=crypto cases.

Example: https://api.exchangerate.host/convert?from=usd&to=eth&source=crypto

{
  "motd": {
    "msg": "If you or your company use this project or like what we doing, please consider backing us so we can continue maintaining and evolving this project.",
    "url": "https://exchangerate.host/#/donate"
  },
  "success": true,
  "query": {
    "from": "USD",
    "to": "ETH",
    "amount": 1
  },
  "info": {
    "rate": 1145.182585
  },
  "historical": false,
  "date": "2021-02-05",
  "result": 1145.182585
}
nonvex commented 3 years ago

To add some more information here. As long as source=crypto even for regular currencies the rate is inverted.

Example: https://api.exchangerate.host/convert?from=usd&to=eur&source=crypto

{
  "motd": {
    "msg": "If you or your company use this project or like what we doing, please consider backing us so we can continue maintaining and evolving this project.",
    "url": "https://exchangerate.host/#/donate"
  },
  "success": true,
  "query": {
    "from": "USD",
    "to": "EUR",
    "amount": 1
  },
  "info": {
    "rate": 1.203956
  },
  "historical": false,
  "date": "2021-02-08",
  "result": 1.203956
}
stevecondylios commented 3 years ago

To me, it seems the historical information is wrong. See example Bitcoin to USD (not correct prior to 2 May 2020):

image

stevecondylios commented 3 years ago

@arzzen do you know if it's possible to correct historical information in the database?

francislavoie commented 3 years ago

I'm seeing this issue as well.

$ curl -s 'https://api.exchangerate.host/latest?base=USD&symbols=USD,BTC&source=crypto&places=12' | jq .rates.BTC
"0.000019086908"

$ curl -s 'https://api.exchangerate.host/latest?base=USD&symbols=USD,DOGE&source=crypto&places=12' | jq .rates.DOGE
"0.037495561690"

$ curl -s 'https://api.exchangerate.host/latest?base=USD&symbols=USD,ETH&source=crypto&places=12' | jq .rates.ETH
"1162.310469314080"

ETH seems inverted, but BTC and DOGE seem ok.

emvaized commented 3 years ago

Any updates on this issue?

It seems to me that even querieng for list of all crypto rates returns inverted values sometimes: https://api.exchangerate.host/latest?base=USD&source=crypto

gwevans commented 3 years ago

Pinging here as we are blocked on this. We use exchangerate.host for our fiat currency conversions and would like to use the same provider for crypto conversions.

However unless this is fixed we have to choose another provider.

@arzzen We (Quaestor) are a sponsor of yours and would be great if this could get prioritized as source=crypto is unusable/broken in its current state.

alerque commented 2 years ago

Also affected by this. It seems to be directly related to sources. BTC works out fine because it is actually available in some of the FOREX sources and seems to get served from there. Others that ace part of the CRYPTO only list (the majority of cryptocurrencies) seems to be consistently inverted. I'm post processing the fixed list on ones I need and inverting them myself, but this is very obnoxious.

cguagenti commented 2 years ago

Same here. Would be great if this can be fixed 😔