Documentation ¶
Index ¶
- type Action
- type Orderbook
- func (w *Orderbook) FlushBuffer()
- func (w *Orderbook) FlushOrderbook(p currency.Pair, a asset.Item) error
- func (w *Orderbook) GetOrderbook(p currency.Pair, a asset.Item) (*orderbook.Base, error)
- func (w *Orderbook) LoadSnapshot(book *orderbook.Base) error
- func (w *Orderbook) Setup(cfg *config.Exchange, ...) error
- func (w *Orderbook) Update(u *Update) error
- type Update
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action string
Action defines a set of differing states required to implement an incoming orderbook update used in conjunction with UpdateEntriesByID
const ( // Amend applies amount adjustment by ID Amend Action = "update" // Delete removes price level from book by ID Delete Action = "delete" // Insert adds price level to book Insert Action = "insert" // UpdateInsert on conflict applies amount adjustment or appends new amount // to book UpdateInsert Action = "update/insert" )
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 ¶
FlushOrderbook flushes independent orderbook
func (*Orderbook) GetOrderbook ¶
GetOrderbook returns an orderbook copy as orderbook.Base
func (*Orderbook) LoadSnapshot ¶
LoadSnapshot loads initial snapshot of orderbook data from websocket
type Update ¶
type Update struct { UpdateID int64 // Used when no time is provided UpdateTime time.Time Asset asset.Item Action Bids []orderbook.Item Asks []orderbook.Item Pair currency.Pair // Determines if there is a max depth of orderbooks and after an append we // should remove any items that are outside of this scope. Kraken is the // only exchange utilising this field. MaxDepth int }
Update stores orderbook updates and dictates what features to use when processing