support

package
v1.21.2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const ID = "support"

Variables

This section is empty.

Functions

This section is empty.

Types

type PercentageTargetStop added in v1.18.0

type PercentageTargetStop struct {
	Targets []Target `json:"targets"`
}

PercentageTargetStop is a kind of stop order by setting fixed percentage target

func (*PercentageTargetStop) GenerateOrders added in v1.18.0

func (stop *PercentageTargetStop) GenerateOrders(market types.Market, pos *types.Position) []types.SubmitOrder

GenerateOrders generates the orders from the given targets

type ResistanceStop added in v1.18.0

type ResistanceStop struct {
	Interval types.Interval `json:"interval"`

	MinVolume     fixedpoint.Value `json:"minVolume"`
	TakerBuyRatio fixedpoint.Value `json:"takerBuyRatio"`
	// contains filtered or unexported fields
}

ResistanceStop is a kind of stop order by detecting resistance

type State added in v1.17.0

type State struct {
	Position *types.Position `json:"position,omitempty"`
}

type Strategy

type Strategy struct {
	*bbgo.Notifiability `json:"-"`
	*bbgo.Persistence
	*bbgo.Graceful `json:"-"`

	Symbol string       `json:"symbol"`
	Market types.Market `json:"-"`

	// Interval for checking support
	Interval types.Interval `json:"interval"`

	// moving average window for checking support (support should be under the moving average line)
	TriggerMovingAverage types.IntervalWindow `json:"triggerMovingAverage"`

	// LongTermMovingAverage is the second moving average line for checking support position
	LongTermMovingAverage types.IntervalWindow `json:"longTermMovingAverage"`

	Quantity              fixedpoint.Value                `json:"quantity"`
	MinVolume             fixedpoint.Value                `json:"minVolume"`
	Sensitivity           fixedpoint.Value                `json:"sensitivity"`
	TakerBuyRatio         fixedpoint.Value                `json:"takerBuyRatio"`
	MarginOrderSideEffect types.MarginOrderSideEffectType `json:"marginOrderSideEffect"`
	Targets               []Target                        `json:"targets"`

	ResistanceStop *ResistanceStop `json:"resistanceStop"`

	ResistanceTakerBuyRatio fixedpoint.Value `json:"resistanceTakerBuyRatio"`

	// Min BaseAsset balance to keep
	MinBaseAssetBalance fixedpoint.Value `json:"minBaseAssetBalance"`
	// Max BaseAsset balance to buy
	MaxBaseAssetBalance  fixedpoint.Value `json:"maxBaseAssetBalance"`
	MinQuoteAssetBalance fixedpoint.Value `json:"minQuoteAssetBalance"`

	ScaleQuantity *bbgo.PriceVolumeScale `json:"scaleQuantity"`
	// contains filtered or unexported fields
}

func (*Strategy) ID

func (s *Strategy) ID() string

func (*Strategy) LoadState added in v1.17.0

func (s *Strategy) LoadState() error

func (*Strategy) Run

func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error

func (*Strategy) SaveState added in v1.17.0

func (s *Strategy) SaveState() error

func (*Strategy) Subscribe

func (s *Strategy) Subscribe(session *bbgo.ExchangeSession)

func (*Strategy) Validate added in v1.15.3

func (s *Strategy) Validate() error

type Target

type Target struct {
	ProfitPercentage      float64                         `json:"profitPercentage"`
	QuantityPercentage    float64                         `json:"quantityPercentage"`
	MarginOrderSideEffect types.MarginOrderSideEffectType `json:"marginOrderSideEffect"`
}

Jump to

Keyboard shortcuts

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