Skip to content

Commit

Permalink
csvsource: fix okex timestamp parsing (it's milliseconds)
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Jul 9, 2024
1 parent ee4455f commit a4f2207
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/datasource/csvsource/csv_tick_decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,25 @@ func OKExCSVTickDecoder(row []string, index int) (*CsvTick, error) {
if err != nil {
return nil, ErrInvalidPriceFormat
}

qty, err := fixedpoint.NewFromString(row[2])
if err != nil {
return nil, ErrInvalidVolumeFormat
}

side := types.SideTypeBuy
isBuyerMaker := false
if row[1] == "sell" {
side = types.SideTypeSell
isBuyerMaker = true
}

n, err := strconv.ParseFloat(row[4], 64) // startTime
if err != nil {
return nil, ErrInvalidTimeFormat
}
ts := time.Unix(int64(n), 0)

ts := time.UnixMilli(int64(n))
return &CsvTick{
TradeID: uint64(id),
Exchange: types.ExchangeOKEx,
Expand Down

0 comments on commit a4f2207

Please sign in to comment.