schedule

package
v1.16.3 Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ID = "schedule"

Variables

This section is empty.

Functions

This section is empty.

Types

type Float64Indicator

type Float64Indicator interface {
	Last() float64
}

Float64Indicator is the indicators (SMA and EWMA) that we want to use are returning float64 data.

type MovingAverageSettings

type MovingAverageSettings struct {
	Type     string         `json:"type"`
	Interval types.Interval `json:"interval"`
	Window   int            `json:"window"`

	Side     *types.SideType   `json:"side"`
	Quantity *fixedpoint.Value `json:"quantity"`
	Amount   *fixedpoint.Value `json:"amount"`
}

func (*MovingAverageSettings) Indicator

func (settings *MovingAverageSettings) Indicator(indicatorSet *bbgo.StandardIndicatorSet) (inc Float64Indicator, err error)

func (MovingAverageSettings) IntervalWindow

func (settings MovingAverageSettings) IntervalWindow() types.IntervalWindow

type Strategy

type Strategy struct {
	Market types.Market

	Notifiability *bbgo.Notifiability

	// StandardIndicatorSet contains the standard indicators of a market (symbol)
	// This field will be injected automatically since we defined the Symbol field.
	*bbgo.StandardIndicatorSet

	// Interval is the period that you want to submit order
	Interval types.Interval `json:"interval"`

	// Symbol is the symbol of the market
	Symbol string `json:"symbol"`

	// Side is the order side type, which can be buy or sell
	Side types.SideType `json:"side"`

	// Quantity is the quantity of the submit order
	Quantity fixedpoint.Value `json:"quantity,omitempty"`

	Amount fixedpoint.Value `json:"amount,omitempty"`

	BelowMovingAverage *MovingAverageSettings `json:"belowMovingAverage,omitempty"`

	AboveMovingAverage *MovingAverageSettings `json:"aboveMovingAverage,omitempty"`
}

func (*Strategy) ID

func (s *Strategy) ID() 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)

func (*Strategy) Validate

func (s *Strategy) Validate() error

Jump to

Keyboard shortcuts

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