models

package
v0.3.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultStrategy = ModelHousNo1
	KLineMin        = 89 // K线最少记录数
)
View Source
const (
	// MaximumResultDays 结果最大天数
	MaximumResultDays int = 3
)

Variables

This section is empty.

Functions

func ExecuteStrategy

func ExecuteStrategy(model Strategy, barIndex *int)

ExecuteStrategy 执行策略

func GetAllSnapshots added in v0.1.3

func GetAllSnapshots(barIndex *int)

GetAllSnapshots 同步快照数据

Types

type ModelKind

type ModelKind = int

ModelKind 做多64个策略

const (
	ModelHousNo1 ModelKind = 1 << iota // 1号策略
	ModelTail                          // 尾盘策略
)
const (
	ModelZero ModelKind = 0 // 0号策略
)

type ModelNo1

type ModelNo1 struct {
}

ModelNo1 1号模型

FormulaNo1 3天内5天线上穿10天线,10天线上穿20天线的个股
count(cross(MA(c,5),MA(c,10)),3)>=1 and count(cross(MA(c,10),MA(c,20)),3)>=1

func (*ModelNo1) Code

func (m *ModelNo1) Code() ModelKind

func (*ModelNo1) Evaluate

func (m *ModelNo1) Evaluate(securityCode string, result *treemap.Map)

func (*ModelNo1) Name

func (m *ModelNo1) Name() string

type ResultInfo

type ResultInfo struct {
	Code           string  `name:"证券代码" dataframe:"code"`
	Name           string  `name:"证券名称" dataframe:"name"`
	Date           string  `name:"信号日期" dataframe:"date"`
	TurnZ          float64 `name:"开盘换手Z" dataframe:"turn_z"`
	Rate           float64 `name:"涨跌幅%" dataframe:"rate"`
	Buy            float64 `name:"委托价格" dataframe:"buy"`
	Sell           float64 `name:"目标价格" dataframe:"sell"`
	StrategyCode   int     `name:"策略编码" dataframe:"strategy_code"`
	StrategyName   string  `name:"策略名称" dataframe:"strategy_name"`
	BlockType      string  `name:"板块类型" dataframe:"block_type"`
	BlockCode      string  `name:"板块代码" dataframe:"block_code"`
	BlockName      string  `name:"板块名称" dataframe:"block_name"`
	BlockRate      float64 `name:"板块涨幅%" dataframe:"block_rate"`
	BlockTop       int     `name:"板块排名" dataframe:"block_top"`
	BlockRank      int     `name:"个股排名" dataframe:"block_rank"`
	BlockZhangTing string  `name:"板块涨停数" dataframe:"block_zhangting"`
	BlockDescribe  string  `name:"涨/跌/平" dataframe:"block_describe"`
	BlockTopCode   string  `name:"领涨股代码" dataframe:"block_top_code"`
	BlockTopName   string  `name:"领涨股名称" dataframe:"block_top_name"`
	BlockTopRate   float64 `name:"领涨股涨幅%" dataframe:"block_top_rate"`
	Tendency       string  `name:"短线趋势" dataframe:"tendency"`
}

ResultInfo 策略结果

type Strategy

type Strategy interface {
	// Code 策略编号
	Code() ModelKind
	// Name 策略名称
	Name() string
	// Evaluate 评估 日线数据
	Evaluate(securityCode string, result *treemap.Map)
}

Strategy 策略/公式指标(features)接口

type StrategyWrap

type StrategyWrap struct {
	Type ModelKind
	Name string
}

Jump to

Keyboard shortcuts

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