config

package
v0.42.13 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package config contains structures used in retrieving app configuration from disk.

Package config contains structures and functions for configuring the app.

Index

Constants

View Source
const (
	DiscreteThreeLevelString = "discreteThreeLevel"
	CoinAndBinomialString    = "coinAndBinomial"
)
View Source
const (
	BotStrategyNormal = "normal"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BotConfig

type BotConfig struct {
	// Name is the name of the bot. It is also used as the wallet name.
	// It is *not* a public key seen by Vega.
	Name string `yaml:"name"`

	// CallTimeout is the per-call timeout (in milliseconds) for communicating with the Vega node gRPC endpoint.
	CallTimeout int `yaml:"callTimeout"`

	// InstrumentBase is the base asset of the instrument.
	InstrumentBase string `yaml:"instrumentBase"`

	// InstrumentQuote is the quote asset of the instrument.
	InstrumentQuote string `yaml:"instrumentQuote"`

	// Strategy specifies which algorithm the bot is to use.
	Strategy string `yaml:"strategy"`

	// SettlementAsset is the asset used for settlement.
	SettlementAsset string `yaml:"settlementAsset"`

	// StrategyDetails contains the parameters needed by the strategy algorithm.
	StrategyDetails Strategy `yaml:"strategyDetails"`
}

BotConfig specifies the configuration parameters for one bot, which talks to one market on one Vega node.

type Config

type Config struct {
	Server *ServerConfig `yaml:"server"`

	Pricing   *PricingConfig `yaml:"pricing"`
	Wallet    *WalletConfig  `yaml:"wallet"`
	Token     *TokenConfig   `yaml:"token"`
	Locations []string       `yaml:"locations"`

	Bots []BotConfig `yaml:"bots"`
}

Config describes the top level config file format.

func (*Config) CheckConfig added in v0.42.0

func (cfg *Config) CheckConfig() error

CheckConfig checks the config for valid structure and values.

func (*Config) ConfigureLogging added in v0.42.0

func (cfg *Config) ConfigureLogging() error

ConfigureLogging configures logging.

type LimitOrderDistParams added in v0.37.0

type LimitOrderDistParams struct {
	Method              SteeringMethod `yaml:"method"`
	GttLength           uint64         `yaml:"gttLengthSeconds"`
	TgtTimeHorizonHours float64        `yaml:"tgtTimeHorizonHours"`
	NumTicksFromMid     uint64         `yaml:"numTicksFromMid"`
	NumIdenticalBots    int            `yaml:"numIdenticalBots"`
}

LimitOrderDistParams for configuring the way price steering orders are sent.

type LiquidityOrder

type LiquidityOrder struct {
	Reference  string `yaml:"reference"`
	Proportion uint32 `yaml:"proportion"`
	Offset     string `yaml:"offset"`
}

LiquidityOrder describes ...

func (LiquidityOrder) ToVegaLiquidityOrder added in v0.42.0

func (l LiquidityOrder) ToVegaLiquidityOrder() *vega.LiquidityOrder

type LiquidityOrders added in v0.42.0

type LiquidityOrders []LiquidityOrder

func (LiquidityOrders) ToVegaLiquidityOrders added in v0.42.0

func (l LiquidityOrders) ToVegaLiquidityOrders() []*vega.LiquidityOrder

type PricingConfig

type PricingConfig struct {
	Address *url.URL `yaml:"address"`
}

PricingConfig describes the settings for contacting the price proxy.

type ServerConfig

type ServerConfig struct {
	Env       string
	Listen    string
	LogFormat string
	LogLevel  string
}

ServerConfig describes the settings for running the liquidity bot.

type Shape

type Shape struct {
	Sells LiquidityOrders `yaml:"sells"`
	Buys  LiquidityOrders `yaml:"buys"`
}

Shape describes the buy and sell sides of a Liquidity Provision instruction.

func (Shape) ToVegaShape added in v0.42.0

func (s Shape) ToVegaShape() types.Shape

type SteeringMethod added in v0.42.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
)

func (*SteeringMethod) Get added in v0.42.0

func (s *SteeringMethod) Get() string

