代码拉取完成,页面将自动刷新
package tracker
import (
"gitee.com/quant1x/engine/factors"
"gitee.com/quant1x/num"
)
func tickWeight(snapshot factors.QuoteSnapshot) float64 {
// 1. 板块涨幅
weight1 := snapshot.ChangeRate
// 2. 涨速
weight2 := snapshot.Rate
return num.Mean([]float64{weight1, weight2})
}
// SectorSortForTick 板块排序, 盘中
func SectorSortForTick(a, b factors.QuoteSnapshot) bool {
aWeight := tickWeight(a)
bWeight := tickWeight(b)
return aWeight > bWeight
}
// SectorSortForHead 板块排序, 早盘
func SectorSortForHead(a, b factors.QuoteSnapshot) bool {
if a.OpeningChangeRate > b.OpeningChangeRate {
return true
}
if a.OpeningChangeRate == b.OpeningChangeRate && a.Amount > b.Amount {
return true
}
if a.OpeningChangeRate == b.OpeningChangeRate && a.Amount == b.Amount && a.OpenTurnZ > b.OpenTurnZ {
return true
}
return false
}
// StockSort 个股排序
func StockSort(a, b factors.QuoteSnapshot) bool {
if a.ChangeRate > b.ChangeRate {
return true
}
if a.ChangeRate == b.ChangeRate && a.OpenTurnZ > b.OpenTurnZ {
return true
}
return false
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。