javamoney
  1. javamoney
  2. JAVAMONEY-116

ConversionProviders do not work for historic data

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1
    • Component/s: Impl: RI
    • Labels:
      None

      Description

      E.g. see at the following example:

      provider = MonetaryConversions.getExchangeRateProvider("IDENT", "ECB", "ECB-HIST");
              System.out.println("CHF -> EUR (today) -> " + provider.getExchangeRate(ConversionQueryBuilder.of()
                      .setBaseCurrency("EUR").setTermCurrency("CHF")
                      .set(LocalDate.of(2008, 1, 8)).build()));
              System.out.println("CHF -> EUR (1.8.2008) -> " + provider.getExchangeRate(ConversionQueryBuilder.of()
                      .setBaseCurrency("EUR").setTermCurrency("CHF")
                      .set(LocalDate.of(2008, 1, 8)).build()));
      

      Seems that the whole mapping of LocalDate to historic data items does not work. Both ECB-HIST, as well as IMF-HIST providers are affected.

        Activity

        Hide
        otaviojava added a comment - - edited

        @anatole it's not wrong.
        Look the error:

        org.javamoney.moneta.internal.convert.ExchangeRateException: There is not exchange on day 2008-01-08 to rate to  rate on ECBRateProvider.
        

        That is right, the ECBRateProvider just has the three recent days, so there is not this date to find.

        But when you use just the ECB-HIST it's ok.

        ExchangeRateProvider provider = MonetaryConversions.getExchangeRateProvider("ECB-HIST");
        
        Show
        otaviojava added a comment - - edited @anatole it's not wrong. Look the error: org.javamoney.moneta.internal.convert.ExchangeRateException: There is not exchange on day 2008-01-08 to rate to rate on ECBRateProvider. That is right, the ECBRateProvider just has the three recent days, so there is not this date to find. But when you use just the ECB-HIST it's ok. ExchangeRateProvider provider = MonetaryConversions.getExchangeRateProvider("ECB-HIST");
        Hide
        atsticks added a comment -

        Sorry, my fault. Wifi was slow and I had to wait longer until the rates are coming back. Thanks for all helping checking this nevertheless

        Show
        atsticks added a comment - Sorry, my fault. Wifi was slow and I had to wait longer until the rates are coming back. Thanks for all helping checking this nevertheless

          People

          • Assignee:
            atsticks
            Reporter:
            atsticks
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: