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

Support for other currencies #535

Open
joesan opened this issue May 28, 2022 · 2 comments
Open

Support for other currencies #535

joesan opened this issue May 28, 2022 · 2 comments
Labels

Comments

@joesan
Copy link

joesan commented May 28, 2022

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?

@garyKeorkunian
Copy link
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)

@joesan
Copy link
Author

joesan commented May 31, 2022

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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants