orderbook

package
v0.0.0-...-364516c Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Front

type Front struct {
	Buy  PriceLevel
	Sell PriceLevel
}

func (Front) Spread

func (f Front) Spread() float64

type Iterator

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

func (*Iterator) Amount

func (it *Iterator) Amount() float64

func (*Iterator) First

func (it *Iterator) First() bool

func (*Iterator) Last

func (it *Iterator) Last() bool

func (*Iterator) Next

func (it *Iterator) Next() bool

func (*Iterator) Prev

func (it *Iterator) Prev() bool

func (*Iterator) Price

func (it *Iterator) Price() float64

type Order

type Order interface {
	ID() string
	Price() float64
	Amount() float64
	Side() Side
}

type Orderbook

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

func New

func New() *Orderbook

func NewWithPrecision

func NewWithPrecision(precision float64) *Orderbook

func NewWithPricer

func NewWithPricer(priceFn PricerFunc) *Orderbook

func (*Orderbook) Add

func (b *Orderbook) Add(o Order)

func (*Orderbook) BestSide

func (b *Orderbook) BestSide(side Side, amount float64) PriceLevel

func (*Orderbook) Front

func (b *Orderbook) Front(amount float64) Front

func (*Orderbook) Iterator

func (b *Orderbook) Iterator(side Side) Iterator

func (*Orderbook) Remove

func (b *Orderbook) Remove(id string)

type PriceLevel

type PriceLevel struct {
	Price  float64
	Amount float64
}

type PricerFunc

type PricerFunc func(o Order) float64

type Side

type Side string
const (
	Buy  Side = "BUY"
	Sell Side = "SELL"
)

Jump to

Keyboard shortcuts

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