2 Star 3 Fork 10

王布衣 / engine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
cache_code.go 559 Bytes
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2024-01-11 11:15 . 适配exchange工具包
package cache
import (
"fmt"
"gitee.com/quant1x/exchange"
)
// CacheId 通过代码构建目录结构
func CacheId(code string) string {
_, marketName, code := exchange.DetectMarket(code)
cacheId := fmt.Sprintf("%s%s", marketName, code)
return cacheId
}
// CacheIdPath code从后保留3位, 市场缩写+从头到倒数第3的代码, 确保每个目录只有000~999个代码
func CacheIdPath(code string) string {
N := 3
cacheId := CacheId(code)
length := len(cacheId)
prefix := cacheId[:length-N]
return fmt.Sprintf("%s/%s", prefix, cacheId)
}
1
https://gitee.com/quant1x/engine.git
git@gitee.com:quant1x/engine.git
quant1x
engine
engine
v1.8.4

搜索帮助