factors

package
v0.4.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

	FeatureHousNo1 = featureHous + 1 // 侯总1号策略
	FeatureHousNo2 = featureHous + 2 // 侯总2号策略
)

登记所有的特征数据

View Source
const (
	CacheL5KeyF10 = "f10"
)
View Source
const (
	CacheL5KeyHistory = "history"
)
View Source
const (
	SubNewStockYears = 1 // 次新股几年内
)

Variables

This section is empty.

Functions

func BoolIndexOf added in v0.2.0

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

func ComputeFreeCapital added in v0.2.0

func ComputeFreeCapital(holderList []dfcf.CirculatingShareholder, capital float64) (top10Capital, freeCapital, capitalChanged, increaseRatio, reductionRatio float64)

ComputeFreeCapital 计算自由流通股本

func IndexReverse added in v0.2.0

func IndexReverse(s stat.Series) stat.Series

func IsSubNewStockByIpoDate added in v0.2.0

func IsSubNewStockByIpoDate(securityCode, ipoDate, date string) bool

IsSubNewStockByIpoDate 检查是否次新股

func SeriesChangeRate added in v0.2.0

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

SeriesChangeRate 计算两个序列的净增长

func SeriesIndexOf added in v0.2.0

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

SeriesIndexOf 获取序列第n索引的值

func StringIndexOf added in v0.2.0

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

Types

type CompleteData added in v0.2.0

type CompleteData struct {
	No1 HousNo1
}

type F10 added in v0.2.0

type F10 struct {
	cache.DataSummary `dataframe:"-"`
	Date              string  `name:"日期" dataframe:"date"`                    // 日期
	Code              string  `name:"代码" dataframe:"code"`                    // 代码
	Name_             string  `name:"名称" dataframe:"name"`                    // 名称
	SubNew            bool    `name:"次新股" dataframe:"sub_new"`                // 是否次新股
	VolUnit           int     `name:"每手" dataframe:"vol_unit"`                // 每手单位
	DecimalPoint      int     `name:"小数点" dataframe:"decimal_point"`          // 小数点
	IpoDate           string  `name:"上市日期" dataframe:"ipo_date"`              // 上市日期
	UpdateDate        string  `name:"更新日期" dataframe:"update_date"`           // 更新日期
	TotalCapital      float64 `name:"总股本" dataframe:"total_capital"`          // 总股本
	Capital           float64 `name:"流通股本" dataframe:"capital"`               // 流通股本
	FreeCapital       float64 `name:"自由流通股本" dataframe:"free_capital"`        // 自由流通股本
	Top10Capital      float64 `name:"前十大流通股东总股本" dataframe:"top10_capital"`   // 前十大流通股东股本
	Top10Change       float64 `name:"前十大流通股东总股本变化" dataframe:"top10_change"`  //前十大流通股东股本变化
	ChangeCapital     float64 `name:"前十大流通股东持仓变化" dataframe:"change_capital"` // 前十大流通股东持仓变化
	IncreaseRatio     float64 `name:"当期增持比例" dataframe:"increase_ratio"`      // 当期增持比例
	ReductionRatio    float64 `name:"当期减持比例" dataframe:"reduction_ratio"`     // 当期减持比例
	BPS               float64 `name:"每股净资产" dataframe:"bps"`                  // 每股净资产
	BasicEPS          float64 `name:"每股收益" dataframe:"basic_eps"`             // 每股收益
	SafetyScore       int     `name:"安全分" dataframe:"safety_score"`           // 通达信安全分
	Increases         int     `name:"增持" dataframe:"increases"`               // 公告-增持
	Reduces           int     `name:"减持" dataframe:"reduces"`                 // 公告-减持
	Risk              int     `name:"风险数" dataframe:"risk"`                   // 公告-风险数
	RiskKeywords      string  `name:"风险关键词" dataframe:"risk_keywords"`        // 公告-风险关键词
}

F10 证券基本面

func NewF10 added in v0.2.0

func NewF10(date, code string) *F10

func (*F10) Factory added in v0.2.0

func (this *F10) Factory(date string, code string) Feature

func (*F10) FromHistory added in v0.2.0

func (this *F10) FromHistory(history History) Feature

func (*F10) GetDate added in v0.2.0

func (this *F10) GetDate() string

func (*F10) GetSecurityCode added in v0.2.0

func (this *F10) GetSecurityCode() string

func (*F10) Increase added in v0.2.0

func (this *F10) Increase(snapshot quotes.Snapshot) Feature

func (*F10) Init added in v0.2.0

func (this *F10) Init(ctx context.Context, date string) error

func (*F10) Repair added in v0.2.0

func (this *F10) Repair(code, cacheDate, featureDate string, complete bool)

