2 Star 7 Fork 10

王布衣/engine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
sector_snapshot.go 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2024-02-12 22:53 . 适配新版本的pandas
package tracker
import (
"fmt"
"gitee.com/quant1x/engine/factors"
"gitee.com/quant1x/engine/models"
"gitee.com/quant1x/gotdx/securities"
"gitee.com/quant1x/gox/api"
"gitee.com/quant1x/gox/progressbar"
"gitee.com/quant1x/num"
)
// 板块扫描
func scanSectorSnapshots(pbarIndex *int, blockType securities.BlockType) (list []factors.QuoteSnapshot) {
// 执行板块指数的检测
blockInfos := securities.BlockList()
// 获取指定类型的板块代码列表
var blockCodes []string
for _, v := range blockInfos {
if v.Type != blockType {
continue
}
blockCode := v.Code
blockCodes = append(blockCodes, blockCode)
blockTypeName, _ := securities.BlockTypeNameByTypeCode(v.Type)
__mapBlockTypeName[blockCode] = blockTypeName
}
blockCount := len(blockCodes)
fmt.Println()
btn, ok := securities.BlockTypeNameByTypeCode(blockType)
if !ok {
btn = num.AnyToString(blockType)
}
bar := progressbar.NewBar(*pbarIndex, "执行[扫描"+btn+"板块指数]", blockCount)
*pbarIndex++
for i := 0; i < blockCount; i++ {
bar.Add(1)
blockCode := blockCodes[i]
snapshot := models.GetStrategySnapshot(blockCode)
if snapshot == nil {
continue
}
list = append(list, *snapshot)
}
api.SliceSort(list, SectorSort)
return list
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/quant1x/engine.git
git@gitee.com:quant1x/engine.git
quant1x
engine
engine
v1.6.0

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385