factors

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package factors 特征/因子相关的功能

包括: 基础数据, 基本面, 常用历史特征以及1号策略数据

Index

Constants

View Source
const (
	BaseXdxr                = cache.PluginMaskBaseData | (baseKind + 1) // 基础数据-除权除息
	BaseKLine               = cache.PluginMaskBaseData | (baseKind + 2) // 基础数据-基础K线
	BaseTransaction         = cache.PluginMaskBaseData | (baseKind + 3) // 基础数据-历史成交
	BaseMinutes             = cache.PluginMaskBaseData | (baseKind + 4) // 基础数据-分时数据
	BaseQuarterlyReports    = cache.PluginMaskBaseData | (baseKind + 5) // 基础数据-季报
	BaseSafetyScore         = cache.PluginMaskBaseData | (baseKind + 6) // 基础数据-安全分
	BaseWideKLine           = cache.PluginMaskBaseData | (baseKind + 7) // 基础数据-宽表
	BasePerformanceForecast = cache.PluginMaskBaseData | (baseKind + 8) // 基础数据-业绩预告
)
View Source
const (
	InvalidPeriod = -1              // 无效的周期
	InvalidWeight = float64(-99.99) // 无效的权重值
)
View Source
const (
	FeatureF10              = baseFeature + 1 // 特征数据-基本面
	FeatureHistory          = baseFeature + 2 // 特征数据-历史
	FeatureNo1              = baseFeature + 3 // 特征数据-1号策略
	FeatureMisc             = baseFeature + 4 // 特征数据-Misc
	FeatureBreaksThroughBox = baseFeature + 5 // 特征数据-box
	FeatureKLineShap        = baseFeature + 6 // 特征数据-K线形态等

)

登记所有的特征数据

View Source
const (
	SubNewStockYears = 1 // 次新股几年内
)

Variables

View Source
var (
	FBarsProtocolFields = []string{"Open", "Close", "High", "Low", "Vol", "Amount", "DateTime", "UpCount", "DownCount"}
	FBarsRawFields      = []string{"open", "close", "high", "low", "volume", "amount", "date", "up", "down"}
	FBarsHalfFields     = []string{"date", "open", "close", "high", "low", "volume", "amount", "up", "down", "open_volume", "open_turnz", "open_unmatched", "close_volume", "close_turnz", "close_unmatched", "inner_volume", "outer_volume", "inner_amount", "outer_amount"}
	FBarsWideFields     = []string{"date", "open", "close", "high", "low", "volume", "amount", "up", "down", "last_close", "change_rate", "open_volume", "open_turnz", "open_unmatched", "close_volume", "close_turnz", "close_unmatched", "inner_volume", "outer_volume", "inner_amount", "outer_amount"}
)
View Source
var (
	ErrInvalidFeatureSample = errors.New("无效的特征数据样本")
)

Functions

func BasicKLine added in v0.8.8

func BasicKLine(securityCode string) pandas.DataFrame

BasicKLine 基础日K线

func ComputeFreeCapital added in v0.2.0

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

ComputeFreeCapital 计算自由流通股本

func GetCacheKLine added in v0.8.8

func GetCacheKLine(code string, adjust ...bool) pandas.DataFrame

GetCacheKLine 加载K线

第2个参数, 是否前复权

func GetDataDescript added in v0.2.0

func GetDataDescript(kind cache.Kind) cache.DataSummary

func GetKLineAll added in v0.8.8

func GetKLineAll(securityCode string, argv ...int) pandas.DataFrame

GetKLineAll 获取日K线

func GetTimestamp added in v0.8.1

func GetTimestamp() string

GetTimestamp 时间戳

格式: YYYY-MM-DD hh:mm:ss.SSS

func IntegrateQuarterlyReports added in v0.8.8

func IntegrateQuarterlyReports(barIndex int, date string) map[string]dfcf2.QuarterlyReport

IntegrateQuarterlyReports 更新季报数据

func IsSubNewStockByIpoDate added in v0.2.0

func IsSubNewStockByIpoDate(securityCode, ipoDate, date string) bool

IsSubNewStockByIpoDate 检查是否次新股

func KLine added in v0.8.8

func KLine(securityCode string) pandas.DataFrame

KLine 加载日K线宽表

func KLineToWeekly added in v0.8.8

func KLineToWeekly(kline pandas.DataFrame) pandas.DataFrame

KLineToWeekly 日线转周线

deprecated: 不推荐使用

func MonthlyKLine added in v0.8.8

func MonthlyKLine(securityCode string, cacheKLine ...[]base.KLine) (df pandas.DataFrame)

MonthlyKLine 月K线

func RefreshL5Misc added in v1.1.3

func RefreshL5Misc()

RefreshL5Misc 刷新缓存

func RegisterFeatureRotationAdapter added in v1.3.0

func RegisterFeatureRotationAdapter(key string, adapter FeatureRotationAdapter)

func SetKLineOffset added in v0.8.8

func SetKLineOffset(days int)

SetKLineOffset 设置K线数据调整回补天数

func SwitchDate added in v0.8.8

func SwitchDate(date string)

SwitchDate 统一切换数据的缓存日期

func UpdateL5Misc added in v1.1.3

func UpdateL5Misc(misc *Misc)

UpdateL5Misc 更新当日exchange

func WeeklyKLine added in v0.8.8

func WeeklyKLine(securityCode string, cacheKLine ...[]base.KLine) (df pandas.DataFrame)

WeeklyKLine 周线

Types

type Box added in v0.8.8

