normal

package
v0.43.4 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscreteThreeLevelProbabilities added in v0.37.0

func DiscreteThreeLevelProbabilities(V []float64, muHat float64, sigmaHat float64) ([]float64, error)

DiscreteThreeLevelProbabilities is a method for calculating price levels.

func GeneratePriceUsingDiscreteThreeLevel added in v0.37.0

func GeneratePriceUsingDiscreteThreeLevel(M0, delta, sigma, tgtTimeHorizonYrFrac, N float64) (price float64, err error)

GeneratePriceUsingDiscreteThreeLevel is a method for calculating price levels input is a float price (so divide uint64 price by 10^{num of decimals}) it returns a float price which you want to multiply by 10^{num of decimals} and then round.

Types

type Bot

type Bot struct {
	// contains filtered or unexported fields
}

Bot represents one Normal liquidity bot.

func New

func New(config config.BotConfig, pe PricingEngine, ws *wallets.Handler) (b *Bot, err error)

New returns a new instance of Bot.

func (*Bot) GetRealisticOrderDetails added in v0.37.0

func (b *Bot) GetRealisticOrderDetails(externalPrice *num.Uint) (price, size *num.Uint, err error)

GetRealisticOrderDetails uses magic to return a realistic order price and size.

func (*Bot) GetTraderDetails added in v0.36.0

func (b *Bot) GetTraderDetails() string

GetTraderDetails returns information relating to the trader.

func (*Bot) Start

func (b *Bot) Start() error

Start starts the liquidity bot goroutine(s).

func (*Bot) Stop

func (b *Bot) Stop()

Stop stops the liquidity bot goroutine(s).

type CoreService added in v0.41.0

type CoreService interface {
	SubmitTransaction(req *vegaapipb.SubmitTransactionRequest) (response *vegaapipb.SubmitTransactionResponse, err error)
	// rpc PropagateChainEvent(PropagateChainEventRequest) returns (PropagateChainEventResponse);
	Statistics(*vegaapipb.StatisticsRequest) (*vegaapipb.StatisticsResponse, error)
	LastBlockData() (*vegaapipb.LastBlockHeightResponse, error)
	GetVegaTime() (t time.Time, err error)
	ObserveEventBus() (client vegaapipb.CoreService_ObserveEventBusClient, err error)
}

CoreService implements the gRPC service of the same name.

type CoreStateService added in v0.41.0

type CoreStateService interface {
}

CoreStateService implements the gRPC service of the same name.

type DataNode added in v0.41.0

type DataNode interface {
	GetAddress() (url.URL, error)
	CoreService
	TradingDataService
}

DataNode is a Vega Data node

type LODParamsConfig

type LODParamsConfig struct {
	Method              SteeringMethod
	GttLength           uint64
	TgtTimeHorizonHours float64
	NumTicksFromMid     uint64
	NumIdenticalBots    int
}

LODParamsConfig is a little data structure which sets the algo and params for how limits orders are generated.

type PricingEngine

type PricingEngine interface {
	GetPrice(pricecfg ppconfig.PriceConfig) (pi ppservice.PriceResponse, err error)
}

PricingEngine is the source of price information from the price proxy.

type ShapeConfig

type ShapeConfig struct {
	Sells []*vega.LiquidityOrder
	Buys  []*vega.LiquidityOrder
}

ShapeConfig is the top level definition of a liquidity shape.

type SteeringMethod added in v0.37.0

type SteeringMethod int

SteeringMethod is an enum for all the possible price calculations methods for price steering.

const (
	// NotSet for when we cannot parse the input string.
	NotSet SteeringMethod = iota
	// DiscreteThreeLevel uses the discrete three level method.
	DiscreteThreeLevel
	// CoinAndBinomial uses the coin and binomial method.
	CoinAndBinomial
)

type Strategy

type Strategy struct {
	// ExpectedMarkPrice (optional) specifies the expected mark price for a market that may not yet
	// have a mark price. It is used to calculate margin cost of orders meeting liquidity
	// requirement.
	ExpectedMarkPrice config.Uint

	// AuctionVolume ...
	AuctionVolume config.Uint

	// CommitmentFraction is the fractional amount of stake for the LP
	CommitmentFraction float64

	// Fee is the 0->1 fee for supplying liquidity
	Fee float64

	// MaxLong specifies the maximum long position that the bot will tolerate.
	MaxLong config.Uint

	// MaxShort specifies the maximum short position that the bot will tolerate.
	MaxShort config.Uint

	// PosManagementFraction controls the size of market orders used to manage the bot's position.
	PosManagementFraction float64

	// StakeFraction (along with OrdersFraction) is used in rule-of-thumb heuristics to decide how
	// the bot should deploy collateral.
	StakeFraction float64

	// OrdersFraction (along with StakeFraction) is used in rule-of-thumb heuristics to decide how
	// the bot should deploy collateral.
	OrdersFraction float64

	// ShorteningShape (which includes both sides of the book) specifies the shape used when the bot
	// is trying to shorten its position.
	ShorteningShape *ShapeConfig

	// LongeningShape (which includes both sides of the book) specifies the shape used when the bot
	// is trying to lengthen its position. Note that the initial shape used by the bot is always the
	// longening shape, because being long is a little cheaper in position margin than being short.
	LongeningShape *ShapeConfig

	// PosManagementSleepMilliseconds is the sleep time, in milliseconds, between position management
	PosManagementSleepMilliseconds uint64

	// MarketPriceSteeringRatePerSecond ...
	MarketPriceSteeringRatePerSecond float64

	// MinPriceSteerFraction is the minimum difference between external and current price that will
	// allow a price steering order to be placed.
	MinPriceSteerFraction float64

	// PriceSteerOrderScale is the scaling factor used when placing a steering order
	PriceSteerOrderScale float64

	// LimitOrderDistributionParams ...
	LimitOrderDistributionParams *LODParamsConfig

	// TargetLNVol specifies the target log-normal volatility (e.g. 0.5 for 50%).
	TargetLNVol float64
}

Strategy configures the normal strategy.

func (*Strategy) String

func (s *Strategy) String() string

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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