pivotshort

package
v1.64.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2026 License: AGPL-3.0 Imports: 11 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

	// FastWindow is used for fast pivot (this is to filter the nearest high/low)
	FastWindow int `json:"fastWindow"`

	// Ratio is a number less than 1.0, price * ratio will be the price triggers the short order.
	Ratio fixedpoint.Value `json:"ratio"`

	bbgo.OpenPositionOptions

	// BounceRatio is a ratio used for placing the limit order sell price
	// limit sell price = breakLowPrice * (1 + BounceRatio)
	BounceRatio fixedpoint.Value `json:"bounceRatio"`

	StopEMA *bbgo.StopEMA `json:"stopEMA"`

	TrendEMA *bbgo.TrendEMA `json:"trendEMA"`

	FakeBreakStop *FakeBreakStop `json:"fakeBreakStop"`

	// StrategyController
	bbgo.StrategyController
	// 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

	FastWindow int

	bbgo.OpenPositionOptions

	// 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"`

	// EarlyStopRatio adjusts the break high price with the given ratio
	// this is for stop loss earlier if the price goes above the previous price
	EarlyStopRatio fixedpoint.Value `json:"earlyStopRatio"`

	VWMA *types.IntervalWindow `json:"vwma"`

	StopEMA *bbgo.StopEMA `json:"stopEMA"`

	TrendEMA *bbgo.TrendEMA `json:"trendEMA"`

	MACDDivergence *MACDDivergence `json:"macdDivergence"`

	// StrategyController
	bbgo.StrategyController
	// 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 MACDDivergence added in v1.41.0

type MACDDivergence struct {
	*indicator.MACDConfig
	PivotWindow int `json:"pivotWindow"`
}

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"`

	// StrategyController
	bbgo.StrategyController
	// 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 (s *Strategy) ClosePosition(ctx context.Context, percentage fixedpoint.Value) error

func (*Strategy) CurrentPosition added in v1.36.0

func (s *Strategy) CurrentPosition() *types.Position

func (*Strategy) ID

func (s *Strategy) ID() string

func (*Strategy) InstanceID

func (s *Strategy) InstanceID() string

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL