mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
trailing stop: apply ClosePosition parameter
This commit is contained in:
parent
d86338d6e6
commit
d2637ce261
|
@ -153,5 +153,10 @@ func (s *TrailingStop2) triggerStop(price fixedpoint.Value) error {
|
|||
}()
|
||||
Notify("[TrailingStop] %s stop loss triggered. price: %f callback rate: %f", s.Symbol, price.Float64(), s.CallbackRate.Float64())
|
||||
ctx := context.Background()
|
||||
return s.orderExecutor.ClosePosition(ctx, fixedpoint.One, "trailingStop")
|
||||
p := fixedpoint.One
|
||||
if !s.ClosePosition.IsZero() {
|
||||
p = s.ClosePosition
|
||||
}
|
||||
|
||||
return s.orderExecutor.ClosePosition(ctx, p, "trailingStop")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user