Skip to content

Commit 9c67b8e

Browse files
authored
latest slot as argument to getL2 (#1829)
* latest slot as argument to getL2 * add comment * update BN import
1 parent ac8cdc7 commit 9c67b8e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sdk/src/dlob/DLOBSubscriber.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
L3OrderBook,
2020
} from './orderBookLevels';
2121
import { getProtectedMakerParamsMap } from '../math/protectedMakerParams';
22+
import { BN } from '@coral-xyz/anchor';
2223

2324
export class DLOBSubscriber {
2425
driftClient: DriftClient;
@@ -82,6 +83,7 @@ export class DLOBSubscriber {
8283
* @param depth Number of orders to include in the order book. Defaults to 10.
8384
* @param includeVamm Whether to include the VAMM orders in the order book. Defaults to false. If true, creates vAMM generator {@link getVammL2Generator} and adds it to fallbackL2Generators.
8485
* @param fallbackL2Generators L2 generators for fallback liquidity e.g. vAMM {@link getVammL2Generator}, openbook {@link SerumSubscriber}
86+
* @param latestSlot Latest slot observed via slot subscriber or similar for accuarate vamm quotes (if including the vAMM).
8587
*/
8688
public getL2({
8789
marketName,
@@ -91,6 +93,7 @@ export class DLOBSubscriber {
9193
includeVamm = false,
9294
numVammOrders,
9395
fallbackL2Generators = [],
96+
latestSlot,
9497
}: {
9598
marketName?: string;
9699
marketIndex?: number;
@@ -99,6 +102,7 @@ export class DLOBSubscriber {
99102
includeVamm?: boolean;
100103
numVammOrders?: number;
101104
fallbackL2Generators?: L2OrderBookGenerator[];
105+
latestSlot?: BN;
102106
}): L2OrderBook {
103107
if (marketName) {
104108
const derivedMarketInfo =
@@ -146,6 +150,7 @@ export class DLOBSubscriber {
146150
marketIndex < 3
147151
? MAJORS_TOP_OF_BOOK_QUOTE_AMOUNTS
148152
: DEFAULT_TOP_OF_BOOK_QUOTE_AMOUNTS,
153+
latestSlot,
149154
}),
150155
];
151156
}

0 commit comments

Comments
 (0)