diff --git a/pkg/bbgo/exit_protective_stop_loss.go b/pkg/bbgo/exit_protective_stop_loss.go index 456a9f6bd..5928337ca 100644 --- a/pkg/bbgo/exit_protective_stop_loss.go +++ b/pkg/bbgo/exit_protective_stop_loss.go @@ -9,6 +9,8 @@ import ( "github.com/c9s/bbgo/pkg/types" ) +const enableMarketTradeStop = false + type ProtectiveStopLoss struct { Symbol string `json:"symbol"` @@ -122,7 +124,7 @@ func (s *ProtectiveStopLoss) Bind(session *ExchangeSession, orderExecutor *Gener } }) - if !IsBackTesting { + if !IsBackTesting && enableMarketTradeStop { session.MarketDataStream.OnMarketTrade(func(trade types.Trade) { if trade.Symbol != position.Symbol { return diff --git a/pkg/bbgo/exit_roi_stop_loss.go b/pkg/bbgo/exit_roi_stop_loss.go index 875934f41..4dab15a1c 100644 --- a/pkg/bbgo/exit_roi_stop_loss.go +++ b/pkg/bbgo/exit_roi_stop_loss.go @@ -29,7 +29,7 @@ func (s *RoiStopLoss) Bind(session *ExchangeSession, orderExecutor *GeneralOrder s.checkStopPrice(kline.Close, position) })) - if !IsBackTesting { + if !IsBackTesting && enableMarketTradeStop { session.MarketDataStream.OnMarketTrade(func(trade types.Trade) { if trade.Symbol != position.Symbol { return diff --git a/pkg/bbgo/exit_trailing_stop.go b/pkg/bbgo/exit_trailing_stop.go index 809296df5..c66d031f7 100644 --- a/pkg/bbgo/exit_trailing_stop.go +++ b/pkg/bbgo/exit_trailing_stop.go @@ -58,7 +58,7 @@ func (s *TrailingStop2) Bind(session *ExchangeSession, orderExecutor *GeneralOrd } })) - if !IsBackTesting { + if !IsBackTesting && enableMarketTradeStop { session.MarketDataStream.OnMarketTrade(func(trade types.Trade) { if trade.Symbol != position.Symbol { return diff --git a/pkg/strategy/pivotshort/breaklow.go b/pkg/strategy/pivotshort/breaklow.go index 71ca9a6db..03cf0b36f 100644 --- a/pkg/strategy/pivotshort/breaklow.go +++ b/pkg/strategy/pivotshort/breaklow.go @@ -220,13 +220,6 @@ func (s *BreakLow) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.Gener }) } })) - - if !bbgo.IsBackTesting { - // use market trade to submit short order - session.MarketDataStream.OnMarketTrade(func(trade types.Trade) { - - }) - } } func useQuantityOrBaseBalance(session *bbgo.ExchangeSession, market types.Market, price, quantity, leverage fixedpoint.Value) (fixedpoint.Value, error) {