@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.
Files changed (106) hide show
  1. package/README.md +13 -13
  2. package/lib/accounts/pollingClearingHouseAccountSubscriber.d.ts +10 -11
  3. package/lib/accounts/pollingClearingHouseAccountSubscriber.js +4 -4
  4. package/lib/accounts/types.d.ts +4 -6
  5. package/lib/accounts/webSocketClearingHouseAccountSubscriber.d.ts +10 -11
  6. package/lib/accounts/webSocketClearingHouseAccountSubscriber.js +6 -8
  7. package/lib/addresses/marketAddresses.d.ts +1 -3
  8. package/lib/addresses/pda.d.ts +5 -5
  9. package/lib/addresses/pda.js +5 -5
  10. package/lib/admin.d.ts +27 -28
  11. package/lib/admin.js +12 -37
  12. package/lib/clearingHouse.d.ts +61 -62
  13. package/lib/clearingHouse.js +92 -110
  14. package/lib/clearingHouseConfig.d.ts +2 -4
  15. package/lib/clearingHouseUser.d.ts +16 -16
  16. package/lib/clearingHouseUser.js +16 -16
  17. package/lib/config.d.ts +2 -4
  18. package/lib/config.js +1 -1
  19. package/lib/constants/numericConstants.d.ts +7 -8
  20. package/lib/constants/numericConstants.js +17 -18
  21. package/lib/constants/perpMarkets.d.ts +2 -3
  22. package/lib/constants/perpMarkets.js +3 -3
  23. package/lib/constants/spotMarkets.d.ts +2 -1
  24. package/lib/constants/spotMarkets.js +6 -4
  25. package/lib/dlob/DLOB.d.ts +13 -13
  26. package/lib/dlob/DLOB.js +36 -40
  27. package/lib/dlob/DLOBNode.js +2 -2
  28. package/lib/events/sort.js +1 -1
  29. package/lib/examples/makeTradeExample.js +3 -3
  30. package/lib/idl/clearing_house.json +359 -310
  31. package/lib/math/amm.d.ts +2 -2
  32. package/lib/math/amm.js +10 -10
  33. package/lib/math/conversion.js +1 -1
  34. package/lib/math/funding.js +9 -9
  35. package/lib/math/margin.js +3 -3
  36. package/lib/math/market.d.ts +4 -4
  37. package/lib/math/market.js +7 -7
  38. package/lib/math/oracles.js +6 -8
  39. package/lib/math/position.d.ts +2 -2
  40. package/lib/math/position.js +9 -9
  41. package/lib/math/repeg.js +7 -6
  42. package/lib/math/spotBalance.js +5 -5
  43. package/lib/math/spotPosition.js +2 -2
  44. package/lib/math/trade.d.ts +6 -6
  45. package/lib/math/trade.js +15 -19
  46. package/lib/oracles/pythClient.js +1 -1
  47. package/lib/oracles/quoteAssetOracleClient.js +1 -1
  48. package/lib/oracles/switchboardClient.js +1 -1
  49. package/lib/types.d.ts +63 -51
  50. package/lib/types.js +1 -1
  51. package/package.json +2 -1
  52. package/src/accounts/pollingClearingHouseAccountSubscriber.ts +15 -15
  53. package/src/accounts/types.ts +4 -5
  54. package/src/accounts/webSocketClearingHouseAccountSubscriber.ts +17 -25
  55. package/src/addresses/marketAddresses.ts +1 -2
  56. package/src/addresses/pda.ts +10 -10
  57. package/src/admin.ts +42 -79
  58. package/src/clearingHouse.ts +164 -212
  59. package/src/clearingHouseConfig.ts +2 -3
  60. package/src/clearingHouseUser.ts +35 -35
  61. package/src/config.ts +3 -4
  62. package/src/constants/numericConstants.ts +19 -21
  63. package/src/constants/perpMarkets.ts +5 -5
  64. package/src/constants/spotMarkets.ts +8 -5
  65. package/src/dlob/DLOB.ts +54 -70
  66. package/src/dlob/DLOBNode.ts +5 -6
  67. package/src/events/sort.ts +1 -1
  68. package/src/examples/makeTradeExample.js +2 -2
  69. package/src/examples/makeTradeExample.ts +5 -8
  70. package/src/idl/clearing_house.json +359 -310
  71. package/src/math/amm.ts +14 -11
  72. package/src/math/conversion.ts +2 -2
  73. package/src/math/funding.ts +13 -11
  74. package/src/math/margin.ts +4 -5
  75. package/src/math/market.ts +5 -5
  76. package/src/math/oracles.ts +9 -9
  77. package/src/math/position.ts +11 -19
  78. package/src/math/repeg.ts +8 -7
  79. package/src/math/spotBalance.ts +6 -6
  80. package/src/math/spotPosition.ts +2 -2
  81. package/src/math/trade.ts +17 -21
  82. package/src/oracles/pythClient.ts +2 -2
  83. package/src/oracles/quoteAssetOracleClient.ts +2 -2
  84. package/src/oracles/switchboardClient.ts +2 -2
  85. package/src/types.ts +69 -51
  86. package/tests/dlob/helpers.ts +56 -4
  87. package/src/addresses/marketAddresses.js +0 -26
  88. package/src/constants/banks.js +0 -42
  89. package/src/constants/markets.js +0 -42
  90. package/src/events/txEventCache.js +0 -71
  91. package/src/factory/bigNum.js +0 -390
  92. package/src/factory/oracleClient.js +0 -20
  93. package/src/math/auction.js +0 -42
  94. package/src/math/conversion.js +0 -11
  95. package/src/math/funding.js +0 -248
  96. package/src/math/repeg.js +0 -128
  97. package/src/math/trade.js +0 -253
  98. package/src/math/utils.js +0 -26
  99. package/src/math/utils.js.map +0 -1
  100. package/src/oracles/oracleClientCache.js +0 -19
  101. package/src/oracles/pythClient.js +0 -46
  102. package/src/oracles/quoteAssetOracleClient.js +0 -32
  103. package/src/oracles/switchboardClient.js +0 -69
  104. package/src/oracles/types.js +0 -2
  105. package/src/userName.js +0 -20
  106. package/src/wallet.js +0 -35
