buffer

package
v0.0.0-...-219ed90 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 11 Imported by: 64

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// SortBuffer enables a websocket to sort incoming updates before processing.
	SortBuffer bool
	// SortBufferByUpdateIDs allows the sorting of the buffered updates by their
	// corresponding update IDs.
	SortBufferByUpdateIDs bool
	// UpdateEntriesByID will match by IDs instead of price to perform the an
	// action. e.g. update, delete, insert.
	UpdateEntriesByID bool
	// UpdateIDProgression requires that the new update ID be greater than the
	// prior ID. This will skip processing and not error.
	UpdateIDProgression bool
	// Checksum is a package defined checksum calculation for updated books.
	Checksum func(state *orderbook.Base, checksum uint32) error
}

Config defines the configuration variables for the websocket buffer; snapshot and incremental update orderbook processing.

type Orderbook

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

Orderbook defines a local cache of orderbooks for amending, appending and deleting changes and updates the main store for a stream

func (*Orderbook) FlushBuffer

func (w *Orderbook) FlushBuffer()

FlushBuffer flushes w.ob data to be garbage collected and refreshed when a connection is lost and reconnected

func (*Orderbook) FlushOrderbook

func (w *Orderbook) FlushOrderbook(p currency.Pair, a asset.Item) error

FlushOrderbook flushes independent orderbook

func (*Orderbook) GetOrderbook

func (w *Orderbook) GetOrderbook(p currency.Pair, a asset.Item) (*orderbook.Base, error)

GetOrderbook returns an orderbook copy as orderbook.Base

func (*Orderbook) LoadSnapshot

func (w *Orderbook) LoadSnapshot(book *orderbook.Base) error

LoadSnapshot loads initial snapshot of orderbook data from websocket

func (*Orderbook) Setup

func (w *Orderbook) Setup(exchangeConfig *config.Exchange, c *Config, dataHandler chan<- interface{}) error

Setup sets private variables

func (*Orderbook) Update

func (w *Orderbook) Update(u *orderbook.Update) error

Update updates a stored pointer to an orderbook.Depth struct containing a bid and ask Tranches, this switches between the usage of a buffered update

Jump to

Keyboard shortcuts

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