Skip to content

Commit

Permalink
improvement: handle dydx book change mapping more gracefully when no …
Browse files Browse the repository at this point in the history
…offsets are available
  • Loading branch information
thaaddeus committed Jun 10, 2024
1 parent c61351e commit a7e4902
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mappers/dydx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class DydxBookChangeMapper implements Mapper<'dydx', BookChange> {

bids: message.contents.bids
.map((bid) => {
const lastPriceLevelOffset = this._bidsOffsets[message.id][bid[0]]
const lastPriceLevelOffset = this._bidsOffsets[message.id] && this._bidsOffsets[message.id][bid[0]]
if (lastPriceLevelOffset !== undefined && lastPriceLevelOffset >= updateOffset) {
return
}
Expand All @@ -111,7 +111,7 @@ export class DydxBookChangeMapper implements Mapper<'dydx', BookChange> {

asks: message.contents.asks
.map((ask) => {
const lastPriceLevelOffset = this._asksOffsets[message.id][ask[0]]
const lastPriceLevelOffset = this._asksOffsets[message.id] && this._asksOffsets[message.id][ask[0]]
if (lastPriceLevelOffset !== undefined && lastPriceLevelOffset >= updateOffset) {
return
}
Expand Down

0 comments on commit a7e4902

Please sign in to comment.