@drift-labs/sdk 0.2.0-master.29 → 0.2.0-master.30
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/README.md +13 -13
- package/lib/accounts/pollingClearingHouseAccountSubscriber.d.ts +10 -11
- package/lib/accounts/pollingClearingHouseAccountSubscriber.js +4 -4
- package/lib/accounts/types.d.ts +4 -6
- package/lib/accounts/webSocketClearingHouseAccountSubscriber.d.ts +10 -11
- package/lib/accounts/webSocketClearingHouseAccountSubscriber.js +6 -8
- package/lib/addresses/marketAddresses.d.ts +1 -3
- package/lib/addresses/pda.d.ts +5 -5
- package/lib/addresses/pda.js +5 -5
- package/lib/admin.d.ts +27 -28
- package/lib/admin.js +12 -37
- package/lib/clearingHouse.d.ts +61 -62
- package/lib/clearingHouse.js +92 -110
- package/lib/clearingHouseConfig.d.ts +2 -4
- package/lib/clearingHouseUser.d.ts +16 -16
- package/lib/clearingHouseUser.js +16 -16
- package/lib/config.d.ts +2 -4
- package/lib/config.js +1 -1
- package/lib/constants/numericConstants.d.ts +7 -8
- package/lib/constants/numericConstants.js +17 -18
- package/lib/constants/perpMarkets.d.ts +2 -3
- package/lib/constants/perpMarkets.js +3 -3
- package/lib/constants/spotMarkets.d.ts +2 -1
- package/lib/constants/spotMarkets.js +6 -4
- package/lib/dlob/DLOB.d.ts +13 -13
- package/lib/dlob/DLOB.js +36 -40
- package/lib/dlob/DLOBNode.js +2 -2
- package/lib/events/sort.js +1 -1
- package/lib/examples/makeTradeExample.js +3 -3
- package/lib/idl/clearing_house.json +359 -310
- package/lib/math/amm.d.ts +2 -2
- package/lib/math/amm.js +10 -10
- package/lib/math/conversion.js +1 -1
- package/lib/math/funding.js +9 -9
- package/lib/math/margin.js +3 -3
- package/lib/math/market.d.ts +4 -4
- package/lib/math/market.js +7 -7
- package/lib/math/oracles.js +6 -8
- package/lib/math/position.d.ts +2 -2
- package/lib/math/position.js +9 -9
- package/lib/math/repeg.js +7 -6
- package/lib/math/spotBalance.js +5 -5
- package/lib/math/spotPosition.js +2 -2
- package/lib/math/trade.d.ts +6 -6
- package/lib/math/trade.js +15 -19
- package/lib/oracles/pythClient.js +1 -1
- package/lib/oracles/quoteAssetOracleClient.js +1 -1
- package/lib/oracles/switchboardClient.js +1 -1
- package/lib/types.d.ts +63 -51
- package/lib/types.js +1 -1
- package/package.json +2 -1
- package/src/accounts/pollingClearingHouseAccountSubscriber.ts +15 -15
- package/src/accounts/types.ts +4 -5
- package/src/accounts/webSocketClearingHouseAccountSubscriber.ts +17 -25
- package/src/addresses/marketAddresses.ts +1 -2
- package/src/addresses/pda.ts +10 -10
- package/src/admin.ts +42 -79
- package/src/clearingHouse.ts +164 -212
- package/src/clearingHouseConfig.ts +2 -3
- package/src/clearingHouseUser.ts +35 -35
- package/src/config.ts +3 -4
- package/src/constants/numericConstants.ts +19 -21
- package/src/constants/perpMarkets.ts +5 -5
- package/src/constants/spotMarkets.ts +8 -5
- package/src/dlob/DLOB.ts +54 -70
- package/src/dlob/DLOBNode.ts +5 -6
- package/src/events/sort.ts +1 -1
- package/src/examples/makeTradeExample.js +2 -2
- package/src/examples/makeTradeExample.ts +5 -8
- package/src/idl/clearing_house.json +359 -310
- package/src/math/amm.ts +14 -11
- package/src/math/conversion.ts +2 -2
- package/src/math/funding.ts +13 -11
- package/src/math/margin.ts +4 -5
- package/src/math/market.ts +5 -5
- package/src/math/oracles.ts +9 -9
- package/src/math/position.ts +11 -19
- package/src/math/repeg.ts +8 -7
- package/src/math/spotBalance.ts +6 -6
- package/src/math/spotPosition.ts +2 -2
- package/src/math/trade.ts +17 -21
- package/src/oracles/pythClient.ts +2 -2
- package/src/oracles/quoteAssetOracleClient.ts +2 -2
- package/src/oracles/switchboardClient.ts +2 -2
- package/src/types.ts +69 -51
- package/tests/dlob/helpers.ts +56 -4
- package/src/addresses/marketAddresses.js +0 -26
- package/src/constants/banks.js +0 -42
- package/src/constants/markets.js +0 -42
- package/src/events/txEventCache.js +0 -71
- package/src/factory/bigNum.js +0 -390
- package/src/factory/oracleClient.js +0 -20
- package/src/math/auction.js +0 -42
- package/src/math/conversion.js +0 -11
- package/src/math/funding.js +0 -248
- package/src/math/repeg.js +0 -128
- package/src/math/trade.js +0 -253
- package/src/math/utils.js +0 -26
- package/src/math/utils.js.map +0 -1
- package/src/oracles/oracleClientCache.js +0 -19
- package/src/oracles/pythClient.js +0 -46
- package/src/oracles/quoteAssetOracleClient.js +0 -32
- package/src/oracles/switchboardClient.js +0 -69
- package/src/oracles/types.js +0 -2
- package/src/userName.js +0 -20
- package/src/wallet.js +0 -35
|
@@ -35,8 +35,8 @@ export declare class ClearingHouseUser {
|
|
|
35
35
|
* @param marketIndex
|
|
36
36
|
* @returns userPosition
|
|
37
37
|
*/
|
|
38
|
-
getUserPosition(marketIndex:
|
|
39
|
-
getEmptyPosition(marketIndex:
|
|
38
|
+
getUserPosition(marketIndex: number): PerpPosition | undefined;
|
|
39
|
+
getEmptyPosition(marketIndex: number): PerpPosition;
|
|
40
40
|
getClonedPosition(position: PerpPosition): PerpPosition;
|
|
41
41
|
/**
|
|
42
42
|
* @param orderId
|
|
@@ -56,12 +56,12 @@ export declare class ClearingHouseUser {
|
|
|
56
56
|
* @returns : the dust base asset amount (ie, < stepsize)
|
|
57
57
|
* @returns : pnl from settle
|
|
58
58
|
*/
|
|
59
|
-
getSettledLPPosition(marketIndex:
|
|
59
|
+
getSettledLPPosition(marketIndex: number): [PerpPosition, BN, BN];
|
|
60
60
|
/**
|
|
61
61
|
* calculates Buying Power = FC * MAX_LEVERAGE
|
|
62
62
|
* @returns : Precision QUOTE_PRECISION
|
|
63
63
|
*/
|
|
64
|
-
getBuyingPower(marketIndex:
|
|
64
|
+
getBuyingPower(marketIndex: number): BN;
|
|
65
65
|
/**
|
|
66
66
|
* calculates Free Collateral = Total collateral - initial margin requirement
|
|
67
67
|
* @returns : Precision QUOTE_PRECISION
|
|
@@ -83,15 +83,15 @@ export declare class ClearingHouseUser {
|
|
|
83
83
|
* calculates unrealized position price pnl
|
|
84
84
|
* @returns : Precision QUOTE_PRECISION
|
|
85
85
|
*/
|
|
86
|
-
getUnrealizedPNL(withFunding?: boolean, marketIndex?:
|
|
86
|
+
getUnrealizedPNL(withFunding?: boolean, marketIndex?: number, withWeightMarginCategory?: MarginCategory): BN;
|
|
87
87
|
/**
|
|
88
88
|
* calculates unrealized funding payment pnl
|
|
89
89
|
* @returns : Precision QUOTE_PRECISION
|
|
90
90
|
*/
|
|
91
|
-
getUnrealizedFundingPNL(marketIndex?:
|
|
92
|
-
getSpotMarketLiabilityValue(marketIndex?:
|
|
91
|
+
getUnrealizedFundingPNL(marketIndex?: number): BN;
|
|
92
|
+
getSpotMarketLiabilityValue(marketIndex?: number, marginCategory?: MarginCategory, liquidationBuffer?: BN, includeOpenOrders?: boolean): BN;
|
|
93
93
|
getSpotLiabilityValue(tokenAmount: BN, oraclePriceData: OraclePriceData, spotMarketAccount: SpotMarketAccount, marginCategory?: MarginCategory, liquidationBuffer?: BN): BN;
|
|
94
|
-
getSpotMarketAssetValue(marketIndex?:
|
|
94
|
+
getSpotMarketAssetValue(marketIndex?: number, marginCategory?: MarginCategory, includeOpenOrders?: boolean): BN;
|
|
95
95
|
getSpotAssetValue(tokenAmount: BN, oraclePriceData: OraclePriceData, spotMarketAccount: SpotMarketAccount, marginCategory?: MarginCategory): BN;
|
|
96
96
|
getNetSpotMarketValue(withWeightMarginCategory?: MarginCategory): BN;
|
|
97
97
|
/**
|
|
@@ -108,11 +108,11 @@ export declare class ClearingHouseUser {
|
|
|
108
108
|
* calculates position value in margin system
|
|
109
109
|
* @returns : Precision QUOTE_PRECISION
|
|
110
110
|
*/
|
|
111
|
-
getPerpPositionValue(marketIndex:
|
|
111
|
+
getPerpPositionValue(marketIndex: number, oraclePriceData: OraclePriceData): BN;
|
|
112
112
|
getPositionSide(currentPosition: Pick<PerpPosition, 'baseAssetAmount'>): PositionDirection | undefined;
|
|
113
113
|
/**
|
|
114
114
|
* calculates average exit price (optionally for closing up to 100% of position)
|
|
115
|
-
* @returns : Precision
|
|
115
|
+
* @returns : Precision PRICE_PRECISION
|
|
116
116
|
*/
|
|
117
117
|
getPositionEstimatedExitPriceAndPnl(position: PerpPosition, amountToClose?: BN, useAMMClose?: boolean): [BN, BN];
|
|
118
118
|
/**
|
|
@@ -125,7 +125,7 @@ export declare class ClearingHouseUser {
|
|
|
125
125
|
* @params category {Initial, Partial, Maintenance}
|
|
126
126
|
* @returns : Precision TEN_THOUSAND
|
|
127
127
|
*/
|
|
128
|
-
getMaxLeverage(marketIndex:
|
|
128
|
+
getMaxLeverage(marketIndex: number, category?: MarginCategory): BN;
|
|
129
129
|
/**
|
|
130
130
|
* calculates margin ratio: total collateral / |total position value|
|
|
131
131
|
* @returns : Precision TEN_THOUSAND
|
|
@@ -142,16 +142,16 @@ export declare class ClearingHouseUser {
|
|
|
142
142
|
* @param PerpPosition
|
|
143
143
|
* @param positionBaseSizeChange // change in position size to calculate liquidation price for : Precision 10^13
|
|
144
144
|
* @param partial
|
|
145
|
-
* @returns Precision :
|
|
145
|
+
* @returns Precision : PRICE_PRECISION
|
|
146
146
|
*/
|
|
147
147
|
liquidationPrice(perpPosition: Pick<PerpPosition, 'marketIndex'>, positionBaseSizeChange?: BN): BN;
|
|
148
148
|
/**
|
|
149
149
|
* Calculates the estimated liquidation price for a position after closing a quote amount of the position.
|
|
150
150
|
* @param positionMarketIndex
|
|
151
151
|
* @param closeQuoteAmount
|
|
152
|
-
* @returns : Precision
|
|
152
|
+
* @returns : Precision PRICE_PRECISION
|
|
153
153
|
*/
|
|
154
|
-
liquidationPriceAfterClose(positionMarketIndex:
|
|
154
|
+
liquidationPriceAfterClose(positionMarketIndex: number, closeQuoteAmount: BN): BN;
|
|
155
155
|
/**
|
|
156
156
|
* Get the maximum trade size for a given market, taking into account the user's current leverage, positions, collateral, etc.
|
|
157
157
|
*
|
|
@@ -173,7 +173,7 @@ export declare class ClearingHouseUser {
|
|
|
173
173
|
* @param tradeSide
|
|
174
174
|
* @returns tradeSizeAllowed : Precision QUOTE_PRECISION
|
|
175
175
|
*/
|
|
176
|
-
getMaxTradeSizeUSDC(targetMarketIndex:
|
|
176
|
+
getMaxTradeSizeUSDC(targetMarketIndex: number, tradeSide: PositionDirection): BN;
|
|
177
177
|
/**
|
|
178
178
|
* Returns the leverage ratio for the account after adding (or subtracting) the given quote size to the given position
|
|
179
179
|
* @param targetMarketIndex
|
|
@@ -181,7 +181,7 @@ export declare class ClearingHouseUser {
|
|
|
181
181
|
* @param tradeQuoteAmount
|
|
182
182
|
* @returns leverageRatio : Precision TEN_THOUSAND
|
|
183
183
|
*/
|
|
184
|
-
accountLeverageRatioAfterTrade(targetMarketIndex:
|
|
184
|
+
accountLeverageRatioAfterTrade(targetMarketIndex: number, tradeQuoteAmount: BN, tradeSide: PositionDirection): BN;
|
|
185
185
|
/**
|
|
186
186
|
* Calculates how much fee will be taken for a given sized trade
|
|
187
187
|
* @param quoteAmount
|
package/lib/clearingHouseUser.js
CHANGED
|
@@ -60,7 +60,7 @@ class ClearingHouseUser {
|
|
|
60
60
|
* @returns userPosition
|
|
61
61
|
*/
|
|
62
62
|
getUserPosition(marketIndex) {
|
|
63
|
-
return this.getUserAccount().perpPositions.find((position) => position.marketIndex
|
|
63
|
+
return this.getUserAccount().perpPositions.find((position) => position.marketIndex === marketIndex);
|
|
64
64
|
}
|
|
65
65
|
getEmptyPosition(marketIndex) {
|
|
66
66
|
return {
|
|
@@ -70,7 +70,7 @@ class ClearingHouseUser {
|
|
|
70
70
|
marketIndex,
|
|
71
71
|
quoteAssetAmount: numericConstants_1.ZERO,
|
|
72
72
|
quoteEntryAmount: numericConstants_1.ZERO,
|
|
73
|
-
openOrders:
|
|
73
|
+
openOrders: 0,
|
|
74
74
|
openBids: numericConstants_1.ZERO,
|
|
75
75
|
openAsks: numericConstants_1.ZERO,
|
|
76
76
|
settledPnl: numericConstants_1.ZERO,
|
|
@@ -266,11 +266,11 @@ class ClearingHouseUser {
|
|
|
266
266
|
return this.getUserAccount().spotPositions.reduce((totalLiabilityValue, spotPosition) => {
|
|
267
267
|
if ((0, spotPosition_1.isSpotPositionAvailable)(spotPosition) ||
|
|
268
268
|
(marketIndex !== undefined &&
|
|
269
|
-
|
|
269
|
+
spotPosition.marketIndex !== marketIndex)) {
|
|
270
270
|
return totalLiabilityValue;
|
|
271
271
|
}
|
|
272
272
|
const spotMarketAccount = this.clearingHouse.getSpotMarketAccount(spotPosition.marketIndex);
|
|
273
|
-
if (spotPosition.marketIndex
|
|
273
|
+
if (spotPosition.marketIndex === numericConstants_1.QUOTE_SPOT_MARKET_INDEX) {
|
|
274
274
|
if ((0, types_1.isVariant)(spotPosition.balanceType, 'borrow')) {
|
|
275
275
|
const tokenAmount = (0, spotBalance_1.getTokenAmount)(spotPosition.balance, spotMarketAccount, spotPosition.balanceType);
|
|
276
276
|
let weight = numericConstants_1.SPOT_MARKET_WEIGHT_PRECISION;
|
|
@@ -338,12 +338,12 @@ class ClearingHouseUser {
|
|
|
338
338
|
return this.getUserAccount().spotPositions.reduce((totalAssetValue, spotPosition) => {
|
|
339
339
|
if ((0, spotPosition_1.isSpotPositionAvailable)(spotPosition) ||
|
|
340
340
|
(marketIndex !== undefined &&
|
|
341
|
-
|
|
341
|
+
spotPosition.marketIndex !== marketIndex)) {
|
|
342
342
|
return totalAssetValue;
|
|
343
343
|
}
|
|
344
344
|
// Todo this needs to account for whether it's based on initial or maintenance requirements
|
|
345
345
|
const spotMarketAccount = this.clearingHouse.getSpotMarketAccount(spotPosition.marketIndex);
|
|
346
|
-
if (spotPosition.marketIndex
|
|
346
|
+
if (spotPosition.marketIndex === numericConstants_1.QUOTE_SPOT_MARKET_INDEX) {
|
|
347
347
|
if ((0, types_1.isVariant)(spotPosition.balanceType, 'deposit')) {
|
|
348
348
|
const tokenAmount = (0, spotBalance_1.getTokenAmount)(spotPosition.balance, spotMarketAccount, spotPosition.balanceType);
|
|
349
349
|
return totalAssetValue.add(tokenAmount);
|
|
@@ -444,7 +444,7 @@ class ClearingHouseUser {
|
|
|
444
444
|
let baseAssetValue = baseAssetAmount
|
|
445
445
|
.abs()
|
|
446
446
|
.mul(valuationPrice)
|
|
447
|
-
.div(numericConstants_1.AMM_TO_QUOTE_PRECISION_RATIO.mul(numericConstants_1.
|
|
447
|
+
.div(numericConstants_1.AMM_TO_QUOTE_PRECISION_RATIO.mul(numericConstants_1.PRICE_PRECISION));
|
|
448
448
|
if (marginCategory) {
|
|
449
449
|
let marginRatio = new _1.BN((0, _1.calculateMarketMarginRatio)(market, baseAssetAmount.abs(), marginCategory));
|
|
450
450
|
if (marginCategory === 'Initial') {
|
|
@@ -482,7 +482,7 @@ class ClearingHouseUser {
|
|
|
482
482
|
}
|
|
483
483
|
/**
|
|
484
484
|
* calculates average exit price (optionally for closing up to 100% of position)
|
|
485
|
-
* @returns : Precision
|
|
485
|
+
* @returns : Precision PRICE_PRECISION
|
|
486
486
|
*/
|
|
487
487
|
getPositionEstimatedExitPriceAndPnl(position, amountToClose, useAMMClose = false) {
|
|
488
488
|
const market = this.clearingHouse.getPerpMarketAccount(position.marketIndex);
|
|
@@ -490,7 +490,7 @@ class ClearingHouseUser {
|
|
|
490
490
|
const oraclePriceData = this.getOracleDataForMarket(position.marketIndex);
|
|
491
491
|
if (amountToClose) {
|
|
492
492
|
if (amountToClose.eq(numericConstants_1.ZERO)) {
|
|
493
|
-
return [(0, _1.
|
|
493
|
+
return [(0, _1.calculateReservePrice)(market, oraclePriceData), numericConstants_1.ZERO];
|
|
494
494
|
}
|
|
495
495
|
position = {
|
|
496
496
|
baseAssetAmount: amountToClose,
|
|
@@ -511,12 +511,12 @@ class ClearingHouseUser {
|
|
|
511
511
|
}
|
|
512
512
|
const exitPrice = baseAssetValue
|
|
513
513
|
.mul(numericConstants_1.AMM_TO_QUOTE_PRECISION_RATIO)
|
|
514
|
-
.mul(numericConstants_1.
|
|
514
|
+
.mul(numericConstants_1.PRICE_PRECISION)
|
|
515
515
|
.div(position.baseAssetAmount.abs());
|
|
516
516
|
const pnlPerBase = exitPrice.sub(entryPrice);
|
|
517
517
|
const pnl = pnlPerBase
|
|
518
518
|
.mul(position.baseAssetAmount)
|
|
519
|
-
.div(numericConstants_1.
|
|
519
|
+
.div(numericConstants_1.PRICE_PRECISION)
|
|
520
520
|
.div(numericConstants_1.AMM_TO_QUOTE_PRECISION_RATIO);
|
|
521
521
|
return [exitPrice, pnl];
|
|
522
522
|
}
|
|
@@ -591,7 +591,7 @@ class ClearingHouseUser {
|
|
|
591
591
|
* @param PerpPosition
|
|
592
592
|
* @param positionBaseSizeChange // change in position size to calculate liquidation price for : Precision 10^13
|
|
593
593
|
* @param partial
|
|
594
|
-
* @returns Precision :
|
|
594
|
+
* @returns Precision : PRICE_PRECISION
|
|
595
595
|
*/
|
|
596
596
|
liquidationPrice(perpPosition, positionBaseSizeChange = numericConstants_1.ZERO) {
|
|
597
597
|
// solves formula for example canBeLiquidated below
|
|
@@ -619,7 +619,7 @@ class ClearingHouseUser {
|
|
|
619
619
|
quoteAssetAmount: new _1.BN(0),
|
|
620
620
|
lastCumulativeFundingRate: numericConstants_1.ZERO,
|
|
621
621
|
quoteEntryAmount: new _1.BN(0),
|
|
622
|
-
openOrders:
|
|
622
|
+
openOrders: 0,
|
|
623
623
|
openBids: new _1.BN(0),
|
|
624
624
|
openAsks: new _1.BN(0),
|
|
625
625
|
settledPnl: numericConstants_1.ZERO,
|
|
@@ -635,7 +635,7 @@ class ClearingHouseUser {
|
|
|
635
635
|
// total position value after trade
|
|
636
636
|
const totalPositionValueAfterTrade = totalPositionValueExcludingTargetMarket.add(proposedPerpPositionValue);
|
|
637
637
|
const marginRequirementExcludingTargetMarket = this.getUserAccount().perpPositions.reduce((totalMarginRequirement, position) => {
|
|
638
|
-
if (
|
|
638
|
+
if (position.marketIndex !== perpPosition.marketIndex) {
|
|
639
639
|
const market = this.clearingHouse.getPerpMarketAccount(position.marketIndex);
|
|
640
640
|
const positionValue = (0, margin_1.calculateBaseAssetValueWithOracle)(market, position, this.getOracleDataForMarket(market.marketIndex));
|
|
641
641
|
const marketMarginRequirement = positionValue
|
|
@@ -675,7 +675,7 @@ class ClearingHouseUser {
|
|
|
675
675
|
}
|
|
676
676
|
let markPriceAfterTrade;
|
|
677
677
|
if (positionBaseSizeChange.eq(numericConstants_1.ZERO)) {
|
|
678
|
-
markPriceAfterTrade = (0, _1.
|
|
678
|
+
markPriceAfterTrade = (0, _1.calculateReservePrice)(this.clearingHouse.getPerpMarketAccount(perpPosition.marketIndex), this.getOracleDataForMarket(perpPosition.marketIndex));
|
|
679
679
|
}
|
|
680
680
|
else {
|
|
681
681
|
const direction = positionBaseSizeChange.gt(numericConstants_1.ZERO)
|
|
@@ -692,7 +692,7 @@ class ClearingHouseUser {
|
|
|
692
692
|
* Calculates the estimated liquidation price for a position after closing a quote amount of the position.
|
|
693
693
|
* @param positionMarketIndex
|
|
694
694
|
* @param closeQuoteAmount
|
|
695
|
-
* @returns : Precision
|
|
695
|
+
* @returns : Precision PRICE_PRECISION
|
|
696
696
|
*/
|
|
697
697
|
liquidationPriceAfterClose(positionMarketIndex, closeQuoteAmount) {
|
|
698
698
|
const currentPosition = this.getUserPosition(positionMarketIndex) ||
|
package/lib/config.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
1
|
import { PerpMarketConfig } from './constants/perpMarkets';
|
|
3
2
|
import { SpotMarketConfig } from './constants/spotMarkets';
|
|
4
|
-
import { BN } from '@project-serum/anchor';
|
|
5
3
|
import { OracleInfo } from './oracles/types';
|
|
6
4
|
declare type DriftConfig = {
|
|
7
5
|
ENV: DriftEnv;
|
|
@@ -28,8 +26,8 @@ export declare const initialize: (props: {
|
|
|
28
26
|
overrideEnv?: Partial<DriftConfig>;
|
|
29
27
|
}) => DriftConfig;
|
|
30
28
|
export declare function getMarketsAndOraclesForSubscription(env: DriftEnv): {
|
|
31
|
-
perpMarketIndexes:
|
|
32
|
-
spotMarketIndexes:
|
|
29
|
+
perpMarketIndexes: number[];
|
|
30
|
+
spotMarketIndexes: number[];
|
|
33
31
|
oracleInfos: OracleInfo[];
|
|
34
32
|
};
|
|
35
33
|
export {};
|
package/lib/config.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.configs = {
|
|
|
7
7
|
devnet: {
|
|
8
8
|
ENV: 'devnet',
|
|
9
9
|
PYTH_ORACLE_MAPPING_ADDRESS: 'BmA9Z6FjioHJPpjT39QazZyhDRUdZy2ezwx4GiDdE2u2',
|
|
10
|
-
CLEARING_HOUSE_PROGRAM_ID: '
|
|
10
|
+
CLEARING_HOUSE_PROGRAM_ID: 'By7XjakxXVnQ9gMZ4VT98DenTgBCeP295A58ybzgwVPZ',
|
|
11
11
|
USDC_MINT_ADDRESS: '8zGuJQqwhZafTah7Uc7Z4tXRnguqkn5KLFAP8oV6PHe2',
|
|
12
12
|
PERP_MARKETS: perpMarkets_1.DevnetPerpMarkets,
|
|
13
13
|
SPOT_MARKETS: spotMarkets_1.DevnetSpotMarkets,
|
|
@@ -9,17 +9,16 @@ export declare const BN_MAX: BN;
|
|
|
9
9
|
export declare const TEN_MILLION: BN;
|
|
10
10
|
export declare const MAX_LEVERAGE: BN;
|
|
11
11
|
export declare const QUOTE_PRECISION_EXP: BN;
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
12
|
+
export declare const FUNDING_RATE_BUFFER_PRECISION_EXP: BN;
|
|
13
|
+
export declare const PRICE_PRECISION_EXP: BN;
|
|
14
14
|
export declare const FUNDING_RATE_PRECISION_EXP: BN;
|
|
15
15
|
export declare const PEG_PRECISION_EXP: BN;
|
|
16
16
|
export declare const AMM_RESERVE_PRECISION_EXP: BN;
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
17
|
+
export declare const SPOT_MARKET_RATE_PRECISION_EXP: BN;
|
|
18
|
+
export declare const SPOT_MARKET_RATE_PRECISION: BN;
|
|
19
19
|
export declare const SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION_EXP: BN;
|
|
20
20
|
export declare const SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION: BN;
|
|
21
21
|
export declare const SPOT_MARKET_UTILIZATION_PRECISION: BN;
|
|
22
|
-
export declare const SPOT_MARKET_RATE_PRECISION: BN;
|
|
23
22
|
export declare const SPOT_MARKET_WEIGHT_PRECISION: BN;
|
|
24
23
|
export declare const SPOT_MARKET_BALANCE_PRECISION_EXP: BN;
|
|
25
24
|
export declare const SPOT_MARKET_BALANCE_PRECISION: BN;
|
|
@@ -27,8 +26,8 @@ export declare const SPOT_MARKET_IMF_PRECISION_EXP: BN;
|
|
|
27
26
|
export declare const SPOT_MARKET_IMF_PRECISION: BN;
|
|
28
27
|
export declare const LIQUIDATION_FEE_PRECISION: BN;
|
|
29
28
|
export declare const QUOTE_PRECISION: BN;
|
|
30
|
-
export declare const
|
|
31
|
-
export declare const
|
|
29
|
+
export declare const PRICE_PRECISION: BN;
|
|
30
|
+
export declare const FUNDING_RATE_BUFFER_PRECISION: BN;
|
|
32
31
|
export declare const PEG_PRECISION: BN;
|
|
33
32
|
export declare const AMM_RESERVE_PRECISION: BN;
|
|
34
33
|
export declare const BASE_PRECISION: BN;
|
|
@@ -40,6 +39,6 @@ export declare const AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO: BN;
|
|
|
40
39
|
export declare const MARGIN_PRECISION: BN;
|
|
41
40
|
export declare const BID_ASK_SPREAD_PRECISION: BN;
|
|
42
41
|
export declare const ONE_YEAR: BN;
|
|
43
|
-
export declare const QUOTE_SPOT_MARKET_INDEX
|
|
42
|
+
export declare const QUOTE_SPOT_MARKET_INDEX = 0;
|
|
44
43
|
export declare const LAMPORTS_PRECISION: BN;
|
|
45
44
|
export declare const LAMPORTS_EXP: BN;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LAMPORTS_EXP = exports.LAMPORTS_PRECISION = exports.QUOTE_SPOT_MARKET_INDEX = exports.ONE_YEAR = exports.BID_ASK_SPREAD_PRECISION = exports.MARGIN_PRECISION = exports.AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO = exports.PRICE_TO_QUOTE_PRECISION = exports.PRICE_DIV_PEG = exports.AMM_TO_QUOTE_PRECISION_RATIO = exports.BASE_PRECISION_EXP = exports.BASE_PRECISION = exports.AMM_RESERVE_PRECISION = exports.PEG_PRECISION = exports.
|
|
3
|
+
exports.LAMPORTS_EXP = exports.LAMPORTS_PRECISION = exports.QUOTE_SPOT_MARKET_INDEX = exports.ONE_YEAR = exports.BID_ASK_SPREAD_PRECISION = exports.MARGIN_PRECISION = exports.AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO = exports.PRICE_TO_QUOTE_PRECISION = exports.PRICE_DIV_PEG = exports.AMM_TO_QUOTE_PRECISION_RATIO = exports.BASE_PRECISION_EXP = exports.BASE_PRECISION = exports.AMM_RESERVE_PRECISION = exports.PEG_PRECISION = exports.FUNDING_RATE_BUFFER_PRECISION = exports.PRICE_PRECISION = exports.QUOTE_PRECISION = exports.LIQUIDATION_FEE_PRECISION = exports.SPOT_MARKET_IMF_PRECISION = exports.SPOT_MARKET_IMF_PRECISION_EXP = exports.SPOT_MARKET_BALANCE_PRECISION = exports.SPOT_MARKET_BALANCE_PRECISION_EXP = exports.SPOT_MARKET_WEIGHT_PRECISION = exports.SPOT_MARKET_UTILIZATION_PRECISION = exports.SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION = exports.SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION_EXP = exports.SPOT_MARKET_RATE_PRECISION = exports.SPOT_MARKET_RATE_PRECISION_EXP = exports.AMM_RESERVE_PRECISION_EXP = exports.PEG_PRECISION_EXP = exports.FUNDING_RATE_PRECISION_EXP = exports.PRICE_PRECISION_EXP = exports.FUNDING_RATE_BUFFER_PRECISION_EXP = exports.QUOTE_PRECISION_EXP = exports.MAX_LEVERAGE = exports.TEN_MILLION = exports.BN_MAX = exports.TEN_THOUSAND = exports.TEN = exports.TWO = exports.ONE = exports.ZERO = void 0;
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
5
|
const __1 = require("../");
|
|
6
6
|
exports.ZERO = new __1.BN(0);
|
|
@@ -12,37 +12,36 @@ exports.BN_MAX = new __1.BN(Number.MAX_SAFE_INTEGER);
|
|
|
12
12
|
exports.TEN_MILLION = exports.TEN_THOUSAND.mul(exports.TEN_THOUSAND);
|
|
13
13
|
exports.MAX_LEVERAGE = new __1.BN(5);
|
|
14
14
|
exports.QUOTE_PRECISION_EXP = new __1.BN(6);
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.FUNDING_RATE_PRECISION_EXP = exports.
|
|
18
|
-
exports.PEG_PRECISION_EXP = new __1.BN(
|
|
19
|
-
exports.AMM_RESERVE_PRECISION_EXP = new __1.BN(
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
15
|
+
exports.FUNDING_RATE_BUFFER_PRECISION_EXP = new __1.BN(3);
|
|
16
|
+
exports.PRICE_PRECISION_EXP = new __1.BN(6);
|
|
17
|
+
exports.FUNDING_RATE_PRECISION_EXP = exports.PRICE_PRECISION_EXP.mul(exports.FUNDING_RATE_BUFFER_PRECISION_EXP);
|
|
18
|
+
exports.PEG_PRECISION_EXP = new __1.BN(6);
|
|
19
|
+
exports.AMM_RESERVE_PRECISION_EXP = new __1.BN(9);
|
|
20
|
+
exports.SPOT_MARKET_RATE_PRECISION_EXP = new __1.BN(6);
|
|
21
|
+
exports.SPOT_MARKET_RATE_PRECISION = new __1.BN(10).pow(exports.SPOT_MARKET_RATE_PRECISION_EXP);
|
|
22
22
|
exports.SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION_EXP = new __1.BN(10);
|
|
23
23
|
exports.SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION = new __1.BN(10).pow(exports.SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION_EXP);
|
|
24
24
|
exports.SPOT_MARKET_UTILIZATION_PRECISION = new __1.BN(1000000);
|
|
25
|
-
exports.SPOT_MARKET_RATE_PRECISION = new __1.BN(1000000);
|
|
26
25
|
exports.SPOT_MARKET_WEIGHT_PRECISION = new __1.BN(10000);
|
|
27
|
-
exports.SPOT_MARKET_BALANCE_PRECISION_EXP = new __1.BN(
|
|
26
|
+
exports.SPOT_MARKET_BALANCE_PRECISION_EXP = new __1.BN(9);
|
|
28
27
|
exports.SPOT_MARKET_BALANCE_PRECISION = new __1.BN(10).pow(exports.SPOT_MARKET_BALANCE_PRECISION_EXP);
|
|
29
28
|
exports.SPOT_MARKET_IMF_PRECISION_EXP = new __1.BN(6);
|
|
30
29
|
exports.SPOT_MARKET_IMF_PRECISION = new __1.BN(10).pow(exports.SPOT_MARKET_IMF_PRECISION_EXP);
|
|
31
30
|
exports.LIQUIDATION_FEE_PRECISION = new __1.BN(1000000);
|
|
32
31
|
exports.QUOTE_PRECISION = new __1.BN(10).pow(exports.QUOTE_PRECISION_EXP);
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
32
|
+
exports.PRICE_PRECISION = new __1.BN(10).pow(exports.PRICE_PRECISION_EXP);
|
|
33
|
+
exports.FUNDING_RATE_BUFFER_PRECISION = new __1.BN(10).pow(exports.FUNDING_RATE_BUFFER_PRECISION_EXP);
|
|
35
34
|
exports.PEG_PRECISION = new __1.BN(10).pow(exports.PEG_PRECISION_EXP);
|
|
36
35
|
exports.AMM_RESERVE_PRECISION = new __1.BN(10).pow(exports.AMM_RESERVE_PRECISION_EXP);
|
|
37
36
|
exports.BASE_PRECISION = exports.AMM_RESERVE_PRECISION;
|
|
38
37
|
exports.BASE_PRECISION_EXP = exports.AMM_RESERVE_PRECISION_EXP;
|
|
39
|
-
exports.AMM_TO_QUOTE_PRECISION_RATIO = exports.AMM_RESERVE_PRECISION.div(exports.QUOTE_PRECISION); // 10^
|
|
40
|
-
exports.PRICE_DIV_PEG = exports.
|
|
41
|
-
exports.PRICE_TO_QUOTE_PRECISION = exports.
|
|
42
|
-
exports.AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO = exports.AMM_RESERVE_PRECISION.mul(exports.PEG_PRECISION).div(exports.QUOTE_PRECISION); // 10^
|
|
38
|
+
exports.AMM_TO_QUOTE_PRECISION_RATIO = exports.AMM_RESERVE_PRECISION.div(exports.QUOTE_PRECISION); // 10^3
|
|
39
|
+
exports.PRICE_DIV_PEG = exports.PRICE_PRECISION.div(exports.PEG_PRECISION); //10^1
|
|
40
|
+
exports.PRICE_TO_QUOTE_PRECISION = exports.PRICE_PRECISION.div(exports.QUOTE_PRECISION); // 10^1
|
|
41
|
+
exports.AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO = exports.AMM_RESERVE_PRECISION.mul(exports.PEG_PRECISION).div(exports.QUOTE_PRECISION); // 10^9
|
|
43
42
|
exports.MARGIN_PRECISION = exports.TEN_THOUSAND;
|
|
44
|
-
exports.BID_ASK_SPREAD_PRECISION = new __1.BN(1000000);
|
|
43
|
+
exports.BID_ASK_SPREAD_PRECISION = new __1.BN(1000000); // 10^6
|
|
45
44
|
exports.ONE_YEAR = new __1.BN(31536000);
|
|
46
|
-
exports.QUOTE_SPOT_MARKET_INDEX =
|
|
45
|
+
exports.QUOTE_SPOT_MARKET_INDEX = 0;
|
|
47
46
|
exports.LAMPORTS_PRECISION = new __1.BN(web3_js_1.LAMPORTS_PER_SOL);
|
|
48
47
|
exports.LAMPORTS_EXP = new __1.BN(Math.log10(web3_js_1.LAMPORTS_PER_SOL));
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { BN, OracleSource } from '../';
|
|
1
|
+
import { OracleSource } from '../';
|
|
3
2
|
import { DriftEnv } from '../';
|
|
4
3
|
import { PublicKey } from '@solana/web3.js';
|
|
5
4
|
export declare type PerpMarketConfig = {
|
|
@@ -7,7 +6,7 @@ export declare type PerpMarketConfig = {
|
|
|
7
6
|
category?: string[];
|
|
8
7
|
symbol: string;
|
|
9
8
|
baseAssetSymbol: string;
|
|
10
|
-
marketIndex:
|
|
9
|
+
marketIndex: number;
|
|
11
10
|
launchTs: number;
|
|
12
11
|
oracle: PublicKey;
|
|
13
12
|
oracleSource: OracleSource;
|
|
@@ -9,7 +9,7 @@ exports.DevnetPerpMarkets = [
|
|
|
9
9
|
category: ['L1', 'Infra'],
|
|
10
10
|
symbol: 'SOL-PERP',
|
|
11
11
|
baseAssetSymbol: 'SOL',
|
|
12
|
-
marketIndex:
|
|
12
|
+
marketIndex: 0,
|
|
13
13
|
oracle: new web3_js_1.PublicKey('J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix'),
|
|
14
14
|
launchTs: 1655751353000,
|
|
15
15
|
oracleSource: __1.OracleSource.PYTH,
|
|
@@ -19,7 +19,7 @@ exports.DevnetPerpMarkets = [
|
|
|
19
19
|
category: ['L1', 'Payment'],
|
|
20
20
|
symbol: 'BTC-PERP',
|
|
21
21
|
baseAssetSymbol: 'BTC',
|
|
22
|
-
marketIndex:
|
|
22
|
+
marketIndex: 1,
|
|
23
23
|
oracle: new web3_js_1.PublicKey('HovQMDrbAgAYPCmHVSrezcSmkMtXSSUsLDFANExrZh2J'),
|
|
24
24
|
launchTs: 1655751353000,
|
|
25
25
|
oracleSource: __1.OracleSource.PYTH,
|
|
@@ -29,7 +29,7 @@ exports.DevnetPerpMarkets = [
|
|
|
29
29
|
category: ['L1', 'Infra'],
|
|
30
30
|
symbol: 'ETH-PERP',
|
|
31
31
|
baseAssetSymbol: 'ETH',
|
|
32
|
-
marketIndex:
|
|
32
|
+
marketIndex: 2,
|
|
33
33
|
oracle: new web3_js_1.PublicKey('EdVCmQ9FSPcVe5YySXDPCRmc8aDQLKJ9xvYBMZPie1Vw'),
|
|
34
34
|
launchTs: 1637691133472,
|
|
35
35
|
oracleSource: __1.OracleSource.PYTH,
|
|
@@ -3,12 +3,13 @@ import { PublicKey } from '@solana/web3.js';
|
|
|
3
3
|
import { BN, DriftEnv, OracleSource } from '../';
|
|
4
4
|
export declare type SpotMarketConfig = {
|
|
5
5
|
symbol: string;
|
|
6
|
-
marketIndex:
|
|
6
|
+
marketIndex: number;
|
|
7
7
|
oracle: PublicKey;
|
|
8
8
|
mint: PublicKey;
|
|
9
9
|
oracleSource: OracleSource;
|
|
10
10
|
precision: BN;
|
|
11
11
|
precisionExp: BN;
|
|
12
|
+
serumMarket?: PublicKey;
|
|
12
13
|
};
|
|
13
14
|
export declare const WRAPPED_SOL_MINT: PublicKey;
|
|
14
15
|
export declare const DevnetSpotMarkets: SpotMarketConfig[];
|
|
@@ -8,7 +8,7 @@ exports.WRAPPED_SOL_MINT = new web3_js_1.PublicKey('So11111111111111111111111111
|
|
|
8
8
|
exports.DevnetSpotMarkets = [
|
|
9
9
|
{
|
|
10
10
|
symbol: 'USDC',
|
|
11
|
-
marketIndex:
|
|
11
|
+
marketIndex: 0,
|
|
12
12
|
oracle: web3_js_1.PublicKey.default,
|
|
13
13
|
oracleSource: __1.OracleSource.QUOTE_ASSET,
|
|
14
14
|
mint: new web3_js_1.PublicKey('8zGuJQqwhZafTah7Uc7Z4tXRnguqkn5KLFAP8oV6PHe2'),
|
|
@@ -17,27 +17,29 @@ exports.DevnetSpotMarkets = [
|
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
symbol: 'SOL',
|
|
20
|
-
marketIndex:
|
|
20
|
+
marketIndex: 1,
|
|
21
21
|
oracle: new web3_js_1.PublicKey('J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix'),
|
|
22
22
|
oracleSource: __1.OracleSource.PYTH,
|
|
23
23
|
mint: new web3_js_1.PublicKey(exports.WRAPPED_SOL_MINT),
|
|
24
24
|
precision: numericConstants_1.LAMPORTS_PRECISION,
|
|
25
25
|
precisionExp: numericConstants_1.LAMPORTS_EXP,
|
|
26
|
+
serumMarket: new web3_js_1.PublicKey('8N37SsnTu8RYxtjrV9SStjkkwVhmU8aCWhLvwduAPEKW'),
|
|
26
27
|
},
|
|
27
28
|
{
|
|
28
29
|
symbol: 'BTC',
|
|
29
|
-
marketIndex:
|
|
30
|
+
marketIndex: 2,
|
|
30
31
|
oracle: new web3_js_1.PublicKey('HovQMDrbAgAYPCmHVSrezcSmkMtXSSUsLDFANExrZh2J'),
|
|
31
32
|
oracleSource: __1.OracleSource.PYTH,
|
|
32
33
|
mint: new web3_js_1.PublicKey('3BZPwbcqB5kKScF3TEXxwNfx5ipV13kbRVDvfVp5c6fv'),
|
|
33
34
|
precision: numericConstants_1.SPOT_MARKET_BALANCE_PRECISION,
|
|
34
35
|
precisionExp: numericConstants_1.SPOT_MARKET_BALANCE_PRECISION_EXP,
|
|
36
|
+
serumMarket: new web3_js_1.PublicKey('AGsmbVu3MS9u68GEYABWosQQCZwmLcBHu4pWEuBYH7Za'),
|
|
35
37
|
},
|
|
36
38
|
];
|
|
37
39
|
exports.MainnetSpotMarkets = [
|
|
38
40
|
{
|
|
39
41
|
symbol: 'USDC',
|
|
40
|
-
marketIndex:
|
|
42
|
+
marketIndex: 0,
|
|
41
43
|
oracle: web3_js_1.PublicKey.default,
|
|
42
44
|
oracleSource: __1.OracleSource.QUOTE_ASSET,
|
|
43
45
|
mint: new web3_js_1.PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'),
|
package/lib/dlob/DLOB.d.ts
CHANGED
|
@@ -52,22 +52,22 @@ export declare class DLOB {
|
|
|
52
52
|
init(clearingHouse: ClearingHouse, userMap?: UserMap): Promise<boolean>;
|
|
53
53
|
insertOrder(order: Order, userAccount: PublicKey, onInsert?: OrderBookCallback): void;
|
|
54
54
|
trigger(order: Order, userAccount: PublicKey, onTrigger?: OrderBookCallback): void;
|
|
55
|
-
getListForOrder(order: Order): NodeList<any
|
|
56
|
-
findNodesToFill(marketIndex:
|
|
57
|
-
findCrossingNodesToFill(marketIndex:
|
|
58
|
-
findMarketNodesToFill(marketIndex:
|
|
59
|
-
findJitAuctionNodesToFill(marketIndex:
|
|
60
|
-
getMarketBids(marketIndex:
|
|
61
|
-
getMarketAsks(marketIndex:
|
|
62
|
-
getAsks(marketIndex:
|
|
63
|
-
getBids(marketIndex:
|
|
55
|
+
getListForOrder(order: Order): NodeList<any> | undefined;
|
|
56
|
+
findNodesToFill(marketIndex: number, vBid: BN | undefined, vAsk: BN | undefined, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData): NodeToFill[];
|
|
57
|
+
findCrossingNodesToFill(marketIndex: number, vBid: BN | undefined, vAsk: BN | undefined, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData): NodeToFill[];
|
|
58
|
+
findMarketNodesToFill(marketIndex: number, slot: number, marketType: MarketType): NodeToFill[];
|
|
59
|
+
findJitAuctionNodesToFill(marketIndex: number, slot: number, marketType: MarketType): NodeToFill[];
|
|
60
|
+
getMarketBids(marketIndex: number, marketType: MarketType): Generator<DLOBNode>;
|
|
61
|
+
getMarketAsks(marketIndex: number, marketType: MarketType): Generator<DLOBNode>;
|
|
62
|
+
getAsks(marketIndex: number, vAsk: BN | undefined, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData): Generator<DLOBNode>;
|
|
63
|
+
getBids(marketIndex: number, vBid: BN | undefined, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData): Generator<DLOBNode>;
|
|
64
64
|
findCrossingOrders(askNode: DLOBNode, bidNode: DLOBNode, oraclePriceData: OraclePriceData, slot: number): {
|
|
65
65
|
crossingNodes?: NodeToFill;
|
|
66
66
|
exhaustedSide?: Side;
|
|
67
67
|
};
|
|
68
|
-
getBestAsk(marketIndex:
|
|
69
|
-
getBestBid(marketIndex:
|
|
70
|
-
findNodesToTrigger(marketIndex:
|
|
71
|
-
printTopOfOrderLists(sdkConfig: any, clearingHouse: ClearingHouse, slotSubscriber: SlotSubscriber, marketIndex:
|
|
68
|
+
getBestAsk(marketIndex: number, vAsk: BN | undefined, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData): BN;
|
|
69
|
+
getBestBid(marketIndex: number, vBid: BN | undefined, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData): BN;
|
|
70
|
+
findNodesToTrigger(marketIndex: number, slot: number, oraclePrice: BN, marketType: MarketType): NodeToTrigger[];
|
|
71
|
+
printTopOfOrderLists(sdkConfig: any, clearingHouse: ClearingHouse, slotSubscriber: SlotSubscriber, marketIndex: number, marketType: MarketType): void;
|
|
72
72
|
}
|
|
73
73
|
export {};
|