type Box struct {
	cache.DataSummary `dataframe:"-"`
	Code              string  `name:"证券代码" dataframe:"证券代码"`                 // 证券代码
	Date              string  `name:"数据日期" dataframe:"数据日期"`                 // 数据日期
	DoubletPeriod     int     `name:"倍量周期" dataframe:"倍量周期"`                 // 倍量周期
	DoubleHigh        float64 `name:"倍量最高" dataframe:"倍量最高"`                 // 倍量最高
	DoubleLow         float64 `name:"倍量最低" dataframe:"倍量最低"`                 // 倍量最低
	Buy               bool    `name:"买入信号" dataframe:"买入信号"`                 // 买入信号
	HalfPeriod        int     `name:"半量周期" dataframe:"半量周期"`                 // 半量周期
	HalfHigh          float64 `name:"半量最高" dataframe:"半量最高"`                 // 半量最高
	HalfLow           float64 `name:"半量最低" dataframe:"半量最低"`                 // 半量最低
	Sell              bool    `name:"卖出信号" dataframe:"卖出信号"`                 // 卖出信号
	TendencyPeriod    int     `name:"趋势周期" dataframe:"趋势周期"`                 // 趋势周期
	QSFZ              bool    `name:"QSFZ" dataframe:"QSFZ"`                 // QSFZ
	QSCP              float64 `name:"QSCP" dataframe:"QSCP"`                 // QSFZ: QSCP
	QSCV              float64 `name:"QSCV" dataframe:"QSCV"`                 // QSFZ: QSCV
	QSVP              float64 `name:"QSVP" dataframe:"QSVP"`                 // QSFZ: QSVP
	QSVP3             float64 `name:"QSVP3" dataframe:"QSVP3"`               // QSFZ: QSVP3
	QSVP5             float64 `name:"QSVP5" dataframe:"QSVP5"`               // QSFZ: QSVP5
	DkCol             float64 `name:"DkCol" dataframe:"DkCol"`               // dkqs: 能量柱
	DkD               float64 `name:"dkd" dataframe:"dkd"`                   // dkqs: 多头力量
	DkK               float64 `name:"dkk" dataframe:"dkk"`                   // dkqs: 空头力量
	DkB               bool    `name:"dkb" dataframe:"dkb"`                   // dkqs: buy
	DkS               bool    `name:"dks" dataframe:"dks"`                   // dkqs: sell
	DxDivergence      float64 `name:"dxdivergence" dataframe:"dxdivergence"` // madx: 综合发散度评估值
	DxDm0             float64 `name:"dxdm0" dataframe:"dxdm0"`               // madx: 超短线均线发散度
	DxDm1             float64 `name:"dxdm1" dataframe:"dxdm1"`               // madx: 短线均线发散度
	DxDm2             float64 `name:"dxdm2" dataframe:"dxdm2"`               // madx: 中线均线发散度
	DxB               bool    `name:"dxb" dataframe:"dxb"`                   // madx: 买入
	State             uint64  `name:"样本状态" dataframe:"样本状态"`                 // 样本状态
}

Box 平台特征数据

func GetL5Box added in v0.8.8

func GetL5Box(securityCode string, date ...string) *Box

GetL5Box 获取平台数据

func NewBox added in v0.8.8

func NewBox(date, code string) *Box

func (*Box) Factory added in v0.8.8

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

func (*Box) FromHistory added in v0.8.8

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

func (*Box) GetDate added in v0.8.8

func (this *Box) GetDate() string

func (*Box) GetSecurityCode added in v0.8.8

func (this *Box) GetSecurityCode() string

func (*Box) Increase added in v0.8.8

func (this *Box) Increase(snapshot QuoteSnapshot) Feature

func (*Box) Init added in v0.8.8

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

func (*Box) Repair added in v0.8.8

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

func (*Box) Update added in v0.8.8

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

func (*Box) ValidateSample added in v0.8.8

func (this *Box) ValidateSample() error

ValidateSample 验证样本数据

type Cache1D added in v0.8.8

type Cache1D[T Feature] struct {
	Date string // 日期
	// contains filtered or unexported fields
}

Cache1D 缓存所有证券代码的特征组合数据

每天1个证券代码1条数据

func NewCache1D added in v0.8.8

func NewCache1D[T Feature](key string, factory func(date, securityCode string) T) *Cache1D[T]

NewCache1D 创建一个新的C1D对象

key支持多级相对路径, 比如a/b, 创建的路径是~/.quant1x/a/b.yyyy-mm-dd

func (*Cache1D[T]) Apply added in v0.8.8

func (this *Cache1D[T]) Apply(merge func(code string, local *T) (updated bool))

Apply 数据合并

泛型T需要保持一个string类型的Date字段

func (*Cache1D[T]) Check added in v0.8.8

func (this *Cache1D[T]) Check(cacheDate, featureDate string)

func (*Cache1D[T]) Checkout added in v0.8.8

func (this *Cache1D[T]) Checkout(date ...string)

func (*Cache1D[T]) Factory added in v0.8.8

func (this *Cache1D[T]) Factory(date, securityCode string) Feature

func (*Cache1D[T]) Filter added in v1.5.0

func (this *Cache1D[T]) Filter(f func(v T) bool) []T

func (*Cache1D[T]) Get added in v0.8.8

func (this *Cache1D[T]) Get(securityCode string, date ...string) *T

Get 获取指定证券代码的数据

func (*Cache1D[T]) Init added in v0.8.8

func (this *Cache1D[T]) Init(ctx context.Context, date, securityCode string) error

func (*Cache1D[T]) Key added in v0.8.8

func (this *Cache1D[T]) Key() string

func (*Cache1D[T]) Kind added in v0.8.8

func (this *Cache1D[T]) Kind() cache.Kind

func (*Cache1D[T]) Length added in v0.8.8

func (this *Cache1D[T]) Length() int

Length 获取长度

func (*Cache1D[T]) Merge added in v0.8.8

func (this *Cache1D[T]) Merge(p *treemap.Map)

func (*Cache1D[T]) Name added in v0.8.8

func (this *Cache1D[T]) Name() string

func (*Cache1D[T]) Owner added in v0.8.8

func (this *Cache1D[T]) Owner() string

func (*Cache1D[T]) Print added in v0.8.8

func (this *Cache1D[T]) Print(code string, date ...string)

func (*Cache1D[T]) ReplaceCache added in v0.8.8

func (this *Cache1D[T]) ReplaceCache()

ReplaceCache 替换当前缓存数据

func (*Cache1D[T]) Set added in v0.8.8

func (this *Cache1D[T]) Set(securityCode string, newValue T, date ...string)

Set 更新map中指定证券代码的数据

func (*Cache1D[T]) Usage added in v0.8.8

func (this *Cache1D[T]) Usage() string

type CompleteData added in v0.2.0

type CompleteData struct {
	No1 HousNo1
}

type DataKLine added in v0.8.8

type DataKLine struct {
	cache.DataSummary
	Date string
	Code string
}

func (*DataKLine) Check added in v0.8.8

func (k *DataKLine) Check(cacheDate, featureDate string) error

func (*DataKLine) Checkout added in v0.8.8

func (k *DataKLine) Checkout(securityCode, date string)