Get returns the underlying string.

func (SteeringMethod) MarshalText added in v0.42.0

func (s SteeringMethod) MarshalText() ([]byte, error)

MarshalText converts a SteeringMethod to a string.

func (SteeringMethod) String added in v0.42.0

func (s SteeringMethod) String() string

Get returns the underlying string.

func (*SteeringMethod) UnmarshalText added in v0.42.0

func (s *SteeringMethod) UnmarshalText(text []byte) error

UnmarshalText converts a string to a SteeringMethod.

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 Uint `yaml:"expectedMarkPrice"`

	// AuctionVolume ...
	AuctionVolume Uint `yaml:"auctionVolume"`

	// SeedAmount is the amount of tokens to mint, deposit and stake
	SeedAmount Uint `yaml:"seedAmount"`

	// SeedOrderSize is the size of the seed orders that tries to get the market out of auction
	SeedOrderSize uint64 `yaml:"seedOrderSize"`

	// CommitmentAmount is the amount of stake for the LP
	CommitmentAmount string `yaml:"commitmentAmount"`

	// Fee is the 0->1 fee for supplying liquidity
	Fee string `yaml:"fee"`

	// MaxLong specifies the maximum long position that the bot will tolerate.
	MaxLong Uint `yaml:"maxLong"`

	// MaxShort specifies the maximum short position that the bot will tolerate.
	MaxShort Uint `yaml:"maxShort"`

	// PosManagementFraction controls the size of market orders used to manage the bot's position.
	PosManagementFraction float64 `yaml:"posManagementFraction"`

	// OrdersFraction is used in rule-of-thumb heuristics to decide how
	// the bot should deploy collateral.
	OrdersFraction float64 `yaml:"ordersFraction"`

	// ShorteningShape (which includes both sides of the book) specifies the shape used when the bot
	// is trying to shorten its position.
	ShorteningShape Shape `yaml:"shorteningShape"`

	// 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 Shape `yaml:"longeningShape"`

	// PosManagementSleepMilliseconds is the sleep time, in milliseconds, between position management
	PosManagementSleepMilliseconds int `yaml:"posManagementSleepMilliseconds"`

	// MarketPriceSteeringRatePerSecond ...
	MarketPriceSteeringRatePerSecond float64 `yaml:"marketPriceSteeringRatePerSecond"`

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

	// PriceSteerOrderScale is the scaling factor used when placing a steering order
	PriceSteerOrderScale float64 `yaml:"priceSteerOrderScale"`

	// LimitOrderDistributionParams ...
	LimitOrderDistributionParams LimitOrderDistParams `yaml:"limitOrderDistributionParams"`

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

Strategy describes parameters for the bot's strategy.

func (Strategy) String added in v0.42.0

func (s Strategy) String() string

type TokenConfig added in v0.42.0

type TokenConfig struct {
	EthereumAPIAddress      string `yaml:"ethereumAPIAddress"`
	Erc20BridgeAddress      string `yaml:"erc20BridgeAddress"`
	StakingBridgeAddress    string `yaml:"stakingBridgeAddress"`
	ERC20TokenAddress       string `yaml:"erc20TokenAddress"`
	VegaTokenAddress        string `yaml:"vegaTokenAddress"`
	ContractOwnerAddress    string `yaml:"contractOwnerAddress"`
	ContractOwnerPrivateKey string `yaml:"contractOwnerPrivateKey"`
}

type Uint added in v0.41.0

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

Uint is for storing a num.Uint as a string in a config file.

func (*Uint) Get added in v0.41.0

func (u *Uint) Get() *num.Uint

Get returns the underlying num.Uint.

func (Uint) MarshalText added in v0.41.0

func (u Uint) MarshalText() ([]byte, error)

MarshalText converts a Uint to a string.

func (*Uint) UnmarshalText added in v0.41.0

func (u *Uint) UnmarshalText(text []byte) error

UnmarshalText converts a string to a nun.Uint.

type WalletConfig

type WalletConfig struct {
	URL string `yaml:"url"`
}

WalletConfig describes the settings for running an internal wallet server.

Jump to

Keyboard shortcuts

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