2 Star 7 Fork 11

王布衣/engine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
feature_f10_reports.go 1.57 KB
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2023-12-20 07:47 . 统一数据到factors目录
package factors
import (
"gitee.com/quant1x/engine/cache"
dfcf2 "gitee.com/quant1x/engine/datasource/dfcf"
"gitee.com/quant1x/gotdx/proto"
"gitee.com/quant1x/gox/api"
"gitee.com/quant1x/gox/logger"
)
var (
__mapQuarterlyReports = map[string]dfcf2.QuarterlyReport{}
)
func loadQuarterlyReports(date string) {
var allReports []dfcf2.QuarterlyReport
_, qEnd := api.GetQuarterDayByDate(date)
filename := cache.ReportsFilename(qEnd)
err := api.CsvToSlices(filename, &allReports)
if err != nil {
logger.Errorf("cache %s failed, error: %+v", filename, err)
}
if len(allReports) > 0 {
for _, v := range allReports {
__mapQuarterlyReports[v.SecurityCode] = v
}
}
}
func getQuarterlyYearQuarter(date string) string {
q, _, _ := api.GetQuarterByDate(date, 1)
return q
}
// 季报概要
type quarterlyReportSummary struct {
QDate string
BPS float64
BasicEPS float64
TotalOperateIncome float64
DeductBasicEPS float64
}
func (q *quarterlyReportSummary) Assign(v dfcf2.QuarterlyReport) {
q.BPS = v.BPS
q.BasicEPS = v.BasicEPS
q.TotalOperateIncome = v.TotalOperateIncome
q.DeductBasicEPS = v.DeductBasicEPS
q.QDate = v.QDATE
}
func getQuarterlyReportSummary(securityCode, date string) quarterlyReportSummary {
var summary quarterlyReportSummary
if proto.AssertIndexBySecurityCode(securityCode) {
return summary
}
v, ok := __mapQuarterlyReports[securityCode]
if ok {
summary.Assign(v)
return summary
}
q := dfcf2.GetCacheQuarterlyReportsBySecurityCode(securityCode, date)
if q != nil {
summary.Assign(*q)
}
return summary
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/quant1x/engine.git
git@gitee.com:quant1x/engine.git
quant1x
engine
engine
v1.0.5

搜索帮助