From 5ac74e2186d3488beae809624068af70f8efd68f Mon Sep 17 00:00:00 2001 From: Thaddeus Date: Mon, 5 Aug 2024 14:15:34 +0200 Subject: [PATCH] improvement: handle invalid ascendex depth messages gracefully --- src/mappers/ascendex.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mappers/ascendex.ts b/src/mappers/ascendex.ts index dc359e3..7d110f8 100644 --- a/src/mappers/ascendex.ts +++ b/src/mappers/ascendex.ts @@ -54,6 +54,10 @@ export class AscendexBookChangeMapper implements Mapper<'ascendex', BookChange> } *map(message: AscendexDepthRealTime | AscendexDepthRealTimeSnapshot, localTimestamp: Date): IterableIterator { + if (!message.symbol || !message.data.bids || !message.data.asks) { + return + } + yield { type: 'book_change', symbol: message.symbol,