mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
disable marketTrade stop
This commit is contained in:
parent
2d0fbe4b99
commit
6e4c28ed1b
|
@ -9,6 +9,8 @@ import (
|
||||||
"github.com/c9s/bbgo/pkg/types"
|
"github.com/c9s/bbgo/pkg/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const enableMarketTradeStop = false
|
||||||
|
|
||||||
type ProtectiveStopLoss struct {
|
type ProtectiveStopLoss struct {
|
||||||
Symbol string `json:"symbol"`
|
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) {
|
session.MarketDataStream.OnMarketTrade(func(trade types.Trade) {
|
||||||
if trade.Symbol != position.Symbol {
|
if trade.Symbol != position.Symbol {
|
||||||
return
|
return
|
||||||
|
|
|
@ -29,7 +29,7 @@ func (s *RoiStopLoss) Bind(session *ExchangeSession, orderExecutor *GeneralOrder
|
||||||
s.checkStopPrice(kline.Close, position)
|
s.checkStopPrice(kline.Close, position)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
if !IsBackTesting {
|
if !IsBackTesting && enableMarketTradeStop {
|
||||||
session.MarketDataStream.OnMarketTrade(func(trade types.Trade) {
|
session.MarketDataStream.OnMarketTrade(func(trade types.Trade) {
|
||||||
if trade.Symbol != position.Symbol {
|
if trade.Symbol != position.Symbol {
|
||||||
return
|
return
|
||||||
|
|
|
@ -58,7 +58,7 @@ func (s *TrailingStop2) Bind(session *ExchangeSession, orderExecutor *GeneralOrd
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
if !IsBackTesting {
|
if !IsBackTesting && enableMarketTradeStop {
|
||||||
session.MarketDataStream.OnMarketTrade(func(trade types.Trade) {
|
session.MarketDataStream.OnMarketTrade(func(trade types.Trade) {
|
||||||
if trade.Symbol != position.Symbol {
|
if trade.Symbol != position.Symbol {
|
||||||
return
|
return
|
||||||
|
|
|
@ -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) {
|
func useQuantityOrBaseBalance(session *bbgo.ExchangeSession, market types.Market, price, quantity, leverage fixedpoint.Value) (fixedpoint.Value, error) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user