rules

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KRuleF10  = engineBaseRule + 0 // 基础规则
	KRuleBase = engineBaseRule + 1 // 基础规则
)

Variables

View Source
var (
	ErrRangeOfOpeningTurnZ         = exception.New(errorRuleBase+0, "非开盘换手范围")
	ErrRangeOfOpeningQuantityRatio = exception.New(errorRuleBase+1, "非开盘量比范围")
	ErrRangeOfOpeningChangeRate    = exception.New(errorRuleBase+2, "非开盘涨跌幅范围")
	ErrRangeOfFundFlow             = exception.New(errorRuleBase+3, "非资金流出")
	ErrHistoryNotExist             = exception.New(errorRuleBase+4, "没有找到history数据")
	ErrRiskOfGapDown               = exception.New(errorRuleBase+5, "开盘存在向下跳空缺口")
	ErrExchangeNotExist            = exception.New(errorRuleBase+4, "没有找到history数据")
)
View Source
var (
	ErrF10IgnoreStock                 = exception.New(errorRuleF10+0, "忽略的个股")
	ErrF10SubNewStock                 = exception.New(errorRuleF10+1, "次新股")
	ErrF10DisableBeijingStockExchange = exception.New(errorRuleF10+2, "禁止北交所")
	ErrF10DisableChiNextBoard         = exception.New(errorRuleF10+3, "禁止创业板")
	ErrF10DisableSciTechBoard         = exception.New(errorRuleF10+4, "禁止科创板")
	ErrF10PriceRange                  = exception.New(errorRuleF10+5, "股价控制")
	ErrF10RangeOfCapital              = exception.New(errorRuleF10+6, "非流通盘范围")
	ErrF10RangeOfSafetyCode           = exception.New(errorRuleF10+7, "非安全分范围")
	ErrF10RangeOfBasicEPS             = exception.New(errorRuleF10+8, "非每股收益范围")
	ErrF10RangeOfBPS                  = exception.New(errorRuleF10+9, "非净增长范围")
	ErrF10RangeOfMarketCap            = exception.New(errorRuleF10+10, "非市值范围")
)
View Source
var (
	ErrAlreadyExists = errors.New("the rule already exists") // 规则已经存在
)

Functions

func PrintRuleList added in v0.5.6

func PrintRuleList()

PrintRuleList 输出规则列表

func RegisterFunc added in v0.5.6

func RegisterFunc(kind Kind, name string, cb func(ruleParameter config.RuleParameter, snapshot factors.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(ruleParameter config.RuleParameter, snapshot factors.QuoteSnapshot) (passed []uint64, failed Kind, err error)

Filter 遍历所有规则

type Rule

type Rule struct {
	Exec func(ruleParameter config.RuleParameter, snapshot factors.QuoteSnapshot) error
	// contains filtered or unexported fields
}

Rule 规则接口封装

func (Rule) Kind

func (this Rule) Kind() Kind

func (Rule) Name

func (this Rule) 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(rules config.RuleParameter, snapshot factors.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

func (RuleImpl) RuleMethod added in v1.0.0

func (r RuleImpl) RuleMethod() func(rules config.RuleParameter, snapshot factors.QuoteSnapshot) error

Jump to

Keyboard shortcuts

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