From 4452b2d69e48c2ca2b26c8eb841a20471bcc7040 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 4 Dec 2024 18:08:51 +0800 Subject: [PATCH] autoborrow: add icon to the messages --- pkg/strategy/autoborrow/strategy.go | 7 +++---- pkg/strategy/xalign/strategy.go | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/strategy/autoborrow/strategy.go b/pkg/strategy/autoborrow/strategy.go index c890907aa..8f96c4d25 100644 --- a/pkg/strategy/autoborrow/strategy.go +++ b/pkg/strategy/autoborrow/strategy.go @@ -649,7 +649,7 @@ func (s *Strategy) marginAlertWorker(ctx context.Context, alertInterval time.Dur // if the previous danger flag is not set, we should send the alert at the first time if !danger { - s.postLiveNoteMessage(alert, s.MarginLevelAlert.Slack, "the current margin level %f is less than the minimal margin level %f, please repay the debt", + s.postLiveNoteMessage(alert, s.MarginLevelAlert.Slack, "⚠️ The current margin level %f is less than the minimal margin level %f, please repay the debt", account.MarginLevel.Float64(), s.MarginLevelAlert.MinMargin.Float64()) @@ -660,7 +660,7 @@ func (s *Strategy) marginAlertWorker(ctx context.Context, alertInterval time.Dur // if it's not in danger anymore, send a solved message if !danger { - s.postLiveNoteMessage(alert, s.MarginLevelAlert.Slack, "the current margin level %f is safe now", account.MarginLevel.Float64()) + s.postLiveNoteMessage(alert, s.MarginLevelAlert.Slack, "✅ The current margin level %f is safe now", account.MarginLevel.Float64()) } } } @@ -668,9 +668,8 @@ func (s *Strategy) marginAlertWorker(ctx context.Context, alertInterval time.Dur } func (s *Strategy) postLiveNoteMessage(obj livenote.Object, alert *slackalert.SlackAlert, msgf string, args ...any) { - log.Infof(msgf, args...) - if alert == nil { + log.Infof(msgf, args...) return } diff --git a/pkg/strategy/xalign/strategy.go b/pkg/strategy/xalign/strategy.go index 234fc5579..ebd10eff8 100644 --- a/pkg/strategy/xalign/strategy.go +++ b/pkg/strategy/xalign/strategy.go @@ -483,6 +483,7 @@ func (s *Strategy) CrossRun(ctx context.Context, _ bbgo.OrderExecutionRouter, se // bind on trade to update price session.UserDataStream.OnTradeUpdate(s.priceResolver.UpdateFromTrade) } + log.Infof("large amount alert: %+v", s.LargeAmountAlert) bbgo.OnShutdown(ctx, func(ctx context.Context, wg *sync.WaitGroup) {