Golang currency conversion: are exchange rates transitive?

To convert currency, ECB (it is a currency provider) provides the exchange rate for EUR. Namely how much “other currency” units it takes to buy 1 EUR.

When I want to convert an amount of another currency GBP to euro, I can do:

result = amount / gbp_exchange_rate_for_euro

To convert to USD, I can do:

result = ToEuro(amount) *  usd_exchange_rate_for_euro

However, the exchange rates of banks usuall have some small fee hidden in the exchange rate. Am I guaranteed that if I ask my exchange provider what is the rate from GBP to USD, it will be the same as if I first convert from GBP to EUR then EUR to USD ?

Any advice ?

This isn’t a Go-related question, but after some Googling, I found that what you’re talking about is called “arbitrage” and that yes, exchange rates are transitive: https://travel.stackexchange.com/questions/88966/can-three-or-more-currency-exchange-rates-simply-be-multiplied#:~:text=Under%20the%20No%20Arbitrage%20Principle,so%20currency%20rates%20are%20transitive.&text=The%20buy%20and%20sell%20rates,the%20costs%20of%20the%20transaction.

Hi @skillian,

Read the comments to that answer, it seems like the author is using a lot of wishful thinking. There is nothing to enforce transitivity except his amateur concern about getting rich fast: “In reality, arbitrage opportunities may exist briefly, but are eliminated very quickly by the market.”

The participants in that thread are thinking about the scenario “if I buy currency A, convert it to B then convert to A again, and it is more than what I started with => I make a profit”.

With my vast experience as a bank user (debit card owner), I am worried about the scenario “I convert A to B, then B to A, and it is less than what I started with”.

Please excuse my ignorance on this subject, but I don’t see how this question is related to the Go programming language. If you need help implementing a conversion rate calculator in Go, I think we can help, but I don’t think this is the right forum for international finance-related questions.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.