engine

package
v0.0.0-...-362a7da Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderActionCreate = "CREATE"
	OrderActionCancel = "CANCEL"

	EventQueueSize = 8192
)
View Source
const (
	OrderTypeLimit  = "LIMIT"
	OrderTypeMarket = "MARKET"
)
View Source
const (
	PageSideAsk = "ASK"
	PageSideBid = "BID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Book

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

func NewBook

func NewBook(ctx context.Context, market string, transact TransactCallback, cancel CancelCallback) *Book

func (*Book) AttachOrderEvent

func (book *Book) AttachOrderEvent(ctx context.Context, order *Order, action string)

func (*Book) Run

func (book *Book) Run(ctx context.Context)

type CancelCallback

type CancelCallback func(order *Order)

type Entry

type Entry struct {
	Side   string         `json:"side"`
	Price  number.Integer `json:"price"`
	Amount number.Decimal `json:"amount"`
	Funds  number.Decimal `json:"funds"`
	// contains filtered or unexported fields
}

type Order

type Order struct {
	Id              string
	Side            string
	Type            string
	Price           number.Integer
	RemainingAmount number.Integer
	FilledAmount    number.Integer
	RemainingFunds  number.Integer
	FilledFunds     number.Integer

	Quote    string
	Base     string
	UserId   string
	BrokerId string
}

type OrderEvent

type OrderEvent struct {
	Order  *Order
	Action string
}

type Page

type Page struct {
	Side string
	// contains filtered or unexported fields
}

func NewPage

func NewPage(side string) *Page

func (*Page) Iterate

func (page *Page) Iterate(hook func(*Order) (number.Integer, number.Integer, bool))

func (*Page) List

func (page *Page) List(count int, filterEmpty bool) []*Entry

func (*Page) Put

func (page *Page) Put(order *Order)

func (*Page) Remove

func (page *Page) Remove(o *Order) *Order

type TransactCallback

type TransactCallback func(taker, maker *Order, amount number.Integer) string

Jump to

Keyboard shortcuts

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