rules

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuleSubNewStock = engineBaseRule + 0 // 次新股
)

Variables

View Source
var (
	ErrAlreadyExists = errors.New("rule is already exists") // 规则已经存在
	ErrExecuteFailed = errors.New("rule execute failed")    // 规则执行失败
)

Functions

func PrintRuleList added in v0.5.6

func PrintRuleList()

func Register added in v0.5.6

func Register(rule Rule) error

Register 注册规则

func RegisterFunc added in v0.5.6

func RegisterFunc(kind Kind, name string, cb func(snapshot models.QuoteSnapshot) error) error

RegisterFunc 注册规则回调函数

Types

type Kind added in v0.5.6

type Kind = uint

Kind 规则类型

const (
	Pass Kind = 0
)

func Each added in v0.5.6

func Each(snapshot models.QuoteSnapshot) (passed []uint64, failed Kind)

Each 遍历所有规则

type Rule

type Rule interface {
	// Kind 类型
	Kind() Kind
	// Name 名称
	Name() string
	// Exec 执行, 返回nil即为成功
	Exec(snapshot models.QuoteSnapshot) error
}

Rule 规则接口

type RuleImpl added in v0.5.6

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

func (RuleImpl) Exec added in v0.5.6

func (r RuleImpl) Exec(snapshot models.QuoteSnapshot) error

func (RuleImpl) Kind added in v0.5.6

func (r RuleImpl) Kind() Kind

func (RuleImpl) Name added in v0.5.6

func (r RuleImpl) Name() string

type RuleSubNew added in v0.5.6

type RuleSubNew struct{}

func (RuleSubNew) Exec added in v0.5.6

func (r RuleSubNew) Exec(snapshot models.QuoteSnapshot) error

func (RuleSubNew) Kind added in v0.5.6

func (r RuleSubNew) Kind() Kind

func (RuleSubNew) Name added in v0.5.6

func (r RuleSubNew) Name() string

Jump to

Keyboard shortcuts

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