6 Star 18 Fork 28

王布衣 / gotdx

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
block_data.go 925 Bytes
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2024-01-16 11:50 . 优化行业板块的数据处理
package securities
import (
"gitee.com/quant1x/exchange"
"gitee.com/quant1x/gotdx/quotes"
"gitee.com/quant1x/gox/api"
"os"
)
// 同步板块数据
func syncBlockFiles() {
downloadBlockRawData(quotes.BLOCK_DEFAULT)
downloadBlockRawData(quotes.BLOCK_GAINIAN)
downloadBlockRawData(quotes.BLOCK_FENGGE)
downloadBlockRawData(quotes.BLOCK_ZHISHU)
updateCacheBlockFile()
}
// 更新缓存csv数据文件
func updateCacheBlockFile() {
// 如果板块数据不存在, 从应用内导出
blockFile := SectorFilename()
createOrUpdate := false
if !api.FileExist(blockFile) {
createOrUpdate = true
} else {
dataStat, err := os.Stat(blockFile)
if err == nil || os.IsExist(err) {
dataModifyTime := dataStat.ModTime()
toInit := exchange.CanInitialize(dataModifyTime)
if toInit {
createOrUpdate = true
}
} else {
createOrUpdate = true
}
}
if createOrUpdate {
parseAndGenerateBlockFile()
}
}
Go
1
https://gitee.com/quant1x/gotdx.git
git@gitee.com:quant1x/gotdx.git
quant1x
gotdx
gotdx
v1.22.6

搜索帮助