当request candle数据过于老的时候,使用okx的hsitory-candles接口,规避bug
This commit is contained in:
parent
73ca68fb87
commit
b72d8a69e4
11
core.go
11
core.go
@ -89,7 +89,16 @@ func (rst *RestQueue) Save(cr *Core) {
|
|||||||
if len(rst.Limit) > 0 {
|
if len(rst.Limit) > 0 {
|
||||||
limitSec = fmt.Sprint("&limit=", rst.Limit)
|
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)
|
logrus.Info("restLink: ", link)
|
||||||
rsp, err := cr.v5PublicInvoke(link)
|
rsp, err := cr.v5PublicInvoke(link)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user