Documentation
¶
Index ¶
Constants ¶
View Source
const ID = "grid"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Strategy ¶
type Strategy struct {
// The notification system will be injected into the strategy automatically.
// This field will be injected automatically since it's a single exchange strategy.
*bbgo.Notifiability `json:"-" yaml:"-"`
*bbgo.Graceful `json:"-" yaml:"-"`
// OrderExecutor is an interface for submitting order.
// This field will be injected automatically since it's a single exchange strategy.
bbgo.OrderExecutor `json:"-" yaml:"-"`
// Market stores the configuration of the market, for example, VolumePrecision, PricePrecision, MinLotSize... etc
// This field will be injected automatically since we defined the Symbol field.
types.Market `json:"-" yaml:"-"`
TradeService *service.TradeService `json:"-" yaml:"-"`
// These fields will be filled from the config file (it translates YAML to JSON)
Symbol string `json:"symbol" yaml:"symbol"`
// ProfitSpread is the fixed profit spread you want to submit the sell order
ProfitSpread fixedpoint.Value `json:"profitSpread" yaml:"profitSpread"`
// GridNum is the grid number, how many orders you want to post on the orderbook.
GridNum int `json:"gridNumber" yaml:"gridNumber"`
UpperPrice fixedpoint.Value `json:"upperPrice" yaml:"upperPrice"`
LowerPrice fixedpoint.Value `json:"lowerPrice" yaml:"lowerPrice"`
// Quantity is the quantity you want to submit for each order.
Quantity fixedpoint.Value `json:"quantity,omitempty"`
// FixedAmount is used for fixed amount (dynamic quantity) if you don't want to use fixed quantity.
FixedAmount fixedpoint.Value `json:"amount,omitempty" yaml:"amount"`
// Long means you want to hold more base asset than the quote asset.
Long bool `json:"long,omitempty" yaml:"long,omitempty"`
// contains filtered or unexported fields
}
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)
Click to show internal directories.
Click to hide internal directories.