Documentation ¶
Index ¶
- Constants
- Variables
- func AllStockTopN() int
- func BatchSnapShot(codes []string) []factors.QuoteSnapshot
- func FeatureToSnapshot(feature factors.SecurityFeature, securityCode string) factors.QuoteSnapshot
- func GetStrategySnapshot(securityCode string) *factors.QuoteSnapshot
- func GetTick(securityCode string) *factors.QuoteSnapshot
- func GetTickFromMemory(securityCode string) *quotes.Snapshot
- func QmtOrderRemark(model Strategy) string
- func QmtStrategyName(model Strategy) string
- func QuoteSnapshotFromProtocol(v quotes.Snapshot) factors.QuoteSnapshot
- func Register(strategy Strategy) error
- func SyncAllSnapshots(barIndex *int)
- func UsageStrategyList() string
- type ModelKind
- type ResultInfo
- type SortedStatus
- type Statistics
- type Strategy
- type StrategySummary
Constants ¶
View Source
const ( DefaultStrategy = ModelHousNo1 KLineMin = cache.KLineMin // K线最少记录数 )
View Source
const ( OrderFlagHead = "head" // 早盘订单标志 OrderFlagTick = "tick" // 实时订单标志 OrderFlagTail = "tail" // 尾盘订单标志 OrderFlagSell = "sell" // 卖出订单标志 )
View Source
const ( SortNotExecuted = iota // 没有排序, 由engine自行决定 SortFinished // 排序已完成 SortDefault // 默认排序, 由engine自行决定 SortNotRequired // 无需排序, 保持自然顺序, 这个顺序是证券代码的顺序 )
View Source
const (
// CACHE_STRATEGY_PATH 策略文件存储路径
CACHE_STRATEGY_PATH = "strategy"
)
Variables ¶
View Source
var ( ErrAlreadyExists = errors.New("the strategy already exists") // 已经存在 ErrNotFound = errors.New("the strategy was not found") // 不存在 )
View Source
var ( CountDays int // 统计多少天, 由控制台传入数值 CountTopN int // 统计前N, 由控制台传入数值 )
View Source
var ( MapStrategies = map[ModelKind]StrategySummary{ ModelZero: {Type: ModelZero, Name: "0号策略"}, ModelHousNo1: {Type: ModelHousNo1, Name: "1号策略"}, } )
View Source
var ( // ReserveStrategyNumberRanges Quant1X保留的策略编码范围 ReserveStrategyNumberRanges = []ModelKind{ ModelZero, ModelHousNo1, ModelNo2, ModelNo3, ModelNo4, ModelNo5, ModelNo6, ModelNo7, ModelNo8, ModelNo9, Model89K, ModelOneSizeFitsAllSells, ModelNoShareHolding, } )
Functions ¶
func BatchSnapShot ¶ added in v0.5.6
func BatchSnapShot(codes []string) []factors.QuoteSnapshot
BatchSnapShot 批量获取即时行情数据快照
func FeatureToSnapshot ¶ added in v0.5.6
func FeatureToSnapshot(feature factors.SecurityFeature, securityCode string) factors.QuoteSnapshot
FeatureToSnapshot 特征缓存数据转快照
func GetStrategySnapshot ¶ added in v0.6.1
func GetStrategySnapshot(securityCode string) *factors.QuoteSnapshot
GetStrategySnapshot 从缓存中获取快照
func GetTick ¶ added in v0.7.6
func GetTick(securityCode string) *factors.QuoteSnapshot
GetTick 获取一只股票的tick数据
该函数用于测试
func GetTickFromMemory ¶ added in v0.7.3
GetTickFromMemory 获取快照缓存
func QmtOrderRemark ¶ added in v0.7.7
QmtOrderRemark 获取用于QMT系统的订单备注
func QmtStrategyName ¶ added in v0.7.7
QmtStrategyName 获取用于QMT系统的策略名称
func QuoteSnapshotFromProtocol ¶ added in v0.6.1
func QuoteSnapshotFromProtocol(v quotes.Snapshot) factors.QuoteSnapshot
func SyncAllSnapshots ¶ added in v0.7.3
func SyncAllSnapshots(barIndex *int)
SyncAllSnapshots 实时更新快照
Types ¶
type ModelKind ¶
type ModelKind = uint64
ModelKind 模型类型编码, 整型
const ( ModelZero ModelKind = 0 // 0号策略, 是一个特殊策略, 不允许覆盖 ModelHousNo1 ModelKind = 1 // 1号策略, 经典的默认策略, 不允许覆盖 ModelNo2 ModelKind = 2 // 2号策略, 不允许覆盖 ModelNo3 ModelKind = 3 // 3号策略, 不允许覆盖 ModelNo4 ModelKind = 4 // 4号策略, 不允许覆盖 ModelNo5 ModelKind = 5 // 5号策略, 不允许覆盖 ModelNo6 ModelKind = 6 // 6号策略, 不允许覆盖 ModelNo7 ModelKind = 7 // 7号策略, 不允许覆盖 ModelNo8 ModelKind = 8 // 8号策略, 不允许覆盖 ModelNo9 ModelKind = 9 // 9号策略, 不允许覆盖 Model89K ModelKind = 89 // 89号策略, 89K策略, 不允许覆盖 ModelOneSizeFitsAllSells ModelKind = 117 // 卖出策略: 一刀切(Panic sell, cookie-cutter, One size fits all sales) ModelForceOverwrite ModelKind = 0x80000000 // 强制覆盖 )
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 uint64 `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 Statistics ¶ added in v0.5.6
type Statistics struct { Date string `name:"日期" dataframe:"date"` Code string `name:"证券代码" dataframe:"code"` Name string `name:"证券名称" dataframe:"name"` TurnZ float64 `name:"开盘换手Z%" dataframe:"turnz"` QuantityRatio float64 `name:"开盘量比" dataframe:"quantity_ratio"` Tendency string `name:"趋势" dataframe:"tendency"` LastClose float64 `name:"昨收" dataframe:"last_close"` Open float64 `name:"开盘价" dataframe:"open"` OpenRaise float64 `name:"开盘涨幅%" dataframe:"open_raise"` Price float64 `name:"现价" dataframe:"price"` UpRate float64 `name:"涨跌幅%" dataframe:"up_rate"` OpenPremiumRate float64 `name:"浮动溢价率%" dataframe:"open_premium_rate"` NextPremiumRate float64 `name:"隔日溢价率%" dataframe:"next_premium_rate"` BlockName string `name:"板块名称" dataframe:"block_name"` BlockRate float64 `name:"板块涨幅%" dataframe:"block_rate"` BlockTop int `name:"板块排名" dataframe:"block_top"` BlockRank int `name:"个股排名" dataframe:"block_rank"` OpenVolume int `name:"开盘量" dataframe:"open_volume"` AveragePrice float64 `name:"均价线" dataframe:"average_price"` Active int `name:"活跃度" dataframe:"active"` Speed float64 `dataframe:"speed"` ChangePower float64 `dataframe:"change_power"` AverageBiddingVolume int `name:"委托均量" dataframe:"average_bidding_volume"` Beta float64 `name:"Beta" dataframe:"beta"` // beta值 Alpha float64 `name:"Alpha" dataframe:"alpha"` // alpha值 UpdateTime string `name:"时间戳" dataframe:"update_time"` }
Statistics 0号策略数据, 订单结构
type Strategy ¶
type Strategy interface { // Code 策略编号 Code() ModelKind // Name 策略名称 Name() string // OrderFlag 订单标志 OrderFlag() string // Filter 过滤 Filter(ruleParameter config.RuleParameter, snapshot factors.QuoteSnapshot) error // Sort 排序 Sort([]factors.QuoteSnapshot) SortedStatus // Evaluate 评估 日线数据 Evaluate(securityCode string, result *concurrent.TreeMap[string, ResultInfo]) }
Strategy 策略/公式指标(features)接口
func CheckoutStrategy ¶ added in v0.7.2
CheckoutStrategy 捡出策略对象
type StrategySummary ¶ added in v1.0.5
Click to show internal directories.
Click to hide internal directories.