diff --git a/config/xalign.yaml b/config/xalign.yaml index 6f07ba4b8..177cc371d 100644 --- a/config/xalign.yaml +++ b/config/xalign.yaml @@ -47,3 +47,7 @@ crossExchangeStrategies: USDT: 100 USDC: 100 TWD: 3000 + alertAmounts: + USDT: 200 + USDC: 200 + TWD: 6000 diff --git a/pkg/strategy/xalign/strategy.go b/pkg/strategy/xalign/strategy.go index 3920aa981..202271d56 100644 --- a/pkg/strategy/xalign/strategy.go +++ b/pkg/strategy/xalign/strategy.go @@ -50,6 +50,7 @@ type Strategy struct { BalanceToleranceRange fixedpoint.Value `json:"balanceToleranceRange"` Duration types.Duration `json:"for"` MaxAmounts map[string]fixedpoint.Value `json:"maxAmounts"` + AlertAmounts map[string]fixedpoint.Value `json:"alertAmounts"` SlackNotify bool `json:"slackNotify"` SlackNotifyMentions []string `json:"slackNotifyMentions"` @@ -304,6 +305,11 @@ func (s *Strategy) selectSessionForCurrency( } } + alertAmount, ok := s.AlertAmounts[market.QuoteCurrency] + if ok && requiredQuoteAmount.Compare(alertAmount) > 0 { + bbgo.Notify("quote amount %s is greater than %s, please check it", requiredQuoteAmount.String(), alertAmount.String()) + } + maxAmount, ok := s.MaxAmounts[market.QuoteCurrency] if ok && requiredQuoteAmount.Compare(maxAmount) > 0 { log.Infof("adjusted required quote ammount %f %s by max amount %f %s", requiredQuoteAmount.Float64(), market.QuoteCurrency, maxAmount.Float64(), market.QuoteCurrency) @@ -349,6 +355,11 @@ func (s *Strategy) selectSessionForCurrency( continue } + alertAmount, ok := s.AlertAmounts[market.QuoteCurrency] + if ok && q.Compare(alertAmount) > 0 { + bbgo.Notify("quote amount %s is greater than %s, please check it", q.String(), alertAmount.String()) + } + maxAmount, ok := s.MaxAmounts[market.QuoteCurrency] if ok { q = bbgo.AdjustQuantityByMaxAmount(q, price, maxAmount)