orderbook

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// DefaultDepthUpdateBufferSize is the default capacity for depth update ring buffers
	DefaultDepthUpdateBufferSize = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	coreactor.ActorBase
	// contains filtered or unexported fields
}

Actor is the orderbook actor that maintains per-symbol order books, writes state to Cache, and requests snapshots via MsgBus commands.

func NewActor

func NewActor(cat *catalog.Catalog, c *cache.Cache) *Actor

NewActor creates a new orderbook Actor.

func (*Actor) Handle

func (a *Actor) Handle(ev msgbus.Event, bus *msgbus.MsgBus)

Handle dispatches events to the appropriate handler.

func (*Actor) OnInit

func (a *Actor) OnInit(config map[string]any)

OnInit decodes the config and registers the symbol for this orderbook.

func (*Actor) OnStart

func (a *Actor) OnStart()

OnStart is called once when the actor is started.

func (*Actor) OnStop

func (a *Actor) OnStop()

OnStop is called once when the actor is stopped.

func (*Actor) RegisterSymbol

func (a *Actor) RegisterSymbol(symbolID, pricePrecision, sizePrecision int)

RegisterSymbol registers a symbol with its precision info. Creates a new SymbolBook in WaitForSnapshot state.

type DepthUpdateBuffer

type DepthUpdateBuffer struct {
	PreviousDepthID int
	FirstDepthID    int
	FinalDepthID    int
	Timestamp       uint64
	Bids            []common.PriceLevel
	Asks            []common.PriceLevel
}

DepthUpdateBuffer holds a buffered depth update during sync. For Binance depth updates:

  • PreviousDepthID = U - 1 (one before first update ID)
  • FirstDepthID = U (first update ID in event)
  • FinalDepthID = u (final update ID in event)

type OrderbookConfig

type OrderbookConfig struct {
	Symbol string `yaml:"symbol"` // Universal ticker of the symbol to track
}

OrderbookConfig contains configuration for a single orderbook actor instance.

type SymbolBook

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

SymbolBook maintains the orderbook state for a single symbol. Uses btree.Map keyed by PriceTick for both bids and asks.

Jump to

Keyboard shortcuts

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