2 Star 7 Fork 11

王布衣/engine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
feature_f10_shareholder.go 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2024-01-11 11:15 . 适配exchange工具包
package factors
import (
"gitee.com/quant1x/engine/datasource/base"
"gitee.com/quant1x/engine/datasource/dfcf"
"gitee.com/quant1x/exchange"
"gitee.com/quant1x/gotdx/quotes"
"gitee.com/quant1x/gox/api"
)
type top10ShareHolder struct {
Code string
FreeCapital float64
Top10Capital float64
Top10Change float64
ChangeCapital float64
IncreaseRatio float64
ReductionRatio float64
}
func checkoutShareHolder(securityCode, featureDate string) *top10ShareHolder {
xdxrs := base.GetCacheXdxrList(securityCode)
api.SliceSort(xdxrs, func(a, b quotes.XdxrInfo) bool {
return a.Date > b.Date
})
xdxrInfo := checkoutCapital(xdxrs, featureDate)
if xdxrInfo != nil && exchange.AssertStockBySecurityCode(securityCode) {
list := dfcf.GetCacheShareHolder(securityCode, featureDate)
capital := xdxrInfo.HouLiuTong * 10000
totalCapital := xdxrInfo.HouZongGuBen * 10000
top10Capital, freeCapital, capitalChanged, increaseRatio, reductionRatio := ComputeFreeCapital(list, capital)
if freeCapital < 0 {
top10Capital, freeCapital, capitalChanged, increaseRatio, reductionRatio = ComputeFreeCapital(list, totalCapital)
}
frontList := dfcf.GetCacheShareHolder(securityCode, featureDate, 2)
frontTop10Capital, _, _, _, _ := ComputeFreeCapital(frontList, totalCapital)
shareHolder := top10ShareHolder{
Code: securityCode,
FreeCapital: freeCapital,
Top10Capital: top10Capital,
Top10Change: top10Capital - frontTop10Capital,
ChangeCapital: capitalChanged,
IncreaseRatio: increaseRatio,
ReductionRatio: reductionRatio,
}
return &shareHolder
}
return nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/quant1x/engine.git
git@gitee.com:quant1x/engine.git
quant1x
engine
engine
v1.8.10

搜索帮助