代码拉取完成,页面将自动刷新
package storages
import (
"gitee.com/quant1x/engine/cache"
"gitee.com/quant1x/engine/cachel5"
"gitee.com/quant1x/engine/factors"
"gitee.com/quant1x/engine/market"
"gitee.com/quant1x/engine/smart"
"gitee.com/quant1x/gox/progressbar"
"gitee.com/quant1x/gox/text/runewidth"
"gitee.com/quant1x/gox/util/treemap"
)
// FeaturesUpdate 更新特征
func FeaturesUpdate(barIndex *int, cacheDate, featureDate string, plugins []cache.DataPlugin, op cache.OpKind) {
moduleName := "特征数据"
if op == cache.OpRepair {
moduleName = "修复" + moduleName
} else {
moduleName = "更新" + moduleName
}
moduleName += cacheDate
var cacheList []cachel5.CacheAdapter
maxWidth := 0
for _, plugin := range plugins {
adapter, ok := plugin.(cachel5.CacheAdapter)
if ok {
cacheList = append(cacheList, adapter)
width := runewidth.StringWidth(adapter.Name())
if width > maxWidth {
maxWidth = width
}
}
}
allCodes := market.GetCodeList()
cacheCount := len(cacheList)
barCache := progressbar.NewBar(*barIndex, "执行["+moduleName+"]", cacheCount)
for _, adapter := range cacheList {
mapFeature := treemap.NewWithStringComparator()
codeCount := len(allCodes)
barCode := progressbar.NewBar(*barIndex+1, "执行["+adapter.Name()+"]", codeCount)
dataSource := adapter.Factory(featureDate, "")
_ = dataSource.Init(barIndex, featureDate)
for _, code := range allCodes {
data := adapter.Factory(cacheDate, code).(factors.Feature)
if data.Kind() != factors.FeatureHistory {
history := smart.GetL5History(code, cacheDate)
if history != nil {
data = data.FromHistory(*history)
}
}
if op == cache.OpRepair {
data.Repair(code, cacheDate, featureDate, true)
} else {
data.Update(code, cacheDate, featureDate, true)
}
mapFeature.Put(code, data)
barCode.Add(1)
}
// 加载缓存
adapter.Checkout(cacheDate)
// 合并
adapter.Merge(mapFeature)
barCache.Add(1)
}
}
//// RepairFeatures 修复特征数据
//func RepairFeatures(barIndex *int, cacheDate, featureDate string) {
// moduleName := "修复特征数据" + cacheDate
// // 1. 获取全部注册的数据集插件
// mask := cache.PluginMaskFeature
// //dataSetList := flash.DataSetList()
// plugins := cache.Plugins(mask)
// var cacheList []cachel5.CacheAdapter
// maxWidth := 0
// for _, plugin := range plugins {
// adapter, ok := plugin.(cachel5.CacheAdapter)
// if ok {
// cacheList = append(cacheList, adapter)
// width := runewidth.StringWidth(adapter.Name())
// if width > maxWidth {
// maxWidth = width
// }
// }
// }
// allCodes := market.GetCodeList()
// cacheCount := len(cacheList)
// barCache := progressbar.NewBar(*barIndex, "执行["+moduleName+"]", cacheCount)
// for _, adapter := range cacheList {
// mapFeature := treemap.NewWithStringComparator()
// codeCount := len(allCodes)
// barCode := progressbar.NewBar(*barIndex+1, "执行["+adapter.Name()+"]", codeCount)
// dataSource := adapter.Factory(featureDate, "")
// _ = dataSource.Init(barIndex, featureDate)
// for _, code := range allCodes {
// data := adapter.Factory(cacheDate, code).(factors.Feature)
// if data.Kind() != factors.FeatureHistory {
// history := smart.GetL5History(code, cacheDate)
// if history != nil {
// data = data.FromHistory(*history)
// }
// }
// data.Repair(code, cacheDate, featureDate, true)
// mapFeature.Put(code, data)
// barCode.Add(1)
// }
// // 加载缓存
// adapter.Checkout(cacheDate)
// // 合并
// adapter.Merge(mapFeature)
// _ = adapter
// barCache.Add(1)
// }
// _ = allCodes
//}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。