matcheng

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AssetDecimals = 18
)

Variables

This section is empty.

Functions

func NormalizeQuoteQuantity

func NormalizeQuoteQuantity(quotePrice sdk.Uint, baseQuantity sdk.Uint) (sdk.Uint, error)

func PlotCurves

func PlotCurves(bids []AggregatePrice, asks []AggregatePrice) string

func ReturnMatcher

func ReturnMatcher(m *Matcher)

Types

type AggregatePrice

type AggregatePrice [2]sdk.Uint

type Direction

type Direction uint8
const (
	Bid Direction = iota
	Ask
)

func (Direction) MarshalJSON

func (d Direction) MarshalJSON() ([]byte, error)

func (Direction) String

func (d Direction) String() string

func (*Direction) UnmarshalJSON

func (d *Direction) UnmarshalJSON(data []byte) error

type Fill

type Fill struct {
	OrderID     store.EntityID
	QtyFilled   sdk.Uint
	QtyUnfilled sdk.Uint
}

type MatchEntry

type MatchEntry [3]sdk.Uint

type MatchResults

type MatchResults struct {
	ClearingPrice sdk.Uint
	Fills         []Fill
	MatchTable    []MatchEntry
	BidAggregates []AggregatePrice
	AskAggregates []AggregatePrice
}

type Matcher

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

func GetMatcher

func GetMatcher() *Matcher

func NewMatcher

func NewMatcher() *Matcher

func (*Matcher) EnqueueOrder

func (m *Matcher) EnqueueOrder(oType Direction, id store.EntityID, price sdk.Uint, quantity sdk.Uint)

func (*Matcher) Match

func (m *Matcher) Match() *MatchResults

func (*Matcher) Reset

func (m *Matcher) Reset()

type Order

type Order struct {
	ID       store.EntityID
	Price    sdk.Uint
	Quantity sdk.Uint
}

Jump to

Keyboard shortcuts

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