diff --git a/exchanges/okx/okx_type_convert.go b/exchanges/okx/okx_type_convert.go index 523d8c1fd23..18d2b4533fe 100644 --- a/exchanges/okx/okx_type_convert.go +++ b/exchanges/okx/okx_type_convert.go @@ -212,35 +212,21 @@ func (a *OrderDetail) UnmarshalJSON(data []byte) error { } // UnmarshalJSON deserializes JSON, and timestamp information. -func (a *PendingOrderItem) UnmarshalJSON(data []byte) error { +func (o *PendingOrderItem) UnmarshalJSON(data []byte) error { type Alias PendingOrderItem - chil := &struct { + a := &struct { *Alias - Side string `json:"side"` - UpdateTime string `json:"uTime"` - CreationTime string `json:"cTime"` + UpdateTime okxUnixMilliTime `json:"uTime"` + CreationTime okxUnixMilliTime `json:"cTime"` + FillTime okxUnixMilliTime `json:"fillTime"` }{ - Alias: (*Alias)(a), - } - err := json.Unmarshal(data, chil) - if err != nil { - return err - } - uTime, err := strconv.ParseInt(chil.UpdateTime, 10, 64) - if err != nil { - return err + Alias: (*Alias)(o), } - cTime, err := strconv.ParseInt(chil.CreationTime, 10, 64) - if err != nil { - return err - } - a.Side, err = order.StringToOrderSide(chil.Side) - if err != nil { - return err - } - a.CreationTime = time.UnixMilli(cTime) - a.UpdateTime = time.UnixMilli(uTime) - return nil + err := json.Unmarshal(data, a) + o.CreationTime = a.CreationTime.Time() + o.UpdateTime = a.UpdateTime.Time() + o.FillTime = a.FillTime.Time() + return err } // UnmarshalJSON deserializes JSON, and timestamp information. diff --git a/exchanges/okx/okx_types.go b/exchanges/okx/okx_types.go index 606ecb63a1c..25c24bce0a9 100644 --- a/exchanges/okx/okx_types.go +++ b/exchanges/okx/okx_types.go @@ -727,7 +727,7 @@ type PendingOrderItem struct { FeeCurrency string `json:"feeCcy"` LastFilledPrice convert.StringToFloat64 `json:"fillPx"` LastFilledSize convert.StringToFloat64 `json:"fillSz"` - FillTime string `json:"fillTime"` + FillTime time.Time `json:"fillTime"` InstrumentID string `json:"instId"` InstrumentType string `json:"instType"` Leverage convert.StringToFloat64 `json:"lever"`