csvsource: fix okex timestamp parsing (it's milliseconds)

This commit is contained in:
c9s 2023-12-14 16:00:46 +08:00
parent ee4455fa85
commit a4f220749a
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -158,21 +158,25 @@ func OKExCSVTickDecoder(row []string, index int) (*CsvTick, error) {
if err != nil { if err != nil {
return nil, ErrInvalidPriceFormat return nil, ErrInvalidPriceFormat
} }
qty, err := fixedpoint.NewFromString(row[2]) qty, err := fixedpoint.NewFromString(row[2])
if err != nil { if err != nil {
return nil, ErrInvalidVolumeFormat return nil, ErrInvalidVolumeFormat
} }
side := types.SideTypeBuy side := types.SideTypeBuy
isBuyerMaker := false isBuyerMaker := false
if row[1] == "sell" { if row[1] == "sell" {
side = types.SideTypeSell side = types.SideTypeSell
isBuyerMaker = true isBuyerMaker = true
} }
n, err := strconv.ParseFloat(row[4], 64) // startTime n, err := strconv.ParseFloat(row[4], 64) // startTime
if err != nil { if err != nil {
return nil, ErrInvalidTimeFormat return nil, ErrInvalidTimeFormat
} }
ts := time.Unix(int64(n), 0)
ts := time.UnixMilli(int64(n))
return &CsvTick{ return &CsvTick{
TradeID: uint64(id), TradeID: uint64(id),
Exchange: types.ExchangeOKEx, Exchange: types.ExchangeOKEx,