From 6011fd51579f2e9f6c5a3d04b6680407a16d3633 Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 27 Aug 2024 22:45:11 +0800 Subject: [PATCH] xmaker: set profitChanged only when Hedge is called --- pkg/strategy/xmaker/strategy.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pkg/strategy/xmaker/strategy.go b/pkg/strategy/xmaker/strategy.go index 2190b1aca..31e2eeafb 100644 --- a/pkg/strategy/xmaker/strategy.go +++ b/pkg/strategy/xmaker/strategy.go @@ -677,12 +677,6 @@ func (s *Strategy) Hedge(ctx context.Context, pos fixedpoint.Value) { } } - notional := quantity.Mul(lastPrice) - if notional.Compare(s.sourceMarket.MinNotional) <= 0 { - log.Warnf("%s %v less than min notional, skipping hedge", s.Symbol, notional) - return - } - // adjust quantity according to the balances account := s.sourceSession.GetAccount() switch side { @@ -934,10 +928,9 @@ func (s *Strategy) hedgeWorker(ctx context.Context) { ) s.Hedge(ctx, uncoverPosition.Neg()) + profitChanged = true } - profitChanged = true - case <-reportTicker.C: if profitChanged { if s.reportProfitStatsRateLimiter.Allow() {