Versions in this module Expand all Collapse all v1 v1.0.0 Jun 16, 2026 Changes in this version + const TopicError + const TopicExecution + const TopicMarketData + const TopicTimer + var ErrInvalidIndicator = fmt.Errorf("invalid indicator") + var ErrInvalidStrategyConfig = fmt.Errorf("invalid strategy config") + var ErrInvalidTimer = errors.New("invalid timer") + func ValidateTimer(name string, interval time.Duration) error + type AverageTrueRange struct + func NewAverageTrueRange(period int) (*AverageTrueRange, error) + func (a *AverageTrueRange) Count() int + func (a *AverageTrueRange) Initialized() bool + func (a *AverageTrueRange) Name() string + func (a *AverageTrueRange) Reset() + func (a *AverageTrueRange) UpdateBar(bar model.Bar) error + func (a *AverageTrueRange) Value() decimal.Decimal + type Clock interface + Now func() time.Time + type Engine struct + func NewEngine(b *bus.Bus, opts ...Option) *Engine + func (e *Engine) Add(s Strategy) error + func (e *Engine) Errors() <-chan error + func (e *Engine) Process(ctx context.Context, env bus.Envelope) error + func (e *Engine) Start(ctx context.Context) error + func (e *Engine) Stop(ctx context.Context) error + type ErrorEvent struct + Err error + Source string + type ExponentialMovingAverage struct + func NewExponentialMovingAverage(period int) (*ExponentialMovingAverage, error) + func (e *ExponentialMovingAverage) Count() int + func (e *ExponentialMovingAverage) Initialized() bool + func (e *ExponentialMovingAverage) Name() string + func (e *ExponentialMovingAverage) Reset() + func (e *ExponentialMovingAverage) Update(value decimal.Decimal) error + func (e *ExponentialMovingAverage) Value() decimal.Decimal + type Indicator interface + Count func() int + Initialized func() bool + Name func() string + Reset func() + Value func() decimal.Decimal + type Option func(*Engine) + func WithRuntime(runtime Runtime) Option + func WithSynchronousDispatch() Option + func WithTraderID(traderID model.TraderID) Option + type Runtime interface + BatchCancelOrders func(context.Context, model.BatchCancelOrders) ([]model.OrderStatusReport, error) + Cache func() *cache.Cache + CancelAllOrders func(context.Context, model.CancelAllOrders) ([]model.OrderStatusReport, error) + CancelOrder func(context.Context, model.CancelOrder) (model.OrderStatusReport, error) + CancelTimer func(context.Context, string) error + Clock func() Clock + Logger func() *slog.Logger + ModifyOrder func(context.Context, model.ModifyOrder) (model.OrderStatusReport, error) + OrderFactory func(model.AccountID) *model.OrderFactory + Portfolio func() *portfolio.Portfolio + QueryAccount func(context.Context, model.QueryAccount) (model.AccountSnapshot, error) + QueryOrder func(context.Context, model.QueryOrder) (model.OrderStatusReport, error) + RequestData func(context.Context, model.DataRequest) (model.DataResponse, error) + SetTimer func(context.Context, string, time.Duration) error + SubmitOrder func(context.Context, model.SubmitOrder) (model.OrderStatusReport, error) + SubmitOrderList func(context.Context, model.OrderList) ([]model.OrderStatusReport, error) + SubscribeBars func(context.Context, model.BarType) error + SubscribeFundingRates func(context.Context, model.InstrumentID) error + SubscribeMarketData func(context.Context, model.SubscribeMarketData) error + SubscribeOrderBookDepth func(context.Context, model.InstrumentID, int) error + SubscribeQuoteTicks func(context.Context, model.InstrumentID) error + SubscribeTicker func(context.Context, model.InstrumentID) error + SubscribeTradeTicks func(context.Context, model.InstrumentID) error + UnsubscribeBars func(context.Context, model.BarType) error + UnsubscribeFundingRates func(context.Context, model.InstrumentID) error + UnsubscribeMarketData func(context.Context, model.SubscribeMarketData) error + UnsubscribeOrderBookDepth func(context.Context, model.InstrumentID, int) error + UnsubscribeQuoteTicks func(context.Context, model.InstrumentID) error + UnsubscribeTicker func(context.Context, model.InstrumentID) error + UnsubscribeTradeTicks func(context.Context, model.InstrumentID) error + type Strategy interface + ID func() string + OnEvent func(context.Context, bus.Envelope) error + OnStart func(context.Context, Runtime) error + OnStop func(context.Context) error + type StrategyConfig struct + ID model.StrategyID + func (c StrategyConfig) Validate() error + type TimerEvent struct + Name string + Timestamp time.Time + type TypedStrategy struct + func NewTyped(id string, handler any) *TypedStrategy + func NewTypedWithConfig(cfg StrategyConfig, handler any) (*TypedStrategy, error) + func (s *TypedStrategy) ID() string + func (s *TypedStrategy) OnEvent(ctx context.Context, env bus.Envelope) error + func (s *TypedStrategy) OnStart(ctx context.Context, rt Runtime) error + func (s *TypedStrategy) OnStop(ctx context.Context) error + type WallClock struct + func (WallClock) Now() time.Time