remove serum from spot markets

This commit is contained in:
Nour Alharithi
2024-07-31 08:55:09 -07:00
parent d7a4853bc2
commit 8b6598c0d6
4 changed files with 274 additions and 89 deletions

View File

@@ -22,12 +22,7 @@ import {
import { RedisClient, RedisClientPrefix } from '@drift/common';
import { logger, setLogLevel } from '../utils/logger';
import {
SubscriberLookup,
getSerumSubscriber,
parsePositiveIntArray,
sleep,
} from '../utils/utils';
import { SubscriberLookup, parsePositiveIntArray, sleep } from '../utils/utils';
import {
DLOBSubscriberIO,
wsMarketInfo,
@@ -199,7 +194,6 @@ const initializeAllMarketSubscribers = async (driftClient: DriftClient) => {
for (const market of driftClient.getSpotMarketAccounts()) {
markets[market.marketIndex] = {
phoenix: undefined,
serum: undefined,
};
const marketConfig = sdkConfig.SPOT_MARKETS[market.marketIndex];
@@ -239,32 +233,6 @@ const initializeAllMarketSubscribers = async (driftClient: DriftClient) => {
}
}
}
if (marketConfig.serumMarket) {
const serumConfigAccount = await driftClient.getSerumV3FulfillmentConfig(
marketConfig.serumMarket
);
if (isVariant(serumConfigAccount.status, 'enabled')) {
logger.info(
`Loading serum subscriber for spot market ${market.marketIndex}`
);
const serumSubscriber = getSerumSubscriber(
driftClient,
marketConfig,
sdkConfig
);
await serumSubscriber.subscribe();
try {
serumSubscriber.getL2Asks();
serumSubscriber.getL2Bids();
markets[market.marketIndex].serum = serumSubscriber;
} catch (e) {
logger.info(
`Excluding phoenix for ${market.marketIndex}, error: ${e}`
);
}
}
}
}
return markets;