Support for other currencies
Opened this issue · 2 comments
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?
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)
Thanks for the hint. I think I did that already but nevertheless was running into some exceptions:
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)