rules

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KRuleF10  = engineBaseRule + 0 // 基础规则
	KRuleBase = engineBaseRule + 1 // 基础规则
)
View Source
const (
	TenThousand = 1e4               // 万
	Million     = 100 * TenThousand // 百万
	Billion     = 100 * Million     // 1亿
)

Variables

View Source
var (
	ErrAlreadyExists = errors.New("rule is already exists") // 规则已经存在
	ErrExecuteFailed = errors.New("rule execute failed")    // 规则执行失败
)
View Source
var (
	ErrRangeOfOpeningTurnZ         = exception.New(errorRuleBase+0, "非开盘换手范围")
	ErrRangeOfOpeningQuantityRatio = exception.New(errorRuleBase+1, "非开盘量比范围")
	ErrRangeOfOpeningChangeRate    = exception.New(errorRuleBase+2, "非开盘涨跌幅范围")
)
View Source
var (
	RuleParameters  = config.RuleParameter{}
	OrderParameters = config.OrderParameter{}
)
View Source
var (
	ErrF10IgnoreStock                         = exception.New(errorRuleF10+0, "忽略的个股")
	ErrF10SubNewStock                         = exception.New(errorRuleF10+1, "次新股")
	ErrF10ScienceAndTechnologyInnovationBoard = exception.New(errorRuleF10+2, "科创板")
	ErrF10PriceRange                          = exception.New(errorRuleF10+3, "股价控制")
	ErrF10RangeOfCapital                      = exception.New(errorRuleF10+4, "非流通盘范围")
	ErrF10RangeOfSafetyCode                   = exception.New(errorRuleF10+5, "非安全分范围")
	ErrF10RangeOfBasicEPS                     = exception.New(errorRuleF10+6, "非每股收益范围")
	ErrF10RangeOfBPS                          = exception.New(errorRuleF10+7, "非净增长范围")
)

Functions

func PrintRuleList added in v0.5.6

func PrintRuleList()

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 Filter added in v0.6.6

func Filter(snapshot models.QuoteSnapshot) (passed []uint64, failed Kind, err error)

Filter 遍历所有规则

type Rule

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

Rule 规则接口

type RuleBase added in v0.7.2

type RuleBase struct{}

RuleBase 基本面规则

func (RuleBase) Exec added in v0.7.2

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

func (RuleBase) Kind added in v0.7.2

func (r RuleBase) Kind() Kind

func (RuleBase) Name added in v0.7.2

func (r RuleBase) Name() string

type RuleF10 added in v0.6.6

type RuleF10 struct{}

RuleF10 基本面规则

func (RuleF10) Exec added in v0.6.6

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

func (RuleF10) Kind added in v0.6.6

func (r RuleF10) Kind() Kind

func (RuleF10) Name added in v0.6.6

func (r RuleF10) Name() string

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

Jump to

Keyboard shortcuts

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