remove serum from spot markets
This commit is contained in:
@@ -109,7 +109,6 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
|
||||
updateOnChange: false,
|
||||
fallbackL2Generators: [
|
||||
config.spotMarketSubscribers[market.marketIndex].phoenix,
|
||||
config.spotMarketSubscribers[market.marketIndex].serum,
|
||||
].filter((a) => !!a),
|
||||
});
|
||||
}
|
||||
|
||||
41
src/index.ts
41
src/index.ts
@@ -39,7 +39,6 @@ import {
|
||||
SubscriberLookup,
|
||||
addOracletoResponse,
|
||||
errorHandler,
|
||||
getSerumSubscriber,
|
||||
l2WithBNToStrings,
|
||||
normalizeBatchQueryParams,
|
||||
sleep,
|
||||
@@ -145,7 +144,6 @@ const initializeAllMarketSubscribers = async (driftClient: DriftClient) => {
|
||||
for (const market of sdkConfig.SPOT_MARKETS) {
|
||||
markets[market.marketIndex] = {
|
||||
phoenix: undefined,
|
||||
serum: undefined,
|
||||
};
|
||||
|
||||
if (market.phoenixMarket) {
|
||||
@@ -179,29 +177,6 @@ const initializeAllMarketSubscribers = async (driftClient: DriftClient) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (market.serumMarket) {
|
||||
const serumConfigAccount = await driftClient.getSerumV3FulfillmentConfig(
|
||||
market.serumMarket
|
||||
);
|
||||
if (isVariant(serumConfigAccount.status, 'enabled')) {
|
||||
const serumSubscriber = getSerumSubscriber(
|
||||
driftClient,
|
||||
market,
|
||||
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;
|
||||
@@ -658,7 +633,6 @@ const main = async (): Promise<void> => {
|
||||
numVammOrders,
|
||||
includeVamm,
|
||||
includePhoenix,
|
||||
includeSerum,
|
||||
includeOracle,
|
||||
} = req.query;
|
||||
|
||||
@@ -702,11 +676,7 @@ const main = async (): Promise<void> => {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
isSpot &&
|
||||
`${includeSerum}`?.toLowerCase() === 'true' &&
|
||||
`${includePhoenix}`?.toLowerCase() === 'true'
|
||||
) {
|
||||
} else if (isSpot && `${includePhoenix}`?.toLowerCase() === 'true') {
|
||||
const redisClient = spotMarketRedisMap.get(normedMarketIndex).client;
|
||||
const redisL2 = await redisClient.get(
|
||||
`last_update_orderbook_spot_${normedMarketIndex}`
|
||||
@@ -750,8 +720,6 @@ const main = async (): Promise<void> => {
|
||||
? [
|
||||
`${includePhoenix}`.toLowerCase() === 'true' &&
|
||||
MARKET_SUBSCRIBERS[normedMarketIndex].phoenix,
|
||||
`${includeSerum}`.toLowerCase() === 'true' &&
|
||||
MARKET_SUBSCRIBERS[normedMarketIndex].serum,
|
||||
].filter((a) => !!a)
|
||||
: [],
|
||||
});
|
||||
@@ -787,7 +755,6 @@ const main = async (): Promise<void> => {
|
||||
depth,
|
||||
includeVamm,
|
||||
includePhoenix,
|
||||
includeSerum,
|
||||
includeOracle,
|
||||
} = req.query;
|
||||
|
||||
@@ -798,7 +765,6 @@ const main = async (): Promise<void> => {
|
||||
depth: depth as string | undefined,
|
||||
includeVamm: includeVamm as string | undefined,
|
||||
includePhoenix: includePhoenix as string | undefined,
|
||||
includeSerum: includeSerum as string | undefined,
|
||||
includeOracle: includeOracle as string | undefined,
|
||||
});
|
||||
|
||||
@@ -865,8 +831,7 @@ const main = async (): Promise<void> => {
|
||||
}
|
||||
} else if (
|
||||
isSpot &&
|
||||
normedParam['includePhoenix']?.toLowerCase() === 'true' &&
|
||||
normedParam['includeSerum']?.toLowerCase() === 'true'
|
||||
normedParam['includePhoenix']?.toLowerCase() === 'true'
|
||||
) {
|
||||
const redisClient =
|
||||
spotMarketRedisMap.get(normedMarketIndex).client;
|
||||
@@ -915,8 +880,6 @@ const main = async (): Promise<void> => {
|
||||
? [
|
||||
`${normedParam['includePhoenix']}`.toLowerCase() === 'true' &&
|
||||
MARKET_SUBSCRIBERS[normedMarketIndex].phoenix,
|
||||
`${normedParam['includeSerum']}`.toLowerCase() === 'true' &&
|
||||
MARKET_SUBSCRIBERS[normedMarketIndex].serum,
|
||||
].filter((a) => !!a)
|
||||
: [],
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user