Skip to content

Incorrect Currency Conversion from COP to EUR in JavaMoney Moneta #424

@rahul-avaghan

Description

@rahul-avaghan

When performing a currency conversion from Colombian Pesos (COP) to Euros (EUR) using the JavaMoney Moneta library, the resulting value appears to be incorrect compared to the expected conversion rate. The discrepancy suggests that the wrong exchange rate or configuration is being used.

Steps to Reproduce:

<dependency>
    <groupId>org.javamoney</groupId>
    <artifactId>moneta</artifactId>
    <version>1.4.4</version>
</dependency>


import javax.money.*;
import javax.money.convert.*;
import org.javamoney.moneta.Money;

public class CurrencyConverterApp {
    public static void main(String[] args) {
        MonetaryAmount sourceAmount = Money.of(107329, "COP");
        CurrencyConversion conversion = MonetaryConversions.getConversion("EUR");

        MonetaryAmount targetAmount = sourceAmount.with(conversion);
        System.out.println("Source: " + sourceAmount);
        System.out.println("Converted: " + targetAmount);
    }
}


Observe the conversion result.
Expected Behavior:
The conversion should match the current IMF or ECB exchange rates. For example:

At the time of testing, the IMF exchange rate for COP to EUR was approximately 0.0002015, resulting in an expected value of around 21.63 EUR for 107329 COP.
Actual Behavior:
The result was significantly higher than expected:

31.86 EUR for 107329 COP.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Exchangeanalysisfix-olderPotential fix for older version trains like 1.4, where possible

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions