sma

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	UniversalTicker string `yaml:"universal_ticker"`
	Interval        string `yaml:"interval"` // e.g. 1m, 5m, 1h
	Period          int    `yaml:"period"`   // window length n
}

Config is the YAML configuration for the SMA strategy.

type SMA

type SMA struct {
	strategy.StrategyActorBase
	// contains filtered or unexported fields
}

SMA computes a simple moving average over the last n closed kline closes. On the first live kline it requests the previous n-1 bars, seeds a circular buffer, then overwrites the oldest close on each subsequent closed bar.

func NewSMA

func NewSMA(cat *catalog.Catalog, bus *msgbus.MsgBus, c *cache.Cache) *SMA

NewSMA creates a new SMA strategy actor.

func (*SMA) Handle

func (s *SMA) Handle(ev msgbus.Event, bus *msgbus.MsgBus)

Handle dispatches live kline and historical kline responses.

func (*SMA) OnInit

func (s *SMA) OnInit(config map[string]any)

OnInit decodes config and resolves the symbol / interval.

func (*SMA) OnStart

func (s *SMA) OnStart()

func (*SMA) OnStop

func (s *SMA) OnStop()

Jump to

Keyboard shortcuts

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