mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 17:13:51 +00:00
26 lines
540 B
Go
26 lines
540 B
Go
package kucoin
|
|
|
|
import (
|
|
"github.com/c9s/bbgo/pkg/exchange/kucoin/kucoinapi"
|
|
"github.com/c9s/bbgo/pkg/types"
|
|
)
|
|
|
|
func toGlobalBalanceMap(accounts []kucoinapi.Account) types.BalanceMap {
|
|
balances := types.BalanceMap{}
|
|
|
|
// for now, we only return the trading account
|
|
for _, account := range accounts {
|
|
switch account.Type {
|
|
case kucoinapi.AccountTypeTrade:
|
|
balances[account.Currency] = types.Balance{
|
|
Currency: account.Currency,
|
|
Available: account.Available,
|
|
Locked: account.Holds,
|
|
}
|
|
}
|
|
}
|
|
|
|
return balances
|
|
}
|
|
|