adding new spot markets

This commit is contained in:
Nour Alharithi
2023-12-04 10:51:09 -08:00
parent 4f43422f35
commit 83e28e1cd6
2 changed files with 66 additions and 4 deletions

View File

@@ -13,7 +13,11 @@ import {
} from '@drift-labs/sdk';
import { driftEnv } from '../publishers/dlobPublisher';
import { RedisClient } from '../utils/redisClient';
import { addOracletoResponse, l2WithBNToStrings } from '../utils/utils';
import {
SubscriberLookup,
addOracletoResponse,
l2WithBNToStrings,
} from '../utils/utils';
type wsMarketL2Args = {
marketIndex: number;
@@ -32,7 +36,12 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
public lastSeenL2Formatted: Map<MarketType, Map<number, any>>;
redisClient: RedisClient;
constructor(config: DLOBSubscriptionConfig & { redisClient: RedisClient }) {
constructor(
config: DLOBSubscriptionConfig & {
redisClient: RedisClient;
spotMarketSubscribers: SubscriberLookup;
}
) {
super(config);
this.redisClient = config.redisClient;
@@ -67,7 +76,10 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
depth: -1,
includeVamm: false,
updateOnChange: true,
fallbackL2Generators: [],
fallbackL2Generators: [
config.spotMarketSubscribers[market.marketIndex].phoenix,
config.spotMarketSubscribers[market.marketIndex].serum,
].filter((a) => !!a),
});
}
}