patch trades and move last update
This commit is contained in:
@@ -115,5 +115,9 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
|
|||||||
`orderbook_${marketType}_${l2Args.marketIndex}`,
|
`orderbook_${marketType}_${l2Args.marketIndex}`,
|
||||||
JSON.stringify(l2Formatted)
|
JSON.stringify(l2Formatted)
|
||||||
);
|
);
|
||||||
|
this.redisClient.client.set(
|
||||||
|
`last_update_orderbook_${marketType}_${l2Args.marketIndex}`,
|
||||||
|
JSON.stringify(l2Formatted)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
QUOTE_PRECISION,
|
QUOTE_PRECISION,
|
||||||
PRICE_PRECISION,
|
PRICE_PRECISION,
|
||||||
getVariant,
|
getVariant,
|
||||||
|
ZERO,
|
||||||
} from '@drift-labs/sdk';
|
} from '@drift-labs/sdk';
|
||||||
|
|
||||||
import { logger, setLogLevel } from '../utils/logger';
|
import { logger, setLogLevel } from '../utils/logger';
|
||||||
@@ -181,7 +182,10 @@ const main = async () => {
|
|||||||
slot: fill.slot,
|
slot: fill.slot,
|
||||||
action: 'fill',
|
action: 'fill',
|
||||||
actionExplanation: getVariant(fill.actionExplanation),
|
actionExplanation: getVariant(fill.actionExplanation),
|
||||||
referrerReward: convertToNumber(fill.referrerReward, QUOTE_PRECISION),
|
referrerReward: convertToNumber(
|
||||||
|
fill.referrerReward ?? ZERO,
|
||||||
|
QUOTE_PRECISION
|
||||||
|
),
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -93,12 +93,6 @@ async function main() {
|
|||||||
subscribers.forEach((ws) => {
|
subscribers.forEach((ws) => {
|
||||||
ws.send(JSON.stringify({ channel: subscribedChannel, data: message }));
|
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) => {
|
redisClient.client.on('error', (error) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user