Merge pull request #441 from drift-labs/jack/group-20-levels

Jack/group 20 levels
This commit is contained in:
lowkeynicc
2025-07-08 10:03:42 -04:00
committed by GitHub
5 changed files with 940 additions and 3 deletions

View File

@@ -1,14 +1,17 @@
import {
BN,
BigNum,
DLOBSubscriber,
DLOBSubscriptionConfig,
DriftEnv,
L2OrderBookGenerator,
MarketType,
ONE,
Order,
OrderStatus,
OrderTriggerCondition,
OrderType,
PRICE_PRECISION,
PerpOperation,
PositionDirection,
ZERO,
@@ -23,11 +26,12 @@ import {
addOracletoResponse,
l2WithBNToStrings,
parsePositiveIntArray,
publishGroupings,
} from '../utils/utils';
import { setHealthStatus, HEALTH_STATUS } from '../core/metrics';
import { OffloadQueue } from '../utils/offload';
type wsMarketArgs = {
export type wsMarketArgs = {
marketIndex: number;
marketType: MarketType;
marketName: string;
@@ -36,6 +40,7 @@ type wsMarketArgs = {
numVammOrders?: number;
fallbackL2Generators?: L2OrderBookGenerator[];
updateOnChange?: boolean;
tickSize?: BN;
};
require('dotenv').config();
@@ -123,6 +128,7 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
includeVamm,
updateOnChange: false,
fallbackL2Generators: [],
tickSize: perpMarket?.amm?.orderTickSize ?? ONE,
});
}
for (const market of config.spotMarketInfos) {
@@ -137,6 +143,8 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
config.spotMarketSubscribers[market.marketIndex].phoenix,
config.spotMarketSubscribers[market.marketIndex].openbook,
].filter((a) => !!a),
tickSize:
config.spotMarketSubscribers[market.marketIndex].tickSize ?? ONE,
});
}
}
@@ -423,6 +431,15 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
l2Formatted_depth100
);
publishGroupings(
l2Formatted,
marketArgs,
this.redisClient,
clientPrefix,
marketType,
this.indicativeQuotesRedisClient
);
if (!this.indicativeQuotesRedisClient) {
const bids = this.dlob
.getBestMakers({