wsorderbook

package
v0.0.0-...-5388330 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: MIT Imports: 6 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, assetType string) *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, overwrite bool) 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

func (w *WebsocketOrderbookLocal) Update(orderbookUpdate *WebsocketOrderbookUpdate) error

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
	AssetType    string
	Action       string // Used in conjunction with UpdateEntriesByID
	Bids         []orderbook.Item
	Asks         []orderbook.Item
	CurrencyPair 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