2 Star 5 Fork 10

王布衣/engine

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
feature_f10_reports.go 1.57 KB
Copy Edit Raw Blame History
王布衣 authored 2024-01-11 11:15 . 适配exchange工具包
package factors
import (
"gitee.com/quant1x/engine/cache"
dfcf2 "gitee.com/quant1x/engine/datasource/dfcf"
"gitee.com/quant1x/exchange"
"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 exchange.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.4.8

Search