strategy

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(typeName string, factory Factory)

Register registers a strategy actor factory under the given type name. Typically called from init() in each strategy actor package.

Types

type Config

type Config struct {
	Actor []actor.Entry `yaml:"actor"`
}

Config contains strategy engine configuration.

type Engine

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

Engine manages the lifecycle of multiple strategy actors. It constructs actors from config entries using the factory registry, registers them with the MsgBus, and manages their lifecycle.

func NewEngine

func NewEngine(cat *catalog.Catalog, bus *msgbus.MsgBus, c *cache.Cache) *Engine

NewEngine creates a new strategy Engine.

func (*Engine) Init

func (e *Engine) Init(config Config)

Init constructs strategy actors from config entries using the factory registry, registers them with the MsgBus, and calls OnInit.

func (*Engine) Start

func (e *Engine) Start()

Start calls OnStart on every actor.

func (*Engine) Stop

func (e *Engine) Stop()

Stop calls OnStop on every actor.

type Factory

type Factory func(cat *catalog.Catalog, bus *msgbus.MsgBus, c *cache.Cache) actor.Actor

Factory is a constructor function that creates a strategy actor.

type StrategyActorBase

type StrategyActorBase struct {
	actor.ActorBase
	// contains filtered or unexported fields
}

func NewStrategyActorBase

func NewStrategyActorBase(name string, catalog *catalog.Catalog, cache *cache.Cache, msgbus *msgbus.MsgBus, topics []event.Topic) StrategyActorBase

func (*StrategyActorBase) CancelAllOrders

func (s *StrategyActorBase) CancelAllOrders(accountID int, symbolID int)

func (*StrategyActorBase) CancelOrder

func (s *StrategyActorBase) CancelOrder(clientOrderID int, accountID int)

func (*StrategyActorBase) GetCatalog

func (s *StrategyActorBase) GetCatalog() *catalog.Catalog

func (*StrategyActorBase) ReqHistoricalKline

func (s *StrategyActorBase) ReqHistoricalKline(symbolID int, interval common.Interval, startTimeNs, endTimeNs uint64, limit int)

ReqHistoricalKline requests historical candles. The data engine publishes TopicEventRespHistoricalKline when the HTTP response is ready. startTimeNs/endTimeNs are nanoseconds; 0 omits that bound. limit 0 uses venue default.

func (*StrategyActorBase) SubmitOrder

func (s *StrategyActorBase) SubmitOrder(accountID int, symbolID int, side common.Side, orderType common.OrderType, timeInForce common.TimeInForce, price float64, quantity float64) int

Directories

Path Synopsis
actor
sma

Jump to

Keyboard shortcuts

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