From 3a6ff7ca45e9a6d15c1544f70c73f52e88130d94 Mon Sep 17 00:00:00 2001 From: Nour Alharithi Date: Tue, 7 Nov 2023 09:49:04 -0800 Subject: [PATCH] bulk account loader for user stats --- src/index.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index e7d1a5a..b817de1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,6 +24,7 @@ import { Wallet, UserStatsMap, DLOBSubscriber, + BulkAccountLoader, } from '@drift-labs/sdk'; import { logger, setLogLevel } from './utils/logger'; @@ -205,10 +206,14 @@ const main = async () => { false ); await userMap.subscribe(); - const userStatsMap = new UserStatsMap( - driftClient, - driftClient.userStatsAccountSubscriptionConfig - ); + const userStatsMap = new UserStatsMap(driftClient, { + type: 'polling', + accountLoader: new BulkAccountLoader( + connection, + stateCommitment, + ORDERBOOK_UPDATE_INTERVAL * 10 + ), + }); await userStatsMap.subscribe(); const dlobSubscriber = new DLOBSubscriber({