func (*F10) TurnZ added in v0.2.0

func (this *F10) TurnZ(v any) float64

func (*F10) Update added in v0.2.0

func (this *F10) Update(code, cacheDate, featureDate string, complete bool)

type Feature

type Feature interface {
	cache.Manifest
	cache.Future
	// Factory 工厂
	Factory(date string, code string) Feature
	Trait
}

Feature 特征

type History

type History struct {
	cache.DataSummary `dataframe:"-"`
	Date              string         `name:"日期" dataframe:"date"`           // 日期, 数据落地的日期
	Code              string         `name:"代码" dataframe:"code"`           // 代码
	MA3               float64        `name:"3日均价" dataframe:"ma3"`          // 3日均价
	MV3               float64        `name:"3日均量" dataframe:"mv3"`          // 3日均量
	MA5               float64        `name:"5日均价" dataframe:"ma5"`          // 5日均价
	MV5               float64        `name:"5日均量" dataframe:"mv5"`          // 5日均量
	MA10              float64        `name:"10日均价" dataframe:"ma10"`        // 10日均价
	MV10              float64        `name:"10日均量" dataframe:"mv10"`        // 10日均量
	MA20              float64        `name:"20日均价" dataframe:"ma20"`        // 20日均价
	MV20              float64        `name:"20日均量" dataframe:"mv20"`        // 20日均量
	QSFZ              bool           `name:"QSFZ: 反转信号" dataframe:"qsfz"`   // QSFZ: 反转信号
	CP                float64        `name:"QSFZ: 股价涨幅" dataframe:"cp"`     // QSFZ: 股价涨幅
	CV                float64        `name:"QSFZ: 成交量涨幅" dataframe:"cv"`    // QSFZ: 成交量涨幅
	VP                float64        `name:"QSFZ: 价量比" dataframe:"vp"`      // QSFZ: 价量比
	VP3               float64        `name:"QSFZ: 3日价量比" dataframe:"vp_3"`  // QSFZ: 3日价量比
	VP5               float64        `name:"QSFZ: 5日价量比" dataframe:"vp_5"`  // QSFZ: 5日价量比
	Payloads          IncompleteData `name:"payloads" dataframe:"payloads"` // 扩展的半成品数据
	Last              CompleteData   `name:"last" dataframe:"last"`         // 上一个交易日的数据
	UpdateTime        string         `name:"更新时间" dataframe:"update_time"`  // 更新时间
}

History 历史整合数据

func NewHistory added in v0.2.0

func NewHistory(date, code string) *History

func (*History) Factory added in v0.2.0

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

func (*History) FromHistory added in v0.2.0

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

func (*History) GetDate added in v0.2.0

func (this *History) GetDate() string

func (*History) GetSecurityCode added in v0.2.0

func (this *History) GetSecurityCode() string

func (*History) Increase added in v0.2.0

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

func (*History) Init added in v0.2.0

func (this *History) Init(ctx context.Context, date string) error

func (*History) Repair added in v0.2.0

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

func (*History) Update added in v0.2.0

func (this *History) Update(code, cacheDate, featureDate string, complete bool)

type HousNo1 added in v0.2.0

type HousNo1 struct {
	cache.DataSummary `dataframe:"-"`
	MA5               float64 `dataframe:"ma5"`
	MA10              float64 `dataframe:"ma10"`
	MA20              float64 `dataframe:"ma20"`
}

func (*HousNo1) Factory added in v0.2.0

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

func (*HousNo1) FromHistory added in v0.2.0

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

func (*HousNo1) GetDate added in v0.2.0

func (f *HousNo1) GetDate() string

func (*HousNo1) GetSecurityCode added in v0.2.0

func (f *HousNo1) GetSecurityCode() string

func (*HousNo1) Increase added in v0.2.0

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

func (*HousNo1) Init added in v0.2.0

func (f *HousNo1) Init(ctx context.Context, date string) error

func (*HousNo1) Repair added in v0.2.0

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

func (*HousNo1) Update added in v0.2.0

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

type IncompleteData added in v0.2.0

type IncompleteData struct {
	No1 HousNo1
}

IncompleteData 不完整的数据

type Trait added in v0.3.7

type Trait interface {
	// FromHistory 从历史数据加载
	FromHistory(history History) Feature
	// Increase 增量计算
	//	用快照增量计算特征
	Increase(snapshot quotes.Snapshot) Feature
}

Trait 基础的特性

这也是一个特征, 为啥起这个名字, 自己可以脑补 哈哈~

type Weight

type Weight = uint64

Weight 权重数据类型为64, 实际容纳63个

Jump to

Keyboard shortcuts

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