From 88e66bf579c8d021f4969a3dc97a118f4c6f39d1 Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 23 Dec 2024 14:14:24 +0800 Subject: [PATCH] xmaker: add NotifyIgnoreSmallAmountProfitTrade option --- pkg/strategy/xmaker/strategy.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/strategy/xmaker/strategy.go b/pkg/strategy/xmaker/strategy.go index 83d07c6a9..5fdb7b940 100644 --- a/pkg/strategy/xmaker/strategy.go +++ b/pkg/strategy/xmaker/strategy.go @@ -208,7 +208,8 @@ type Strategy struct { DisableHedge bool `json:"disableHedge"` - NotifyTrade bool `json:"notifyTrade"` + NotifyTrade bool `json:"notifyTrade"` + NotifyIgnoreSmallAmountProfitTrade fixedpoint.Value `json:"notifyIgnoreSmallAmountProfitTrade"` EnableArbitrage bool `json:"enableArbitrage"` @@ -2141,7 +2142,13 @@ func (s *Strategy) CrossRun( s.CircuitBreaker.RecordProfit(profit.Profit, trade.Time.Time()) } - bbgo.Notify(profit) + if amount := s.NotifyIgnoreSmallAmountProfitTrade; amount.Sign() > 0 { + if profit.QuoteQuantity.Compare(amount) > 0 { + bbgo.Notify(profit) + } + } else { + bbgo.Notify(profit) + } netProfitMarginHistogram.With(s.metricsLabels).Observe(profit.NetProfitMargin.Float64())