From 62fb09c8d94923e021b1eb4b6ee35fa3dd6670fb Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 7 Sep 2022 00:50:16 +0800 Subject: [PATCH] bbgo: protective stop should send notification when it's activated --- pkg/bbgo/exit_protective_stop_loss.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/bbgo/exit_protective_stop_loss.go b/pkg/bbgo/exit_protective_stop_loss.go index f4ed4c921..6b3a064d5 100644 --- a/pkg/bbgo/exit_protective_stop_loss.go +++ b/pkg/bbgo/exit_protective_stop_loss.go @@ -175,7 +175,7 @@ func (s *ProtectiveStopLoss) handleChange(ctx context.Context, position *types.P s.stopLossPrice = position.AverageCost.Mul(one.Add(s.StopLossRatio)) } - log.Infof("[ProtectiveStopLoss] %s protection stop loss activated, current price = %f, average cost = %f, stop loss price = %f", + Notify("[ProtectiveStopLoss] %s protection stop loss activated, current price = %f, average cost = %f, stop loss price = %f", position.Symbol, closePrice.Float64(), position.AverageCost.Float64(), s.stopLossPrice.Float64()) if s.PlaceStopOrder { @@ -200,7 +200,7 @@ func (s *ProtectiveStopLoss) checkStopPrice(closePrice fixedpoint.Value, positio } if s.shouldStop(closePrice, position) { - log.Infof("[ProtectiveStopLoss] protection stop order is triggered at price %f, position = %+v", closePrice.Float64(), position) + Notify("[ProtectiveStopLoss] protection stop order is triggered at price %f", closePrice.Float64(), position) if err := s.orderExecutor.ClosePosition(context.Background(), one, "protectiveStopLoss"); err != nil { log.WithError(err).Errorf("failed to close position") }