func (*DataKLine) Clone added in v0.8.8

func (k *DataKLine) Clone(date, code string) DataSet

func (*DataKLine) Filename added in v0.8.8

func (k *DataKLine) Filename(date, code string) string

func (*DataKLine) GetDate added in v0.8.8

func (k *DataKLine) GetDate() string

func (*DataKLine) GetSecurityCode added in v0.8.8

func (k *DataKLine) GetSecurityCode() string

func (*DataKLine) Increase added in v0.8.8

func (k *DataKLine) Increase(snapshot quotes.Snapshot)

func (*DataKLine) Init added in v0.8.8

func (k *DataKLine) Init(ctx context.Context, date string) error

func (*DataKLine) Print added in v0.8.8

func (k *DataKLine) Print(code string, date ...string)

func (*DataKLine) Repair added in v0.8.8

func (k *DataKLine) Repair(date string)

func (*DataKLine) Update added in v0.8.8

func (k *DataKLine) Update(date string)

type DataMinutes added in v0.8.8

type DataMinutes struct {
	Manifest
}

DataMinutes 分时数据

func (*DataMinutes) Clone added in v0.8.8

func (this *DataMinutes) Clone(date string, code string) DataSet

func (*DataMinutes) Increase added in v0.8.8

func (this *DataMinutes) Increase(snapshot quotes.Snapshot)

func (*DataMinutes) Init added in v0.8.8

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

func (*DataMinutes) Print added in v0.8.8

func (this *DataMinutes) Print(code string, date ...string)

func (*DataMinutes) Repair added in v0.8.8

func (this *DataMinutes) Repair(date string)

func (*DataMinutes) Update added in v0.8.8

func (this *DataMinutes) Update(date string)

type DataPreviewReport added in v0.8.8

type DataPreviewReport struct {
	Manifest
}

DataPreviewReport 业绩预告(Listed Companies'Performance Forecast)

func (*DataPreviewReport) Clone added in v0.8.8

func (this *DataPreviewReport) Clone(date string, code string) DataSet

func (*DataPreviewReport) Increase added in v0.8.8

func (this *DataPreviewReport) Increase(snapshot quotes.Snapshot)

func (*DataPreviewReport) Init added in v0.8.8

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

func (*DataPreviewReport) Print added in v0.8.8

func (this *DataPreviewReport) Print(code string, date ...string)

func (*DataPreviewReport) Repair added in v0.8.8

func (this *DataPreviewReport) Repair(date string)

func (*DataPreviewReport) Update added in v0.8.8

func (this *DataPreviewReport) Update(date string)

type DataQuarterlyReport added in v0.8.8

type DataQuarterlyReport struct {
	cache.DataSummary
	Date string
	Code string
	// contains filtered or unexported fields
}

DataQuarterlyReport 季报

func (*DataQuarterlyReport) Check added in v0.8.8

func (r *DataQuarterlyReport) Check(cacheDate, featureDate string) error

func (*DataQuarterlyReport) Checkout added in v0.8.8

func (r *DataQuarterlyReport) Checkout(securityCode, date string)

func (*DataQuarterlyReport) Clone added in v0.8.8

func (r *DataQuarterlyReport) Clone(date string, code string) DataSet

func (*DataQuarterlyReport) Filename added in v0.8.8

func (r *DataQuarterlyReport) Filename(date, code string) string

func (*DataQuarterlyReport) GetDate added in v0.8.8

func (r *DataQuarterlyReport) GetDate() string

func (*DataQuarterlyReport) GetSecurityCode added in v0.8.8

func (r *DataQuarterlyReport) GetSecurityCode() string

func (*DataQuarterlyReport) Increase added in v0.8.8

func (r *DataQuarterlyReport) Increase(snapshot quotes.Snapshot)

func (*DataQuarterlyReport) Init added in v0.8.8

func (r *DataQuarterlyReport) Init(ctx context.Context, date string) error

func (*DataQuarterlyReport) Print added in v0.8.8

func (r *DataQuarterlyReport) Print(code string, date ...string)

func (*DataQuarterlyReport) Repair added in v0.8.8

func (r *DataQuarterlyReport) Repair(date string)

func (*DataQuarterlyReport) Update added in v0.8.8

func (r *DataQuarterlyReport) Update(date string)

type DataSafetyScore deprecated added in v0.8.8

type DataSafetyScore struct {
	cache.DataSummary
}

DataSafetyScore 个股基本面安全评分

Deprecated: 废弃

type DataSet added in v0.8.8

type DataSet interface {
	// Clone 克隆一个DataSet, 是所有写操作的基础
	Clone(date string, code string) DataSet
	cache.Manifest
	// Update 更新数据
	Update(date string)
	// Repair 回补数据
	Repair(date string)
	// Increase 增量计算, 用快照增量计算特征
	Increase(snapshot quotes.Snapshot)
}

DataSet 数据层, 数据集接口 smart

数据集是基础数据, 应当遵循结构简单, 尽量减小缓存的文件数量, 加载迅速
检索的规则是按日期和代码进行查询

type DataWideKLine added in v1.1.8

type DataWideKLine struct {
	Manifest
}

DataWideKLine 宽表

func (*DataWideKLine) Clone added in v1.1.8

func (this *DataWideKLine) Clone(date string, code string) DataSet

func (*DataWideKLine) Increase added in v1.1.8

func (this *DataWideKLine) Increase(snapshot quotes.Snapshot)

func (*DataWideKLine) Init added in v1.1.8

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

func (*DataWideKLine) Print added in v1.1.8

func (this *DataWideKLine) Print(code string, date ...string)

func (*DataWideKLine) Repair added in v1.1.8

func (this *DataWideKLine) Repair(date string)

func (*DataWideKLine) Update added in v1.1.8

func (this *DataWideKLine) Update(date string)

type DataXdxr added in v0.8.8

type DataXdxr struct {
	cache.DataSummary
	Date string
	Code string
}

DataXdxr 除权除息

func (*DataXdxr) Clone added in v0.8.8

func (x *DataXdxr) Clone(date string, code string) DataSet

func (*DataXdxr) Filename added in v0.8.8

func (x *DataXdxr) Filename(date, code string) string

func (*DataXdxr) GetDate added in v0.8.8

func (x *DataXdxr) GetDate() string

func (*DataXdxr) GetSecurityCode added in v0.8.8

func (x *DataXdxr) GetSecurityCode() string

func (*DataXdxr) Increase added in v0.8.8

func (x *DataXdxr) Increase(snapshot quotes.Snapshot)

func (*DataXdxr) Init added in v0.8.8

func (x *DataXdxr) Init(ctx context.Context, date string) error

func (*DataXdxr) Print added in v0.8.8

func (x *DataXdxr) Print(code string, date ...string)

func (*DataXdxr) Repair added in v0.8.8

func (x *DataXdxr) Repair(date string)

func (*DataXdxr) Update added in v0.8.8

func (x *DataXdxr) Update(date string)

type DuoKongQuShi added in v0.8.8

type DuoKongQuShi struct {
	Col float64 // 多空能量
	K0  float64
	K   float64
	D   float64
	B   bool
	S   bool
}

DuoKongQuShi 多空趋势

type F10 added in v0.2.0

type F10 struct {
	cache.DataSummary    `dataframe:"-"`
	Date                 string  `name:"日期" dataframe:"Date"`                    // 日期
	Code                 string  `name:"代码" dataframe:"Code"`                    // 证券代码
	SecurityName         string  `name:"名称" dataframe:"Name"`                    // 证券名称
	SubNew               bool    `name:"次新股" dataframe:"SubNew"`                 // 是否次新股
	VolUnit              int     `name:"每手" dataframe:"VolUnit"`                 // 每手单位
	DecimalPoint         int     `name:"小数点" dataframe:"DecimalPoint"`           // 小数点
	IpoDate              string  `name:"上市日期" dataframe:"IpoDate"`               // 上市日期
	UpdateDate           string  `name:"更新日期" dataframe:"UpdateDate"`            // 更新日期
	TotalCapital         float64 `name:"总股本" dataframe:"TotalCapital"`           // 总股本
	Capital              float64 `name:"流通股本" dataframe:"Capital"`               // 流通股本
	FreeCapital          float64 `name:"自由流通股本" dataframe:"FreeCapital"`         // 自由流通股本
	Top10Capital         float64 `name:"前十大流通股东总股本" dataframe:"Top10Capital"`    // 前十大流通股东股本
	Top10Change          float64 `name:"前十大流通股东总股本变化" dataframe:"Top10Change"`   //前十大流通股东股本变化
	ChangeCapital        float64 `name:"前十大流通股东持仓变化" dataframe:"ChangeCapital"`  // 前十大流通股东持仓变化
	IncreaseRatio        float64 `name:"当期增持比例" dataframe:"IncreaseRatio"`       // 当期增持比例
	ReductionRatio       float64 `name:"当期减持比例" dataframe:"ReductionRatio"`      // 当期减持比例
	QuarterlyYearQuarter string  `name:"季报期" dataframe:"quarterly_year_quarter"` // 当前市场处于哪个季报期, 用于比较个股的季报数据是否存在拖延的情况
	QDate                string  `name:"新报告期" dataframe:"qdate"`                 // 最新报告期
	TotalOperateIncome   float64 `name:"营业总收入" dataframe:"TotalOperateIncome"`   // 当期营业总收入
	BPS                  float64 `name:"每股净资产" dataframe:"BPS"`                  // 每股净资产
	BasicEPS             float64 `name:"每股收益" dataframe:"BasicEPS"`              // 每股收益
	DeductBasicEPS       float64 `name:"每股收益(扣除)" dataframe:"DeductBasicEPS"`    // 每股收益(扣除)
	SafetyScore          int     `name:"安全分" dataframe:"SafetyScore"`            // 通达信安全分
	Increases            int     `name:"增持" dataframe:"Increases"`               // 公告-增持
	Reduces              int     `name:"减持" dataframe:"Reduces"`                 // 公告-减持
	Risk                 int     `name:"风险数" dataframe:"Risk"`                   // 公告-风险数
	RiskKeywords         string  `name:"风险关键词" dataframe:"RiskKeywords"`         // 公告-风险关键词
	UpdateTime           string  `name:"更新时间" dataframe:"update_time"`           // 更新时间
	State                uint64  `name:"样本状态" dataframe:"样本状态"`
}

F10 证券基本面

func GetL5F10 added in v0.8.8

func GetL5F10(securityCode string, date ...string) *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 QuoteSnapshot) 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)

