Skip to content

Commit

Permalink
autoborrow: add icon to the messages
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Dec 4, 2024
1 parent aebaeb7 commit 4452b2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/strategy/autoborrow/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand All @@ -660,17 +660,16 @@ 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())
}
}
}
}
}

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
}

Expand Down
1 change: 1 addition & 0 deletions pkg/strategy/xalign/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4452b2d

Please sign in to comment.