Documentation ¶
Index ¶
- Constants
- Variables
- func ExecuteStrategy(model Strategy, barIndex *int)
- func GetAllSnapshots(barIndex *int)
- func GetAllSnapshotsV2() map[string]quotes.Snapshot
- func GetQuoteSnapshot(securityCode string) *quotes.Snapshot
- type ModelKind
- type QuoteSnapshot
- type ResultInfo
- type Statistics
- type Strategy
- type StrategyWrap
Constants ¶
View Source
const ( DefaultStrategy = ModelHousNo1 KLineMin = 89 // K线最少记录数 )
View Source
const ( OrderFlagHead = "head" // 早盘订单标志 OrderFlagTick = "tick" // 实时订单标志 OrderFlagTail = "tail" // 尾盘订单标志 )
View Source
const (
// CACHE_STRATEGY_PATH 策略文件存储路径
CACHE_STRATEGY_PATH = "strategy"
)
Variables ¶
View Source
var ( MapStrategies = map[ModelKind]StrategyWrap{ ModelZero: {Type: ModelZero, Name: "0号策略"}, ModelHousNo1: {Type: ModelHousNo1, Name: "1号策略"}, ModelTail: {Type: ModelTail, Name: "尾盘策略"}, } )
Functions ¶
func GetAllSnapshotsV2 ¶ added in v0.6.1
GetAllSnapshotsV2 同步快照数据
func GetQuoteSnapshot ¶ added in v0.6.1
Types ¶
type QuoteSnapshot ¶ added in v0.5.6
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%"` // 开盘换手 QuantityRatio float64 `name:"开盘量比"` ChangePower float64 `name:"涨跌力度"` // 开盘金额除以开盘涨幅 AverageBiddingVolume int `name:"委托均量"` // 委托均量 }
func BatchSnapShot ¶ added in v0.5.6
func BatchSnapShot(codes []string) []QuoteSnapshot
BatchSnapShot 批量获取即时行情数据快照
func FeatureToSnapshot ¶ added in v0.5.6
func FeatureToSnapshot(feature cache.SecurityFeature, securityCode string) QuoteSnapshot
func GetStrategySnapshot ¶ added in v0.6.1
func GetStrategySnapshot(securityCode string) *QuoteSnapshot
GetStrategySnapshot 从缓存中获取快照
func QuoteSnapshotFromProtocol ¶ added in v0.6.1
func QuoteSnapshotFromProtocol(v quotes.Snapshot) QuoteSnapshot
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"` ChangePower float64 `name:"力度" dataframe:"change_power"` AverageBiddingVolume int `name:"委托均量" dataframe:"average_bidding_volume"` // 委托均量 UpdateTime string `dataframe:"update_time"` }
Statistics 0号策略数据, 订单结构
type Strategy ¶
type Strategy interface { // Code 策略编号 Code() ModelKind // Name 策略名称 Name() string // OrderFlag 订单标志 OrderFlag() string // Filter 过滤 Filter(snapshot QuoteSnapshot) bool // Evaluate 评估 日线数据 Evaluate(securityCode string, result *treemap.Map) }
Strategy 策略/公式指标(features)接口
type StrategyWrap ¶
Click to show internal directories.
Click to hide internal directories.