mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
exhange/binance: exclude unrealized pnl from balance calculation
This commit is contained in:
parent
0b5f2c308e
commit
b5beadceb4
|
@ -651,10 +651,11 @@ func (e *Exchange) QueryFuturesAccount(ctx context.Context) (*types.Account, err
|
|||
for _, b := range accountBalances {
|
||||
balanceAvailable := fixedpoint.Must(fixedpoint.NewFromString(b.AvailableBalance))
|
||||
balanceTotal := fixedpoint.Must(fixedpoint.NewFromString(b.Balance))
|
||||
unrealizedPnl := fixedpoint.Must(fixedpoint.NewFromString(b.CrossUnPnl))
|
||||
balances[b.Asset] = types.Balance{
|
||||
Currency: b.Asset,
|
||||
Available: balanceAvailable,
|
||||
Locked: balanceTotal.Sub(balanceAvailable),
|
||||
Locked: balanceTotal.Sub(balanceAvailable.Sub(unrealizedPnl)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user