func (*F10) ValidateSample added in v0.8.1

func (this *F10) ValidateSample() error

type Feature

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

Feature 特征

type FeatureRotationAdapter added in v1.3.0

type FeatureRotationAdapter interface {
	// Name 名称
	Name() string
	// Checkout 加载指定日期的缓存
	Checkout(date ...string)
	// Merge 合并数据
	Merge(p *treemap.Map)
	// Factory 工厂
	Factory(date, securityCode string) Feature
}

FeatureRotationAdapter 特征缓存日旋转适配器

一天一个特征组合缓存文件

func Get added in v0.8.8

type FinancingAndSecuritiesLendingTarget added in v1.0.5

type FinancingAndSecuritiesLendingTarget struct {
	Code string `name:"证券代码" dataframe:"code"`
}

type History

type History struct {
	cache.DataSummary `dataframe:"-"`
	Date              string         `name:"日期" dataframe:"date"`           // 日期, 数据落地的日期
	Code              string         `name:"代码" dataframe:"code"`           // 代码
	MA2               float64        `name:"2日均价" dataframe:"ma2"`          // 2日均价
	MA3               float64        `name:"3日均价" dataframe:"ma3"`          // 3日均价
	MV3               float64        `name:"3日均量" dataframe:"mv3"`          // 3日均量
	MA4               float64        `name:"4日均价" dataframe:"ma4"`          // 4日均价
	MA5               float64        `name:"5日均价" dataframe:"ma5"`          // 5日均价
	MV5               float64        `name:"5日均量" dataframe:"mv5"`          // 5日均量
	MA9               float64        `name:"9日均价" dataframe:"ma9"`          // 9日均价
	MV9               float64        `name:"9日均量" dataframe:"mv9"`          // 9日均量
	MA10              float64        `name:"10日均价" dataframe:"ma10"`        // 10日均价
	MV10              float64        `name:"10日均量" dataframe:"mv10"`        // 10日均量
	MA19              float64        `name:"19日均价" dataframe:"ma19"`        // 19日均价
	MV19              float64        `name:"19日均量" dataframe:"mv19"`        // 19日均量
	MA20              float64        `name:"20日均价" dataframe:"ma20"`        // 20日均价
	MV20              float64        `name:"20日均量" dataframe:"mv20"`        // 20日均量
	OPEN              float64        `name:"开盘" dataframe:"open"`           // 昨日开盘
	CLOSE             float64        `name:"收盘" dataframe:"close"`          // 昨日收盘
	HIGH              float64        `name:"最高" dataframe:"high"`           // 昨日最高
	LOW               float64        `name:"最低" dataframe:"low"`            // 昨日最低
	VOL               float64        `name:"成交量" dataframe:"vol"`           // 昨日成交量
	AMOUNT            float64        `name:"成交额" dataframe:"amount"`        // 昨日成交额
	AveragePrice      float64        `name:"均价" dataframe:"average_price"`  // 昨日均价
	Payloads          IncompleteData `name:"payloads" dataframe:"payloads"` // 扩展的半成品数据
	Last              CompleteData   `name:"last" dataframe:"last"`         // 上一个交易日的数据
	UpdateTime        string         `name:"更新时间" dataframe:"update_time"`  // 更新时间
	State             uint64         `name:"样本状态" dataframe:"样本状态"`
}

