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.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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user