statevar

package
v0.73.6-patch.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StateVarEventTypeToName = map[EventType]string{
	EventTypeAuctionUnknown:                     "unknown",
	EventTypeMarketEnactment:                    "market-enacted",
	EventTypeOpeningAuctionFirstUncrossingPrice: "opening-auction-first-uncrossing-price",
	EventTypeAuctionEnded:                       "auction-ended",
	EventTypeTimeTrigger:                        "time-trigger",
	EventTypeMarketUpdated:                      "market-updated",
}

Functions

func ValueFromProto

func ValueFromProto(val *vega.StateVarValue) (value, error)

ValueFromProto converts the proto into a value.

Types

type Converter

type Converter interface {
	BundleToInterface(*KeyValueBundle) StateVariableResult
	InterfaceToBundle(StateVariableResult) *KeyValueBundle
}

type DecimalMatrix

type DecimalMatrix struct {
	Val [][]num.Decimal
}

func (*DecimalMatrix) Equals

func (dm *DecimalMatrix) Equals(other value) bool

Equals returns true of the other value is a matrix of floating point values with the same shape and equals values.

func (DecimalMatrix) ToProto

func (dm DecimalMatrix) ToProto() *vega.StateVarValue

ToProto converts the state variable value to protobuf.

func (*DecimalMatrix) WithinTolerance

func (dm *DecimalMatrix) WithinTolerance(other value, tolerance num.Decimal) bool

WithinTolerance returns true if the other value is a matrix and has the same shape and values in the same index are within the given tolerance of each other.

type DecimalScalar

type DecimalScalar struct {
	Val num.Decimal
}

DecimalScalar is a scalar floating point value.

func (*DecimalScalar) Equals

func (dv *DecimalScalar) Equals(other value) bool

Equals returns true of the other value is a scalar floating point with equals value.

func (*DecimalScalar) ToProto

func (dv *DecimalScalar) ToProto() *vega.StateVarValue

ToProto converts the state variable value to protobuf.

func (*DecimalScalar) WithinTolerance

func (dv *DecimalScalar) WithinTolerance(other value, tolerance num.Decimal) bool

WithinTolerance returns true if the other value is a scalar value and is equal to this scalar value within the given tolerance.

type DecimalVector

type DecimalVector struct {
	Val []num.Decimal
}

func (*DecimalVector) Equals

func (dv *DecimalVector) Equals(other value) bool

Equals returns true of the other value is a vector of floating point values with the same shape and equals values.

func (*DecimalVector) ToProto

func (dv *DecimalVector) ToProto() *vega.StateVarValue

ToProto converts the state variable value to protobuf.

func (*DecimalVector) WithinTolerance

func (dv *DecimalVector) WithinTolerance(other value, tolerance num.Decimal) bool

WithinTolerance returns true if the other value is a vector and has the same shape and values in the same index are within the given tolerance of each other.

type EventType added in v0.55.0

type EventType int

EventType enumeration for supported events triggering calculation.

const (
	EventTypeAuctionUnknown EventType = iota
	EventTypeMarketEnactment
	EventTypeOpeningAuctionFirstUncrossingPrice
	EventTypeAuctionEnded
	EventTypeTimeTrigger
	EventTypeMarketUpdated
)

type FinaliseCalculation

type FinaliseCalculation interface {
	CalculationFinished(string, StateVariableResult, error)
}

type KeyValueBundle

type KeyValueBundle struct {
	KVT []KeyValueTol
}

KeyValueBundle is a slice of key value and their expected tolerances.

func KeyValueBundleFromProto

func KeyValueBundleFromProto(protoKVT []*vega.KeyValueBundle) (*KeyValueBundle, error)

KeyValueBundleFromProto converts from proto into KeyValueBundle.

func (*KeyValueBundle) Equals

func (kvb *KeyValueBundle) Equals(other *KeyValueBundle) bool

Equals returns true of the two bundles have the same keys in the same order and the values in the same index are equal.

func (KeyValueBundle) ToProto

func (kvb KeyValueBundle) ToProto() []*vega.KeyValueBundle

ToProto converts KevValueBundle into proto.

func (*KeyValueBundle) WithinTolerance

func (kvb *KeyValueBundle) WithinTolerance(other *KeyValueBundle) bool

WithinTolerance returns true if the two bundles have the same keys, same tolerances and the values at the same index are with the tolerance of each other.

type KeyValueTol

type KeyValueTol struct {
	Key       string      // the name of the key
	Val       value       // the floating point value (scalar, vector, matrix)
	Tolerance num.Decimal // the tolerance to use in comparison
}

type StateVariableResult

type StateVariableResult interface{}

Jump to

Keyboard shortcuts

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