diff --git a/src/dlob-subscriber/DLOBSubscriberIO.ts b/src/dlob-subscriber/DLOBSubscriberIO.ts index a61d2d7..9d2e200 100644 --- a/src/dlob-subscriber/DLOBSubscriberIO.ts +++ b/src/dlob-subscriber/DLOBSubscriberIO.ts @@ -115,5 +115,9 @@ export class DLOBSubscriberIO extends DLOBSubscriber { `orderbook_${marketType}_${l2Args.marketIndex}`, JSON.stringify(l2Formatted) ); + this.redisClient.client.set( + `last_update_orderbook_${marketType}_${l2Args.marketIndex}`, + JSON.stringify(l2Formatted) + ); } } diff --git a/src/publishers/tradesPublisher.ts b/src/publishers/tradesPublisher.ts index 513de34..5feaaf1 100644 --- a/src/publishers/tradesPublisher.ts +++ b/src/publishers/tradesPublisher.ts @@ -17,6 +17,7 @@ import { QUOTE_PRECISION, PRICE_PRECISION, getVariant, + ZERO, } from '@drift-labs/sdk'; import { logger, setLogLevel } from '../utils/logger'; @@ -181,7 +182,10 @@ const main = async () => { slot: fill.slot, action: 'fill', actionExplanation: getVariant(fill.actionExplanation), - referrerReward: convertToNumber(fill.referrerReward, QUOTE_PRECISION), + referrerReward: convertToNumber( + fill.referrerReward ?? ZERO, + QUOTE_PRECISION + ), }; }) ) diff --git a/src/wsConnectionManager.ts b/src/wsConnectionManager.ts index 4263e20..8b7283f 100644 --- a/src/wsConnectionManager.ts +++ b/src/wsConnectionManager.ts @@ -93,12 +93,6 @@ async function main() { subscribers.forEach((ws) => { ws.send(JSON.stringify({ channel: subscribedChannel, data: message })); }); - - // Save and persist last message - lastMessageRetriever.client.set( - `last_update_${subscribedChannel}`, - message - ); }); redisClient.client.on('error', (error) => {