代码拉取完成,页面将自动刷新
package services
import (
"gitee.com/quant1x/engine/cache"
"gitee.com/quant1x/engine/factors"
"gitee.com/quant1x/engine/storages"
"gitee.com/quant1x/gotdx/trading"
"time"
)
var (
// 非交易日每天更新一次
lastUpdateTime = "22:00:00.000"
// 交易日每天更新2次
allDateUpdateTimes = []string{"15:10:00.000", "18:10:00.000", lastUpdateTime}
)
// 任务 - 更新全部数据
func jobUpdateAll() {
//funcName := "jobUpdateAll"
now := time.Now()
tm := now.Format(trading.CN_SERVERTIME_FORMAT)
today := trading.Today()
lastDate := trading.LastTradeDate()
bUpdated := false
phase := ""
if today == lastDate {
for _, v := range allDateUpdateTimes {
if tm >= v {
phase = v
bUpdated = checkUpdateState(today, phase)
if bUpdated {
break
}
}
}
} else {
if tm >= lastUpdateTime {
phase = lastUpdateTime
bUpdated = checkUpdateState(today, phase)
}
}
if bUpdated && len(phase) > 0 {
factors.SwitchDate(cache.DefaultCanReadDate())
updateAll()
doneUpdate(today, phase)
}
//else {
// logger.Infof("%s, 非全数据更新时段", funcName)
//}
}
func updateAll() {
barIndex := 1
currentDate := cache.DefaultCanUpdateDate()
cacheDate, featureDate := cache.CorrectDate(currentDate)
updateAllBaseData(barIndex, featureDate)
updateAllFeatures(barIndex+1, cacheDate, featureDate)
}
func updateAllBaseData(barIndex int, featureDate string) {
// 1. 获取全部注册的数据集插件
mask := cache.PluginMaskBaseData
plugins := cache.Plugins(mask)
// 2. 执行操作
storages.BaseDataUpdate(barIndex, featureDate, plugins, cache.OpUpdate)
}
func updateAllFeatures(barIndex int, cacheDate, featureDate string) {
// 1. 获取全部注册的数据集插件
mask := cache.PluginMaskFeature
//dataSetList := flash.DataSetList()
plugins := cache.Plugins(mask)
storages.FeaturesUpdate(&barIndex, cacheDate, featureDate, plugins, cache.OpUpdate)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。