2 Star 13 Fork 14

王布衣/engine

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
tdx_xdxr.go 1.12 KB
Copy Edit Raw Blame History
王布衣 authored 2025-10-28 16:39 +08:00 . 用quant1x/data替换exchange和gotdx
package base
import (
"gitee.com/quant1x/data/exchange"
"gitee.com/quant1x/data/level1"
"gitee.com/quant1x/data/level1/quotes"
"gitee.com/quant1x/engine/cache"
"gitee.com/quant1x/gox/api"
"gitee.com/quant1x/gox/logger"
)
// UpdateXdxrInfo 除权除息数据
func UpdateXdxrInfo(securityCode string) {
securityCode = exchange.CorrectSecurityCode(securityCode)
tdxApi := level1.GetApi()
xdxrInfos, err := tdxApi.GetXdxrInfo(securityCode)
if err != nil {
logger.Errorf("获取除权除息数据失败", err)
return
}
//slices.SortFunc(xdxrInfos, func(a, b quotes.XdxrInfo) int {
// if a.Date == b.Date {
// return 0
// } else if a.Date > b.Date {
// return 1
// } else {
// return -1
// }
//})
if len(xdxrInfos) > 0 {
filename := cache.XdxrFilename(securityCode)
_ = api.SlicesToCsv(filename, xdxrInfos)
}
}
// GetCacheXdxrList 获取除权除息的数据列表
func GetCacheXdxrList(securityCode string) []quotes.XdxrInfo {
securityCode = exchange.CorrectSecurityCode(securityCode)
filename := cache.XdxrFilename(securityCode)
var list []quotes.XdxrInfo
_ = api.CsvToSlices(filename, &list)
return list
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/quant1x/engine.git
git@gitee.com:quant1x/engine.git
quant1x
engine
engine
v1.12.11

Search