wsorderbook

package
v0.0.0-...-1ca2487 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WebsocketOrderbookLocal

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

WebsocketOrderbookLocal defines a local cache of orderbooks for amending, appending and deleting changes and updates the main store in wsorderbook.go

func (*WebsocketOrderbookLocal) FlushCache

func (w *WebsocketOrderbookLocal) FlushCache()

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

func (*WebsocketOrderbookLocal) GetOrderbook

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

GetOrderbook use sparingly. Modifying anything here will ruin hash calculation and cause problems

func (*WebsocketOrderbookLocal) LoadSnapshot

func (w *WebsocketOrderbookLocal) LoadSnapshot(newOrderbook *orderbook.Base) error

LoadSnapshot loads initial snapshot of ob data, overwrite allows full ob to be completely rewritten because the exchange is a doing a full update not an incremental one

func (*WebsocketOrderbookLocal) Setup

func (w *WebsocketOrderbookLocal) Setup(obBufferLimit int, bufferEnabled, sortBuffer, sortBufferByUpdateIDs, updateEntriesByID bool, exchangeName string)

Setup sets private variables

func (*WebsocketOrderbookLocal) Update

Update updates a local cache using bid targets and ask targets then updates main orderbook Volume == 0; deletion at price target Price target not found; append of price target Price target found; amend volume of price target

type WebsocketOrderbookUpdate

type WebsocketOrderbookUpdate struct {
	UpdateID   int64 // Used when no time is provided
	UpdateTime time.Time
	Asset      asset.Item
	Action     string // Used in conjunction with UpdateEntriesByID
	Bids       []orderbook.Item
	Asks       []orderbook.Item
	Pair       currency.Pair
}

WebsocketOrderbookUpdate stores orderbook updates and dictates what features to use when processing

Jump to

Keyboard shortcuts

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