History 历史整合数据

记录重要的截止上一个交易日的数据

func GetL5History added in v0.8.8

func GetL5History(securityCode string, date ...string) *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) GetMV5 added in v0.6.1

func (this *History) GetMV5() float64

GetMV5 前5日分钟均量

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 QuoteSnapshot) 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)

func (*History) ValidateSample added in v0.8.1

func (this *History) ValidateSample() error

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 (this *HousNo1) Factory(date string, code string) Feature

func (*HousNo1) FromHistory added in v0.2.0

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

func (*HousNo1) GetDate added in v0.2.0

func (this *HousNo1) GetDate() string

func (*HousNo1) GetSecurityCode added in v0.2.0

func (this *HousNo1) GetSecurityCode() string

func (*HousNo1) Increase added in v0.2.0

func (this *HousNo1) Increase(snapshot QuoteSnapshot) Feature

func (*HousNo1) Init added in v0.2.0

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

func (*HousNo1) Repair added in v0.2.0

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

func (*HousNo1) Update added in v0.2.0

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

func (*HousNo1) ValidateSample added in v0.8.1

func (this *HousNo1) ValidateSample() error

type IncompleteData added in v0.2.0

type IncompleteData struct {
	No1 HousNo1
}

IncompleteData 不完整的数据

type JuXianDongXiang added in v0.8.8

type JuXianDongXiang struct {
	Dm0       float64
	Dm1       float64
	Dm2       float64
	Diverging float64
	B         bool
}

type KLineBox added in v0.8.8

type KLineBox struct {
	Code           string  // 证券代码
	Date           string  // 数据日期
	DoubletPeriod  int     // box: 倍量周期
	DoubleHigh     float64 // box: 倍量最高
	DoubleLow      float64 // box: 倍量最低
	Buy            bool    // box: 买入
	HalfPeriod     int     // box: 半量周期
	HalfHigh       float64 // box: 半量最高
	HalfLow        float64 // box: 半量最低
	Sell           bool    // box: 卖出
	TendencyPeriod int     // box: 趋势周期
	QSFZ           bool    // qsfz: 信号
	QSCP           float64 // qsfz: cp
	QSCV           float64 // qsfz: cv
	QSVP           float64 // qsfz: vp
	QSVP3          float64 // qsfz: vp3
	QSVP5          float64 // qsfz: vp5
	DkCol          float64 // dkqs: 能量柱, 通达信分时指标DkCol
	DkD            float64 // dkqs: 多头力量
	DkK            float64 // dkqs: 空头力量
	DkB            bool    // dkqs: 买入
	DkS            bool    // dkqs: 卖出
	DxDivergence   float64 // madx: 综合发散度评估值
	DxDm0          float64 // madx: 均线发散度-超短线
	DxDm1          float64 // madx: 均线发散度-短线
	DxDm2          float64 // madx: 均线发散度-中线
	DxB            bool    // madx: 买入
}

KLineBox 有效突破(BreaksThrough)平台

func NewKLineBox added in v0.8.8

func NewKLineBox(code, date string) *KLineBox

NewKLineBox 构建有效突破数据

func (*KLineBox) Kind added in v0.8.8

func (k *KLineBox) Kind() cache.Kind

func (*KLineBox) Name added in v0.8.8

func (k *KLineBox) Name() string

type Manifest added in v0.3.5

type Manifest struct {
	cache.DataSummary
	Date string
	Code string
}

func (Manifest) GetDate added in v0.3.5

func (m Manifest) GetDate() string

func (Manifest) GetSecurityCode added in v0.3.5

func (m Manifest) GetSecurityCode() string

type Misc added in v1.1.3

