Documentation ¶
Index ¶
- Constants
- type LiquidityOrderGenerator
- type Strategy
- func (s *Strategy) Defaults() error
- func (s *Strategy) ID() string
- func (s *Strategy) Initialize() error
- func (s *Strategy) InstanceID() string
- func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.ExchangeSession) error
- func (s *Strategy) Subscribe(session *bbgo.ExchangeSession)
Constants ¶
const ID = "liquiditymaker"
const IDAlias = "liqmaker"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LiquidityOrderGenerator ¶
type LiquidityOrderGenerator struct { Symbol string Market types.Market // contains filtered or unexported fields }
input: liquidityOrderGenerator(
totalLiquidityAmount, startPrice, endPrice, numLayers, quantityScale)
when side == sell
priceAsk1 * scale(1) * f = amount1 priceAsk2 * scale(2) * f = amount2 priceAsk3 * scale(3) * f = amount3
totalLiquidityAmount = priceAsk1 * scale(1) * f + priceAsk2 * scale(2) * f + priceAsk3 * scale(3) * f + .... totalLiquidityAmount = f * (priceAsk1 * scale(1) + priceAsk2 * scale(2) + priceAsk3 * scale(3) + ....) f = totalLiquidityAmount / (priceAsk1 * scale(1) + priceAsk2 * scale(2) + priceAsk3 * scale(3) + ....)
when side == buy
priceBid1 * scale(1) * f = amount1
func (*LiquidityOrderGenerator) Generate ¶
func (g *LiquidityOrderGenerator) Generate( side types.SideType, totalAmount, startPrice, endPrice fixedpoint.Value, numLayers int, scale bbgo.Scale, ) (orders []types.SubmitOrder)
type Strategy ¶
type Strategy struct { *common.Strategy Environment *bbgo.Environment Market types.Market Symbol string `json:"symbol"` LiquidityUpdateInterval types.Interval `json:"liquidityUpdateInterval"` AdjustmentUpdateInterval types.Interval `json:"adjustmentUpdateInterval"` AdjustmentOrderMaxQuantity fixedpoint.Value `json:"adjustmentOrderMaxQuantity"` AdjustmentOrderPriceType types.PriceType `json:"adjustmentOrderPriceType"` NumOfLiquidityLayers int `json:"numOfLiquidityLayers"` LiquiditySlideRule *bbgo.SlideRule `json:"liquidityScale"` LiquidityPriceRange fixedpoint.Value `json:"liquidityPriceRange"` AskLiquidityAmount fixedpoint.Value `json:"askLiquidityAmount"` BidLiquidityAmount fixedpoint.Value `json:"bidLiquidityAmount"` StopBidPrice fixedpoint.Value `json:"stopBidPrice"` StopAskPrice fixedpoint.Value `json:"stopAskPrice"` StopEMA *struct { Enabled bool `json:"enabled"` types.IntervalWindow } `json:"stopEMA"` UseProtectedPriceRange bool `json:"useProtectedPriceRange"` UseLastTradePrice bool `json:"useLastTradePrice"` Spread fixedpoint.Value `json:"spread"` MaxPrice fixedpoint.Value `json:"maxPrice"` MinPrice fixedpoint.Value `json:"minPrice"` MaxPositionExposure fixedpoint.Value `json:"maxPositionExposure"` MinProfit fixedpoint.Value `json:"minProfit"` common.ProfitFixerBundle // contains filtered or unexported fields }
Strategy is the strategy struct of LiquidityMaker liquidity maker does not care about the current price, it tries to place liquidity orders (limit maker orders) around the current mid price liquidity maker's target: - place enough total liquidity amount on the order book, for example, 20k USDT value liquidity on both sell and buy - ensure the spread by placing the orders from the mid price (or the last trade price)
func (*Strategy) Initialize ¶ added in v1.55.2
func (*Strategy) InstanceID ¶
func (*Strategy) Run ¶
func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.ExchangeSession) error
func (*Strategy) Subscribe ¶
func (s *Strategy) Subscribe(session *bbgo.ExchangeSession)