Skip to content

Commit

Permalink
Merge pull request #616 from niij/thai-baht
Browse files Browse the repository at this point in the history
  • Loading branch information
cquiroz authored Jan 8, 2024
2 parents 87e41e5 + c91e8e5 commit 5ad6433
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions shared/src/main/scala/squants/market/Money.scala
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ object LTC extends Currency("LTC", "Litecoin", "\u0141", 8)
object ZAR extends Currency("ZAR", "South African Rand", "R", 2)
object NAD extends Currency("NAD", "Namibian Dollar", "N$", 2)
object TRY extends Currency("TRY", "Turkish lira", "", 2)

object UAH extends Currency("UAH", "Ukrainian Hryvnia", "", 2)
object THB extends Currency("THB", "Thai Baht", "฿", 2)

/**
* Support for Money DSL
Expand Down Expand Up @@ -534,8 +534,9 @@ object MoneyConversions {
def ZAR = Money(n, squants.market.ZAR)
def NAD = Money(n, squants.market.NAD)
def TRY = Money(n, squants.market.TRY)

def UAH = Money(n, squants.market.UAH)
def THB = Money(n, squants.market.THB)
def satang = Money(num.toDouble(n) / 100d, squants.market.THB)
}

class MoneyNumeric()(implicit mc: MoneyContext) extends Numeric[Money] {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/squants/market/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ package object market {
KRW, MXN, MYR, NOK, NZD,
RUB, SEK, XAG, XAU, BTC,
ETH, LTC, ZAR, NAD, TRY,
UAH
UAH, THB
)

lazy val defaultMoneyContext = MoneyContext(USD, defaultCurrencySet, Nil)
Expand Down
2 changes: 2 additions & 0 deletions shared/src/test/scala/squants/market/MoneySpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,8 @@ class MoneySpec extends AnyFlatSpec with Matchers with TryValues {
d.NAD should be(NAD(d))
d.TRY should be(TRY(d))
d.UAH should be(UAH(d))
d.THB should be(THB(d))
d.satang should be(Money(d / 100d, squants.market.THB))
}

it should "provide Numeric support within a MoneyContext with no Exchange Rates" in {
Expand Down

0 comments on commit 5ad6433

Please sign in to comment.