type Misc struct {
	cache.DataSummary     `dataframe:"-"`
	Date                  string  `name:"日期" dataframe:"日期"`             // 数据日期
	Code                  string  `name:"证券代码" dataframe:"证券代码"`         // 证券代码
	Shape                 uint64  `name:"K线形态" dataframe:"K线形态"`         // K线形态
	MV3                   float64 `name:"前3日分钟均量" dataframe:"前3日分钟均量"`   // 前3日分钟均量
	MA3                   float64 `name:"3日均线" dataframe:"3日均线"`         // 3日均价
	MV5                   float64 `name:"前5日分钟均量" dataframe:"前5日分钟均量"`   // 前5日每分钟均量, 量比(QuantityRelativeRatio)需要
	MA5                   float64 `name:"5日均线" dataframe:"5日均线"`         // 5日均价
	MA10                  float64 `name:"10日均线" dataframe:"10日均线"`       // 10日均价
	MA20                  float64 `name:"20日均线" dataframe:"20日均线"`       // 生命线(MA20)/20日线
	FundFlow              float64 `name:"资金流向" dataframe:"资金流向"`         // 资金流向, 暂时无用
	VolumeRatio           float64 `name:"成交量比" dataframe:"成交量比"`         // 成交量放大比例, 相邻的两个交易日进行比对
	TurnoverRate          float64 `name:"换手率" dataframe:"换手率"`           // 换手率
	AmplitudeRatio        float64 `name:"振幅" dataframe:"振幅"`             // 振幅
	BidOpen               float64 `name:"竞价开盘" dataframe:"竞价开盘"`         // 竞价开盘价
	BidClose              float64 `name:"竞价结束" dataframe:"竞价结束"`         // 竞价结束
	BidHigh               float64 `name:"竞价最高" dataframe:"竞价最高"`         // 竞价最高
	BidLow                float64 `name:"竞价最低" dataframe:"竞价最低"`         // 竞价最低
	BidMatched            float64 `name:"竞价匹配量" dataframe:"竞价匹配量"`       // 竞价匹配量
	BidUnmatched          float64 `name:"竞价未匹配" dataframe:"竞价未匹配"`       // 竞价未匹配量
	BidDirection          int     `name:"竞价方向" dataframe:"竞价方向"`         // 竞价方向
	OpenBiddingDirection  int     `name:"开盘竞价" dataframe:"开盘竞价"`         // 竞价方向, 交易当日集合竞价开盘时更新
	OpenVolumeDirection   int     `name:"开盘竞量" dataframe:"开盘竞量"`         // 委托量差, 交易当日集合竞价开盘时更新
	CloseBiddingDirection int     `name:"收盘竞价" dataframe:"收盘竞价"`         // 竞价方向, 交易当日集合竞价收盘时更新
	CloseVolumeDirection  int     `name:"收盘竞量" dataframe:"收盘竞量"`         // 委托量差, 交易当日集合竞价收盘时更新
	OpenVolume            int64   `name:"开盘量" dataframe:"开盘量"`           // 开盘量
	OpenTurnZ             float64 `name:"开盘换手z" dataframe:"开盘换手z"`       // 开盘换手z
	CloseVolume           int64   `name:"收盘量" dataframe:"收盘量"`           // TODO:快照数据实际上有好几条, 应该用当日成交记录修订
	CloseTurnZ            float64 `name:"收盘换手z" dataframe:"收盘换手z"`       // 收盘换手z
	LastSentiment         float64 `name:"昨日情绪" dataframe:"昨日情绪"`         // 昨日情绪
	LastConsistent        int     `name:"昨日情绪一致" dataframe:"昨日情绪一致"`     // 昨日情绪一致
	OpenSentiment         float64 `name:"开盘情绪值" dataframe:"开盘情绪值"`       // 开盘情绪值, 个股没有
	OpenConsistent        int     `name:"开盘情绪一致" dataframe:"开盘情绪一致"`     // 开盘情绪一致, 个股没有
	CloseSentiment        float64 `name:"收盘情绪值" dataframe:"收盘情绪值"`       // 收盘情绪值
	CloseConsistent       int     `name:"收盘情绪一致" dataframe:"收盘情绪一致"`     // 收盘情绪一致
	AveragePrice          float64 `name:"均价线" dataframe:"均价线"`           // 均价线
	Volume                int64   `name:"成交量" dataframe:"成交量"`           // 成交量
	InnerVolume           int64   `name:"内盘" dataframe:"内盘"`             // 内盘
	OuterVolume           int64   `name:"外盘" dataframe:"外盘"`             // 外盘
	InnerAmount           float64 `name:"卖出金额" dataframe:"inner_amount"` // 卖出金额合计
	OuterAmount           float64 `name:"买入金额" dataframe:"outer_amount"` // 买入金额合计
	Change5               float64 `name:"5日涨幅" dataframe:"5日涨幅"`         // 5日涨幅
	Change10              float64 `name:"10日涨幅" dataframe:"10日涨幅"`       // 10日涨幅
	InitialPrice          float64 `name:"启动价格" dataframe:"启动价格"`         // 短线底部(Short-Term Bottom),股价最近一次上穿5日均线
	ShortIntensity        float64 `name:"短线强度" dataframe:"短线强度"`         // 短线强度,Strength
	ShortIntensityDiff    float64 `name:"短线强度增幅" dataframe:"短线强度增幅"`     // 短线强度
	MediumIntensity       float64 `name:"中线强度" dataframe:"中线强度"`         // 中线强度
	MediumIntensityDiff   float64 `name:"中线强度增幅" dataframe:"中线强度增幅"`     // 中线强度
	Vix                   float64 `name:"波动率" dataframe:"波动率"`           // 波动率
	BullPower             float64 `name:"多方强度" dataframe:"多方强度"`         // 多方强度
	BearPower             float64 `name:"空方强度" dataframe:"空方强度"`         // 空方强度
	PowerTrendReversal    int     `name:"多空反转" dataframe:"多空反转"`         // 多空反转
	PowerTrendPeriod      int     `name:"多空趋势周期" dataframe:"多空趋势周期"`     // 多空趋势周期
	State                 uint64  `name:"样本状态" dataframe:"样本状态"`         // 样本状态
}

Misc 上一个交易日的数据快照

func FilterL5Misc added in v1.5.0

func FilterL5Misc(f func(v *Misc) bool, date ...string) []*Misc

func GetL5Misc added in v1.1.3

func GetL5Misc(securityCode string, date ...string) (exchange *Misc)

GetL5Misc 获取扩展信息

func NewMisc added in v1.1.5

func NewMisc(date, code string) *Misc

func (*Misc) Factory added in v1.1.3

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

func (*Misc) FromHistory added in v1.1.3

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

func (*Misc) GetDate added in v1.1.3

func (this *Misc) GetDate() string

func (*Misc) GetSecurityCode added in v1.1.3

func (this *Misc) GetSecurityCode() string

func (*Misc) Increase added in v1.1.3

func (this *Misc) Increase(snapshot QuoteSnapshot) Feature

func (*Misc) Init added in v1.1.3

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

func (*Misc) Repair added in v1.1.3

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

func (*Misc) Update added in v1.1.3

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

func (*Misc) ValidateSample added in v1.1.3

func (this *Misc) ValidateSample() error

ValidateSample 验证样本数据

type MiscKLine added in v1.4.8

