mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
pivotshort: add safety check
This commit is contained in:
parent
279bb66a4d
commit
e1a9df0a2d
|
@ -168,6 +168,10 @@ func (s *ProtectionStopLoss) handleChange(ctx context.Context, position *types.P
|
|||
}
|
||||
|
||||
func (s *ProtectionStopLoss) checkStopPrice(closePrice fixedpoint.Value, position *types.Position) {
|
||||
if s.stopLossPrice.IsZero() {
|
||||
return
|
||||
}
|
||||
|
||||
if s.shouldStop(closePrice) {
|
||||
log.Infof("[ProtectionStopLoss] protection stop order is triggered at price %f, position = %+v", closePrice.Float64(), position)
|
||||
if err := s.orderExecutor.ClosePosition(context.Background(), one); err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user