Skip to content

Commit

Permalink
xmaker: add NotifyIgnoreSmallAmountProfitTrade option
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Dec 23, 2024
1 parent 420d128 commit 88e66bf
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/strategy/xmaker/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`

Expand Down Expand Up @@ -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())

Expand Down

0 comments on commit 88e66bf

Please sign in to comment.