type MiscKLine struct {
	Date                string  // 日期
	Code                string  // 证券代码
	Shape               uint64  // K线形态
	MV3                 float64 // 3日均量
	MA3                 float64 // 3日均价
	MV5                 float64 // 5日均量
	MA5                 float64 // 5日均价
	MA10                float64 // 10日均价
	MA20                float64 // 20日均价
	VolumeRatio         float64 // 成交量比
	TurnoverRate        float64 // 换手率
	AmplitudeRatio      float64 // 振幅
	AveragePrice        float64 // 均价线
	Change5             float64 // 5日涨幅
	Change10            float64 // 10日涨幅
	InitialPrice        float64 // 短线底部(Short-Term Bottom),股价最近一次上串5日均线
	ShortIntensity      float64 // 短线强度
	ShortIntensityDiff  float64 // 短线强度增幅
	MediumIntensity     float64 // 中线强度
	MediumIntensityDiff float64 // 中线强度增幅
	Vix                 float64 // 波动率
	Sentiment           float64 // 情绪值
	Consistent          int     // 情绪一致
}

MiscKLine K线特征

func NewMiscKLine added in v1.4.8

func NewMiscKLine(code, date string) *MiscKLine

NewMiscKLine 构建制定日期的K线数据

func (*MiscKLine) Kind added in v1.4.8

func (k *MiscKLine) Kind() cache.Kind

func (*MiscKLine) Name added in v1.4.8

func (k *MiscKLine) Name() string

type MovingAverage added in v0.8.8

type MovingAverage struct {
	MA5  float64 // 5日均线
	MA10 float64 // 10日均线
	MA20 float64 // 20日均线
}

MovingAverage 移动平均线(MA)

type PowerTrend added in v1.5.0

type PowerTrend = int
const (
	// SignalNegative indicates that a particular value is a negative peak.
	SignalNegative PowerTrend = -1
	// SignalNeutral indicates that a particular value is not a peak.
	SignalNeutral PowerTrend = 0
	// SignalPositive indicates that a particular value is a positive peak.
	SignalPositive PowerTrend = 1
)

type QuShiFanZhuan added in v0.8.8

type QuShiFanZhuan struct {
	QSFZ bool    // 反转信号
	CP   float64 // 股价涨幅
	CV   float64 // 成交量涨幅
	VP   float64 // 价量比
	VP3  float64 // 3日价量比
	VP5  float64 // 5日价量比
}

QuShiFanZhuan 趋势反转

type QuoteSnapshot added in v0.8.5

type QuoteSnapshot struct {
	Date                  string               // 交易日期
	ServerTime            string               // 时间
	SecurityCode          string               // 证券代码
	ExchangeState         quotes.ExchangeState // 交易状态
	State                 quotes.TradeState    // 上市公司状态
	Market                uint8                // 市场ID
	Code                  string               `name:"证券代码"`  // 代码
	Name                  string               `name:"证券名称"`  // 证券名称
	Active                uint16               `name:"活跃度"`   // 活跃度
	LastClose             float64              `name:"昨收"`    // 昨收
	Open                  float64              `name:"开盘价"`   // 开盘
	OpeningChangeRate     float64              `name:"开盘涨幅%"` // 开盘
	Price                 float64              `name:"现价"`    // 现价
	ChangeRate            float64              `name:"涨跌幅%"`  // 涨跌幅
	PremiumRate           float64              `name:"溢价率%"`  // 集合竞价买入溢价, hedgeRatio
	High                  float64              // 最高
	Low                   float64              // 最低
	Vol                   int                  // 总量
	CurVol                int                  // 现量
	Amount                float64              // 总金额
	SVol                  int                  // 内盘
	BVol                  int                  // 外盘
	IndexOpenAmount       int                  // 指数-集合竞价成交金额=开盘成交金额
	StockOpenAmount       int                  // 个股-集合竞价成交金额=开盘成交金额
	OpenVolume            int                  `name:"开盘量"` // 集合竞价-开盘量, 单位是股
	CloseVolume           int                  `name:"收盘量"` /// 集合竞价-收盘量, 单位是股
	IndexUp               int                  // 指数有效-上涨数
	IndexUpLimit          int                  // 指数有效-涨停数
	IndexDown             int                  // 指数有效-下跌数
	IndexDownLimit        int                  // 指数有效-跌停数
	OpenBiddingDirection  int                  `name:"开盘竞价" dataframe:"开盘竞价"` // 竞价方向, 交易当日集合竞价开盘时更新
	OpenVolumeDirection   int                  `name:"开盘竞量" dataframe:"开盘竞量"` // 委托量差, 交易当日集合竞价开盘时更新
	CloseBiddingDirection int                  `name:"收盘竞价" dataframe:"收盘竞价"` // 竞价方向, 交易当日集合竞价收盘时更新
	CloseVolumeDirection  int                  `name:"收盘竞量" dataframe:"收盘竞量"` // 委托量差, 交易当日集合竞价收盘时更新
	Rate                  float64              // 涨速
	TopNo                 int                  // 板块排名
	TopCode               string               // 领涨个股
	TopName               string               // 领涨个股名称
	TopRate               float64              // 领涨个股涨幅
	ZhanTing              int                  // 涨停数
	Ling                  int                  // 平盘数
	Count                 int                  // 总数
	Capital               float64              `name:"流通盘"`    // 流通盘
	FreeCapital           float64              `name:"自由流通股本"` // 自由流通股本
	OpenTurnZ             float64              `name:"开盘换手Z%"` // 开盘换手
	OpenQuantityRatio     float64              `name:"开盘量比"`
	QuantityRatio         float64              `name:"量比"`
	ChangePower           float64              `name:"涨跌力度"` // 开盘金额除以开盘涨幅
	AverageBiddingVolume  int                  `name:"委托均量"` // 委托均量
	UpdateTime            string               // 本地时间戳
}

QuoteSnapshot 即时行情快照

type SecurityFeature added in v1.1.4

