data

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventTime

func EventTime(event model.MarketEvent) time.Time

Types

type BarAggregator

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

func NewBarAggregator

func NewBarAggregator(barType model.BarType) (*BarAggregator, error)

func (*BarAggregator) Flush

func (a *BarAggregator) Flush() (model.Bar, bool, error)

func (*BarAggregator) Update

func (a *BarAggregator) Update(event model.MarketEvent) (model.Bar, bool, error)

type Catalog

type Catalog interface {
	Write(context.Context, ...model.MarketEvent) error
	Query(context.Context, model.DataRequest) (model.DataResponse, error)
}

type ClientHealth

type ClientHealth struct {
	Venue    model.Venue
	ClientID string
	Health   venue.DataHealth
	Stale    bool
}

type Config

type Config struct {
	Bus             *bus.Bus
	Cache           *cache.Cache
	Catalog         Catalog
	ReconnectPolicy RetryPolicy
	StaleAfter      time.Duration
}

type Engine

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

func NewEngine

func NewEngine(cfg Config) *Engine

func (*Engine) AddBarAggregation

func (e *Engine) AddBarAggregation(barType model.BarType) error

func (*Engine) AddClient

func (e *Engine) AddClient(client venue.DataClient) error

func (*Engine) Events

func (e *Engine) Events() <-chan model.MarketEvent

func (*Engine) Health

func (e *Engine) Health() Health

func (*Engine) Request

func (e *Engine) Request(ctx context.Context, request model.DataRequest) (model.DataResponse, error)

func (*Engine) Start

func (e *Engine) Start(ctx context.Context) error

func (*Engine) Stop

func (e *Engine) Stop(ctx context.Context) error

func (*Engine) Subscribe

func (e *Engine) Subscribe(ctx context.Context, sub model.SubscribeMarketData) error

func (*Engine) Unsubscribe

func (e *Engine) Unsubscribe(ctx context.Context, sub model.SubscribeMarketData) error

type Health

type Health struct {
	Running        bool
	Clients        int
	Subscriptions  int
	Events         int64
	Requests       int64
	AggregatedBars int64
	StaleClients   int
	LastEventTime  time.Time
	LastError      error
	ClientsHealth  []ClientHealth
}

type MemoryCatalog

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

func NewMemoryCatalog

func NewMemoryCatalog(events ...model.MarketEvent) *MemoryCatalog

func (*MemoryCatalog) Events

func (*MemoryCatalog) Query

func (*MemoryCatalog) Write

func (c *MemoryCatalog) Write(_ context.Context, events ...model.MarketEvent) error

type ReplayCatalog

type ReplayCatalog interface {
	Catalog
	Events(context.Context) ([]model.MarketEvent, error)
}

type RetryPolicy

type RetryPolicy struct {
	MaxAttempts int
	Backoff     time.Duration
}

Jump to

Keyboard shortcuts

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