In Laravel 11 app I import currency rates from FrankfurterService or ExchangeRateHost switching different service implementation retrieving results and compare data I got results a bit different.
Firstly I thought that difference as they show currency rate in different "mode" : "We buy" / "We trade"
After that a question if this "mode" is shown somewhere in docs at
https://exchangerate.host/documentation
and
https://github.com/brunoinds/frankfurter-laravel
?
I did not find...
Checking results I retrieve of some currencies :
I see they are a bit different. Not sure is it "We buy" / "We trade" "mode" or something else ?
In both cases I show "source" currency - "CAD"
There is no centralized "correct" price for currencies.
Stocks, futures etc. are traded on centralized exchanges (New York Stock Exchange, Chicago Mercantile Exchange etc.) and the ticker price is taken from the last transaction on record. This makes for a universally-consistent price at any given time.
Currency transactions happen all over the world between two parties with no obligation to publicize the agreed pricing. Each broker calculates their own price from their own transactions. This is known as Over-The-Counter (OTC) trading. Given the decentralized nature and free-flowing purpose of money, it's very difficult for a centralized authority to get in the middle and regulate how people choose to exchange it (though this could possibly change in the future, e.g. with the Digital RMB)
Generally, broker prices are very similar, because if a difference larger than trading commission ever opened up between 2 brokers, investors would arbitrage it away. Free money.
This is equally true for traditional currencies and for cryptocurrencies.
You're right to also be wary of the spread
between bid price and offer price.
Practically, the easiest solution is to pick one source and declare it next to the data. Alternatively, you could constantly calculate an average, or select a source by comparing it to the average of multiple sources, but the result would depend heavily on your choice of sources and time-frame considered.