Documentation
¶
Index ¶
- Constants
- type BreakLow
- type FailedBreakHigh
- type FakeBreakStop
- type ResistanceShort
- type Strategy
- func (s *Strategy) ClosePosition(ctx context.Context, percentage fixedpoint.Value) error
- func (s *Strategy) CurrentPosition() *types.Position
- func (s *Strategy) ID() string
- func (s *Strategy) InstanceID() string
- func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, ...) error
- func (s *Strategy) Subscribe(session *bbgo.ExchangeSession)
Constants ¶
View Source
const ID = "pivotshort"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BreakLow ¶ added in v1.33.3
type BreakLow struct {
Symbol string
Market types.Market
types.IntervalWindow
// Ratio is a number less than 1.0, price * ratio will be the price triggers the short order.
Ratio fixedpoint.Value `json:"ratio"`
// MarketOrder is the option to enable market order short.
MarketOrder bool `json:"marketOrder"`
// BounceRatio is a ratio used for placing the limit order sell price
// limit sell price = breakLowPrice * (1 + BounceRatio)
BounceRatio fixedpoint.Value `json:"bounceRatio"`
Leverage fixedpoint.Value `json:"leverage"`
Quantity fixedpoint.Value `json:"quantity"`
StopEMA *bbgo.StopEMA `json:"stopEMA"`
TrendEMA *bbgo.TrendEMA `json:"trendEMA"`
FakeBreakStop *FakeBreakStop `json:"fakeBreakStop"`
// contains filtered or unexported fields
}
BreakLow -- when price breaks the previous pivot low, we set a trade entry
func (*BreakLow) Bind ¶ added in v1.36.0
func (s *BreakLow) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.GeneralOrderExecutor)
func (*BreakLow) Subscribe ¶ added in v1.36.0
func (s *BreakLow) Subscribe(session *bbgo.ExchangeSession)
type FailedBreakHigh ¶ added in v1.40.0
type FailedBreakHigh struct {
Symbol string
Market types.Market
// IntervalWindow is used for finding the pivot high
types.IntervalWindow
// BreakInterval is used for checking failed break
BreakInterval types.Interval `json:"breakInterval"`
Enabled bool `json:"enabled"`
// Ratio is a number less than 1.0, price * ratio will be the price triggers the short order.
Ratio fixedpoint.Value `json:"ratio"`
// MarketOrder is the option to enable market order short.
MarketOrder bool `json:"marketOrder"`
Leverage fixedpoint.Value `json:"leverage"`
Quantity fixedpoint.Value `json:"quantity"`
VWMA *types.IntervalWindow `json:"vwma"`
StopEMA *bbgo.StopEMA `json:"stopEMA"`
TrendEMA *bbgo.TrendEMA `json:"trendEMA"`
PivotHighPrices []fixedpoint.Value
// contains filtered or unexported fields
}
FailedBreakHigh -- when price breaks the previous pivot low, we set a trade entry
func (*FailedBreakHigh) Bind ¶ added in v1.40.0
func (s *FailedBreakHigh) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.GeneralOrderExecutor)
func (*FailedBreakHigh) Subscribe ¶ added in v1.40.0
func (s *FailedBreakHigh) Subscribe(session *bbgo.ExchangeSession)
type FakeBreakStop ¶ added in v1.38.0
type FakeBreakStop struct {
types.IntervalWindow
}
type ResistanceShort ¶ added in v1.36.0
type ResistanceShort struct {
Enabled bool `json:"enabled"`
Symbol string `json:"-"`
Market types.Market `json:"-"`
types.IntervalWindow
MinDistance fixedpoint.Value `json:"minDistance"`
GroupDistance fixedpoint.Value `json:"groupDistance"`
NumLayers int `json:"numLayers"`
LayerSpread fixedpoint.Value `json:"layerSpread"`
Quantity fixedpoint.Value `json:"quantity"`
Leverage fixedpoint.Value `json:"leverage"`
Ratio fixedpoint.Value `json:"ratio"`
TrendEMA *bbgo.TrendEMA `json:"trendEMA"`
// contains filtered or unexported fields
}
func (*ResistanceShort) Bind ¶ added in v1.36.0
func (s *ResistanceShort) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.GeneralOrderExecutor)
func (*ResistanceShort) Subscribe ¶ added in v1.38.0
func (s *ResistanceShort) Subscribe(session *bbgo.ExchangeSession)
type Strategy ¶
type Strategy struct {
Environment *bbgo.Environment
Symbol string `json:"symbol"`
Market types.Market
// pivot interval and window
types.IntervalWindow
Leverage fixedpoint.Value `json:"leverage"`
Quantity fixedpoint.Value `json:"quantity"`
Position *types.Position `persistence:"position"`
ProfitStats *types.ProfitStats `persistence:"profit_stats"`
TradeStats *types.TradeStats `persistence:"trade_stats"`
// BreakLow is one of the entry method
BreakLow *BreakLow `json:"breakLow"`
FailedBreakHigh *FailedBreakHigh `json:"failedBreakHigh"`
// ResistanceShort is one of the entry method
ResistanceShort *ResistanceShort `json:"resistanceShort"`
ExitMethods bbgo.ExitMethodSet `json:"exits"`
// StrategyController
bbgo.StrategyController
// contains filtered or unexported fields
}
func (*Strategy) ClosePosition ¶
func (*Strategy) CurrentPosition ¶ added in v1.36.0
func (*Strategy) InstanceID ¶
func (*Strategy) Run ¶
func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error
func (*Strategy) Subscribe ¶
func (s *Strategy) Subscribe(session *bbgo.ExchangeSession)
Click to show internal directories.
Click to hide internal directories.