Documentation ¶
Index ¶
- Constants
- Variables
- func AllStockTopN() int
- func BatchSnapShot(codes []string) []factors.QuoteSnapshot
- func ExecuteStrategy(model Strategy, barIndex *int)
- func FeatureToSnapshot(feature cache.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 StrategyWrap
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]StrategyWrap{ ModelZero: {Type: ModelZero, Name: "0号策略"}, ModelHousNo1: {Type: ModelHousNo1, Name: "1号策略"}, ModelTail: {Type: ModelTail, Name: "尾盘策略"}, } )
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 cache.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 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 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 `name:"涨速" dataframe:"speed"` ChangePower float64 `name:"力度" dataframe:"change_power"` AverageBiddingVolume int `name:"委托均量" dataframe:"average_bidding_volume"` 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 StrategyWrap ¶
Click to show internal directories.
Click to hide internal directories.