@drift-labs/sdk 0.2.0-master.3 → 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/bulkUserStatsSubscription.d.ts +7 -0
- package/lib/accounts/bulkUserStatsSubscription.js +21 -0
- package/lib/accounts/bulkUserSubscription.js +0 -1
- package/lib/accounts/fetch.d.ts +2 -1
- package/lib/accounts/fetch.js +9 -1
- package/lib/accounts/pollingClearingHouseAccountSubscriber.d.ts +16 -16
- package/lib/accounts/pollingClearingHouseAccountSubscriber.js +31 -28
- package/lib/accounts/pollingUserStatsAccountSubscriber.d.ts +27 -0
- package/lib/accounts/pollingUserStatsAccountSubscriber.js +113 -0
- package/lib/accounts/types.d.ts +22 -11
- package/lib/accounts/webSocketClearingHouseAccountSubscriber.d.ts +17 -17
- package/lib/accounts/webSocketClearingHouseAccountSubscriber.js +37 -35
- package/lib/accounts/webSocketUserStatsAccountSubsriber.d.ts +20 -0
- package/lib/accounts/webSocketUserStatsAccountSubsriber.js +47 -0
- package/lib/addresses/marketAddresses.d.ts +1 -3
- package/lib/addresses/pda.d.ts +10 -4
- package/lib/addresses/pda.js +51 -14
- package/lib/admin.d.ts +34 -22
- package/lib/admin.js +182 -73
- package/lib/clearingHouse.d.ts +120 -42
- package/lib/clearingHouse.js +1505 -254
- package/lib/clearingHouseConfig.d.ts +4 -4
- package/lib/clearingHouseUser.d.ts +50 -38
- package/lib/clearingHouseUser.js +410 -190
- package/lib/clearingHouseUserStats.d.ts +18 -0
- package/lib/clearingHouseUserStats.js +49 -0
- package/lib/clearingHouseUserStatsConfig.d.ts +14 -0
- package/lib/clearingHouseUserStatsConfig.js +2 -0
- package/lib/config.d.ts +7 -9
- package/lib/config.js +21 -21
- package/lib/constants/numericConstants.d.ts +18 -12
- package/lib/constants/numericConstants.js +28 -21
- package/lib/constants/perpMarkets.d.ts +18 -0
- package/lib/constants/{markets.js → perpMarkets.js} +7 -7
- package/lib/constants/spotMarkets.d.ts +19 -0
- package/lib/constants/spotMarkets.js +53 -0
- package/lib/dlob/DLOB.d.ts +73 -0
- package/lib/dlob/DLOB.js +553 -0
- package/lib/dlob/DLOBNode.d.ts +52 -0
- package/lib/dlob/DLOBNode.js +82 -0
- package/lib/dlob/NodeList.d.ts +26 -0
- package/lib/dlob/NodeList.js +138 -0
- package/lib/events/eventList.js +3 -0
- package/lib/events/eventSubscriber.d.ts +4 -2
- package/lib/events/eventSubscriber.js +16 -9
- package/lib/events/fetchLogs.d.ts +10 -1
- package/lib/events/fetchLogs.js +27 -7
- package/lib/events/pollingLogProvider.d.ts +2 -1
- package/lib/events/pollingLogProvider.js +6 -2
- package/lib/events/sort.js +8 -11
- package/lib/events/types.d.ts +7 -2
- package/lib/events/types.js +5 -0
- package/lib/examples/makeTradeExample.js +20 -8
- package/lib/factory/bigNum.d.ts +1 -0
- package/lib/factory/bigNum.js +34 -10
- package/lib/idl/clearing_house.json +4313 -1433
- package/lib/idl/{mock_usdc_faucet.json → token_faucet.json} +46 -23
- package/lib/index.d.ts +21 -6
- package/lib/index.js +25 -6
- package/lib/math/amm.d.ts +8 -5
- package/lib/math/amm.js +68 -46
- package/lib/math/auction.js +4 -1
- package/lib/math/conversion.js +1 -1
- package/lib/math/funding.d.ts +6 -6
- package/lib/math/funding.js +11 -10
- package/lib/math/insurance.d.ts +4 -0
- package/lib/math/insurance.js +27 -0
- package/lib/math/margin.d.ts +11 -0
- package/lib/math/margin.js +77 -0
- package/lib/math/market.d.ts +14 -9
- package/lib/math/market.js +69 -7
- package/lib/math/oracles.d.ts +4 -0
- package/lib/math/oracles.js +36 -8
- package/lib/math/orders.d.ts +6 -2
- package/lib/math/orders.js +78 -3
- package/lib/math/position.d.ts +21 -13
- package/lib/math/position.js +76 -36
- package/lib/math/repeg.js +14 -5
- package/lib/math/spotBalance.d.ts +22 -0
- package/lib/math/spotBalance.js +193 -0
- package/lib/math/spotMarket.d.ts +4 -0
- package/lib/math/spotMarket.js +8 -0
- package/lib/math/spotPosition.d.ts +6 -0
- package/lib/math/spotPosition.js +23 -0
- package/lib/math/trade.d.ts +10 -10
- package/lib/math/trade.js +22 -29
- package/lib/oracles/pythClient.js +1 -1
- package/lib/oracles/quoteAssetOracleClient.js +1 -1
- package/lib/oracles/switchboardClient.js +1 -1
- package/lib/orderParams.d.ts +14 -5
- package/lib/orderParams.js +12 -92
- package/lib/serum/serumSubscriber.d.ts +23 -0
- package/lib/serum/serumSubscriber.js +41 -0
- package/lib/serum/types.d.ts +11 -0
- package/lib/serum/types.js +2 -0
- package/lib/slot/SlotSubscriber.d.ts +7 -0
- package/lib/slot/SlotSubscriber.js +3 -0
- package/lib/{mockUSDCFaucet.d.ts → tokenFaucet.d.ts} +8 -5
- package/lib/{mockUSDCFaucet.js → tokenFaucet.js} +63 -51
- package/lib/tx/retryTxSender.d.ts +1 -1
- package/lib/tx/retryTxSender.js +13 -4
- package/lib/tx/types.d.ts +1 -1
- package/lib/tx/utils.js +1 -1
- package/lib/types.d.ts +474 -123
- package/lib/types.js +99 -5
- package/lib/userMap/userMap.d.ts +25 -0
- package/lib/userMap/userMap.js +73 -0
- package/lib/userMap/userStatsMap.d.ts +19 -0
- package/lib/userMap/userStatsMap.js +68 -0
- package/lib/util/computeUnits.js +1 -1
- package/lib/util/getTokenAddress.d.ts +2 -0
- package/lib/util/getTokenAddress.js +9 -0
- package/package.json +9 -5
- package/src/accounts/bulkUserStatsSubscription.ts +33 -0
- package/src/accounts/bulkUserSubscription.ts +0 -1
- package/src/accounts/fetch.ts +27 -2
- package/src/accounts/pollingClearingHouseAccountSubscriber.ts +46 -42
- package/src/accounts/pollingUserStatsAccountSubscriber.ts +172 -0
- package/src/accounts/types.ts +31 -11
- package/src/accounts/webSocketClearingHouseAccountSubscriber.ts +64 -59
- package/src/accounts/webSocketUserStatsAccountSubsriber.ts +80 -0
- package/src/addresses/marketAddresses.ts +1 -2
- package/src/addresses/pda.ts +88 -14
- package/src/admin.ts +333 -128
- package/src/assert/assert.js +9 -0
- package/src/clearingHouse.ts +2464 -458
- package/src/clearingHouseConfig.ts +4 -3
- package/src/clearingHouseUser.ts +747 -291
- package/src/clearingHouseUserStats.ts +75 -0
- package/src/clearingHouseUserStatsConfig.ts +18 -0
- package/src/config.ts +30 -31
- package/src/constants/numericConstants.ts +41 -25
- package/src/constants/{markets.ts → perpMarkets.ts} +10 -10
- package/src/constants/spotMarkets.ts +72 -0
- package/src/dlob/DLOB.ts +868 -0
- package/src/dlob/DLOBNode.ts +162 -0
- package/src/dlob/NodeList.ts +185 -0
- package/src/events/eventList.js +77 -0
- package/src/events/eventList.ts +3 -0
- package/src/events/eventSubscriber.ts +20 -12
- package/src/events/fetchLogs.ts +35 -8
- package/src/events/pollingLogProvider.ts +10 -2
- package/src/events/sort.ts +11 -15
- package/src/events/types.ts +16 -1
- package/src/examples/makeTradeExample.js +157 -0
- package/src/examples/makeTradeExample.ts +32 -14
- package/src/factory/bigNum.ts +42 -13
- package/src/idl/clearing_house.json +4313 -1433
- package/src/idl/{mock_usdc_faucet.json → token_faucet.json} +46 -23
- package/src/index.ts +21 -6
- package/src/math/amm.ts +136 -66
- package/src/math/auction.ts +5 -1
- package/src/math/conversion.ts +2 -2
- package/src/math/funding.ts +20 -18
- package/src/math/insurance.ts +35 -0
- package/src/math/margin.ts +127 -0
- package/src/math/market.ts +138 -12
- package/src/math/oracles.ts +63 -9
- package/src/math/orders.ts +138 -4
- package/src/math/position.ts +119 -58
- package/src/math/repeg.ts +16 -6
- package/src/math/spotBalance.ts +316 -0
- package/src/math/spotMarket.ts +9 -0
- package/src/math/spotPosition.ts +47 -0
- package/src/math/trade.ts +43 -49
- package/src/oracles/pythClient.ts +2 -2
- package/src/oracles/quoteAssetOracleClient.ts +2 -2
- package/src/oracles/switchboardClient.ts +2 -2
- package/src/orderParams.ts +24 -137
- package/src/serum/serumSubscriber.ts +80 -0
- package/src/serum/types.ts +13 -0
- package/src/slot/SlotSubscriber.ts +11 -1
- package/src/token/index.js +38 -0
- package/src/{mockUSDCFaucet.ts → tokenFaucet.ts} +82 -70
- package/src/tx/retryTxSender.ts +16 -5
- package/src/tx/types.js +2 -0
- package/src/tx/types.ts +2 -1
- package/src/tx/utils.js +17 -0
- package/src/tx/utils.ts +1 -1
- package/src/types.ts +477 -125
- package/src/userMap/userMap.ts +100 -0
- package/src/userMap/userStatsMap.ts +110 -0
- package/src/util/computeUnits.js +21 -11
- package/src/util/computeUnits.ts +1 -1
- package/src/util/getTokenAddress.js +9 -0
- package/src/util/getTokenAddress.ts +18 -0
- package/src/util/promiseTimeout.js +14 -0
- package/src/util/tps.js +27 -0
- package/tests/bn/test.ts +12 -3
- package/tests/dlob/helpers.ts +374 -0
- package/tests/dlob/test.ts +2865 -0
- package/lib/constants/banks.d.ts +0 -16
- package/lib/constants/banks.js +0 -34
- package/lib/constants/markets.d.ts +0 -19
- package/lib/math/bankBalance.d.ts +0 -9
- package/lib/math/bankBalance.js +0 -75
- package/lib/math/state.d.ts +0 -8
- package/lib/math/state.js +0 -15
- package/lib/orders.d.ts +0 -8
- package/lib/orders.js +0 -134
- package/src/constants/banks.ts +0 -43
- package/src/math/bankBalance.ts +0 -112
- package/src/math/state.ts +0 -14
- package/src/math/utils.js +0 -27
- package/src/math/utils.js.map +0 -1
- package/src/orders.ts +0 -244
- package/src/util/computeUnits.js.map +0 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
/// <reference types="bn.js" />
|
|
2
1
|
import { ConfirmOptions, Connection, PublicKey } from '@solana/web3.js';
|
|
3
2
|
import { IWallet } from './types';
|
|
4
|
-
import { BN } from '@project-serum/anchor';
|
|
5
3
|
import { OracleInfo } from './oracles/types';
|
|
6
4
|
import { BulkAccountLoader } from './accounts/bulkAccountLoader';
|
|
7
5
|
import { DriftEnv } from './config';
|
|
@@ -14,10 +12,12 @@ export declare type ClearingHouseConfig = {
|
|
|
14
12
|
txSenderConfig?: TxSenderConfig;
|
|
15
13
|
userIds?: number[];
|
|
16
14
|
activeUserId?: number;
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
perpMarketIndexes?: number[];
|
|
16
|
+
spotMarketIndexes?: number[];
|
|
19
17
|
oracleInfos?: OracleInfo[];
|
|
20
18
|
env?: DriftEnv;
|
|
19
|
+
userStats?: boolean;
|
|
20
|
+
authority?: PublicKey;
|
|
21
21
|
};
|
|
22
22
|
declare type ClearingHouseSubscriptionConfig = {
|
|
23
23
|
type: 'websocket';
|
|
@@ -4,9 +4,9 @@ import { PublicKey } from '@solana/web3.js';
|
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
6
6
|
import { ClearingHouse } from './clearingHouse';
|
|
7
|
-
import { MarginCategory, Order, UserAccount,
|
|
7
|
+
import { MarginCategory, Order, UserAccount, PerpPosition } from './types';
|
|
8
8
|
import { UserAccountSubscriber, UserAccountEvents, DataAndSlot } from './accounts/types';
|
|
9
|
-
import { PositionDirection, BN } from '.';
|
|
9
|
+
import { PositionDirection, BN, SpotMarketAccount } from '.';
|
|
10
10
|
import { OraclePriceData } from './oracles/types';
|
|
11
11
|
import { ClearingHouseUserConfig } from './clearingHouseUserConfig';
|
|
12
12
|
export declare class ClearingHouseUser {
|
|
@@ -35,8 +35,9 @@ 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
|
+
getClonedPosition(position: PerpPosition): PerpPosition;
|
|
40
41
|
/**
|
|
41
42
|
* @param orderId
|
|
42
43
|
* @returns Order
|
|
@@ -49,77 +50,88 @@ export declare class ClearingHouseUser {
|
|
|
49
50
|
getOrderByUserOrderId(userOrderId: number): Order | undefined;
|
|
50
51
|
getUserAccountPublicKey(): PublicKey;
|
|
51
52
|
exists(): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* calculates the market position if the lp position was settled
|
|
55
|
+
* @returns : the settled userPosition
|
|
56
|
+
* @returns : the dust base asset amount (ie, < stepsize)
|
|
57
|
+
* @returns : pnl from settle
|
|
58
|
+
*/
|
|
59
|
+
getSettledLPPosition(marketIndex: number): [PerpPosition, BN, BN];
|
|
52
60
|
/**
|
|
53
61
|
* calculates Buying Power = FC * MAX_LEVERAGE
|
|
54
62
|
* @returns : Precision QUOTE_PRECISION
|
|
55
63
|
*/
|
|
56
|
-
getBuyingPower(marketIndex:
|
|
64
|
+
getBuyingPower(marketIndex: number): BN;
|
|
57
65
|
/**
|
|
58
66
|
* calculates Free Collateral = Total collateral - initial margin requirement
|
|
59
67
|
* @returns : Precision QUOTE_PRECISION
|
|
60
68
|
*/
|
|
61
69
|
getFreeCollateral(): BN;
|
|
62
|
-
getInitialMarginRequirement(): BN;
|
|
63
70
|
/**
|
|
64
|
-
* @returns The
|
|
71
|
+
* @returns The margin requirement of a certain type (Initial or Maintenance) in USDC. : QUOTE_PRECISION
|
|
65
72
|
*/
|
|
66
|
-
|
|
73
|
+
getMarginRequirement(marginCategory: MarginCategory, liquidationBuffer?: BN): BN;
|
|
67
74
|
/**
|
|
68
|
-
*
|
|
69
|
-
|
|
75
|
+
* @returns The initial margin requirement in USDC. : QUOTE_PRECISION
|
|
76
|
+
*/
|
|
77
|
+
getInitialMarginRequirement(): BN;
|
|
78
|
+
/**
|
|
79
|
+
* @returns The maintenance margin requirement in USDC. : QUOTE_PRECISION
|
|
70
80
|
*/
|
|
71
|
-
|
|
81
|
+
getMaintenanceMarginRequirement(liquidationBuffer?: BN): BN;
|
|
72
82
|
/**
|
|
73
83
|
* calculates unrealized position price pnl
|
|
74
84
|
* @returns : Precision QUOTE_PRECISION
|
|
75
85
|
*/
|
|
76
|
-
|
|
86
|
+
getUnrealizedPNL(withFunding?: boolean, marketIndex?: number, withWeightMarginCategory?: MarginCategory): BN;
|
|
77
87
|
/**
|
|
78
88
|
* calculates unrealized funding payment pnl
|
|
79
89
|
* @returns : Precision QUOTE_PRECISION
|
|
80
90
|
*/
|
|
81
|
-
getUnrealizedFundingPNL(marketIndex?:
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
getUnrealizedFundingPNL(marketIndex?: number): BN;
|
|
92
|
+
getSpotMarketLiabilityValue(marketIndex?: number, marginCategory?: MarginCategory, liquidationBuffer?: BN, includeOpenOrders?: boolean): BN;
|
|
93
|
+
getSpotLiabilityValue(tokenAmount: BN, oraclePriceData: OraclePriceData, spotMarketAccount: SpotMarketAccount, marginCategory?: MarginCategory, liquidationBuffer?: BN): BN;
|
|
94
|
+
getSpotMarketAssetValue(marketIndex?: number, marginCategory?: MarginCategory, includeOpenOrders?: boolean): BN;
|
|
95
|
+
getSpotAssetValue(tokenAmount: BN, oraclePriceData: OraclePriceData, spotMarketAccount: SpotMarketAccount, marginCategory?: MarginCategory): BN;
|
|
96
|
+
getNetSpotMarketValue(withWeightMarginCategory?: MarginCategory): BN;
|
|
84
97
|
/**
|
|
85
98
|
* calculates TotalCollateral: collateral + unrealized pnl
|
|
86
|
-
* TODO: rename to total equity (for perpetuals swaps)
|
|
87
99
|
* @returns : Precision QUOTE_PRECISION
|
|
88
100
|
*/
|
|
89
|
-
getTotalCollateral(): BN;
|
|
101
|
+
getTotalCollateral(marginCategory?: MarginCategory): BN;
|
|
90
102
|
/**
|
|
91
|
-
* calculates sum of position value across all positions
|
|
103
|
+
* calculates sum of position value across all positions in margin system
|
|
92
104
|
* @returns : Precision QUOTE_PRECISION
|
|
93
105
|
*/
|
|
94
|
-
|
|
106
|
+
getTotalPerpPositionValue(marginCategory?: MarginCategory, liquidationBuffer?: BN, includeOpenOrders?: boolean): BN;
|
|
95
107
|
/**
|
|
96
|
-
* calculates position value
|
|
108
|
+
* calculates position value in margin system
|
|
97
109
|
* @returns : Precision QUOTE_PRECISION
|
|
98
110
|
*/
|
|
99
|
-
|
|
100
|
-
getPositionSide(currentPosition: Pick<
|
|
111
|
+
getPerpPositionValue(marketIndex: number, oraclePriceData: OraclePriceData): BN;
|
|
112
|
+
getPositionSide(currentPosition: Pick<PerpPosition, 'baseAssetAmount'>): PositionDirection | undefined;
|
|
101
113
|
/**
|
|
102
|
-
* calculates average exit price for closing 100% of position
|
|
103
|
-
* @returns : Precision
|
|
114
|
+
* calculates average exit price (optionally for closing up to 100% of position)
|
|
115
|
+
* @returns : Precision PRICE_PRECISION
|
|
104
116
|
*/
|
|
105
|
-
getPositionEstimatedExitPriceAndPnl(position:
|
|
117
|
+
getPositionEstimatedExitPriceAndPnl(position: PerpPosition, amountToClose?: BN, useAMMClose?: boolean): [BN, BN];
|
|
106
118
|
/**
|
|
107
119
|
* calculates current user leverage across all positions
|
|
108
120
|
* @returns : Precision TEN_THOUSAND
|
|
109
121
|
*/
|
|
110
|
-
getLeverage(): BN;
|
|
122
|
+
getLeverage(marginCategory?: MarginCategory): BN;
|
|
111
123
|
/**
|
|
112
124
|
* calculates max allowable leverage exceeding hitting requirement category
|
|
113
125
|
* @params category {Initial, Partial, Maintenance}
|
|
114
126
|
* @returns : Precision TEN_THOUSAND
|
|
115
127
|
*/
|
|
116
|
-
getMaxLeverage(marketIndex:
|
|
128
|
+
getMaxLeverage(marketIndex: number, category?: MarginCategory): BN;
|
|
117
129
|
/**
|
|
118
130
|
* calculates margin ratio: total collateral / |total position value|
|
|
119
131
|
* @returns : Precision TEN_THOUSAND
|
|
120
132
|
*/
|
|
121
|
-
getMarginRatio(): BN;
|
|
122
|
-
canBeLiquidated():
|
|
133
|
+
getMarginRatio(marginCategory?: MarginCategory): BN;
|
|
134
|
+
canBeLiquidated(): boolean;
|
|
123
135
|
/**
|
|
124
136
|
* Checks if any user position cumulative funding differs from respective market cumulative funding
|
|
125
137
|
* @returns
|
|
@@ -127,19 +139,19 @@ export declare class ClearingHouseUser {
|
|
|
127
139
|
needsToSettleFundingPayment(): boolean;
|
|
128
140
|
/**
|
|
129
141
|
* Calculate the liquidation price of a position, with optional parameter to calculate the liquidation price after a trade
|
|
130
|
-
* @param
|
|
142
|
+
* @param PerpPosition
|
|
131
143
|
* @param positionBaseSizeChange // change in position size to calculate liquidation price for : Precision 10^13
|
|
132
144
|
* @param partial
|
|
133
|
-
* @returns Precision :
|
|
145
|
+
* @returns Precision : PRICE_PRECISION
|
|
134
146
|
*/
|
|
135
|
-
liquidationPrice(
|
|
147
|
+
liquidationPrice(perpPosition: Pick<PerpPosition, 'marketIndex'>, positionBaseSizeChange?: BN): BN;
|
|
136
148
|
/**
|
|
137
149
|
* Calculates the estimated liquidation price for a position after closing a quote amount of the position.
|
|
138
150
|
* @param positionMarketIndex
|
|
139
151
|
* @param closeQuoteAmount
|
|
140
|
-
* @returns : Precision
|
|
152
|
+
* @returns : Precision PRICE_PRECISION
|
|
141
153
|
*/
|
|
142
|
-
liquidationPriceAfterClose(positionMarketIndex:
|
|
154
|
+
liquidationPriceAfterClose(positionMarketIndex: number, closeQuoteAmount: BN): BN;
|
|
143
155
|
/**
|
|
144
156
|
* Get the maximum trade size for a given market, taking into account the user's current leverage, positions, collateral, etc.
|
|
145
157
|
*
|
|
@@ -161,7 +173,7 @@ export declare class ClearingHouseUser {
|
|
|
161
173
|
* @param tradeSide
|
|
162
174
|
* @returns tradeSizeAllowed : Precision QUOTE_PRECISION
|
|
163
175
|
*/
|
|
164
|
-
getMaxTradeSizeUSDC(targetMarketIndex:
|
|
176
|
+
getMaxTradeSizeUSDC(targetMarketIndex: number, tradeSide: PositionDirection): BN;
|
|
165
177
|
/**
|
|
166
178
|
* Returns the leverage ratio for the account after adding (or subtracting) the given quote size to the given position
|
|
167
179
|
* @param targetMarketIndex
|
|
@@ -169,7 +181,7 @@ export declare class ClearingHouseUser {
|
|
|
169
181
|
* @param tradeQuoteAmount
|
|
170
182
|
* @returns leverageRatio : Precision TEN_THOUSAND
|
|
171
183
|
*/
|
|
172
|
-
accountLeverageRatioAfterTrade(targetMarketIndex:
|
|
184
|
+
accountLeverageRatioAfterTrade(targetMarketIndex: number, tradeQuoteAmount: BN, tradeSide: PositionDirection): BN;
|
|
173
185
|
/**
|
|
174
186
|
* Calculates how much fee will be taken for a given sized trade
|
|
175
187
|
* @param quoteAmount
|
|
@@ -181,7 +193,7 @@ export declare class ClearingHouseUser {
|
|
|
181
193
|
* @param marketToIgnore
|
|
182
194
|
* @returns positionValue : Precision QUOTE_PRECISION
|
|
183
195
|
*/
|
|
184
|
-
private
|
|
196
|
+
private getTotalPerpPositionValueExcludingMarket;
|
|
185
197
|
private getOracleDataForMarket;
|
|
186
|
-
private
|
|
198
|
+
private getOracleDataForSpotMarket;
|
|
187
199
|
}
|