diff --git a/pkg/bbgo/environment.go b/pkg/bbgo/environment.go index efdb69d45..bee0c2e92 100644 --- a/pkg/bbgo/environment.go +++ b/pkg/bbgo/environment.go @@ -134,6 +134,10 @@ func (environ *Environment) Init(ctx context.Context) (err error) { session.Account.UpdateBalances(balances) session.Account.BindStream(session.Stream) + session.Stream.OnBalanceUpdate(func(balances types.BalanceMap) { + log.Infof("balance update: %+v", balances) + }) + // update last prices session.Stream.OnKLineClosed(func(kline types.KLine) { log.Infof("kline closed: %+v", kline) diff --git a/pkg/exchange/max/maxapi/userdata.go b/pkg/exchange/max/maxapi/userdata.go index f6600c1db..95bcc916e 100644 --- a/pkg/exchange/max/maxapi/userdata.go +++ b/pkg/exchange/max/maxapi/userdata.go @@ -1,6 +1,8 @@ package max import ( + "strings" + "github.com/pkg/errors" "github.com/valyala/fastjson" @@ -183,7 +185,7 @@ func (m *BalanceMessage) Balance() (*types.Balance, error) { } return &types.Balance{ - Currency: m.Currency, + Currency: strings.ToUpper(m.Currency), Locked: locked, Available: available, }, nil