improve/exit: show symbol in trailing stop triggered message

This commit is contained in:
Andy Cheng 2023-03-08 15:35:44 +08:00
parent f26568e213
commit 2970f73542
No known key found for this signature in database
GPG Key ID: 936427CF651A9D28

View File

@ -100,7 +100,7 @@ func (s *TrailingStop2) checkStopPrice(price fixedpoint.Value, position *types.P
// check if we have the minimal profit // check if we have the minimal profit
roi := position.ROI(price) roi := position.ROI(price)
if roi.Compare(s.MinProfit) >= 0 { if roi.Compare(s.MinProfit) >= 0 {
Notify("[trailingStop] activated: ROI %f > minimal profit ratio %f", roi.Float64(), s.MinProfit.Float64()) Notify("[trailingStop] activated: %s ROI %f > minimal profit ratio %f", s.Symbol, roi.Float64(), s.MinProfit.Float64())
s.activated = true s.activated = true
} }
} else if !s.ActivationRatio.IsZero() { } else if !s.ActivationRatio.IsZero() {
@ -174,7 +174,7 @@ func (s *TrailingStop2) triggerStop(price fixedpoint.Value) error {
s.activated = false s.activated = false
s.latestHigh = fixedpoint.Zero s.latestHigh = fixedpoint.Zero
}() }()
Notify("[TrailingStop] %s stop loss triggered. price: %f callback rate: %f", s.Symbol, price.Float64(), s.CallbackRate.Float64()) Notify("[TrailingStop] %s %s stop loss triggered. price: %f callback rate: %f", s.Symbol, s, price.Float64(), s.CallbackRate.Float64())
ctx := context.Background() ctx := context.Background()
p := fixedpoint.One p := fixedpoint.One
if !s.ClosePosition.IsZero() { if !s.ClosePosition.IsZero() {