当request candle数据过于老的时候,使用okx的hsitory-candles接口,规避bug

This commit is contained in:
zhangkun9038@dingtalk.com 2024-12-25 15:52:19 +08:00
parent 73ca68fb87
commit b72d8a69e4

11
core.go
View File

@ -89,7 +89,16 @@ func (rst *RestQueue) Save(cr *Core) {
if len(rst.Limit) > 0 {
limitSec = fmt.Sprint("&limit=", rst.Limit)
}
link := "/api/v5/market/candles?instId=" + rst.InstId + "&bar=" + rst.Bar + limitSec + afterSec + beforeSec
isHistory := false
ct, _ := cr.PeriodToMinutes(rst.Bar)
if rst.After/ct > 30 {
isHistory = true
}
prfix := ""
if isHistory {
prfix = "history-"
}
link := "/api/v5/market/" + prfix + "candles?instId=" + rst.InstId + "&bar=" + rst.Bar + limitSec + afterSec + beforeSec
logrus.Info("restLink: ", link)
rsp, err := cr.v5PublicInvoke(link)