Merge pull request #876 from andycheng123/fix/risk

Fix: risk.AvailableQuote() should use Net() to get net value
This commit is contained in:
Andy Cheng 2022-08-13 13:42:13 +08:00 committed by GitHub
commit f2f9e8c2bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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