add lastUpdate to candle and max

This commit is contained in:
zhangkun9038@dingtalk.com 2024-12-18 13:32:49 +08:00
parent b17c657863
commit bcf0347002
2 changed files with 2 additions and 1 deletions

View File

@ -455,7 +455,7 @@ func (cl *Candle) SetToKey(core *Core) ([]interface{}, error) {
tss := strconv.FormatInt(tsi, 10) tss := strconv.FormatInt(tsi, 10)
keyName := "candle" + cl.Period + "|" + cl.InstID + "|ts:" + tss keyName := "candle" + cl.Period + "|" + cl.InstID + "|ts:" + tss
//过期时间:根号(当前candle的周期/1分钟)*10000 //过期时间:根号(当前candle的周期/1分钟)*10000
cl.LastUpdate = time.Now()
dt, err := json.Marshal(cl) dt, err := json.Marshal(cl)
exp, err := core.PeriodToMinutes(cl.Period) exp, err := core.PeriodToMinutes(cl.Period)
if err != nil { if err != nil {

1
maX.go
View File

@ -38,6 +38,7 @@ type WillMX struct {
func (mx MaX) SetToKey(cr *Core) ([]interface{}, error) { func (mx MaX) SetToKey(cr *Core) ([]interface{}, error) {
// fmt.Println(utils.GetFuncName(), " step1 ", mx.InstID, " ", mx.Period) // fmt.Println(utils.GetFuncName(), " step1 ", mx.InstID, " ", mx.Period)
mx.Timestamp, _ = Int64ToTime(mx.Ts) mx.Timestamp, _ = Int64ToTime(mx.Ts)
mx.LastUpdate = time.Now()
cstr := strconv.Itoa(mx.Count) cstr := strconv.Itoa(mx.Count)
tss := strconv.FormatInt(mx.Ts, 10) tss := strconv.FormatInt(mx.Ts, 10)
//校验时间戳是否合法 //校验时间戳是否合法