bbgo_origin/pkg/strategy/pivotshort/exit.go

26 lines
1.0 KiB
Go
Raw Normal View History

package pivotshort
import "github.com/c9s/bbgo/pkg/bbgo"
type ExitMethod struct {
2022-06-27 11:54:58 +00:00
RoiStopLoss *RoiStopLoss `json:"roiStopLoss"`
ProtectionStopLoss *ProtectionStopLoss `json:"protectionStopLoss"`
RoiTakeProfit *RoiTakeProfit `json:"roiTakeProfit"`
LowerShadowTakeProfit *LowerShadowTakeProfit `json:"lowerShadowTakeProfit"`
CumulatedVolumeTakeProfit *CumulatedVolumeTakeProfit `json:"cumulatedVolumeTakeProfit"`
}
func (m *ExitMethod) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.GeneralOrderExecutor) {
if m.ProtectionStopLoss != nil {
m.ProtectionStopLoss.Bind(session, orderExecutor)
} else if m.RoiStopLoss != nil {
m.RoiStopLoss.Bind(session, orderExecutor)
} else if m.RoiTakeProfit != nil {
m.RoiTakeProfit.Bind(session, orderExecutor)
} else if m.LowerShadowTakeProfit != nil {
m.LowerShadowTakeProfit.Bind(session, orderExecutor)
} else if m.CumulatedVolumeTakeProfit != nil {
m.CumulatedVolumeTakeProfit.Bind(session, orderExecutor)
}
}