liquiditymaker

package
v1.53.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: AGPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const ID = "liquiditymaker"

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"`

	NumOfLiquidityLayers int              `json:"numOfLiquidityLayers"`
	LiquiditySlideRule   *bbgo.SlideRule  `json:"liquidityScale"`
	LiquidityPriceRange  fixedpoint.Value `json:"liquidityPriceRange"`
	AskLiquidityAmount   fixedpoint.Value `json:"askLiquidityAmount"`
	BidLiquidityAmount   fixedpoint.Value `json:"bidLiquidityAmount"`

	UseLastTradePrice bool             `json:"useLastTradePrice"`
	Spread            fixedpoint.Value `json:"spread"`
	MaxPrice          fixedpoint.Value `json:"maxPrice"`
	MinPrice          fixedpoint.Value `json:"minPrice"`

	MaxExposure fixedpoint.Value `json:"maxExposure"`

	MinProfit fixedpoint.Value `json:"minProfit"`
	// 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) ID

func (s *Strategy) ID() string

func (*Strategy) InstanceID

func (s *Strategy) InstanceID() string

func (*Strategy) Run

func (*Strategy) Subscribe

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

Jump to

Keyboard shortcuts

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