exhange/binance: exclude unrealized pnl from balance calculation

This commit is contained in:
Andy Cheng 2022-08-16 15:06:13 +08:00
parent 0b5f2c308e
commit b5beadceb4

View File

@ -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)),
}
}