Skip to content

Commit

Permalink
fix: okex spreads - skip book ticker messages with timestamp == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
thaaddeus committed Aug 29, 2024
1 parent 50b9262 commit 1b828b5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/mappers/okexspreads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ export class OkexSpreadsBookTickerMapper implements Mapper<'okex-spreads', BookT
}

for (const tbtTicker of message.data) {
const timestamp = new Date(Number(tbtTicker.ts))

if (timestamp.valueOf() === 0) {
continue
}

const bestAsk = tbtTicker.asks !== undefined && tbtTicker.asks[0] ? mapBookLevel(tbtTicker.asks[0]) : undefined
const bestBid = tbtTicker.bids !== undefined && tbtTicker.bids[0] ? mapBookLevel(tbtTicker.bids[0]) : undefined

Expand All @@ -124,7 +130,7 @@ export class OkexSpreadsBookTickerMapper implements Mapper<'okex-spreads', BookT

bidPrice: bestBid?.price,
bidAmount: bestBid?.amount,
timestamp: new Date(Number(tbtTicker.ts)),
timestamp,
localTimestamp: localTimestamp
}

Expand Down

0 comments on commit 1b828b5

Please sign in to comment.