package/src/dlob/DLOB.ts CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  getVariant,
14
14
  Order,
15
15
  ZERO,
16
- MARK_PRICE_PRECISION,
16
+ PRICE_PRECISION,
17
17
  SpotMarketAccount,
18
18
  PerpMarketAccount,
19
19
  OraclePriceData,
@@ -89,9 +89,9 @@ export class DLOB {
89
89
 
90
90
  for (const market of perpMarkets) {
91
91
  const marketIndex = market.marketIndex;
92
- this.marketIndexToAccount.get('perp').set(marketIndex.toNumber(), market);
92
+ this.marketIndexToAccount.get('perp').set(marketIndex, market);
93
93
 
94
- this.orderLists.get('perp').set(marketIndex.toNumber(), {
94
+ this.orderLists.get('perp').set(marketIndex, {
95
95
  limit: {
96
96
  ask: new NodeList('limit', 'asc'),
97
97
  bid: new NodeList('limit', 'desc'),
@@ -112,9 +112,9 @@ export class DLOB {
112
112
  }
113
113
  for (const market of spotMarkets) {
114
114
  const marketIndex = market.marketIndex;
115
- this.marketIndexToAccount.get('spot').set(marketIndex.toNumber(), market);
115
+ this.marketIndexToAccount.get('spot').set(marketIndex, market);
116
116
 
117
- this.orderLists.get('spot').set(marketIndex.toNumber(), {
117
+ this.orderLists.get('spot').set(marketIndex, {
118
118
  limit: {
119
119
  ask: new NodeList('limit', 'asc'),
120
120
  bid: new NodeList('limit', 'desc'),
@@ -191,12 +191,10 @@ export class DLOB {
191
191
  .get(marketType)
192
192
  .add(getOrderSignature(order.orderId, userAccount));
193
193
  }
194
- this.getListForOrder(order).insert(
194
+ this.getListForOrder(order)?.insert(
195
195
  order,
196
196
  marketType,
197
- this.marketIndexToAccount
198
- .get(marketType)
199
- .get(order.marketIndex.toNumber()),
197
+ this.marketIndexToAccount.get(marketType).get(order.marketIndex),
200
198
  userAccount
201
199
  );
202
200
 
@@ -216,19 +214,14 @@ export class DLOB {
216
214
 
217
215
  const marketType = getVariant(order.marketType) as MarketTypeStr;
218
216
 
219
- const triggerList = this.orderLists
220
- .get(marketType)
221
- .get(order.marketIndex.toNumber()).trigger[
222
- isVariant(order.triggerCondition, 'above') ? 'above' : 'below'
223
- ];
217
+ const triggerList = this.orderLists.get(marketType).get(order.marketIndex)
218
+ .trigger[isVariant(order.triggerCondition, 'above') ? 'above' : 'below'];
224
219
  triggerList.remove(order, userAccount);
225
220
 
226
- this.getListForOrder(order).insert(
221
+ this.getListForOrder(order)?.insert(
227
222
  order,
228
223
  marketType,
229
- this.marketIndexToAccount
230
- .get(marketType)
231
- .get(order.marketIndex.toNumber()),
224
+ this.marketIndexToAccount.get(marketType).get(order.marketIndex),
232
225
  userAccount
233
226
  );
234
227
  if (onTrigger) {
@@ -236,7 +229,7 @@ export class DLOB {
236
229
  }
237
230
  }
238
231
 
239
- public getListForOrder(order: Order): NodeList<any> {
232
+ public getListForOrder(order: Order): NodeList<any> | undefined {
240
233
  const isInactiveTriggerOrder =
241
234
  isOneOfVariant(order.orderType, ['triggerMarket', 'triggerLimit']) &&
242
235
  !order.triggered;
@@ -260,13 +253,18 @@ export class DLOB {
260
253
  }
261
254
 
262
255
  const marketType = getVariant(order.marketType) as MarketTypeStr;
263
- return this.orderLists.get(marketType).get(order.marketIndex.toNumber())[
264
- type
265
- ][subType];
256
+
257
+ if (!this.orderLists.has(marketType)) {
258
+ return undefined;
259
+ }
260
+
261
+ return this.orderLists.get(marketType).get(order.marketIndex)[type][
262
+ subType
263
+ ];
266
264
  }
267
265
 
268
266
  public findNodesToFill(
269
- marketIndex: BN,
267
+ marketIndex: number,
270
268
  vBid: BN | undefined,
271
269
  vAsk: BN | undefined,
272
270
  slot: number,
@@ -293,7 +291,7 @@ export class DLOB {
293
291
  }
294
292
 
295
293
  public findCrossingNodesToFill(
296
- marketIndex: BN,
294
+ marketIndex: number,
297
295
  vBid: BN | undefined,
298
296
  vAsk: BN | undefined,
299
297
  slot: number,
@@ -356,7 +354,7 @@ export class DLOB {
356
354
  }
357
355
 
358
356
  public findMarketNodesToFill(
359
- marketIndex: BN,
357
+ marketIndex: number,
360
358
  slot: number,
361
359
  marketType: MarketType
362
360
  ): NodeToFill[] {
@@ -387,7 +385,7 @@ export class DLOB {
387
385
  }
388
386
 
389
387
  public findJitAuctionNodesToFill(
390
- marketIndex: BN,
388
+ marketIndex: number,
391
389
  slot: number,
392
390
  marketType: MarketType
393
391
  ): NodeToFill[] {
@@ -412,29 +410,29 @@ export class DLOB {
412
410
  }
413
411
 
414
412
  public getMarketBids(
415
- marketIndex: BN,
413
+ marketIndex: number,
416
414
  marketType: MarketType
417
415
  ): Generator<DLOBNode> {
418
416
  const marketTypeStr = getVariant(marketType) as MarketTypeStr;
419
417
  return this.orderLists
420
418
  .get(marketTypeStr)
421
- .get(marketIndex.toNumber())
419
+ .get(marketIndex)
422
420
  .market.bid.getGenerator();
423
421
  }
424
422
 
425
423
  public getMarketAsks(
426
- marketIndex: BN,
424
+ marketIndex: number,
427
425
  marketType: MarketType
428
426
  ): Generator<DLOBNode> {
429
427
  const marketTypeStr = getVariant(marketType) as MarketTypeStr;
430
428
  return this.orderLists
431
429
  .get(marketTypeStr)
432
- .get(marketIndex.toNumber())
430
+ .get(marketIndex)
433
431
  .market.ask.getGenerator();
434
432
  }
435
433
 
436
434
  *getAsks(
437
- marketIndex: BN,
435
+ marketIndex: number,
438
436
  vAsk: BN | undefined,
439
437
  slot: number,
440
438
  marketType: MarketType,
@@ -444,9 +442,7 @@ export class DLOB {
444
442
  throw new Error('Must provide OraclePriceData to get spot asks');
445
443
  }
446
444
  const marketTypeStr = getVariant(marketType) as MarketTypeStr;
447
- const nodeLists = this.orderLists
448
- .get(marketTypeStr)
449
- .get(marketIndex.toNumber());
445
+ const nodeLists = this.orderLists.get(marketTypeStr).get(marketIndex);
450
446
 
451
447
  const generatorList = [
452
448
  nodeLists.limit.ask.getGenerator(),
@@ -502,7 +498,7 @@ export class DLOB {
502
498
  }
503
499
 
504
500
  *getBids(
505
- marketIndex: BN,
501
+ marketIndex: number,
506
502
  vBid: BN | undefined,
507
503
  slot: number,
508
504
  marketType: MarketType,
@@ -513,9 +509,7 @@ export class DLOB {
513
509
  }
514
510
 
515
511
  const marketTypeStr = getVariant(marketType) as MarketTypeStr;
516
- const nodeLists = this.orderLists
517
- .get(marketTypeStr)
518
- .get(marketIndex.toNumber());
512
+ const nodeLists = this.orderLists.get(marketTypeStr).get(marketIndex);
519
513
 
520
514
  const generatorList = [
521
515
  nodeLists.limit.bid.getGenerator(),
@@ -708,7 +702,7 @@ export class DLOB {
708
702
  }
709
703
 
710
704
  public getBestAsk(
711
- marketIndex: BN,
705
+ marketIndex: number,
712
706
  vAsk: BN | undefined,
713
707
  slot: number,
714
708
  marketType: MarketType,
@@ -720,7 +714,7 @@ export class DLOB {
720
714
  }
721
715
 
722
716
  public getBestBid(
723
- marketIndex: BN,
717
+ marketIndex: number,
724
718
  vBid: BN | undefined,
725
719
  slot: number,
726
720
  marketType: MarketType,
@@ -732,7 +726,7 @@ export class DLOB {
732
726
  }
733
727
 
734
728
  public findNodesToTrigger(
735
- marketIndex: BN,
729
+ marketIndex: number,
736
730
  slot: number,
737
731
  oraclePrice: BN,
738
732
  marketType: MarketType
@@ -741,7 +735,7 @@ export class DLOB {
741
735
  const marketTypeStr = getVariant(marketType) as MarketTypeStr;
742
736
  for (const node of this.orderLists
743
737
  .get(marketTypeStr)
744
- .get(marketIndex.toNumber())
738
+ .get(marketIndex)
745
739
  .trigger.above.getGenerator()) {
746
740
  if (oraclePrice.gt(node.order.triggerPrice)) {
747
741
  if (isAuctionComplete(node.order, slot)) {
@@ -756,7 +750,7 @@ export class DLOB {
756
750
 
757
751
  for (const node of this.orderLists
758
752
  .get(marketTypeStr)
759
- .get(marketIndex.toNumber())
753
+ .get(marketIndex)
760
754
  .trigger.below.getGenerator()) {
761
755
  if (oraclePrice.lt(node.order.triggerPrice)) {
762
756
  if (isAuctionComplete(node.order, slot)) {
@@ -776,7 +770,7 @@ export class DLOB {
776
770
  sdkConfig: any,
777
771
  clearingHouse: ClearingHouse,
778
772
  slotSubscriber: SlotSubscriber,
779
- marketIndex: BN,
773
+ marketIndex: number,
780
774
  marketType: MarketType
781
775
  ) {
782
776
  if (isVariant(marketType, 'perp')) {
@@ -804,31 +798,26 @@ export class DLOB {
804
798
  const mid = bestAsk.add(bestBid).div(new BN(2));
805
799
 
806
800
  const bidSpread =
807
- (convertToNumber(bestBid, MARK_PRICE_PRECISION) /
808
- convertToNumber(oraclePriceData.price, MARK_PRICE_PRECISION) -
801
+ (convertToNumber(bestBid, PRICE_PRECISION) /
802
+ convertToNumber(oraclePriceData.price, PRICE_PRECISION) -
809
803
  1) *
810
804
  100.0;
811
805
  const askSpread =
812
- (convertToNumber(bestAsk, MARK_PRICE_PRECISION) /
813
- convertToNumber(oraclePriceData.price, MARK_PRICE_PRECISION) -
806
+ (convertToNumber(bestAsk, PRICE_PRECISION) /
807
+ convertToNumber(oraclePriceData.price, PRICE_PRECISION) -
814
808
  1) *
815
809
  100.0;
816
810
 
817
- console.log(
818
- `Market ${sdkConfig.MARKETS[marketIndex.toNumber()].symbol} Orders`
819
- );
811
+ console.log(`Market ${sdkConfig.MARKETS[marketIndex].symbol} Orders`);
820
812
  console.log(
821
813
  ` Ask`,
822
- convertToNumber(bestAsk, MARK_PRICE_PRECISION).toFixed(3),
814
+ convertToNumber(bestAsk, PRICE_PRECISION).toFixed(3),
823
815
  `(${askSpread.toFixed(4)}%)`
824
816
  );
825
- console.log(
826
- ` Mid`,
827
- convertToNumber(mid, MARK_PRICE_PRECISION).toFixed(3)
828
- );
817
+ console.log(` Mid`, convertToNumber(mid, PRICE_PRECISION).toFixed(3));
829
818
  console.log(
830
819
  ` Bid`,
831
- convertToNumber(bestBid, MARK_PRICE_PRECISION).toFixed(3),
820
+ convertToNumber(bestBid, PRICE_PRECISION).toFixed(3),
832
821
  `(${bidSpread.toFixed(4)}%)`
833
822
  );
834
823
  } else if (isVariant(marketType, 'spot')) {
@@ -852,31 +841,26 @@ export class DLOB {
852
841
  const mid = bestAsk.add(bestBid).div(new BN(2));
853
842
 
854
843
  const bidSpread =
855
- (convertToNumber(bestBid, MARK_PRICE_PRECISION) /
856
- convertToNumber(oraclePriceData.price, MARK_PRICE_PRECISION) -
844
+ (convertToNumber(bestBid, PRICE_PRECISION) /
845
+ convertToNumber(oraclePriceData.price, PRICE_PRECISION) -
857
846
  1) *
858
847
  100.0;
859
848
  const askSpread =
860
- (convertToNumber(bestAsk, MARK_PRICE_PRECISION) /
861
- convertToNumber(oraclePriceData.price, MARK_PRICE_PRECISION) -
849
+ (convertToNumber(bestAsk, PRICE_PRECISION) /
850
+ convertToNumber(oraclePriceData.price, PRICE_PRECISION) -
862
851
  1) *
863
852
  100.0;
864
853
 
865
- console.log(
866
- `Market ${sdkConfig.MARKETS[marketIndex.toNumber()].symbol} Orders`
867
- );
854
+ console.log(`Market ${sdkConfig.MARKETS[marketIndex].symbol} Orders`);
868
855
  console.log(
869
856
  ` Ask`,
870
- convertToNumber(bestAsk, MARK_PRICE_PRECISION).toFixed(3),
857
+ convertToNumber(bestAsk, PRICE_PRECISION).toFixed(3),
871
858
  `(${askSpread.toFixed(4)}%)`
872
859
  );
873
- console.log(
874
- ` Mid`,
875
- convertToNumber(mid, MARK_PRICE_PRECISION).toFixed(3)
876
- );
860
+ console.log(` Mid`, convertToNumber(mid, PRICE_PRECISION).toFixed(3));
877
861
  console.log(
878
862
  ` Bid`,
879
- convertToNumber(bestBid, MARK_PRICE_PRECISION).toFixed(3),
863
+ convertToNumber(bestBid, PRICE_PRECISION).toFixed(3),
880
864
  `(${bidSpread.toFixed(4)}%)`
881
865
  );
882
866
  }
@@ -7,7 +7,7 @@ import {
7
7
  isVariant,
8
8
  SpotMarketAccount,
9
9
  PerpMarketAccount,
10
- MARK_PRICE_PRECISION,
10
+ PRICE_PRECISION,
11
11
  OraclePriceData,
12
12
  Order,
13
13
  ZERO,
@@ -56,10 +56,9 @@ export abstract class OrderNode implements DLOBNode {
56
56
  AMM_RESERVE_PRECISION
57
57
  ).toFixed(3)}`;
58
58
  if (this.order.price.gt(ZERO)) {
59
- msg += ` @ ${convertToNumber(
60
- this.order.price,
61
- MARK_PRICE_PRECISION
62
- ).toFixed(3)}`;
59
+ msg += ` @ ${convertToNumber(this.order.price, PRICE_PRECISION).toFixed(
60
+ 3
61
+ )}`;
63
62
  }
64
63
  if (this.order.triggerPrice.gt(ZERO)) {
65
64
  msg += ` ${
@@ -67,7 +66,7 @@ export abstract class OrderNode implements DLOBNode {
67
66
  }`;
68
67
  msg += ` ${convertToNumber(
69
68
  this.order.triggerPrice,
70
- MARK_PRICE_PRECISION
69
+ PRICE_PRECISION
71
70
  ).toFixed(3)}`;
72
71
  }
73
72
  return msg;
@@ -30,7 +30,7 @@ function orderActionRecordSortFn(
30
30
  ): 'less than' | 'greater than' {
31
31
  const currentEventMarketIndex = currentEvent.marketIndex;
32
32
  const newEventMarketIndex = newEvent.marketIndex;
33
- if (!currentEventMarketIndex.eq(newEventMarketIndex)) {
33
+ if (currentEventMarketIndex !== newEventMarketIndex) {
34
34
  return currentEvent.ts.lte(newEvent.ts) ? 'less than' : 'greater than';
35
35
  }
36
36
 
@@ -116,7 +116,7 @@ const main = () =>
116
116
  );
117
117
  const formattedPrice = __2.convertToNumber(
118
118
  currentMarketPrice,
119
- __2.MARK_PRICE_PRECISION
119
+ __2.PRICE_PRECISION
120
120
  );
121
121
  console.log(`Current Market Price is $${formattedPrice}`);
122
122
  // Estimate the slippage for a $5000 LONG trade
@@ -132,7 +132,7 @@ const main = () =>
132
132
  'quote',
133
133
  undefined
134
134
  )[0],
135
- __2.MARK_PRICE_PRECISION
135
+ __2.PRICE_PRECISION
136
136
  );
137
137
  console.log(
138
138
  `Slippage for a $5000 LONG on the SOL market would be $${slippage}`
@@ -3,7 +3,7 @@ import { Wallet } from '..';
3
3
  import { Token, TOKEN_PROGRAM_ID } from '@solana/spl-token';
4
4
  import { Connection, Keypair, PublicKey } from '@solana/web3.js';
5
5
  import {
6
- calculateMarkPrice,
6
+ calculateReservePrice,
7
7
  ClearingHouse,
8
8
  ClearingHouseUser,
9
9
  initialize,
@@ -12,7 +12,7 @@ import {
12
12
  calculateTradeSlippage,
13
13
  BulkAccountLoader,
14
14
  PerpMarkets,
15
- MARK_PRICE_PRECISION,
15
+ PRICE_PRECISION,
16
16
  QUOTE_PRECISION,
17
17
  } from '..';
18
18
  import { SpotMarkets } from '../constants/spotMarkets';
@@ -120,15 +120,12 @@ const main = async () => {
120
120
  (market) => market.baseAssetSymbol === 'SOL'
121
121
  );
122
122
 
123
- const currentMarketPrice = calculateMarkPrice(
123
+ const currentMarketPrice = calculateReservePrice(
124
124
  clearingHouse.getPerpMarketAccount(solMarketInfo.marketIndex),
125
125
  undefined
126
126
  );
127
127
 
128
- const formattedPrice = convertToNumber(
129
- currentMarketPrice,
130
- MARK_PRICE_PRECISION
131
- );
128
+ const formattedPrice = convertToNumber(currentMarketPrice, PRICE_PRECISION);
132
129
 
133
130
  console.log(`Current Market Price is $${formattedPrice}`);
134
131
 
@@ -146,7 +143,7 @@ const main = async () => {
146
143
  'quote',
147
144
  undefined
148
145
  )[0],
149
- MARK_PRICE_PRECISION
146
+ PRICE_PRECISION
150
147
  );
151
148
 
152
149
  console.log(