From 3da86556b52f588158bc4754ceb50dfabe2a721e Mon Sep 17 00:00:00 2001 From: Andy Cheng Date: Sat, 13 Aug 2022 13:28:45 +0800 Subject: [PATCH] risk: AvailableQuote() should use Net() to get net value --- pkg/risk/account_value.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/risk/account_value.go b/pkg/risk/account_value.go index 5a0f606e6..2f17f9fe2 100644 --- a/pkg/risk/account_value.go +++ b/pkg/risk/account_value.go @@ -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