2 Star 7 Fork 10

王布衣/engine

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
cache_code.go 559 Bytes
Copy Edit Raw Blame History
王布衣 authored 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)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/quant1x/engine.git
git@gitee.com:quant1x/engine.git
quant1x
engine
engine
v1.5.4

Search