risk: AvailableQuote() should use Net() to get net value

This commit is contained in:
Andy Cheng 2022-08-13 13:28:45 +08:00
parent dad562db97
commit 3da86556b5

View File

@ -154,7 +154,7 @@ func (c *AccountValueCalculator) AvailableQuote(ctx context.Context) (fixedpoint
balances := c.session.Account.Balances() balances := c.session.Account.Balances()
for _, b := range balances { for _, b := range balances {
if b.Currency == c.quoteCurrency { if b.Currency == c.quoteCurrency {
accountValue = accountValue.Add(b.Available) accountValue = accountValue.Add(b.Net())
continue continue
} }
@ -164,7 +164,7 @@ func (c *AccountValueCalculator) AvailableQuote(ctx context.Context) (fixedpoint
continue continue
} }
accountValue = accountValue.Add(b.Available.Mul(price)) accountValue = accountValue.Add(b.Net().Mul(price))
} }
return accountValue, nil return accountValue, nil