improve balance printing

This commit is contained in:
c9s 2020-11-17 14:45:27 +08:00
parent 18d9245b06
commit 8f5491d818

View File

@ -15,6 +15,14 @@ type Balance struct {
Locked fixedpoint.Value `json:"locked"` Locked fixedpoint.Value `json:"locked"`
} }
func (b Balance) String() string {
if b.Locked > 0 {
return fmt.Sprintf("%s: %f (locked %f)", b.Currency, b.Available.Float64(), b.Locked.Float64())
}
return fmt.Sprintf("%s: %f", b.Currency, b.Available.Float64())
}
type BalanceMap map[string]Balance type BalanceMap map[string]Balance
func (m BalanceMap) Print() { func (m BalanceMap) Print() {