features

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	FeatureHistory          = 1 << iota // 特征数据-历史
	FeatureF10                          // 特征数据-基本面
	FeatureKLineShap                    // 特征数据-K线形态等
	FeatureMovingAverage                // 特征数据-移动平均线
	FeatureBreaksThroughBox             // 特征数据-有效突破平台

	FeatureHousNo1 // 侯总1号策略
	FeatureHousNo2 // 侯总2号策略
)

登记所有的特征数据

View Source
const (
	CacheL5KeyHistory = "cache/history"
)

Variables

This section is empty.

Functions

func BoolIndexOf

func BoolIndexOf(s stat.Series, n int) bool

func IndexReverse

func IndexReverse(s stat.Series) stat.Series

func SeriesChangeRate

func SeriesChangeRate(base, v stat.Series) stat.Series

SeriesChangeRate 计算两个序列的净增长

func SeriesIndexOf

func SeriesIndexOf(s stat.Series, n int) float64

SeriesIndexOf 获取序列第n索引的值

func StringIndexOf

func StringIndexOf(s stat.Series, n int) string

Types

type CompleteData added in v0.1.2

type CompleteData struct {
	No1 HousNo1
}

type DataBuilder

type DataBuilder struct {
	Name          string // 名称
	CacheDate     string // 缓存文件日期
	ResourcesDate string // 源数据日期, 一般来说源数据日期要比缓存文件的日期早一个交易日
	Build         func(allCodes []string)
}

DataBuilder 数据构建器

func NewDataBuilder

func NewDataBuilder(name, date string, build func(allCodes []string)) *DataBuilder

func (*DataBuilder) Execute

func (this *DataBuilder) Execute(allCodes []string)

type Feature

type Feature interface {
	Factory(date string, code string) Feature                  // 工厂
	Kind() FeatureKind                                         // 类型
	Name() string                                              // 特征名称
	Key() string                                               // 缓存关键字
	Init() error                                               // 初始化, 加载配置信息
	GetDate() string                                           // 日期
	GetSecurityCode() string                                   // 证券代码
	FromHistory(history History) Feature                       // 从历史数据加载
	Update(cacheDate, featureDate string)                      // 更新数据
	Repair(code, cacheDate, featureDate string, complete bool) // 回补数据
	Increase(snapshot quotes.Snapshot) Feature                 // 增量计算, 用快照增量计算特征
}

Feature 特征

type FeatureCache

type FeatureCache struct {
	Type FeatureKind
	Key  string
	Name string
}

type FeatureKind

type FeatureKind = uint64

type History

type History struct {
	Date       string         // 日期, 数据落地的日期
	Code       string         // 代码
	MA3        float64        // 3日均价
	MV3        float64        // 3日均量
	MA5        float64        // 5日均价
	MV5        float64        // 5日均量
	MA10       float64        // 10日均价
	MV10       float64        // 10日均量
	MA20       float64        // 20日均价
	MV20       float64        // 20日均量
	QSFZ       bool           // QSFZ: 反转信号
	CP         float64        // QSFZ: 股价涨幅
	CV         float64        // QSFZ: 成交量涨幅
	VP         float64        // QSFZ: 价量比
	VP3        float64        // QSFZ: 3日价量比
	VP5        float64        // QSFZ: 5日价量比
	Payloads   IncompleteData // 扩展的半成品数据
	Last       CompleteData   // 上一个交易日的数据
	UpdateTime string         // 更新时间
}

History 历史整合数据

func NewHistory

func NewHistory(date, code string) *History

func (*History) Factory

func (h *History) Factory(date string, code string) Feature

func (*History) FromHistory

func (h *History) FromHistory(history History) Feature

func (*History) GetDate

func (h *History) GetDate() string

func (*History) GetSecurityCode

func (h *History) GetSecurityCode() string

func (*History) Increase

func (h *History) Increase(snapshot quotes.Snapshot) Feature

func (*History) Init

func (h *History) Init() error

func (*History) Key

func (h *History) Key() string

func (*History) Kind

func (h *History) Kind() FeatureKind

func (*History) Name

func (h *History) Name() string

func (*History) Repair

func (h *History) Repair(code, cacheDate, featureDate string, complete bool)

func (*History) Update

func (h *History) Update(cacheDate, featureDate string)

type HousNo1 added in v0.1.2

type HousNo1 struct {
	MA5  float64
	MA10 float64
	MA20 float64
}

func (*HousNo1) Factory added in v0.1.2

func (f *HousNo1) Factory(date string, code string) Feature

func (*HousNo1) FromHistory added in v0.1.2

func (f *HousNo1) FromHistory(history History) Feature

func (*HousNo1) GetDate added in v0.1.2

func (f *HousNo1) GetDate() string

func (*HousNo1) GetSecurityCode added in v0.1.2

func (f *HousNo1) GetSecurityCode() string

func (*HousNo1) Increase added in v0.1.2

func (f *HousNo1) Increase(snapshot quotes.Snapshot) Feature

func (*HousNo1) Init added in v0.1.2

func (f *HousNo1) Init() error

func (*HousNo1) Key added in v0.1.2

func (f *HousNo1) Key() string

func (*HousNo1) Kind added in v0.1.2

func (f *HousNo1) Kind() FeatureKind

func (*HousNo1) Name added in v0.1.2

func (f *HousNo1) Name() string

func (*HousNo1) Repair added in v0.1.2

func (f *HousNo1) Repair(code, cacheDate, featureDate string, complete bool)

func (*HousNo1) Update added in v0.1.2

func (f *HousNo1) Update(cacheDate, featureDate string)

type IncompleteData added in v0.1.2

type IncompleteData struct {
	No1 HousNo1
}

IncompleteData 不完整的数据

type Quicker deprecated added in v0.1.2

type Quicker interface {
	Update(cacheDate, featureDate string) // 更新数据
	Repair(cacheDate, featureDate string) // 回补数据
	Increase(snapshot quotes.Snapshot)    // 增量计算, 用快照增量计算特征
}

Quicker 迅速的数据接口

Deprecated: 废弃的接口

Jump to

Keyboard shortcuts

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