xvs

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ID = "xvs"

Variables

This section is empty.

Functions

This section is empty.

Types

type Strategy

type Strategy struct {
	*common.Strategy

	Market      types.Market
	Environment *bbgo.Environment

	Symbol            string                 `json:"symbol"`
	Quantity          fixedpoint.Value       `json:"quantity"`
	ScaleQuantity     *bbgo.PriceVolumeScale `json:"scaleQuantity"`
	MaxExposure       fixedpoint.Value       `json:"maxExposure"`
	PriceRatioProtect fixedpoint.Value       `json:"priceRatioProtect"` // Price protection ratio (e.g. 1.05 means 5% slippage)

	// Entry condition parameters
	VolumeInterval           types.Interval   `json:"volumeInterval"`           // Volume monitoring time interval (e.g. 5m or 15m)
	VolumeThreshold          fixedpoint.Value `json:"volumeThreshold"`          // Base asset volume threshold (e.g. >= 800 BTC)
	VolumeThresholdInQuote   fixedpoint.Value `json:"volumeThresholdInQuote"`   // Quote asset volume threshold (e.g. > 40M USDT)
	MinKLineLowerShadowRatio fixedpoint.Value `json:"minKLineLowerShadowRatio"` // Minimum lower shadow ratio (0.1 means 90% body)

	// EMA technical indicator settings
	LongTermEMAWindow  types.IntervalWindow `json:"longTermEMAWindow"`  // Long-term EMA window settings, customizable days and period
	ShortTermEMAWindow types.IntervalWindow `json:"shortTermEMAWindow"` // Short-term EMA window settings, customizable days and period

	// Pivot High settings
	PivotHighWindow types.IntervalWindow `json:"pivotHighWindow"` // Pivot High window settings

	// Exit condition parameters
	EngulfingInterval types.Interval `json:"engulfingInterval"` // Engulfing pattern monitoring time interval (30m)

	// Exit methods collection (supports stop-loss and other exit methods)
	ExitMethods bbgo.ExitMethodSet `json:"exits"`

	// Persistent data
	TradeStats *types.TradeStats `persistence:"trade_stats"` // Trading statistics

	// Strategy controller (supports pause, emergency stop and other control functions)
	bbgo.StrategyController
	// contains filtered or unexported fields
}

Strategy XVS strategy main structure Based on high volume breakout entry signals and engulfing pattern exit signals

func (*Strategy) ClosePosition

func (s *Strategy) ClosePosition(ctx context.Context, percentage fixedpoint.Value) error

ClosePosition closes the specified percentage of position

func (*Strategy) CurrentPosition

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

func (*Strategy) Defaults

func (s *Strategy) Defaults() error

Defaults sets default values for strategy parameters

func (*Strategy) EnterBuy

func (s *Strategy) EnterBuy(ctx context.Context, kline types.KLine)

func (*Strategy) ID

func (s *Strategy) ID() string

func (*Strategy) Initialize

func (s *Strategy) Initialize() error

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)

Subscribe subscribes to necessary market data

func (*Strategy) TakeProfit

func (s *Strategy) TakeProfit(ctx context.Context, kline types.KLine)

func (*Strategy) Validate

func (s *Strategy) Validate() error

Validate validates the validity of strategy parameters

Jump to

Keyboard shortcuts

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