尝试在报错时补齐缺少的candle序列

This commit is contained in:
zhangkun9038@dingtalk.com 2025-01-13 18:02:13 +08:00
parent 373359dde0
commit 3905624278
2 changed files with 5 additions and 0 deletions

View File

@ -462,6 +462,9 @@ func MakeMaX(cr *core.Core, cl *core.Candle, count int) (error, int) {
// cdl, err := cr.GetLastCandleListOfCoin(cl.InstID, cl.Period, count, lastTime)
cdl, err := GetRangeCandleSortedSet(cr, setName, count, lastTime)
if err != nil {
to, _ := cr.PeriodToMinutes(cl.Period)
to = tsi + to*ToInt64(count)
InvokeCandle(cr, cl.InstID, cl.Period, tsi, to)
return err, 0
}

View File

@ -93,6 +93,8 @@ func ToInt64(val interface{}) int64 {
vali, _ = strconv.ParseInt(val.(string), 10, 64)
} else if reflect.TypeOf(val).Name() == "float64" {
vali = int64(val.(float64))
} else if reflect.TypeOf(val).Name() == "int" {
vali = int64(val.(int))
}
return vali
}