mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
fix account currency translation
This commit is contained in:
parent
95b0910a09
commit
ed6d6342e7
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user