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
353 stars 33 forks source link

Incorrect XAU value #129

Open olegrain opened 2 years ago

olegrain commented 2 years ago

If you try to use https://api.exchangerate.host/latest?base=USD and find XAU rate, you can see it is 0.001338. But If you math 1/0.001338 you get 747.38 USD for one gold Ounce. But it is wrong, the now rate near the 1900 USD for one Ounce. But if you make the same math with XAG (Silver) rate is it Ok. Please, fix the wrong XAU value.

sal0max commented 2 years ago

One big problem with this API is that it caches every request. So latest is likely not latest but potentially very old. See #123.

However, even with the un-cached call https://api.exchangerate.host/latest?base=USD&symbols=XAU&v=7c7536a4-cd63-11ec-9d64-0242ac120002 it returns XAU=0.001764. The inverse value (1/0.001764) is 566.9. That's also what this API returns from the request base=XAU&symbols=USD. (At least this is consistent)

Here the values XAU->USD from the same time from other platforms:

So, yeah.. That is extremely off and should be addressed.

alerque commented 2 years ago

I have unfortunately been caught by this too — worse I didn't know I was affected until I saw this issue! My gold holdings are small and typically reference them through a different set of currencies (grams of gold valued in Turkish Lira) so the affect on my ledgers when estimated in USD was small.

I am not using the latest API endpoint at all, only historical queries on specific dates, but the result seems to be off similarly to the results mentioned here.

wiktor-jozwik commented 2 years ago

I also caught it and the problem starts on the 24th of July 2021:

"2021-07-20"=>{"USD"=>1809.956989},
"2021-07-21"=>{"USD"=>1803.2263},
"2021-07-22"=>{"USD"=>1808.463902},
"2021-07-23"=>{"USD"=>1802.679939},
"2021-07-24"=>{"USD"=>994.453547},
"2021-07-25"=>{"USD"=>592.126258}

Prices until 2021-07-23 seems to be legit but then something went wrong I think

URL which I tested: https://api.exchangerate.host/timeseries?start_date=2021-07-20&end_date=2021-07-25&base=XAU&symbols=USD

OlehTitov commented 2 years ago

Unfortunately the conversion endpoint gives wrong values as well... {"from":"XAU","to":"USD","amount":1},"info":{"rate":666.18262},"historical":false,"date":"2022-06-23","result":666.18262} Please fix XAU rates.

olegrain commented 2 years ago

Hello! I find a free solution to get a correct rates: https://moneyconvert.net/pages/api Since the developers here don't fix this issue for a long time, I think we should switch to another free API.

wiktor-jozwik commented 2 years ago

Hello! I find a free solution to get a correct rates: https://moneyconvert.net/pages/api Since the developers here don't fix this issue for a long time, I think we should switch to another free API.

As I see it's a converter for currencies, what about gold prices?

olegrain commented 2 years ago

Hello! I find a free solution to get a correct rates: https://moneyconvert.net/pages/api Since the developers here don't fix this issue for a long time, I think we should switch to another free API.

As I see it's a converter for currencies, what about gold prices?

It is API for all currencies rates, including gold prices: https://cdn.moneyconvert.net/api/latest.json You can find here XAU and it is rate for now is 0.00054553, the main currency used is USD. And you can easily convert cross rates from/to different currencies by easy math. But this is only current rates, not historical.

OlehTitov commented 2 years ago
Thank you Oleg!



On Thu, Jun 23, 2022 at 11:46am, Oleg Rain <> wrote:


Since the developers here don't fix this issue for a long time, I think we should switch to another free API.

As I see it's a converter for currencies, what about gold prices?

It is API for all currencies rates, including gold prices: https://cdn.moneyconvert.net/api/latest.json
You can find here XAU and it is rate for now is 0.00054553, the main currency used is USD. And you can easily convert cross rates from/to differs currencies by easy math. But this is only current rates, not historical.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: <Formicka/exchangerate.host/issues/129/1164191622@github.com>

[ { ***@***.***": "schema.org", ***@***.***": "EmailMessage", "potentialAction": { ***@***.***": "ViewAction", "target": "github.com/Formicka/exchangerate.host/issues/129#issuecomment-1164191622", "url": "github.com/Formicka/exchangerate.host/issues/129#issuecomment-1164191622", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { ***@***.***": "Organization", "name": "GitHub", "url": "github.com" } } ]

wiktor-jozwik commented 2 years ago

It is API for all currencies rates, including gold prices: https://cdn.moneyconvert.net/api/latest.json You can find here XAU and it is rate for now is 0.00054553, the main currency used is USD. And you can easily convert cross rates from/to different currencies by easy math. But this is only current rates, not historical.

Ah yes, you are right, I didn't see it, but if this API does not support historical data, I don't know whether this is a sufficient replacement...

olegrain commented 2 years ago

It is API for all currencies rates, including gold prices: https://cdn.moneyconvert.net/api/latest.json You can find here XAU and it is rate for now is 0.00054553, the main currency used is USD. And you can easily convert cross rates from/to different currencies by easy math. But this is only current rates, not historical.

Ah yes, you are right, I didn't see it, but if this API does not support historical data, I don't know whether this is a sufficient replacement...

As for me I only need current rates. If you need historical data, you can use other service: https://docs.openexchangerates.org/docs/historical-json but their free plan provides only hourly updates (with base currency USD) and up to 1,000 requests/month. So, if you math 1000 requests / 30 days / 24 hour = 1.38, so you can make a request every hour and get the rates you need.

Quicksilver0218 commented 2 years ago

The same problem also appears on XPD.