config

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: 7 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

This section is empty.

Variables

View Source
var (
	// ErrNil indicates that a nil/null pointer was encountered.
	ErrNil = errors.New("nil pointer")

	// ErrMissingEmptyConfigSection indicates that a required config file section is missing (not present) or empty (zero-length).
	ErrMissingEmptyConfigSection = errors.New("config file section is missing/empty")

	// ErrInvalidValue indicates that a value was invalid.
	ErrInvalidValue = errors.New("invalid value")
)

Functions

func CheckConfig

func CheckConfig(cfg *Config) error

CheckConfig checks the config for valid structure and values.

func ConfigureLogging

func ConfigureLogging(cfg *ServerConfig) error

ConfigureLogging configures logging.

func ReadFloat64

func ReadFloat64(details map[string]string, key string) (v float64, err error)

ReadFloat64 extracts a float64 from a strategy config map.

func ReadUint64

func ReadUint64(details map[string]string, key string) (v uint64, err error)

ReadUint64 extracts a uint64 from a strategy config map.

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

	// Location points to a Vega node gRPC endpoint (host:port).
	Location string `yaml:"location"`

	// ConnectTimeout is the timeout (in milliseconds) for connecting to the Vega node gRPC endpoint.
	ConnectTimeout int `yaml:"connectTimeout"`

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

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

	// Additional metadata filters for the selecting markets
	MetadataFilters []string `yaml:"metadataFilters"`
}

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

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

Config describes the top level config file format.

type LimitOrderDistParams added in v0.37.0

type LimitOrderDistParams struct {
	Method              string  `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 ...

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 []LiquidityOrder `yaml:"sells"`
	Buys  []LiquidityOrder `yaml:"buys"`
}

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

type Strategy

type Strategy struct {
	ExpectedMarkPrice Uint `yaml:"expectedMarkPrice"`
	AuctionVolume     Uint `yaml:"auctionVolume"`
	MaxLong           Uint `yaml:"maxLong"`
	MaxShort          Uint `yaml:"maxShort"`

	PosManagementFraction float64 `yaml:"posManagementFraction"`
	StakeFraction         float64 `yaml:"stakeFraction"`
	OrdersFraction        float64 `yaml:"ordersFraction"`
	CommitmentFraction    float64 `yaml:"commitmentFraction"`
	Fee                   string  `yaml:"fee"`

	PosManagementSleepMilliseconds   int     `yaml:"posManagementSleepMilliseconds"`
	MarketPriceSteeringRatePerSecond float64 `yaml:"marketPriceSteeringRatePerSecond"`
	MinPriceSteerFraction            float64 `yaml:"minPriceSteerFraction"`
	PriceSteerOrderScale             float64 `yaml:"priceSteerOrderScale"`

	LimitOrderDistributionParams LimitOrderDistParams `yaml:"limitOrderDistributionParams"`
	TargetLNVol                  float64              `yaml:"targetLNVol"`

	ShorteningShape Shape `yaml:"shorteningShape"`
	LongeningShape  Shape `yaml:"longeningShape"`
}

Strategy describes parameters for the bot's strategy.

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 {
	RootPath    string `yaml:"rootPath"`
	TokenExpiry int    `yaml:"tokenExpiry"`
}

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