type SecurityFeature struct {
	Date           string  `name:"日期" dataframe:"date,string"`
	Open           float64 `name:"开盘" dataframe:"open,float64"`
	Close          float64 `name:"收盘" dataframe:"close,float64"`
	High           float64 `name:"最高" dataframe:"high,float64"`
	Low            float64 `name:"最低" dataframe:"low,float64"`
	Volume         int64   `name:"成交量" dataframe:"volume,int64"`
	Amount         float64 `name:"成交额" dataframe:"amount,float64"`
	Up             int     `name:"上涨家数" dataframe:"up,int64"`   // 个股无效
	Down           int     `name:"下跌家数" dataframe:"down,int64"` // 个股无效
	LastClose      float64 `name:"昨收" dataframe:"last_close,float64"`
	ChangeRate     float64 `name:"涨跌幅" dataframe:"change_rate,float64"`
	OpenVolume     int64   `name:"开盘量" dataframe:"open_volume,int64"`
	OpenTurnZ      float64 `name:"开盘换手z" dataframe:"open_turnz,float64"`
	OpenUnmatched  int64   `name:"开盘未匹配" dataframe:"open_unmatched,int64"` // K线无效, 调取misc特征数据获取
	CloseVolume    int64   `name:"收盘量" dataframe:"close_volume,int64"`
	CloseTurnZ     float64 `name:"收盘换手z" dataframe:"close_turnz,float64"`
	CloseUnmatched int64   `name:"收盘未匹配" dataframe:"close_unmatched,int64"` // K线无效, 调取misc特征数据获取
	InnerVolume    int64   `name:"内盘" dataframe:"inner_volume,int64"`
	OuterVolume    int64   `name:"外盘" dataframe:"outer_volume,int64"`
	InnerAmount    float64 `name:"流出金额" dataframe:"inner_amount,float64"`
	OuterAmount    float64 `name:"流入金额" dataframe:"outer_amount,float64"`
}

SecurityFeature 证券特征信息

func CheckoutWideTableByDate added in v1.3.1

func CheckoutWideTableByDate(code, date string) []SecurityFeature

CheckoutWideTableByDate 捡出指定日期的K线数据

TODO: 扩展数据不适用内存缓存, 减小内存压力

type ShapeType added in v0.8.8

type ShapeType = uint64

ShapeType K线形态类型

const (
	KLineShapeYiZi                 ShapeType = 1 << iota // 1一字
	KLineShapeLimitUp                                    // 2涨停板
	KLineShapeLimitDown                                  // 3跌停板
	KLineShapeNoChanged                                  // 4平盘
	KLineShapeUp                                         // 5上涨
	KLineShapeDown                                       // 6下跌
	KLineShapeDoji                                       // 7十字星
	KLineShapeLongUpShadow                               // 8长上影线
	KLineShapeLongDownShadow                             // 9长下影线
	KLineShapeDaYangLine                                 // 10大阳线
	KLineShapeDaYinLine                                  // 11大阴线
	KLineShapeZhongYangLine                              // 12中阳线
	KLineShapeZhongYinLine                               // 13中阴线
	KLineShapeXiaoYangLine                               // 14小阳线
	KLineShapeXiaoYinLine                                // 15小阴线
	KLineShapeNotLimitUp                                 // 16炸板, 曾涨停
	KLineShapeNotLimitDown                               // 17曾跌停
	KLineShapeShrinkToHalf                               // 18第3日缩量到一半
	KLineShapeGrabChipInFinalRound                       // 19尾盘抢筹
	KLineShapeChant                                      // 20吟唱, 蓄力 配合大阳线
	KLineShapeStepBackDailyMA                            // 21日线-连续2个周期回踩均线
	KLineShapeStepBackWeeklyMA                           // 22周线-连续2个周期回踩均线
	KLineShapeStepBackMonthlyMA                          // 23月线-连续2个周期回踩均线
)

func KLineShape added in v0.8.8

func KLineShape(df pandas.DataFrame, securityCode string) (shape ShapeType)

KLineShape K线形态

type Trait added in v0.3.7

type Trait interface {
	// FromHistory 从历史数据加载
	FromHistory(history History) Feature
	// Increase 增量计算
	//	用快照增量计算特征
	Increase(snapshot QuoteSnapshot) Feature
	// ValidateSample 验证样本
	ValidateSample() error
}

Trait 基础的特性

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

type TransactionRecord added in v0.8.8

type TransactionRecord struct {
	cache.DataSummary
	Date string
	Code string
}

TransactionRecord 成交记录

最短3秒内的合并统计数据, 与行情数据保持一致
不可以当作tick数据来使用

func (*TransactionRecord) Check added in v0.8.8

func (r *TransactionRecord) Check(cacheDate, featureDate string) error

func (*TransactionRecord) Checkout added in v0.8.8

func (r *TransactionRecord) Checkout(securityCode, date string)

func (*TransactionRecord) Clone added in v0.8.8

func (r *TransactionRecord) Clone(date string, code string) DataSet

func (*TransactionRecord) Filename added in v0.8.8

func (r *TransactionRecord) Filename(date, code string) string

func (*TransactionRecord) GetDate added in v0.8.8

func (r *TransactionRecord) GetDate() string

func (*TransactionRecord) GetSecurityCode added in v0.8.8

func (r *TransactionRecord) GetSecurityCode() string

func (*TransactionRecord) Increase added in v0.8.8

func (r *TransactionRecord) Increase(snapshot quotes.Snapshot)

func (*TransactionRecord) Init added in v0.8.8

func (r *TransactionRecord) Init(ctx context.Context, date string) error

func (*TransactionRecord) Print added in v0.8.8

func (r *TransactionRecord) Print(code string, date ...string)

func (*TransactionRecord) Repair added in v0.8.8

func (r *TransactionRecord) Repair(date string)

func (*TransactionRecord) Update added in v0.8.8

func (r *TransactionRecord) Update(date string)

type TurnoverDataSummary added in v1.1.4

type TurnoverDataSummary struct {
	OpenVolume     int64   `name:"开盘量" dataframe:"open_volume,int64"`
	OpenTurnZ      float64 `name:"开盘换手z" dataframe:"open_turnz,float64"`
	OpenUnmatched  int64   `name:"开盘未匹配" dataframe:"open_unmatched,int64"` // K线无效, 调取misc特征数据获取
	CloseVolume    int64   `name:"收盘量" dataframe:"close_volume,int64"`
	CloseTurnZ     float64 `name:"收盘换手z" dataframe:"close_turnz,float64"`
	CloseUnmatched int64   `name:"收盘未匹配" dataframe:"close_unmatched,int64"` // K线无效, 调取misc特征数据获取
	InnerVolume    int64   `name:"内盘" dataframe:"inner_volume,int64"`
	OuterVolume    int64   `name:"外盘" dataframe:"outer_volume,int64"`
	InnerAmount    float64 `name:"流出金额" dataframe:"inner_amount,float64"`
	OuterAmount    float64 `name:"流入金额" dataframe:"outer_amount,float64"`
}

TurnoverDataSummary 换手数据概要

func CountInflow added in v0.8.8

func CountInflow(list []quotes.TickTransaction, securityCode string, date string) (summary TurnoverDataSummary)

CountInflow 统计指定日期的内外盘

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