Documentation
¶
Index ¶
- Constants
- Variables
- func ValidateTimer(name string, interval time.Duration) error
- type AverageTrueRange
- type Clock
- type Engine
- type ErrorEvent
- type ExponentialMovingAverage
- 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
- type Option
- type Runtime
- type Strategy
- type StrategyConfig
- type TimerEvent
- type TypedStrategy
- type WallClock
Constants ¶
View Source
const ( TopicExecution = "execution" TopicMarketData = "market.data" TopicTimer = "timer" TopicError = "error" )
Variables ¶
View Source
var ErrInvalidIndicator = fmt.Errorf("invalid indicator")
View Source
var ErrInvalidStrategyConfig = fmt.Errorf("invalid strategy config")
View Source
var ErrInvalidTimer = errors.New("invalid timer")
Functions ¶
Types ¶
type AverageTrueRange ¶
type AverageTrueRange struct {
// contains filtered or unexported fields
}
func NewAverageTrueRange ¶
func NewAverageTrueRange(period int) (*AverageTrueRange, error)
func (*AverageTrueRange) Count ¶
func (a *AverageTrueRange) Count() int
func (*AverageTrueRange) Initialized ¶
func (a *AverageTrueRange) Initialized() bool
func (*AverageTrueRange) Name ¶
func (a *AverageTrueRange) Name() string
func (*AverageTrueRange) Reset ¶
func (a *AverageTrueRange) Reset()
func (*AverageTrueRange) Value ¶
func (a *AverageTrueRange) Value() decimal.Decimal
type ErrorEvent ¶
type ExponentialMovingAverage ¶
type ExponentialMovingAverage struct {
// contains filtered or unexported fields
}
func NewExponentialMovingAverage ¶
func NewExponentialMovingAverage(period int) (*ExponentialMovingAverage, error)
func (*ExponentialMovingAverage) Count ¶
func (e *ExponentialMovingAverage) Count() int
func (*ExponentialMovingAverage) Initialized ¶
func (e *ExponentialMovingAverage) Initialized() bool
func (*ExponentialMovingAverage) Name ¶
func (e *ExponentialMovingAverage) Name() string
func (*ExponentialMovingAverage) Reset ¶
func (e *ExponentialMovingAverage) Reset()
func (*ExponentialMovingAverage) Update ¶
func (e *ExponentialMovingAverage) Update(value decimal.Decimal) error
func (*ExponentialMovingAverage) Value ¶
func (e *ExponentialMovingAverage) Value() decimal.Decimal
type Option ¶
type Option func(*Engine)
func WithRuntime ¶
func WithSynchronousDispatch ¶
func WithSynchronousDispatch() Option
func WithTraderID ¶
type Runtime ¶
type Runtime interface {
Cache() *cache.Cache
Portfolio() *portfolio.Portfolio
Clock() Clock
Logger() *slog.Logger
SetTimer(context.Context, string, time.Duration) error
CancelTimer(context.Context, string) error
OrderFactory(model.AccountID) *model.OrderFactory
SubscribeMarketData(context.Context, model.SubscribeMarketData) error
UnsubscribeMarketData(context.Context, model.SubscribeMarketData) error
SubscribeTicker(context.Context, model.InstrumentID) error
UnsubscribeTicker(context.Context, model.InstrumentID) error
SubscribeTradeTicks(context.Context, model.InstrumentID) error
UnsubscribeTradeTicks(context.Context, model.InstrumentID) error
SubscribeQuoteTicks(context.Context, model.InstrumentID) error
UnsubscribeQuoteTicks(context.Context, model.InstrumentID) error
SubscribeFundingRates(context.Context, model.InstrumentID) error
UnsubscribeFundingRates(context.Context, model.InstrumentID) error
SubscribeBars(context.Context, model.BarType) error
UnsubscribeBars(context.Context, model.BarType) error
SubscribeOrderBookDepth(context.Context, model.InstrumentID, int) error
UnsubscribeOrderBookDepth(context.Context, model.InstrumentID, int) error
RequestData(context.Context, model.DataRequest) (model.DataResponse, error)
SubmitOrder(context.Context, model.SubmitOrder) (model.OrderStatusReport, error)
SubmitOrderList(context.Context, model.OrderList) ([]model.OrderStatusReport, error)
ModifyOrder(context.Context, model.ModifyOrder) (model.OrderStatusReport, error)
CancelOrder(context.Context, model.CancelOrder) (model.OrderStatusReport, error)
BatchCancelOrders(context.Context, model.BatchCancelOrders) ([]model.OrderStatusReport, error)
CancelAllOrders(context.Context, model.CancelAllOrders) ([]model.OrderStatusReport, error)
QueryOrder(context.Context, model.QueryOrder) (model.OrderStatusReport, error)
QueryAccount(context.Context, model.QueryAccount) (model.AccountSnapshot, error)
}
type StrategyConfig ¶
type StrategyConfig struct {
ID model.StrategyID
}
func (StrategyConfig) Validate ¶
func (c StrategyConfig) Validate() error
type TimerEvent ¶
type TypedStrategy ¶
type TypedStrategy struct {
// contains filtered or unexported fields
}
func NewTyped ¶
func NewTyped(id string, handler any) *TypedStrategy
func NewTypedWithConfig ¶
func NewTypedWithConfig(cfg StrategyConfig, handler any) (*TypedStrategy, error)
func (*TypedStrategy) ID ¶
func (s *TypedStrategy) ID() string
Click to show internal directories.
Click to hide internal directories.