types: fix net asset value display in telegram

This commit is contained in:
c9s 2022-09-19 09:44:26 +08:00
parent 59b1e52439
commit 850f3c86ba
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -59,25 +59,26 @@ func (m AssetMap) PlainText() (o string) {
usd := a.InUSD
btc := a.InBTC
if !a.InUSD.IsZero() {
o += fmt.Sprintf(" %s: %s (≈ %s) (≈ %s)",
o += fmt.Sprintf(" %s: %s (≈ %s) (≈ %s)",
a.Currency,
a.Total.String(),
a.NetAsset.String(),
USD.FormatMoney(usd),
BTC.FormatMoney(btc),
) + "\n"
sumUsd = sumUsd.Add(usd)
sumBTC = sumBTC.Add(btc)
} else {
o += fmt.Sprintf(" %s: %s",
o += fmt.Sprintf(" %s: %s",
a.Currency,
a.Total.String(),
a.NetAsset.String(),
) + "\n"
}
}
o += fmt.Sprintf(" Summary: (≈ %s) (≈ %s)",
o += fmt.Sprintf("Net Asset Value: (≈ %s) (≈ %s)",
USD.FormatMoney(sumUsd),
BTC.FormatMoney(sumBTC),
) + "\n"
)
return o
}