Documentation ¶
Index ¶
- Constants
- Variables
- func CacheId(code string) string
- func CacheIdPath(code string) string
- func CorrectDate(date string) (cacheDate, resourcesDate string)
- func DefaultCanReadDate() string
- func DefaultCanUpdateDate() string
- func FeatureFilename(code string) string
- func FundFlowFilename(securityCode string) string
- func GetConfigFilename() string
- func GetDayPath() string
- func GetFeaturesPath() string
- func GetFundFlowPath() string
- func GetHoldingPath() string
- func GetInfoPath() string
- func GetLoggerPath() string
- func GetMetaPath() string
- func GetMinutePath() string
- func GetQuarterlyPath() stringdeprecated
- func GetRootPath() string
- func GetSnapshotPath() string
- func GetTickPath() string
- func GetVariablePath() string
- func GetXdxrPath() string
- func GetZxgFile() string
- func KLineFilename(code string) string
- func MinuteFilename(code, date string) string
- func PreviewReportFilename(date string) string
- func QuarterlyReportFilename(code, date string) string
- func Register(plugin DataAdapter) error
- func ReportsFilename(date string) string
- func Reset()
- func SnapshotFilename(securityCode string) string
- func TickFilename(code, date string) string
- func Today() string
- func Top10HoldersFilename(code, date string) string
- func XdxrFilename(code string) string
- type DataAdapter
- type DataFile
- type DataSummary
- type Depend
- type Future
- type Handover
- type Increase
- type Initialization
- type Job
- type Kind
- type Manifest
- type OpKind
- type Operator
- type OrderParameter
- type PprofParameter
- type Properties
- type Quant1XConfig
- type RuleParameter
- type RuntimeParameter
- type Schema
- type ScoreBoard
- type SecurityFeature
- type Swift
- type TurnoverDataSummary
- type Validator
Constants ¶
const ( TDX_FORMAT_PROTOCOL_DATE = "20060102" // 通达信协议的日期字符串格式 CACHE_DATE = "20060102" // 缓存日期 INDEX_DATE = "2006-01-02" // 索引日期格式 TDX_DATE = "20060102" // 通达信日期 YearOnly = "2006" // 仅年份 )
const ( // Debug 调试开关 Debug = false )
const (
// DefaultDataProvider 默认数据提供者
DefaultDataProvider = "engine"
)
const (
FilenameDate = "20060102" // 缓存文件相关的日期格式
)
const (
KBarIndex = "barIndex"
)
const (
// ResourcesPath 资源路径
ResourcesPath = "resources"
)
const (
UseGoroutine = false // 更新和修复数据是否启用协程
)
Variables ¶
var (
ErrAlreadyExists = errors.New("plugin is already exists")
)
Functions ¶
func CacheIdPath ¶
CacheIdPath code从后保留3位, 市场缩写+从头到倒数第3的代码, 确保每个目录只有000~999个代码
func CorrectDate ¶ added in v0.1.5
CorrectDate 校正日期
func DefaultCanReadDate ¶ added in v0.1.5
func DefaultCanReadDate() string
DefaultCanReadDate 获取默认可以读缓存文件的日期
func DefaultCanUpdateDate ¶ added in v0.1.5
func DefaultCanUpdateDate() string
DefaultCanUpdateDate 获取默认可以更新缓存文件的日期
func FeatureFilename ¶ added in v0.5.4
FeatureFilename 特征数据缓存路径
func FundFlowFilename ¶ added in v0.5.1
FundFlowFilename 通过证券代码获取资金流向的缓存文件路径
func GetQuarterlyPath
deprecated
added in
v0.1.5
func MinuteFilename ¶ added in v0.5.3
func PreviewReportFilename ¶ added in v0.6.2
PreviewReportFilename 业绩预告文件名
func QuarterlyReportFilename ¶ added in v0.1.5
QuarterlyReportFilename 季报存储路径
info |-- YYYYQ1 |-- sh600105.report |-- YYYYQ2 |-- YYYYQ3 |-- YYYYQ4 Deprecated: 不推荐使用
func ReportsFilename ¶ added in v0.1.5
ReportsFilename 报告数据文件名
func SnapshotFilename ¶ added in v0.5.1
SnapshotFilename 快照数据文件
func TickFilename ¶ added in v0.2.0
TickFilename tick文件比较多, 目录结构${tick}/${YYYY}/${YYYYMMDD}/${CacheIdPath}
func Top10HoldersFilename ¶ added in v0.1.5
Top10HoldersFilename 前十大流通股股东缓存文件名
Types ¶
type DataAdapter ¶ added in v0.3.2
type DataAdapter interface { // Schema 继承基础特性接口 Schema // Print 控制台输出指定日期的数据 Print(code string, date ...string) }
DataAdapter 数据插件
func Plugins ¶ added in v0.1.7
func Plugins(mask ...Kind) (list []DataAdapter)
Plugins 按照类型标志位捡出数据插件
func PluginsWithName ¶ added in v0.2.0
func PluginsWithName(pluginType Kind, keywords ...string) (list []DataAdapter)
type DataFile ¶ added in v0.3.2
type DataFile interface { // Checkout 捡出指定日期的缓存数据 Checkout(securityCode, date string) // Filename 缓存文件名 // 接受两个参数 日期和证券代码 // 文件名为空不缓存 Filename(date, securityCode string) string // Check 数据校验 Check(cacheDate, featureDate string) error }
DataFile 基础数据文件接口
type DataSummary ¶ added in v0.3.2
type DataSummary struct {
// contains filtered or unexported fields
}
DataSummary 数据概要
func Summary ¶ added in v0.3.2
func Summary(kind Kind, key, name, owner string) DataSummary
func (DataSummary) Key ¶ added in v0.3.2
func (d DataSummary) Key() string
func (DataSummary) Kind ¶ added in v0.3.2
func (d DataSummary) Kind() Kind
func (DataSummary) Name ¶ added in v0.3.2
func (d DataSummary) Name() string
func (DataSummary) Owner ¶ added in v0.3.2
func (d DataSummary) Owner() string
func (DataSummary) Usage ¶ added in v0.3.4
func (d DataSummary) Usage() string
type Future ¶ added in v0.3.2
type Future interface { // Update 更新数据 // whole 是否完整的数据, false是加工成半成品数据, 为了配合Increase Update(securityCode, cacheDate, featureDate string, whole bool) // Repair 回补数据 Repair(securityCode, cacheDate, featureDate string, whole bool) }
Future 预备数据的接口
type Handover ¶ added in v0.1.7
type Handover interface { // ChangingOverDate 缓存数据转换日期 // 数据集等基础数据不需要切换日期 ChangingOverDate(date string) }
Handover 缓存切换接口
type Increase ¶ added in v0.3.2
type Increase[T any] interface { Add(data T) T }
Increase 增量数据计算接口
deprecated: 不推荐
type Initialization ¶ added in v0.3.4
type Initialization interface { // Init 初始化, 接受context, 日期和证券代码作为入参 Init(ctx context.Context, date string) error }
Initialization 初始化接口
type Manifest ¶ added in v0.3.8
type Manifest interface { Schema Properties Initialization }
Manifest 提要
type OrderParameter ¶ added in v0.6.6
type OrderParameter struct { AccountId string `yaml:"account_id"` // 账号ID OrderPath string `yaml:"order_path"` // 订单路径 TopN int `yaml:"top_n" default:"3"` // 最多输出前多少名个股 HaveETF bool `yaml:"have_etf" default:"false"` // 是否包含ETF }
OrderParameter 订单参数
type PprofParameter ¶ added in v0.4.7
type Properties ¶ added in v0.3.4
type Properties interface { // GetDate 日期 GetDate() string // GetSecurityCode 证券代码 GetSecurityCode() string }
Properties 属性接口
type Quant1XConfig ¶
type Quant1XConfig struct { BaseDir string `yaml:"basedir"` // 基础路径 Runtime RuntimeParameter `yaml:"runtime"` // 运行时参数 Rules RuleParameter `yaml:"rules"` // 规则参数 Order OrderParameter `yaml:"order"` // 订单参数 }
Quant1XConfig Quant1X基础配置
var ( // EngineConfig engine配置信息 EngineConfig Quant1XConfig )
type RuleParameter ¶ added in v0.6.6
type RuleParameter struct { SectorsFilter bool `yaml:"sectors_filter" default:"false"` // 是否启用板块过滤, false代表全市场扫描 SectorsTopN int `yaml:"sectors_top_n" default:"3"` // 最多关联多少个板块, 默认3个 StockTopNInSector int `yaml:"stock_top_n_in_sector" default:"5"` // 板块内个股排名前N PriceMin float64 `yaml:"price_min" default:"2.00"` // 2.00 股价最低 PriceMax float64 `yaml:"price_max" default:"30.00"` // 30.00 股价最高 MaximumIncreaseWithin5days float64 `yaml:"maximum_increase_within_5_days" default:"20.00"` // 20.00 5日累计最大涨幅 MaximumIncreaseWithin10days float64 `yaml:"maximum_increase_within_10_days" default:"70.00"` // 70.00 10日累计最大涨幅 MaxReduceAmount float64 `yaml:"max_reduce_amount" default:"-1000"` // -1000 最大流出1000万 TurnZMax float64 `yaml:"turn_z_max" default:"200.00"` // 200.00 换手最大值 TurnZMin float64 `yaml:"turn_z_min" default:"1.50"` // 1.50 换手最小值 OpenRateMax float64 `yaml:"open_rate_max" default:"2.00"` // 2.00 最大涨幅 OpenRateMin float64 `yaml:"open_rate_min" default:"-2.00"` // -2.00 最低涨幅 QuantityRatioMax float64 `yaml:"quantity_ratio_max" default:"9.99"` // 9.99 最大开盘量比 QuantityRatioMin float64 `yaml:"quantity_ratio_min" default:"1.00"` // 1.00 最小开盘量比 SafetyScoreMin float64 `yaml:"safety_score_min" default:"80"` // 80 通达信安全分最小值 VolumeRatioMax float64 `yaml:"volume_ratio_max" default:"3.82"` // 1.800 成交量放大不能超过1.8 CapitalMin float64 `yaml:"capital_min" default:"2"` // 2 * 亿 流通股本最小值 CapitalMax float64 `yaml:"capital_max" default:"20"` // 20 * 亿 流通股本最大值 VixMax float64 `yaml:"vix_max" default:"100"` // 波动率最大值100 VixMin float64 `yaml:"vix_min" default:"0"` // 波动率最小值0 TurnoverRateMax float64 `yaml:"turnover_rate_max" default:"20.00"` // 换手率最大20% TurnoverRateMin float64 `yaml:"turnover_rate_min" default:"1.00"` // 换手率最小1% AmplitudeRatioMax float64 `yaml:"amplitude_ratio_max" default:"15"` // 振幅 最大 AmplitudeRatioMin float64 `yaml:"amplitude_ratio_min" default:"0"` // 振幅 最小 BiddingVolumeMax int `yaml:"bidding_volume_max" default:"5000"` // 5档行情委托平均最大值 BiddingVolumeMin int `yaml:"bidding_volume_min" default:"100"` // 5档行情委托平均最小值 SentimentHigh float64 `yaml:"sentiment_high" default:"61.8"` // 情绪值最高 SentimentLow float64 `yaml:"sentiment_low" default:"38.2"` // 情绪值最低 }
RuleParameter 规则参数
type RuntimeParameter ¶ added in v0.4.7
type RuntimeParameter struct {
Pprof PprofParameter `yaml:"pprof"`
}
type Schema ¶ added in v0.3.9
type Schema interface { // Kind 数据类型 Kind() Kind // Owner 提供者 Owner() string // Key 数据关键词, key与cache落地强关联 Key() string // Name 特性名称 Name() string // Usage 控制台参数提示信息, 数据描述(data description) Usage() string }
Schema 缓存的概要信息
type ScoreBoard ¶ added in v0.3.2
type ScoreBoard struct { Kind Kind `name:"kind"` // 类型 Count int `name:"count"` // 总数 Max time.Duration `name:"max"` // 最大值 Min time.Duration `name:"min"` // 最小值 CrossTime time.Duration `name:"cross_time"` // 总耗时 Speed float64 `name:"speed"` // 速度 // contains filtered or unexported fields }
ScoreBoard 记分牌
func (*ScoreBoard) String ¶ added in v0.3.2
func (this *ScoreBoard) String() string
type SecurityFeature ¶ added in v0.2.0
type SecurityFeature struct { Date string `json:"Date" array:"0" name:"日期" dataframe:"date,string"` Open float64 `json:"Open" array:"1" name:"开盘" dataframe:"open,float64"` Close float64 `json:"Close" array:"2" name:"收盘" dataframe:"close,float64"` High float64 `json:"High" array:"3" name:"最高" dataframe:"high,float64"` Low float64 `json:"Low" array:"4" name:"最低" dataframe:"low,float64"` Volume int64 `json:"Volume" array:"5" name:"成交量" dataframe:"volume,int64"` Amount float64 `json:"Amount" array:"6" name:"成交额" dataframe:"amount,float64"` Up int `json:"Up" array:"7" name:"上涨家数" dataframe:"up,int64"` Down int `json:"Down" array:"8" name:"下跌家数" dataframe:"down,int64"` LastClose float64 `json:"LastClose" array:"9" name:"昨收" dataframe:"last_close,float64"` ChangeRate float64 `json:"ChangeRate" array:"10" name:"涨跌幅" dataframe:"change_rate,float64"` OpenVolume int64 `json:"OpenVolume" array:"11" name:"开盘量" dataframe:"open_volume,int64"` OpenTurnZ float64 `json:"OpenTurnZ" array:"12" name:"开盘换手z" dataframe:"open_turnz,float64"` OpenUnmatched int64 `json:"OpenUnmatched" array:"13" name:"开盘未匹配" dataframe:"open_unmatched,int64"` CloseVolume int64 `json:"CloseVolume" array:"14" name:"收盘量" dataframe:"close_volume,int64"` CloseTurnZ float64 `json:"CloseTurnZ" array:"15" name:"收盘换手z" dataframe:"close_turnz,float64"` CloseUnmatched int64 `json:"CloseUnmatched" array:"16" name:"收盘未匹配" dataframe:"close_unmatched,int64"` InnerVolume int64 `json:"InnerVolume" array:"17" name:"内盘" dataframe:"inner_volume,int64"` OuterVolume int64 `json:"OuterVolume" array:"18" name:"外盘" dataframe:"outer_volume,int64"` InnerAmount float64 `json:"InnerAmount" array:"19" name:"流出金额" dataframe:"inner_amount,float64"` OuterAmount float64 `json:"OuterAmount" array:"20" name:"流入金额" dataframe:"outer_amount,float64"` }
SecurityFeature 证券特征信息
type Swift ¶ added in v0.3.2
type Swift interface { }
Swift 快速接口
securityCode 证券代码, 2位交易所缩写+6位数字代码, 例如sh600600, 代表上海市场的青岛啤酒 cacheDate 缓存日期 featureDate 特征数据的日期
type TurnoverDataSummary ¶ added in v0.2.0
type TurnoverDataSummary struct { OpenVolume int64 `json:"OpenVolume" array:"0" name:"开盘量" dataframe:"open_volume,int64"` OpenTurnZ float64 `json:"OpenTurnZ" array:"1" name:"开盘换手z" dataframe:"open_turnz,float64"` OpenUnmatched int64 `json:"OpenUnmatched" array:"2" name:"开盘未匹配" dataframe:"open_unmatched,int64"` CloseVolume int64 `json:"CloseVolume" array:"3" name:"收盘量" dataframe:"close_volume,int64"` CloseTurnZ float64 `json:"CloseTurnZ" array:"4" name:"收盘换手z" dataframe:"close_turnz,float64"` CloseUnmatched int64 `json:"CloseUnmatched" array:"5" name:"收盘未匹配" dataframe:"close_unmatched,int64"` InnerVolume int64 `json:"InnerVolume" array:"6" name:"内盘" dataframe:"inner_volume,int64"` OuterVolume int64 `json:"OuterVolume" array:"7" name:"外盘" dataframe:"outer_volume,int64"` InnerAmount float64 `json:"InnerAmount" array:"8" name:"流出金额" dataframe:"inner_amount,float64"` OuterAmount float64 `json:"OuterAmount" array:"9" name:"流入金额" dataframe:"outer_amount,float64"` }
TurnoverDataSummary 换手数据概要
Source Files ¶
- cache.go
- cache_code.go
- cache_config.go
- cache_config_crontab.go
- cache_config_order.go
- cache_config_rules.go
- cache_filename.go
- cache_filepath.go
- cache_others.go
- cache_release.go
- data.go
- data_action.go
- data_adapter.go
- data_features.go
- data_increase.go
- data_summary.go
- datetime.go
- profile.go
- scoreboard.go