代码拉取完成,页面将自动刷新
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
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。