orderbook

package
v0.0.0-...-6afe3c7 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBook

func NewBook() *book

func NewBookLimit

func NewBookLimit() *bookLimit

func NewBookSnapshotRecord

func NewBookSnapshotRecord(price, size decimal.Decimal) *bookSnapshotRecord

Types

type Book

type Book interface {
	AddBuyOrder(order model.Order)
	AddSellOrder(order model.Order)
	CancelOrder(order model.Order) ([]model.OrderCancellation, error)
	ClearBuySideByUnitsAndPrice(units decimal.Decimal, price decimal.Decimal) (clearedOrders []*model.Order)
	ClearSellSideByUnitsAndPrice(units decimal.Decimal, price decimal.Decimal) (clearedOrders []*model.Order)
	ClearBuySideByUnits(units decimal.Decimal) (clearedOrders []*model.Order)
	ClearSellSideByUnits(units decimal.Decimal) (clearedOrders []*model.Order)
	GetFullSnapshot() *BookSnapshot
	GetSnapshotWithDepth(depth int) *BookSnapshot
	GetTotalBuyUnitsFromPrice(price decimal.Decimal) decimal.Decimal
	GetTotalSellUnitsToPrice(price decimal.Decimal) decimal.Decimal
	GetHighestBuy() *bookLimit
	GetLowestSell() *bookLimit
}

type BookSnapshot

type BookSnapshot struct {
	Buys  []*bookSnapshotRecord `json:"buys"`
	Sells []*bookSnapshotRecord `json:"sells"`
}

func NewBookSnapshot

func NewBookSnapshot() *BookSnapshot

func (*BookSnapshot) AppendBuy

func (sn *BookSnapshot) AppendBuy(record *bookSnapshotRecord)

func (*BookSnapshot) AppendSell

func (sn *BookSnapshot) AppendSell(record *bookSnapshotRecord)

Jump to

Keyboard shortcuts

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