fix account currency translation

This commit is contained in:
c9s 2020-11-17 14:24:26 +08:00
parent 95b0910a09
commit ed6d6342e7
2 changed files with 7 additions and 1 deletions

View File

@ -134,6 +134,10 @@ func (environ *Environment) Init(ctx context.Context) (err error) {
session.Account.UpdateBalances(balances) session.Account.UpdateBalances(balances)
session.Account.BindStream(session.Stream) session.Account.BindStream(session.Stream)
session.Stream.OnBalanceUpdate(func(balances types.BalanceMap) {
log.Infof("balance update: %+v", balances)
})
// update last prices // update last prices
session.Stream.OnKLineClosed(func(kline types.KLine) { session.Stream.OnKLineClosed(func(kline types.KLine) {
log.Infof("kline closed: %+v", kline) log.Infof("kline closed: %+v", kline)

View File

@ -1,6 +1,8 @@
package max package max
import ( import (
"strings"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/valyala/fastjson" "github.com/valyala/fastjson"
@ -183,7 +185,7 @@ func (m *BalanceMessage) Balance() (*types.Balance, error) {
} }
return &types.Balance{ return &types.Balance{
Currency: m.Currency, Currency: strings.ToUpper(m.Currency),
Locked: locked, Locked: locked,
Available: available, Available: available,
}, nil }, nil