From 8b1306a6a6bc38634632a06eb78a164c1196f4fc Mon Sep 17 00:00:00 2001 From: c9s Date: Sun, 1 Sep 2024 01:31:50 +0800 Subject: [PATCH] xmaker: calculate maximum leveraged account value --- pkg/strategy/xmaker/strategy.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/strategy/xmaker/strategy.go b/pkg/strategy/xmaker/strategy.go index 8c3478ee7..098c222d4 100644 --- a/pkg/strategy/xmaker/strategy.go +++ b/pkg/strategy/xmaker/strategy.go @@ -532,6 +532,11 @@ func (s *Strategy) updateQuote(ctx context.Context) { // calculate credit buffer s.logger.Infof("hedge account net value in usd: %f", netValueInUsd.Float64()) + maximumHedgeAccountLeverage := fixedpoint.NewFromFloat(1.2) + netValueInUsd = netValueInUsd.Mul(maximumHedgeAccountLeverage) + + s.logger.Infof("hedge account maximum leveraged value in usd: %f", netValueInUsd.Float64()) + if quote, ok := hedgeAccount.Balance(s.sourceMarket.QuoteCurrency); ok { debt := quote.Debt() quota := netValueInUsd.Sub(debt)