From 3819feacf39db111a52da5ab3cafa2e76a0f2a33 Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 27 Aug 2024 15:48:02 +0800 Subject: [PATCH] xmaker: improve dust quantity check --- pkg/strategy/xmaker/strategy.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/strategy/xmaker/strategy.go b/pkg/strategy/xmaker/strategy.go index 6354bedc3..ba279cfd3 100644 --- a/pkg/strategy/xmaker/strategy.go +++ b/pkg/strategy/xmaker/strategy.go @@ -612,13 +612,8 @@ func (s *Strategy) Hedge(ctx context.Context, pos fixedpoint.Value) { // truncate quantity for the supported precision quantity = s.sourceMarket.TruncateQuantity(quantity) - if notional.Compare(s.sourceMarket.MinNotional.Mul(minGap)) <= 0 { - log.Warnf("the adjusted amount %v is less than minimal notional %v, skipping hedge", notional, s.sourceMarket.MinNotional) - return - } - - if quantity.Compare(s.sourceMarket.MinQuantity.Mul(minGap)) <= 0 { - log.Warnf("the adjusted quantity %v is less than minimal quantity %v, skipping hedge", quantity, s.sourceMarket.MinQuantity) + if s.sourceMarket.IsDustQuantity(quantity, lastPrice) { + log.Warnf("skip dust quantity: %s", quantity.String()) return }