Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rahul-avaghan opened this issue Nov 29, 2024 · 0 comments
Open

Comments

@rahul-avaghan
Copy link

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.

@rahul-avaghan rahul-avaghan changed the title Conversion from COB to EUR does not work correctly. Incorrect Currency Conversion from COP to EUR in JavaMoney Moneta Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant