exchangerate.host icon indicating copy to clipboard operation
exchangerate.host copied to clipboard

Incorrect XAU value

Open deleteduser465656 opened this issue 3 years ago • 11 comments

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.

deleteduser465656 avatar May 04 '22 08:05 deleteduser465656

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:

  • 1883.7 (Bloomberg)
  • 1883.1 (Tradingview)
  • 1883.7 (XE)
  • 1883.2 (Wallstreet Online)

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

sal0max avatar May 06 '22 17:05 sal0max

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.

alerque avatar May 07 '22 07:05 alerque

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

wiktor-jozwik avatar Jun 13 '22 10:06 wiktor-jozwik

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.

OlehTitov avatar Jun 23 '22 08:06 OlehTitov

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.

deleteduser465656 avatar Jun 23 '22 08:06 deleteduser465656

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?

wiktor-jozwik avatar Jun 23 '22 09:06 wiktor-jozwik

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.

deleteduser465656 avatar Jun 23 '22 09:06 deleteduser465656

Thank you Oleg!



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


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 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" } } ]

OlehTitov avatar Jun 23 '22 09:06 OlehTitov

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...

wiktor-jozwik avatar Jun 23 '22 10:06 wiktor-jozwik

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.

deleteduser465656 avatar Jun 23 '22 11:06 deleteduser465656

The same problem also appears on XPD.

Quicksilver0218 avatar Jul 01 '22 19:07 Quicksilver0218