Documentation
¶
Index ¶
- Constants
- type Strategy
- func (s *Strategy) ClosePosition(ctx context.Context, percentage fixedpoint.Value) error
- func (s *Strategy) CurrentPosition() *types.Position
- func (s *Strategy) Defaults() error
- func (s *Strategy) EnterBuy(ctx context.Context, kline types.KLine)
- func (s *Strategy) ID() string
- func (s *Strategy) Initialize() error
- func (s *Strategy) InstanceID() string
- func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, ...) error
- func (s *Strategy) Subscribe(session *bbgo.ExchangeSession)
- func (s *Strategy) TakeProfit(ctx context.Context, kline types.KLine)
- func (s *Strategy) Validate() error
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 ¶
ClosePosition closes the specified percentage of position
func (*Strategy) CurrentPosition ¶
func (*Strategy) Initialize ¶
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)
Subscribe subscribes to necessary market data
Click to show internal directories.
Click to hide internal directories.