@drift-labs/sdk 2.135.0-beta.7 → 2.135.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/VERSION +1 -1
- package/lib/browser/dlob/DLOBSubscriber.d.ts +5 -1
- package/lib/browser/dlob/DLOBSubscriber.js +3 -1
- package/lib/node/dlob/DLOBSubscriber.d.ts +5 -1
- package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -1
- package/lib/node/dlob/DLOBSubscriber.js +3 -1
- package/package.json +1 -1
- package/src/dlob/DLOBSubscriber.ts +5 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.135.0-beta.
|
|
1
|
+
2.135.0-beta.8
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="bn.js" />
|
|
2
3
|
import { DLOB } from './DLOB';
|
|
3
4
|
import { EventEmitter } from 'events';
|
|
4
5
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
@@ -6,6 +7,7 @@ import { DLOBSource, DLOBSubscriberEvents, DLOBSubscriptionConfig, ProtectMakerP
|
|
|
6
7
|
import { DriftClient } from '../driftClient';
|
|
7
8
|
import { MarketType } from '../types';
|
|
8
9
|
import { L2OrderBook, L2OrderBookGenerator, L3OrderBook } from './orderBookLevels';
|
|
10
|
+
import { BN } from '@coral-xyz/anchor';
|
|
9
11
|
export declare class DLOBSubscriber {
|
|
10
12
|
driftClient: DriftClient;
|
|
11
13
|
dlobSource: DLOBSource;
|
|
@@ -29,8 +31,9 @@ export declare class DLOBSubscriber {
|
|
|
29
31
|
* @param depth Number of orders to include in the order book. Defaults to 10.
|
|
30
32
|
* @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.
|
|
31
33
|
* @param fallbackL2Generators L2 generators for fallback liquidity e.g. vAMM {@link getVammL2Generator}, openbook {@link SerumSubscriber}
|
|
34
|
+
* @param latestSlot Latest slot observed via slot subscriber or similar for accuarate vamm quotes (if including the vAMM).
|
|
32
35
|
*/
|
|
33
|
-
getL2({ marketName, marketIndex, marketType, depth, includeVamm, numVammOrders, fallbackL2Generators, }: {
|
|
36
|
+
getL2({ marketName, marketIndex, marketType, depth, includeVamm, numVammOrders, fallbackL2Generators, latestSlot, }: {
|
|
34
37
|
marketName?: string;
|
|
35
38
|
marketIndex?: number;
|
|
36
39
|
marketType?: MarketType;
|
|
@@ -38,6 +41,7 @@ export declare class DLOBSubscriber {
|
|
|
38
41
|
includeVamm?: boolean;
|
|
39
42
|
numVammOrders?: number;
|
|
40
43
|
fallbackL2Generators?: L2OrderBookGenerator[];
|
|
44
|
+
latestSlot?: BN;
|
|
41
45
|
}): L2OrderBook;
|
|
42
46
|
/**
|
|
43
47
|
* Get the L3 order book for a given market.
|
|
@@ -51,8 +51,9 @@ class DLOBSubscriber {
|
|
|
51
51
|
* @param depth Number of orders to include in the order book. Defaults to 10.
|
|
52
52
|
* @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.
|
|
53
53
|
* @param fallbackL2Generators L2 generators for fallback liquidity e.g. vAMM {@link getVammL2Generator}, openbook {@link SerumSubscriber}
|
|
54
|
+
* @param latestSlot Latest slot observed via slot subscriber or similar for accuarate vamm quotes (if including the vAMM).
|
|
54
55
|
*/
|
|
55
|
-
getL2({ marketName, marketIndex, marketType, depth = 10, includeVamm = false, numVammOrders, fallbackL2Generators = [], }) {
|
|
56
|
+
getL2({ marketName, marketIndex, marketType, depth = 10, includeVamm = false, numVammOrders, fallbackL2Generators = [], latestSlot, }) {
|
|
56
57
|
if (marketName) {
|
|
57
58
|
const derivedMarketInfo = this.driftClient.getMarketIndexAndType(marketName);
|
|
58
59
|
if (!derivedMarketInfo) {
|
|
@@ -88,6 +89,7 @@ class DLOBSubscriber {
|
|
|
88
89
|
topOfBookQuoteAmounts: marketIndex < 3
|
|
89
90
|
? orderBookLevels_1.MAJORS_TOP_OF_BOOK_QUOTE_AMOUNTS
|
|
90
91
|
: orderBookLevels_1.DEFAULT_TOP_OF_BOOK_QUOTE_AMOUNTS,
|
|
92
|
+
latestSlot,
|
|
91
93
|
}),
|
|
92
94
|
];
|
|
93
95
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="bn.js" />
|
|
2
3
|
import { DLOB } from './DLOB';
|
|
3
4
|
import { EventEmitter } from 'events';
|
|
4
5
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
@@ -6,6 +7,7 @@ import { DLOBSource, DLOBSubscriberEvents, DLOBSubscriptionConfig, ProtectMakerP
|
|
|
6
7
|
import { DriftClient } from '../driftClient';
|
|
7
8
|
import { MarketType } from '../types';
|
|
8
9
|
import { L2OrderBook, L2OrderBookGenerator, L3OrderBook } from './orderBookLevels';
|
|
10
|
+
import { BN } from '@coral-xyz/anchor';
|
|
9
11
|
export declare class DLOBSubscriber {
|
|
10
12
|
driftClient: DriftClient;
|
|
11
13
|
dlobSource: DLOBSource;
|
|
@@ -29,8 +31,9 @@ export declare class DLOBSubscriber {
|
|
|
29
31
|
* @param depth Number of orders to include in the order book. Defaults to 10.
|
|
30
32
|
* @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.
|
|
31
33
|
* @param fallbackL2Generators L2 generators for fallback liquidity e.g. vAMM {@link getVammL2Generator}, openbook {@link SerumSubscriber}
|
|
34
|
+
* @param latestSlot Latest slot observed via slot subscriber or similar for accuarate vamm quotes (if including the vAMM).
|
|
32
35
|
*/
|
|
33
|
-
getL2({ marketName, marketIndex, marketType, depth, includeVamm, numVammOrders, fallbackL2Generators, }: {
|
|
36
|
+
getL2({ marketName, marketIndex, marketType, depth, includeVamm, numVammOrders, fallbackL2Generators, latestSlot, }: {
|
|
34
37
|
marketName?: string;
|
|
35
38
|
marketIndex?: number;
|
|
36
39
|
marketType?: MarketType;
|
|
@@ -38,6 +41,7 @@ export declare class DLOBSubscriber {
|
|
|
38
41
|
includeVamm?: boolean;
|
|
39
42
|
numVammOrders?: number;
|
|
40
43
|
fallbackL2Generators?: L2OrderBookGenerator[];
|
|
44
|
+
latestSlot?: BN;
|
|
41
45
|
}): L2OrderBook;
|
|
42
46
|
/**
|
|
43
47
|
* Get the L3 order book for a given market.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DLOBSubscriber.d.ts","sourceRoot":"","sources":["../../../src/dlob/DLOBSubscriber.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DLOBSubscriber.d.ts","sourceRoot":"","sources":["../../../src/dlob/DLOBSubscriber.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACN,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,EACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAa,UAAU,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAIN,WAAW,EACX,oBAAoB,EACpB,WAAW,EACX,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAEvC,qBAAa,cAAc;IAC1B,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;IAC3C,IAAI,EAAE,IAAI,CAAC;IACJ,YAAY,EAAE,kBAAkB,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;IAC5E,kBAAkB,EAAE,OAAO,CAAC;gBAChB,MAAM,EAAE,sBAAsB;IAU7B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBvC,0BAA0B,IAAI,qBAAqB,GAAG,SAAS;IAMzD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAO1B,OAAO,IAAI,IAAI;IAItB;;;;;;;;;;OAUG;IACI,KAAK,CAAC,EACZ,UAAU,EACV,WAAW,EACX,UAAU,EACV,KAAU,EACV,WAAmB,EACnB,aAAa,EACb,oBAAyB,EACzB,UAAU,GACV,EAAE;QACF,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,oBAAoB,CAAC,EAAE,oBAAoB,EAAE,CAAC;QAC9C,UAAU,CAAC,EAAE,EAAE,CAAC;KAChB,GAAG,WAAW;IA8Df;;;;;;OAMG;IACI,KAAK,CAAC,EACZ,UAAU,EACV,WAAW,EACX,UAAU,GACV,EAAE;QACF,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,UAAU,CAAC;KACxB,GAAG,WAAW;IAmCF,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAMzC"}
|
|
@@ -51,8 +51,9 @@ class DLOBSubscriber {
|
|
|
51
51
|
* @param depth Number of orders to include in the order book. Defaults to 10.
|
|
52
52
|
* @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.
|
|
53
53
|
* @param fallbackL2Generators L2 generators for fallback liquidity e.g. vAMM {@link getVammL2Generator}, openbook {@link SerumSubscriber}
|
|
54
|
+
* @param latestSlot Latest slot observed via slot subscriber or similar for accuarate vamm quotes (if including the vAMM).
|
|
54
55
|
*/
|
|
55
|
-
getL2({ marketName, marketIndex, marketType, depth = 10, includeVamm = false, numVammOrders, fallbackL2Generators = [], }) {
|
|
56
|
+
getL2({ marketName, marketIndex, marketType, depth = 10, includeVamm = false, numVammOrders, fallbackL2Generators = [], latestSlot, }) {
|
|
56
57
|
if (marketName) {
|
|
57
58
|
const derivedMarketInfo = this.driftClient.getMarketIndexAndType(marketName);
|
|
58
59
|
if (!derivedMarketInfo) {
|
|
@@ -88,6 +89,7 @@ class DLOBSubscriber {
|
|
|
88
89
|
topOfBookQuoteAmounts: marketIndex < 3
|
|
89
90
|
? orderBookLevels_1.MAJORS_TOP_OF_BOOK_QUOTE_AMOUNTS
|
|
90
91
|
: orderBookLevels_1.DEFAULT_TOP_OF_BOOK_QUOTE_AMOUNTS,
|
|
92
|
+
latestSlot,
|
|
91
93
|
}),
|
|
92
94
|
];
|
|
93
95
|
}
|
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
L3OrderBook,
|
|
20
20
|
} from './orderBookLevels';
|
|
21
21
|
import { getProtectedMakerParamsMap } from '../math/protectedMakerParams';
|
|
22
|
+
import { BN } from '@coral-xyz/anchor';
|
|
22
23
|
|
|
23
24
|
export class DLOBSubscriber {
|
|
24
25
|
driftClient: DriftClient;
|
|
@@ -82,6 +83,7 @@ export class DLOBSubscriber {
|
|
|
82
83
|
* @param depth Number of orders to include in the order book. Defaults to 10.
|
|
83
84
|
* @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.
|
|
84
85
|
* @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).
|
|
85
87
|
*/
|
|
86
88
|
public getL2({
|
|
87
89
|
marketName,
|
|
@@ -91,6 +93,7 @@ export class DLOBSubscriber {
|
|
|
91
93
|
includeVamm = false,
|
|
92
94
|
numVammOrders,
|
|
93
95
|
fallbackL2Generators = [],
|
|
96
|
+
latestSlot,
|
|
94
97
|
}: {
|
|
95
98
|
marketName?: string;
|
|
96
99
|
marketIndex?: number;
|
|
@@ -99,6 +102,7 @@ export class DLOBSubscriber {
|
|
|
99
102
|
includeVamm?: boolean;
|
|
100
103
|
numVammOrders?: number;
|
|
101
104
|
fallbackL2Generators?: L2OrderBookGenerator[];
|
|
105
|
+
latestSlot?: BN;
|
|
102
106
|
}): L2OrderBook {
|
|
103
107
|
if (marketName) {
|
|
104
108
|
const derivedMarketInfo =
|
|
@@ -146,6 +150,7 @@ export class DLOBSubscriber {
|
|
|
146
150
|
marketIndex < 3
|
|
147
151
|
? MAJORS_TOP_OF_BOOK_QUOTE_AMOUNTS
|
|
148
152
|
: DEFAULT_TOP_OF_BOOK_QUOTE_AMOUNTS,
|
|
153
|
+
latestSlot,
|
|
149
154
|
}),
|
|
150
155
|
];
|
|
151
156
|
}
|