mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-15 03:23:52 +00:00
deposit2transfer: optimize slack messages
This commit is contained in:
parent
ac0dfff59d
commit
10e3323c88
|
@ -246,13 +246,21 @@ func (s *Strategy) checkDeposits(ctx context.Context) {
|
||||||
err2 := retry.GeneralBackoff(ctx, func() error {
|
err2 := retry.GeneralBackoff(ctx, func() error {
|
||||||
return s.marginTransferService.TransferMarginAccountAsset(ctx, d.Asset, amount, types.TransferIn)
|
return s.marginTransferService.TransferMarginAccountAsset(ctx, d.Asset, amount, types.TransferIn)
|
||||||
})
|
})
|
||||||
|
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
logger.WithError(err2).Errorf("unable to transfer deposit asset into the margin account")
|
logger.WithError(err2).Errorf("unable to transfer deposit asset into the margin account")
|
||||||
|
|
||||||
if s.SlackAlert != nil {
|
if s.SlackAlert != nil {
|
||||||
bbgo.PostLiveNote(&d,
|
bbgo.PostLiveNote(&d,
|
||||||
livenote.Channel(s.SlackAlert.Channel),
|
livenote.Channel(s.SlackAlert.Channel),
|
||||||
livenote.Comment(fmt.Sprintf("Margin account transfer error: %+v", err2)),
|
livenote.Comment(fmt.Sprintf(":cross_mark: Margin account transfer error: %+v", err2)),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if s.SlackAlert != nil {
|
||||||
|
bbgo.PostLiveNote(&d,
|
||||||
|
livenote.Channel(s.SlackAlert.Channel),
|
||||||
|
livenote.Comment(fmt.Sprintf(":check_mark_button: %s %s transferred successfully", amount.String(), d.Asset)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user