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

Add Thai Baht (บาทไทย) support 🇹🇭 #616

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading