event

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: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BalanceSize = int(unsafe.Sizeof(common.Balance{}))

	// RespBalanceSnapshotHeaderSize is the size of respBalanceSnapshotHeader.
	RespBalanceSnapshotHeaderSize = int(unsafe.Sizeof(respBalanceSnapshotHeader{}))

	// BalanceUpdateHeaderSize is the size of balanceUpdateHeader.
	BalanceUpdateHeaderSize = int(unsafe.Sizeof(balanceUpdateHeader{}))
)
View Source
const (
	PriceLevelSize          = int(unsafe.Sizeof(common.PriceLevel{}))
	DepthSnapshotHeaderSize = int(unsafe.Sizeof(depthSnapshotHeader{}))
	DepthUpdateHeaderSize   = int(unsafe.Sizeof(depthUpdateHeader{}))
)

Exported layout constants for direct buffer manipulation (used by HTTP adapters).

View Source
const (
	KlineBarSize                  = int(unsafe.Sizeof(KlineBar{}))
	RespHistoricalKlineHeaderSize = int(unsafe.Sizeof(respHistoricalKlineHeader{}))
)

Variables

View Source
var ErrBufferTooSmall = codec.ErrBufferTooSmall

ErrBufferTooSmall is returned when the provided buffer is too small for encoding or decoding. It is the same error value as codec.ErrBufferTooSmall so identity comparisons work across packages.

View Source
var ErrInvalidBuffer = errors.New("invalid buffer layout")

ErrInvalidBuffer is returned when a decoded buffer is structurally invalid (e.g. its length does not match the header-declared element counts).

Functions

func AppendEventJSON

func AppendEventJSON(dst []byte, topic Topic, buf []byte) []byte

AppendEventJSON decodes buf for topic and appends the typed JSON object. On decode failure it appends {"decode_error":"..."}. Unknown topics append {"raw_len":N}. Empty buf appends null.

Types

type AbnormalEvent

type AbnormalEvent struct {
	Source    common.EngineType
	ErrorCode int
	Timestamp uint64
}

func NewAbnormalEventFromBytes

func NewAbnormalEventFromBytes(buf []byte) (AbnormalEvent, error)

func (AbnormalEvent) AppendJSON

func (a AbnormalEvent) AppendJSON(dst []byte) []byte

func (AbnormalEvent) Encode

func (a AbnormalEvent) Encode(buf []byte) error

func (AbnormalEvent) GetBufferLength

func (a AbnormalEvent) GetBufferLength() int

func (AbnormalEvent) Topic

func (a AbnormalEvent) Topic() Topic

type BalanceUpdate

type BalanceUpdate struct {
	AccountID int
	WalletID  int
	Balances  []common.Balance
	UpdatedAt uint64
}

func NewBalanceUpdateFromBytes

func NewBalanceUpdateFromBytes(buf []byte) (BalanceUpdate, error)

NewBalanceUpdateFromBytes interprets buf as a BalanceUpdate. The buffer length is validated against the header-declared balance count before any read. The Balances slice is a zero-copy view into buf and is only valid while buf is (i.e. within the dispatch handler, before the event's arena reservation is released).

func (BalanceUpdate) AppendJSON

func (b BalanceUpdate) AppendJSON(dst []byte) []byte

func (BalanceUpdate) Encode

func (b BalanceUpdate) Encode(buf []byte) error

Encode writes the BalanceUpdate into buf (layout: balanceUpdateHeader).

func (BalanceUpdate) GetBufferLength

func (b BalanceUpdate) GetBufferLength() int

GetBufferLength returns the number of bytes needed to encode a BalanceUpdate.

func (BalanceUpdate) Topic

func (b BalanceUpdate) Topic() Topic

type DepthSnapshot

type DepthSnapshot struct {
	SymbolID  int
	DepthID   int
	Timestamp uint64
	Asks      []common.PriceLevel
	Bids      []common.PriceLevel
}

func NewDepthSnapshotFromBytes

func NewDepthSnapshotFromBytes(buf []byte) (DepthSnapshot, error)

NewDepthSnapshotFromBytes interprets buf as a DepthSnapshot. The buffer length is validated against the header-declared level counts before any read. The Asks/Bids slices are zero-copy views into buf and are only valid while buf is (i.e. within the dispatch handler, before the event's arena reservation is released). Prefer NewDepthSnapshotView, which avoids materializing the slices at all.

func (DepthSnapshot) AppendJSON

func (d DepthSnapshot) AppendJSON(dst []byte) []byte

func (DepthSnapshot) Encode

func (d DepthSnapshot) Encode(buf []byte) error

Encode writes the DepthSnapshot into buf (snapshot layout, see depthSnapshotHeader).

func (DepthSnapshot) GetBufferLength

func (d DepthSnapshot) GetBufferLength() int

GetBufferLength returns the number of bytes needed to encode a DepthSnapshot.

func (DepthSnapshot) Topic

func (d DepthSnapshot) Topic() Topic

type DepthSnapshotView

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

DepthSnapshotView is a zero-copy view over an encoded DepthSnapshot or RespDepthSnapshot (they share the same wire layout, depthSnapshotHeader).

func NewDepthSnapshotView

func NewDepthSnapshotView(buf []byte) (DepthSnapshotView, error)

NewDepthSnapshotView validates the minimum length and the header + n*PriceLevelSize invariant, then wraps buf without copying.

func (DepthSnapshotView) Ask

Ask returns the i-th ask level by value (copied out of the buffer). Panics if i is out of [0, NumAsks()).

func (DepthSnapshotView) Asks

func (v DepthSnapshotView) Asks() []common.PriceLevel

Asks returns a zero-copy slice aliasing the buffer's ask levels. Same lifetime contract as the view itself.

func (DepthSnapshotView) Bid

Bid returns the i-th bid level by value (copied out of the buffer). Panics if i is out of [0, NumBids()).

func (DepthSnapshotView) Bids

func (v DepthSnapshotView) Bids() []common.PriceLevel

Bids returns a zero-copy slice aliasing the buffer's bid levels. Same lifetime contract as the view itself.

func (DepthSnapshotView) DepthID

func (v DepthSnapshotView) DepthID() int

func (DepthSnapshotView) NumAsks

func (v DepthSnapshotView) NumAsks() int

func (DepthSnapshotView) NumBids

func (v DepthSnapshotView) NumBids() int

func (DepthSnapshotView) SymbolID

func (v DepthSnapshotView) SymbolID() int

func (DepthSnapshotView) Timestamp

func (v DepthSnapshotView) Timestamp() uint64

type DepthUpdate

type DepthUpdate struct {
	SymbolID        int
	PreviousDepthID int
	DepthID         int
	CurrentDepthID  int
	NextDepthID     int
	Timestamp       uint64
	Asks            []common.PriceLevel
	Bids            []common.PriceLevel
}

func NewDepthUpdateFromBytes

func NewDepthUpdateFromBytes(buf []byte) (DepthUpdate, error)

NewDepthUpdateFromBytes interprets buf as a DepthUpdate. The buffer length is validated against the header-declared level counts before any read. The Asks/Bids slices are zero-copy views into buf and are only valid while buf is (i.e. within the dispatch handler, before the event's arena reservation is released). Prefer NewDepthUpdateView, which avoids materializing the slices at all.

func (DepthUpdate) AppendJSON

func (d DepthUpdate) AppendJSON(dst []byte) []byte

func (DepthUpdate) Encode

func (d DepthUpdate) Encode(buf []byte) error

Encode writes the DepthUpdate into buf (update layout, see depthUpdateHeader).

func (DepthUpdate) GetBufferLength

func (d DepthUpdate) GetBufferLength() int

GetBufferLength returns the number of bytes needed to encode a DepthUpdate.

func (DepthUpdate) Topic

func (d DepthUpdate) Topic() Topic

type DepthUpdateView

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

DepthUpdateView is a zero-copy view over an encoded DepthUpdate (wire layout: depthUpdateHeader).

func NewDepthUpdateView

func NewDepthUpdateView(buf []byte) (DepthUpdateView, error)

NewDepthUpdateView validates the minimum length and the header + n*PriceLevelSize invariant, then wraps buf without copying.

func (DepthUpdateView) Ask

Ask returns the i-th ask level by value (copied out of the buffer). Panics if i is out of [0, NumAsks()).

func (DepthUpdateView) Asks

func (v DepthUpdateView) Asks() []common.PriceLevel

Asks returns a zero-copy slice aliasing the buffer's ask levels. Same lifetime contract as the view itself.

func (DepthUpdateView) Bid

Bid returns the i-th bid level by value (copied out of the buffer). Panics if i is out of [0, NumBids()).

func (DepthUpdateView) Bids

func (v DepthUpdateView) Bids() []common.PriceLevel

Bids returns a zero-copy slice aliasing the buffer's bid levels. Same lifetime contract as the view itself.

func (DepthUpdateView) CurrentDepthID

func (v DepthUpdateView) CurrentDepthID() int

func (DepthUpdateView) DepthID

func (v DepthUpdateView) DepthID() int

func (DepthUpdateView) NextDepthID

func (v DepthUpdateView) NextDepthID() int

func (DepthUpdateView) NumAsks

func (v DepthUpdateView) NumAsks() int

func (DepthUpdateView) NumBids

func (v DepthUpdateView) NumBids() int

func (DepthUpdateView) PreviousDepthID

func (v DepthUpdateView) PreviousDepthID() int

func (DepthUpdateView) SymbolID

func (v DepthUpdateView) SymbolID() int

func (DepthUpdateView) Timestamp

func (v DepthUpdateView) Timestamp() uint64

type Execution

type Execution struct {
	ClientOrderID int
	OrderID       int
	AccountID     int
	SymbolID      int
	Side          common.Side
	IsMaker       bool
	FillID        int
	FilledQty     float64
	FilledPrice   float64
	FeeCcyID      int
	FeeQty        float64
	FilledAt      uint64
}

func NewExecutionFromBytes

func NewExecutionFromBytes(buf []byte) (Execution, error)

func (Execution) AppendJSON

func (e Execution) AppendJSON(dst []byte) []byte

func (Execution) Encode

func (e Execution) Encode(buf []byte) error

func (Execution) GetBufferLength

func (e Execution) GetBufferLength() int

func (Execution) Topic

func (e Execution) Topic() Topic

type FinishedEvent

type FinishedEvent struct {
	Source    common.EngineType
	Timestamp uint64
}

func NewFinishedEventFromBytes

func NewFinishedEventFromBytes(buf []byte) (FinishedEvent, error)

func (FinishedEvent) AppendJSON

func (f FinishedEvent) AppendJSON(dst []byte) []byte

func (FinishedEvent) Encode

func (f FinishedEvent) Encode(buf []byte) error

func (FinishedEvent) GetBufferLength

func (f FinishedEvent) GetBufferLength() int

func (FinishedEvent) Topic

func (f FinishedEvent) Topic() Topic

type Kline

type Kline struct {
	SymbolID    int
	Interval    common.Interval
	StartTime   uint64 // candle open time, nanoseconds
	EndTime     uint64 // candle close time, nanoseconds
	Timestamp   uint64 // venue event / last-match time, nanoseconds
	Open        float64
	High        float64
	Low         float64
	Close       float64
	Volume      float64 // base asset volume
	QuoteVolume float64 // quote asset volume / turnover
	TradeCount  int
	Closed      bool // true when the candle is finalized
}

Kline is a candlestick / OHLCV update from a venue kline stream.

func NewKlineFromBytes

func NewKlineFromBytes(buf []byte) (Kline, error)

NewKlineFromBytes decodes a Kline by copying out of buf (bounds-checked).

func (Kline) AppendJSON

func (k Kline) AppendJSON(dst []byte) []byte

func (Kline) Encode

func (k Kline) Encode(buf []byte) error

Encode writes the Kline into buf. Returns an error if buf is too small.

func (Kline) GetBufferLength

func (k Kline) GetBufferLength() int

GetBufferLength returns the number of bytes needed to encode a Kline.

func (Kline) Topic

func (k Kline) Topic() Topic

type KlineBar

type KlineBar struct {
	StartTime   uint64
	EndTime     uint64
	Timestamp   uint64
	Open        float64
	High        float64
	Low         float64
	Close       float64
	Volume      float64
	QuoteVolume float64
	TradeCount  int
	Closed      bool
}

KlineBar is one OHLCV bar inside RespHistoricalKline (no symbol/interval; those live on the response header). Times are nanoseconds.

func (KlineBar) AppendJSON

func (b KlineBar) AppendJSON(dst []byte) []byte

type OrderAccepted

type OrderAccepted struct {
	ClientOrderID int
	OrderID       int
	AccountID     int
	CreatedAt     uint64
}

func NewOrderAcceptedFromBytes

func NewOrderAcceptedFromBytes(buf []byte) (OrderAccepted, error)

func (OrderAccepted) AppendJSON

func (o OrderAccepted) AppendJSON(dst []byte) []byte

func (OrderAccepted) Encode

func (o OrderAccepted) Encode(buf []byte) error

func (OrderAccepted) GetBufferLength

func (o OrderAccepted) GetBufferLength() int

func (OrderAccepted) Topic

func (o OrderAccepted) Topic() Topic

type OrderCanceled

type OrderCanceled struct {
	ClientOrderID int
	OrderID       int
	AccountID     int
	ErrorCode     int // 0 = success, non-zero = exchange error code
	UpdatedAt     uint64
}

func NewOrderCanceledFromBytes

func NewOrderCanceledFromBytes(buf []byte) (OrderCanceled, error)

func (OrderCanceled) AppendJSON

func (o OrderCanceled) AppendJSON(dst []byte) []byte

func (OrderCanceled) Encode

func (o OrderCanceled) Encode(buf []byte) error

func (OrderCanceled) GetBufferLength

func (o OrderCanceled) GetBufferLength() int

func (OrderCanceled) Topic

func (o OrderCanceled) Topic() Topic

type OrderError

type OrderError struct {
	ClientOrderID int
	OrderID       int
	AccountID     int
	ErrorCode     int
	Msg           string
}

func NewOrderErrorFromBytes

func NewOrderErrorFromBytes(buf []byte) (OrderError, error)

func (OrderError) AppendJSON

func (o OrderError) AppendJSON(dst []byte) []byte

func (OrderError) Encode

func (o OrderError) Encode(buf []byte) error

func (OrderError) GetBufferLength

func (o OrderError) GetBufferLength() int

func (OrderError) Topic

func (o OrderError) Topic() Topic

type OrderFilled

type OrderFilled struct {
	ClientOrderID int
	OrderID       int
	AccountID     int
	ExecutedQty   float64
	UpdatedAt     uint64
}

func NewOrderFilledFromBytes

func NewOrderFilledFromBytes(buf []byte) (OrderFilled, error)

func (OrderFilled) AppendJSON

func (o OrderFilled) AppendJSON(dst []byte) []byte

func (OrderFilled) Encode

func (o OrderFilled) Encode(buf []byte) error

func (OrderFilled) GetBufferLength

func (o OrderFilled) GetBufferLength() int

func (OrderFilled) Topic

func (o OrderFilled) Topic() Topic

type OrderNew

type OrderNew struct {
	AccountID     int
	ClientOrderID int
	OrderID       int
	SymbolID      int
	Side          common.Side
	OrderType     common.OrderType
	TimeInForce   common.TimeInForce
	Quantity      float64
	Price         float64
	ExecutedQty   float64
	CreatedAt     uint64
	UpdatedAt     uint64
}

func NewOrderNewFromBytes

func NewOrderNewFromBytes(buf []byte) (OrderNew, error)

func (OrderNew) AppendJSON

func (o OrderNew) AppendJSON(dst []byte) []byte

func (OrderNew) Encode

func (o OrderNew) Encode(buf []byte) error

func (OrderNew) GetBufferLength

func (o OrderNew) GetBufferLength() int

func (OrderNew) Topic

func (o OrderNew) Topic() Topic

type OrderPartiallyFilled

type OrderPartiallyFilled struct {
	ClientOrderID int
	OrderID       int
	AccountID     int
	ExecutedQty   float64
	UpdatedAt     uint64
}

func NewOrderPartiallyFilledFromBytes

func NewOrderPartiallyFilledFromBytes(buf []byte) (OrderPartiallyFilled, error)

func (OrderPartiallyFilled) AppendJSON

func (o OrderPartiallyFilled) AppendJSON(dst []byte) []byte

func (OrderPartiallyFilled) Encode

func (o OrderPartiallyFilled) Encode(buf []byte) error

func (OrderPartiallyFilled) GetBufferLength

func (o OrderPartiallyFilled) GetBufferLength() int

func (OrderPartiallyFilled) Topic

func (o OrderPartiallyFilled) Topic() Topic

type OrderRejected

type OrderRejected struct {
	ClientOrderID int
	OrderID       int
	AccountID     int
	ErrorCode     int
	UpdatedAt     uint64
	Msg           string
}

func NewOrderRejectedFromBytes

func NewOrderRejectedFromBytes(buf []byte) (OrderRejected, error)

func (OrderRejected) AppendJSON

func (o OrderRejected) AppendJSON(dst []byte) []byte

func (OrderRejected) Encode

func (o OrderRejected) Encode(buf []byte) error

func (OrderRejected) GetBufferLength

func (o OrderRejected) GetBufferLength() int

func (OrderRejected) Topic

func (o OrderRejected) Topic() Topic

type OrderRiskInvalid

type OrderRiskInvalid struct {
	ClientOrderID int
	AccountID     int
	ErrorCode     int
	Msg           string
}

func NewOrderRiskInvalidFromBytes

func NewOrderRiskInvalidFromBytes(buf []byte) (OrderRiskInvalid, error)

func (OrderRiskInvalid) AppendJSON

func (o OrderRiskInvalid) AppendJSON(dst []byte) []byte

func (OrderRiskInvalid) Encode

func (o OrderRiskInvalid) Encode(buf []byte) error

func (OrderRiskInvalid) GetBufferLength

func (o OrderRiskInvalid) GetBufferLength() int

func (OrderRiskInvalid) Topic

func (o OrderRiskInvalid) Topic() Topic

type OrderUnknownStatus

type OrderUnknownStatus struct {
	ClientOrderID int
	OrderID       int
	AccountID     int
	Msg           string
}

func NewOrderUnknownStatusFromBytes

func NewOrderUnknownStatusFromBytes(buf []byte) (OrderUnknownStatus, error)

func (OrderUnknownStatus) AppendJSON

func (o OrderUnknownStatus) AppendJSON(dst []byte) []byte

func (OrderUnknownStatus) Encode

func (o OrderUnknownStatus) Encode(buf []byte) error

func (OrderUnknownStatus) GetBufferLength

func (o OrderUnknownStatus) GetBufferLength() int

func (OrderUnknownStatus) Topic

func (o OrderUnknownStatus) Topic() Topic

type ReadyEvent

type ReadyEvent struct {
	Source    common.EngineType
	Timestamp uint64
}

func NewReadyEventFromBytes

func NewReadyEventFromBytes(buf []byte) (ReadyEvent, error)

func (ReadyEvent) AppendJSON

func (r ReadyEvent) AppendJSON(dst []byte) []byte

func (ReadyEvent) Encode

func (r ReadyEvent) Encode(buf []byte) error

func (ReadyEvent) GetBufferLength

func (r ReadyEvent) GetBufferLength() int

func (ReadyEvent) Topic

func (r ReadyEvent) Topic() Topic

type RespBalanceSnapshot

type RespBalanceSnapshot struct {
	AccountID int
	WalletID  int
	Balances  []common.Balance
}

func NewRespBalanceSnapshotFromBytes

func NewRespBalanceSnapshotFromBytes(buf []byte) (RespBalanceSnapshot, error)

NewRespBalanceSnapshotFromBytes interprets buf as a RespBalanceSnapshot. The buffer length is validated against the header-declared balance count before any read. The Balances slice is a zero-copy view into buf and is only valid while buf is (i.e. within the dispatch handler, before the event's arena reservation is released).

func (RespBalanceSnapshot) AppendJSON

func (r RespBalanceSnapshot) AppendJSON(dst []byte) []byte

func (RespBalanceSnapshot) Encode

func (r RespBalanceSnapshot) Encode(buf []byte) error

Encode writes the RespBalanceSnapshot into buf (layout: respBalanceSnapshotHeader).

func (RespBalanceSnapshot) GetBufferLength

func (r RespBalanceSnapshot) GetBufferLength() int

GetBufferLength returns the number of bytes needed to encode a RespBalanceSnapshot.

func (RespBalanceSnapshot) Topic

func (r RespBalanceSnapshot) Topic() Topic

type RespDepthSnapshot

type RespDepthSnapshot struct {
	SymbolID  int
	DepthID   int
	Timestamp uint64
	AskLength int                 // number of ask price levels
	BidLength int                 // number of bid price levels
	Asks      []common.PriceLevel // points into arena buffer
	Bids      []common.PriceLevel // points into arena buffer
}

func NewRespDepthSnapshotFromBytes

func NewRespDepthSnapshotFromBytes(buf []byte) (RespDepthSnapshot, error)

NewRespDepthSnapshotFromBytes interprets buf as a RespDepthSnapshot. Same validation and slice-lifetime contract as NewDepthSnapshotFromBytes.

func (RespDepthSnapshot) AppendJSON

func (r RespDepthSnapshot) AppendJSON(dst []byte) []byte

func (RespDepthSnapshot) Encode

func (r RespDepthSnapshot) Encode(buf []byte) error

Encode writes the RespDepthSnapshot into buf. Uses the same layout as DepthSnapshot.

func (RespDepthSnapshot) GetBufferLength

func (r RespDepthSnapshot) GetBufferLength() int

GetBufferLength returns the number of bytes needed to encode a RespDepthSnapshot.

func (RespDepthSnapshot) Topic

func (r RespDepthSnapshot) Topic() Topic

type RespHistoricalKline

type RespHistoricalKline struct {
	SymbolID int
	Interval common.Interval
	Bars     []KlineBar // may alias the arena buffer until the handler returns
}

RespHistoricalKline is the reply to CommandTypeReqHistoricalKline. Bars are ordered oldest → newest.

func NewRespHistoricalKlineFromBytes

func NewRespHistoricalKlineFromBytes(buf []byte) (RespHistoricalKline, error)

NewRespHistoricalKlineFromBytes interprets buf as a RespHistoricalKline. Bars is a zero-copy view into buf and is only valid while buf is.

func (RespHistoricalKline) AppendJSON

func (r RespHistoricalKline) AppendJSON(dst []byte) []byte

func (RespHistoricalKline) Encode

func (r RespHistoricalKline) Encode(buf []byte) error

Encode writes the RespHistoricalKline into buf.

func (RespHistoricalKline) GetBufferLength

func (r RespHistoricalKline) GetBufferLength() int

GetBufferLength returns the number of bytes needed to encode a RespHistoricalKline.

func (RespHistoricalKline) Topic

func (r RespHistoricalKline) Topic() Topic

type StopEvent

type StopEvent struct {
	Source    common.EngineType
	Timestamp uint64
}

func NewStopEventFromBytes

func NewStopEventFromBytes(buf []byte) (StopEvent, error)

func (StopEvent) AppendJSON

func (s StopEvent) AppendJSON(dst []byte) []byte

func (StopEvent) Encode

func (s StopEvent) Encode(buf []byte) error

func (StopEvent) GetBufferLength

func (s StopEvent) GetBufferLength() int

func (StopEvent) Topic

func (s StopEvent) Topic() Topic

type Tick

type Tick struct {
	SymbolID  int
	Timestamp uint64
	Side      common.Side
	Price     float64
	Qty       float64
}

func NewTickFromBytes

func NewTickFromBytes(buf []byte) (Tick, error)

NewTickFromBytes decodes a Tick by copying out of buf (bounds-checked).

func (Tick) AppendJSON

func (t Tick) AppendJSON(dst []byte) []byte

func (Tick) Encode

func (t Tick) Encode(buf []byte) error

Encode writes the Tick into buf. Returns an error if buf is too small.

func (Tick) GetBufferLength

func (t Tick) GetBufferLength() int

GetBufferLength returns the number of bytes needed to encode a Tick.

func (Tick) Topic

func (t Tick) Topic() Topic

type TimeEvent

type TimeEvent struct {
	TimerID     uint64
	ScheduledNs uint64
}

TimeEvent is published by the Clock on each timer tick. TimerID identifies which registered timer fired. ScheduledNs is the scheduled fire time (not wall-clock).

func NewTimeEventFromBytes

func NewTimeEventFromBytes(buf []byte) (TimeEvent, error)

func (TimeEvent) AppendJSON

func (t TimeEvent) AppendJSON(dst []byte) []byte

func (TimeEvent) Encode

func (t TimeEvent) Encode(buf []byte) error

func (TimeEvent) GetBufferLength

func (t TimeEvent) GetBufferLength() int

func (TimeEvent) Topic

func (t TimeEvent) Topic() Topic

type Topic

type Topic int
const (
	TopicEventUnknown   Topic = iota
	TopicEventUnhandled       // Known but not handled
	// State Topic
	TopicEventAbnormal
	TopicEventReady
	TopicEventStop
	TopicEventFinished
	// Market Data
	TopicEventDepthSnapshot
	TopicEventRespDepthSnapshot
	TopicEventDepthUpdate
	TopicEventTick
	// Execution Data
	TopicEventOrderUnknownStatus
	TopicEventOrderError
	TopicEventOrderRiskInvalid
	TopicEventOrderNew
	TopicEventOrderAccepted
	TopicEventOrderPartialFill
	TopicEventOrderFilled
	TopicEventExecution
	TopicEventOrderCanceled
	TopicEventOrderRejected
	// Reconciliation Data
	TopicEventRespBalanceSnapshot
	TopicEventBalanceUpdate
	// Timer
	TopicEventTimer
	// Market Data (appended: keep prior iota values stable)
	TopicEventKline
	TopicEventRespHistoricalKline

	// TopicCount is a sentinel: the number of defined topics. It must remain
	// the last entry in this block (used to size per-topic counter arrays).
	TopicCount
)

func ParseTopic

func ParseTopic(name string) (Topic, error)

ParseTopic converts a config string (e.g. "OrderNew") to its Topic constant.

func ParseTopics

func ParseTopics(names []string) ([]Topic, error)

ParseTopics converts a slice of config strings to a slice of Topics.

func (Topic) IsDroppable

func (t Topic) IsDroppable() bool

IsDroppable reports whether events of this topic may be dropped under overflow (ring buffer or arena full). Droppable topics are recoverable by construction: market-data topics are re-synced via depth-snapshot re-request on DepthID gap detection, and timer events are superseded by the next tick. All other topics (engine state, order lifecycle, execution, balance) are critical and must never be dropped.

func (Topic) String

func (t Topic) String() string

Jump to

Keyboard shortcuts

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