From ec6cbe0f180d581f279fa07b2d5bfafd52989a4d Mon Sep 17 00:00:00 2001 From: c9s Date: Sun, 1 Sep 2024 01:34:25 +0800 Subject: [PATCH] xmaker: separate maximumValueInUsd in a new var --- pkg/strategy/xmaker/strategy.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/strategy/xmaker/strategy.go b/pkg/strategy/xmaker/strategy.go index 3f52f6a..38181e4 100644 --- a/pkg/strategy/xmaker/strategy.go +++ b/pkg/strategy/xmaker/strategy.go @@ -533,13 +533,13 @@ func (s *Strategy) updateQuote(ctx context.Context) { s.logger.Infof("hedge account net value in usd: %f", netValueInUsd.Float64()) maximumHedgeAccountLeverage := fixedpoint.NewFromFloat(1.2) - netValueInUsd = netValueInUsd.Mul(maximumHedgeAccountLeverage) + maximumValueInUsd := netValueInUsd.Mul(maximumHedgeAccountLeverage) - s.logger.Infof("hedge account maximum leveraged value in usd: %f", netValueInUsd.Float64()) + s.logger.Infof("hedge account maximum leveraged value in usd: %f", maximumValueInUsd.Float64()) if quote, ok := hedgeAccount.Balance(s.sourceMarket.QuoteCurrency); ok { debt := quote.Debt() - quota := netValueInUsd.Sub(debt) + quota := maximumValueInUsd.Sub(debt) s.logger.Infof("hedge account quote balance: %s, debt: %s, quota: %s", quote.String(), @@ -551,7 +551,7 @@ func (s *Strategy) updateQuote(ctx context.Context) { if base, ok := hedgeAccount.Balance(s.sourceMarket.BaseCurrency); ok { debt := base.Debt() - quota := netValueInUsd.Div(bestAsk.Price).Sub(debt) + quota := maximumValueInUsd.Div(bestAsk.Price).Sub(debt) s.logger.Infof("hedge account base balance: %s, debt: %s, quota: %s", base.String(),