Skip to content

Support for other currencies #535

Open

Description

@joesan

I tried the library for dealing with some Forex and I was hitting a "Not Implemented Exception" where I was trying ti read That bhat (THB) into a CurrencyCenverter with Money.parser(....). Is there a reason why only limited Currency types are supported?

Activity

  1. garyKeorkunian commented on May 29, 2022

    @garyKeorkunian
    Contributor

    It looks THB is not in the library.  I assume you created it?

    If that's the case, you will need to override the defaultMoneyContext to include your currency as well.  As it is, the defaultMoneyContext only includes currencies defined in the library.

    It's a case class, so you should be able to do something like

      implicit val myMoneyContext = defaultMoneyContext.copy(currencies = defaultCurrencySet ++ THB)
    
  2. joesan commented on May 31, 2022

    @joesan
    Author

    Thanks for the hint. I think I did that already but nevertheless was running into some exceptions:

    squants_error

    I'm using the version: "1.6.0" and when I run, I get the Not Implemented Exception:

    scala.NotImplementedError: an implementation is missing
    	at scala.Predef$.$qmark$qmark$qmark(Predef.scala:344)
    	at squants.market.Money$.units(Money.scala:418)
    	at squants.market.Money$.units(Money.scala:393)
    	at squants.Dimension.squants$Dimension$$QuantityString(Dimension.scala:75)
    	at squants.Dimension.squants$Dimension$$QuantityString$(Dimension.scala:75)
    	at squants.market.Money$.squants$Dimension$$QuantityString$lzycompute(Money.scala:393)
    	at squants.market.Money$.squants$Dimension$$QuantityString(Money.scala:393)
    	at squants.Dimension.parseString(Dimension.scala:71)
    	at squants.Dimension.parseString$(Dimension.scala:69)
    	at squants.market.Money$.parseString(Money.scala:393)
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions