@gearbox-protocol/sdk 15.1.0-next.6 → 15.1.0-next.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.
Files changed (147) hide show
  1. package/dist/cjs/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
  2. package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
  3. package/dist/cjs/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
  4. package/dist/cjs/common-utils/utils/creditAccount/get-time-to-liquidation.js +5 -4
  5. package/dist/cjs/common-utils/utils/creditAccount/liquidation-price.js +21 -11
  6. package/dist/cjs/model/charts.js +147 -0
  7. package/dist/cjs/model/charts.schema.js +240 -0
  8. package/dist/cjs/model/index.js +28 -22
  9. package/dist/cjs/model/liquidations.schema.js +1 -1
  10. package/dist/cjs/model/opportunities.schema.js +1 -1
  11. package/dist/cjs/model/positions.schema.js +15 -2
  12. package/dist/cjs/new-sdk/opportunities/OpportunitiesNamespace.js +2 -6
  13. package/dist/cjs/new-sdk/positions/PositionsNamespace.js +2 -6
  14. package/dist/cjs/new-sdk/utils/index.js +0 -1
  15. package/dist/cjs/offchain/AbstractOffchainNamespace.js +10 -7
  16. package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +4 -8
  17. package/dist/cjs/offchain/positions/OffchainPositions.js +8 -11
  18. package/dist/cjs/preview/preview/CreditAccountState.js +14 -1
  19. package/dist/cjs/preview/preview/buildDelayedPreview.js +16 -6
  20. package/dist/cjs/preview/preview/previewAdjustCreditAccount.js +9 -2
  21. package/dist/cjs/preview/preview/previewOpenCreditAccount.js +11 -3
  22. package/dist/cjs/preview/preview/previewOperation.js +1 -1
  23. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +0 -6
  24. package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
  25. package/dist/cjs/sdk/accounts/intents/testing/sdk-mock.js +31 -4
  26. package/dist/cjs/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +18 -0
  27. package/dist/cjs/sdk/accounts/intents/utils/index.js +2 -0
  28. package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +0 -3
  29. package/dist/cjs/sdk/index.js +12 -0
  30. package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
  31. package/dist/cjs/sdk/positions/PositionsService.js +206 -1
  32. package/dist/cjs/sdk/positions/calcBorrowRate.js +43 -0
  33. package/dist/cjs/sdk/positions/calcHealthFactor.js +44 -0
  34. package/dist/cjs/sdk/positions/calcLiquidationPrice.js +23 -0
  35. package/dist/cjs/sdk/positions/calcLiquidationPriceForTarget.js +30 -0
  36. package/dist/cjs/sdk/positions/calcTimeToLiquidationMs.js +18 -0
  37. package/dist/cjs/sdk/positions/index.js +12 -1
  38. package/dist/cjs/sdk/positions/types.js +31 -0
  39. package/dist/esm/common-utils/utils/apy/get-single-quota-borrow-rate.js +2 -0
  40. package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +24 -22
  41. package/dist/esm/common-utils/utils/creditAccount/calc-quota-borrow-rate.js +2 -0
  42. package/dist/esm/common-utils/utils/creditAccount/get-time-to-liquidation.js +5 -4
  43. package/dist/esm/common-utils/utils/creditAccount/liquidation-price.js +21 -11
  44. package/dist/esm/dev/AccountOpener.js +1 -1
  45. package/dist/esm/dev/withdrawalUtils.js +1 -1
  46. package/dist/esm/model/charts.js +140 -0
  47. package/dist/esm/model/charts.schema.js +226 -0
  48. package/dist/esm/model/index.js +7 -7
  49. package/dist/esm/model/liquidations.schema.js +1 -1
  50. package/dist/esm/model/opportunities.schema.js +1 -1
  51. package/dist/esm/model/positions.schema.js +16 -4
  52. package/dist/esm/new-sdk/opportunities/OpportunitiesNamespace.js +2 -6
  53. package/dist/esm/new-sdk/positions/PositionsNamespace.js +2 -6
  54. package/dist/esm/new-sdk/utils/index.js +0 -1
  55. package/dist/esm/offchain/AbstractOffchainNamespace.js +10 -7
  56. package/dist/esm/offchain/opportunities/OffchainOpportunities.js +4 -8
  57. package/dist/esm/offchain/positions/OffchainPositions.js +8 -11
  58. package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +1 -1
  59. package/dist/esm/preview/preview/CreditAccountState.js +14 -1
  60. package/dist/esm/preview/preview/buildDelayedPreview.js +16 -6
  61. package/dist/esm/preview/preview/previewAdjustCreditAccount.js +9 -2
  62. package/dist/esm/preview/preview/previewOpenCreditAccount.js +11 -3
  63. package/dist/esm/preview/preview/previewOperation.js +1 -1
  64. package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
  65. package/dist/esm/preview/trace/extractTransfers.js +1 -1
  66. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -8
  67. package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +2 -90
  68. package/dist/esm/sdk/accounts/intents/testing/sdk-mock.js +31 -4
  69. package/dist/esm/sdk/accounts/intents/utils/adjust-state-to-snapshot.js +17 -0
  70. package/dist/esm/sdk/accounts/intents/utils/index.js +2 -1
  71. package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +1 -4
  72. package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
  73. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
  74. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
  75. package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
  76. package/dist/esm/sdk/base/TokensMeta.js +3 -3
  77. package/dist/esm/sdk/chain/detectNetwork.js +1 -1
  78. package/dist/esm/sdk/core/createAddressProvider.js +1 -1
  79. package/dist/esm/sdk/index.js +7 -1
  80. package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
  81. package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +10 -3
  82. package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
  83. package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
  84. package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
  85. package/dist/esm/sdk/pools/PoolService.js +1 -1
  86. package/dist/esm/sdk/positions/PositionsService.js +206 -1
  87. package/dist/esm/sdk/positions/calcBorrowRate.js +42 -0
  88. package/dist/esm/sdk/positions/calcHealthFactor.js +43 -0
  89. package/dist/esm/sdk/positions/calcLiquidationPrice.js +22 -0
  90. package/dist/esm/sdk/positions/calcLiquidationPriceForTarget.js +29 -0
  91. package/dist/esm/sdk/positions/calcTimeToLiquidationMs.js +17 -0
  92. package/dist/esm/sdk/positions/index.js +7 -2
  93. package/dist/esm/sdk/positions/types.js +31 -1
  94. package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
  95. package/dist/types/common-utils/utils/apy/get-single-quota-borrow-rate.d.ts +2 -0
  96. package/dist/types/common-utils/utils/creditAccount/calc-health-factor.d.ts +3 -0
  97. package/dist/types/common-utils/utils/creditAccount/calc-quota-borrow-rate.d.ts +2 -0
  98. package/dist/types/common-utils/utils/creditAccount/get-time-to-liquidation.d.ts +3 -0
  99. package/dist/types/common-utils/utils/creditAccount/liquidation-price.d.ts +3 -0
  100. package/dist/types/model/charts.d.ts +349 -0
  101. package/dist/types/model/charts.schema.d.ts +364 -0
  102. package/dist/types/model/index.d.ts +6 -6
  103. package/dist/types/model/positions.d.ts +85 -2
  104. package/dist/types/model/positions.schema.d.ts +26 -1
  105. package/dist/types/new-sdk/index.d.ts +1 -2
  106. package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +4 -5
  107. package/dist/types/new-sdk/opportunities/types.d.ts +9 -7
  108. package/dist/types/new-sdk/positions/PositionsNamespace.d.ts +4 -5
  109. package/dist/types/new-sdk/positions/types.d.ts +9 -9
  110. package/dist/types/new-sdk/utils/index.d.ts +1 -2
  111. package/dist/types/offchain/AbstractOffchainNamespace.d.ts +5 -21
  112. package/dist/types/offchain/index.d.ts +2 -2
  113. package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +8 -4
  114. package/dist/types/offchain/positions/OffchainPositions.d.ts +11 -5
  115. package/dist/types/preview/preview/CreditAccountState.d.ts +6 -0
  116. package/dist/types/preview/preview/buildDelayedPreview.d.ts +5 -1
  117. package/dist/types/preview/preview/types.d.ts +4 -2
  118. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -7
  119. package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +3 -12
  120. package/dist/types/sdk/accounts/credit-account-compressor/index.d.ts +2 -2
  121. package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +1 -19
  122. package/dist/types/sdk/accounts/index.d.ts +2 -2
  123. package/dist/types/sdk/accounts/intents/testing/sdk-mock.d.ts +6 -0
  124. package/dist/types/sdk/accounts/intents/utils/adjust-state-to-snapshot.d.ts +13 -0
  125. package/dist/types/sdk/accounts/intents/utils/index.d.ts +2 -1
  126. package/dist/types/sdk/accounts/types.d.ts +1 -12
  127. package/dist/types/sdk/index.d.ts +8 -3
  128. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +4 -0
  129. package/dist/types/sdk/market/oracle/types.d.ts +8 -0
  130. package/dist/types/sdk/positions/PositionsService.d.ts +31 -2
  131. package/dist/types/sdk/positions/calcBorrowRate.d.ts +40 -0
  132. package/dist/types/sdk/positions/calcHealthFactor.d.ts +45 -0
  133. package/dist/types/sdk/positions/calcLiquidationPrice.d.ts +12 -0
  134. package/dist/types/sdk/positions/calcLiquidationPriceForTarget.d.ts +43 -0
  135. package/dist/types/sdk/positions/calcTimeToLiquidationMs.d.ts +15 -0
  136. package/dist/types/sdk/positions/index.d.ts +7 -2
  137. package/dist/types/sdk/positions/types.d.ts +58 -1
  138. package/package.json +1 -1
  139. package/dist/cjs/model/history.js +0 -53
  140. package/dist/cjs/model/history.schema.js +0 -128
  141. package/dist/cjs/new-sdk/utils/history.js +0 -1
  142. package/dist/esm/model/history.js +0 -49
  143. package/dist/esm/model/history.schema.js +0 -116
  144. package/dist/esm/new-sdk/utils/history.js +0 -1
  145. package/dist/types/model/history.d.ts +0 -153
  146. package/dist/types/model/history.schema.d.ts +0 -95
  147. package/dist/types/new-sdk/utils/history.d.ts +0 -18
@@ -5,6 +5,8 @@ const require_common_utils_utils_creditAccount_calc_quota_borrow_rate = require(
5
5
  /**
6
6
  * Under the hood sums up rates for all given quotas and then multiplies them by 1+feeInterest,
7
7
  * but it is expected that the ONLY quota will be passed
8
+ *
9
+ * @deprecated Use `calcBorrowRate` from `sdk/positions` instead.
8
10
  */
9
11
  function getSingleQuotaBorrowRate(props) {
10
12
  const qr = require_common_utils_utils_creditAccount_calc_quota_borrow_rate.calcQuotaBorrowRate(props);
@@ -1,10 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sdk_utils_bigint_math = require("../../../sdk/utils/bigint-math.js");
3
- const require_sdk_constants_math = require("../../../sdk/constants/math.js");
4
- require("../../../sdk/index.js");
5
- const require_common_utils_utils_price_math = require("../price-math.js");
2
+ const require_sdk_positions_calcHealthFactor = require("../../../sdk/positions/calcHealthFactor.js");
6
3
  //#region src/common-utils/utils/creditAccount/calc-health-factor.ts
7
- const MAX_UINT16 = 65535;
8
4
  /**
9
5
  * Computes account health factor in percentage-factor units.
10
6
  *
@@ -15,25 +11,31 @@ const MAX_UINT16 = 65535;
15
11
  * @param props Credit account balances, quotas, prices, thresholds, and debt context.
16
12
  * @returns Health factor as a number in `PERCENTAGE_FACTOR` scale,
17
13
  * or `65535` when debt is zero.
14
+ *
15
+ * @deprecated Use `calcHealthFactor` from `sdk/positions` instead; this
16
+ * wrapper only maps the legacy props onto an `AccountSnapshot`.
18
17
  */
19
18
  function calcHealthFactor({ assets, quotas, quotasInfo, liquidationThresholds, underlyingToken, debt, prices, tokensList }) {
20
- if (debt === 0n) return MAX_UINT16;
21
- const underlyingDecimals = tokensList[underlyingToken]?.decimals || 18;
22
- const underlyingPrice = prices[underlyingToken] || 0n;
23
- const assetMoney = assets.reduce((acc, { token: tokenAddress, balance: amount }) => {
24
- const tokenDecimals = tokensList[tokenAddress]?.decimals || 18;
25
- const lt = liquidationThresholds[tokenAddress] || 0n;
26
- const price = prices[tokenAddress] || 0n;
27
- const tokenLtMoney = require_common_utils_utils_price_math.PriceUtils.calcTotalPrice(price, amount, tokenDecimals) * lt / require_sdk_constants_math.PERCENTAGE_FACTOR;
28
- const { isActive = false } = quotasInfo?.[tokenAddress] || {};
29
- const quota = quotas[tokenAddress];
30
- const quotaBalance = isActive ? quota?.balance || 0n : 0n;
31
- const quotaMoney = require_common_utils_utils_price_math.PriceUtils.calcTotalPrice(underlyingPrice, quotaBalance, underlyingDecimals);
32
- return acc + (quota ? require_sdk_utils_bigint_math.BigIntMath.min(quotaMoney, tokenLtMoney) : tokenLtMoney);
33
- }, 0n);
34
- const borrowedMoney = require_common_utils_utils_price_math.PriceUtils.calcTotalPrice(underlyingPrice || require_sdk_constants_math.PRICE_DECIMALS, debt, underlyingDecimals);
35
- const hfInPercent = borrowedMoney > 0n ? assetMoney * require_sdk_constants_math.PERCENTAGE_FACTOR / borrowedMoney : 0n;
36
- return Number(hfInPercent);
19
+ const decimals = {};
20
+ for (const [token, meta] of Object.entries(tokensList)) decimals[token] = meta.decimals;
21
+ const lts = {};
22
+ for (const [token, lt] of Object.entries(liquidationThresholds)) lts[token] = Number(lt);
23
+ const activeQuotas = {};
24
+ for (const [token, info] of Object.entries(quotasInfo)) if (info?.isActive) activeQuotas[token] = true;
25
+ return require_sdk_positions_calcHealthFactor.calcHealthFactor({
26
+ snapshot: {
27
+ creditManager: underlyingToken,
28
+ assets,
29
+ quotas: Object.values(quotas),
30
+ totalDebt: debt,
31
+ totalValue: 0n
32
+ },
33
+ underlying: underlyingToken,
34
+ decimals,
35
+ prices,
36
+ liquidationThresholds: lts,
37
+ activeQuotas
38
+ });
37
39
  }
38
40
  //#endregion
39
41
  exports.calcHealthFactor = calcHealthFactor;
@@ -9,6 +9,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
9
9
  *
10
10
  * @param props Quota balances and per-token quota rates.
11
11
  * @returns Sum of `balance * rate` terms in percentage-factor scale.
12
+ *
13
+ * @deprecated Use `calcBorrowRate` from `sdk/positions` instead.
12
14
  */
13
15
  function calcQuotaBorrowRate({ quotas, quotaRates }) {
14
16
  return Object.values(quotas).reduce((acc, { token, balance }) => {
@@ -1,6 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sdk_constants_math = require("../../../sdk/constants/math.js");
3
- require("../../../sdk/index.js");
2
+ const require_sdk_positions_calcTimeToLiquidationMs = require("../../../sdk/positions/calcTimeToLiquidationMs.js");
4
3
  //#region src/common-utils/utils/creditAccount/get-time-to-liquidation.ts
5
4
  /**
6
5
  * Estimates time remaining until health factor reaches liquidation level.
@@ -12,10 +11,12 @@ require("../../../sdk/index.js");
12
11
  * @param props Current health factor and `totalBorrowRate * debt` term.
13
12
  * @returns Milliseconds to liquidation as `bigint`, or `null` when already at/under
14
13
  * liquidation threshold or when borrow-rate exposure is zero.
14
+ *
15
+ * @deprecated Use `calcTimeToLiquidationMs` from `sdk/positions` instead;
16
+ * this wrapper only forwards to the new implementation.
15
17
  */
16
18
  function getTimeToLiquidation({ healthFactor, totalBorrowRate_debt }) {
17
- if (healthFactor <= 10000n || totalBorrowRate_debt === 0n) return null;
18
- return (BigInt(healthFactor) - require_sdk_constants_math.PERCENTAGE_FACTOR) * (BigInt(require_sdk_constants_math.SECONDS_PER_YEAR) * require_sdk_constants_math.PERCENTAGE_FACTOR * require_sdk_constants_math.PERCENTAGE_DECIMALS / totalBorrowRate_debt) * 1000n / require_sdk_constants_math.PERCENTAGE_FACTOR;
19
+ return require_sdk_positions_calcTimeToLiquidationMs.calcTimeToLiquidationMs(healthFactor, totalBorrowRate_debt);
19
20
  }
20
21
  //#endregion
21
22
  exports.getTimeToLiquidation = getTimeToLiquidation;
@@ -1,6 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sdk_constants_math = require("../../../sdk/constants/math.js");
3
- require("../../../sdk/index.js");
2
+ const require_sdk_positions_calcLiquidationPriceForTarget = require("../../../sdk/positions/calcLiquidationPriceForTarget.js");
4
3
  //#region src/common-utils/utils/creditAccount/liquidation-price.ts
5
4
  /**
6
5
  * Calculates target token liquidation price for a credit account.
@@ -13,17 +12,28 @@ require("../../../sdk/index.js");
13
12
  * @param props Debt context, assets, thresholds, and token metadata.
14
13
  * @returns Target token price in `PRICE_DECIMALS` precision that corresponds
15
14
  * to liquidation boundary; returns `0n` when target balance or LT is non-positive.
15
+ *
16
+ * @deprecated Use `calcLiquidationPriceForTarget` from `sdk/positions`
17
+ * instead; this wrapper only maps the legacy props onto an `AccountSnapshot`.
16
18
  */
17
19
  function liquidationPrice({ liquidationThresholds, debt, underlyingToken, targetToken, assets, tokensList }) {
18
- const underlyingDecimals = tokensList[underlyingToken]?.decimals || 18;
19
- const { balance: underlyingBalance = 0n } = assets[underlyingToken] || {};
20
- const effectiveDebt = (debt - underlyingBalance * (liquidationThresholds[underlyingToken] || 0n) / require_sdk_constants_math.PERCENTAGE_FACTOR) * require_sdk_constants_math.WAD / 10n ** BigInt(underlyingDecimals);
21
- const targetDecimals = tokensList[targetToken]?.decimals || 18;
22
- const { balance: targetBalance = 0n } = assets[targetToken] || {};
23
- const effectiveTargetBalance = targetBalance * require_sdk_constants_math.WAD / 10n ** BigInt(targetDecimals);
24
- const lpLT = liquidationThresholds[targetToken] || 0n;
25
- if (targetBalance <= 0n || lpLT <= 0n) return 0n;
26
- return effectiveDebt * require_sdk_constants_math.PRICE_DECIMALS * require_sdk_constants_math.PERCENTAGE_FACTOR / (effectiveTargetBalance * lpLT);
20
+ const decimals = {};
21
+ for (const [token, meta] of Object.entries(tokensList)) decimals[token] = meta.decimals;
22
+ const lts = {};
23
+ for (const [token, lt] of Object.entries(liquidationThresholds)) lts[token] = Number(lt);
24
+ return require_sdk_positions_calcLiquidationPriceForTarget.calcLiquidationPriceForTarget({
25
+ snapshot: {
26
+ creditManager: underlyingToken,
27
+ assets: Object.values(assets),
28
+ quotas: [],
29
+ totalDebt: debt,
30
+ totalValue: 0n
31
+ },
32
+ targetToken,
33
+ underlying: underlyingToken,
34
+ decimals,
35
+ liquidationThresholds: lts
36
+ });
27
37
  }
28
38
  //#endregion
29
39
  exports.liquidationPrice = liquidationPrice;
@@ -0,0 +1,147 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/model/charts.ts
3
+ /**
4
+ * Historical charts of an opportunity or a position.
5
+ *
6
+ * Charts are backend-only by construction: the chain serves the present, and
7
+ * reconstructing a series from it would mean archive-node reads per point.
8
+ *
9
+ * A chart is read as a {@link ChartBundle}: one shared x-axis plus one
10
+ * {@link ChartSeries} per metric, each holding values only. Alignment is
11
+ * therefore structural — series `i` and series `j` describe the same instant at
12
+ * the same index — rather than a property the backend promises and every
13
+ * consumer re-checks.
14
+ **/
15
+ /**
16
+ * Time window a chart covers, ending at the present.
17
+ *
18
+ * `"max"` is the full history the backend retains for the subject.
19
+ **/
20
+ const CHART_RANGES = [
21
+ "1d",
22
+ "1w",
23
+ "1m",
24
+ "1y",
25
+ "max"
26
+ ];
27
+ /**
28
+ * Every metric a pool opportunity can chart.
29
+ **/
30
+ const POOL_OPPORTUNITY_CHART_METRICS = [
31
+ "depositApy",
32
+ "borrowApy",
33
+ "dieselRate",
34
+ "supplied",
35
+ "borrowed",
36
+ "availableLiquidity"
37
+ ];
38
+ /**
39
+ * Every metric a strategy opportunity can chart.
40
+ *
41
+ * `collateralPrice` is the collateral/underlying series a liquidation-price
42
+ * chart draws; the two USD series are the same prices quoted in dollars.
43
+ **/
44
+ const STRATEGY_OPPORTUNITY_CHART_METRICS = [
45
+ "netApy",
46
+ "borrowApy",
47
+ "collateralApy",
48
+ "tvl",
49
+ "collateralPrice",
50
+ "collateralUsdPrice",
51
+ "underlyingUsdPrice"
52
+ ];
53
+ /**
54
+ * Every metric a pool position can chart.
55
+ *
56
+ * Nothing to do with {@link POOL_OPPORTUNITY_CHART_METRICS}: an opportunity charts what the
57
+ * pool did, a position charts what one wallet's deposit did in it. `mwr` and
58
+ * `twr` are cumulative returns since the position opened — money-weighted, so
59
+ * sensitive to when deposits and withdrawals landed, and time-weighted, which
60
+ * strips that timing out. Both are anchored at inception, so a narrow `range`
61
+ * only zooms the visible slice and its first point is rarely zero.
62
+ **/
63
+ const POOL_POSITION_CHART_METRICS = [
64
+ "value",
65
+ "apy",
66
+ "pnl",
67
+ "mwr",
68
+ "twr",
69
+ "underlyingPrice"
70
+ ];
71
+ /**
72
+ * Every metric a strategy position can chart.
73
+ *
74
+ * `twrApy` annualizes `twr` over the position's whole life; the two trailing
75
+ * APYs annualize it over a fixed window instead, so they track the current pace
76
+ * rather than the lifetime rate and are comparable across positions of
77
+ * different ages.
78
+ **/
79
+ const STRATEGY_POSITION_CHART_METRICS = [
80
+ "totalValueUsd",
81
+ "totalValueUnderlying",
82
+ "debt",
83
+ "healthFactor",
84
+ "leverage",
85
+ "borrowApy",
86
+ "underlyingPrice",
87
+ "pnl",
88
+ "mwr",
89
+ "twr",
90
+ "twrApy",
91
+ "trailingApy7d",
92
+ "trailingApy30d"
93
+ ];
94
+ /**
95
+ * Unit of every metric, the one place either side decides it.
96
+ *
97
+ * A metric added to a union above fails to compile here until its unit is
98
+ * named, and the wire schema rejects a series whose `unit` disagrees with this
99
+ * table, so the backend cannot drift from it silently.
100
+ **/
101
+ const CHART_METRIC_UNITS = {
102
+ depositApy: "bps",
103
+ borrowApy: "bps",
104
+ netApy: "bps",
105
+ collateralApy: "bps",
106
+ supplied: "token",
107
+ borrowed: "token",
108
+ availableLiquidity: "token",
109
+ tvl: "token",
110
+ dieselRate: "ratio",
111
+ collateralPrice: "ratio",
112
+ collateralUsdPrice: "usd",
113
+ underlyingUsdPrice: "usd",
114
+ value: "token",
115
+ apy: "bps",
116
+ pnl: "token",
117
+ mwr: "bps",
118
+ twr: "bps",
119
+ underlyingPrice: "usd",
120
+ totalValueUsd: "usd",
121
+ totalValueUnderlying: "token",
122
+ debt: "token",
123
+ healthFactor: "bps",
124
+ leverage: "scalar",
125
+ twrApy: "bps",
126
+ trailingApy7d: "bps",
127
+ trailingApy30d: "bps"
128
+ };
129
+ /**
130
+ * Reason a series could not be produced at all, which is not the same as a
131
+ * series that has no points in the window.
132
+ **/
133
+ const CHART_UNAVAILABLE_CODES = [
134
+ "unknown_subject",
135
+ "unsupported_metric",
136
+ "no_price_feed",
137
+ "not_indexed",
138
+ "internal"
139
+ ];
140
+ //#endregion
141
+ exports.CHART_METRIC_UNITS = CHART_METRIC_UNITS;
142
+ exports.CHART_RANGES = CHART_RANGES;
143
+ exports.CHART_UNAVAILABLE_CODES = CHART_UNAVAILABLE_CODES;
144
+ exports.POOL_OPPORTUNITY_CHART_METRICS = POOL_OPPORTUNITY_CHART_METRICS;
145
+ exports.POOL_POSITION_CHART_METRICS = POOL_POSITION_CHART_METRICS;
146
+ exports.STRATEGY_OPPORTUNITY_CHART_METRICS = STRATEGY_OPPORTUNITY_CHART_METRICS;
147
+ exports.STRATEGY_POSITION_CHART_METRICS = STRATEGY_POSITION_CHART_METRICS;
@@ -0,0 +1,240 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_model_charts = require("./charts.js");
3
+ const require_model_primitives_schema = require("./primitives.schema.js");
4
+ let zod_v4 = require("zod/v4");
5
+ //#region src/model/charts.schema.ts
6
+ /**
7
+ * Runtime schemas for {@link ./charts.js}, see the note in
8
+ * `primitives.schema.ts` on why they are written by hand.
9
+ *
10
+ * Metric schemas are shared with the backend, while
11
+ * {@link chartBundleSchemaFor} builds the response schema for one concrete
12
+ * request. Component schemas remain available for consumers that validate
13
+ * model fragments.
14
+ **/
15
+ /**
16
+ * {@link ChartRange}
17
+ **/
18
+ const chartRangeSchema = zod_v4.z.enum(require_model_charts.CHART_RANGES);
19
+ /**
20
+ * {@link PoolOpportunityChartMetric}
21
+ **/
22
+ const poolOpportunityChartMetricSchema = zod_v4.z.enum(require_model_charts.POOL_OPPORTUNITY_CHART_METRICS);
23
+ /**
24
+ * {@link StrategyOpportunityChartMetric}
25
+ **/
26
+ const strategyOpportunityChartMetricSchema = zod_v4.z.enum(require_model_charts.STRATEGY_OPPORTUNITY_CHART_METRICS);
27
+ /**
28
+ * {@link PoolPositionChartMetric}
29
+ **/
30
+ const poolPositionChartMetricSchema = zod_v4.z.enum(require_model_charts.POOL_POSITION_CHART_METRICS);
31
+ /**
32
+ * {@link StrategyPositionChartMetric}
33
+ **/
34
+ const strategyPositionChartMetricSchema = zod_v4.z.enum(require_model_charts.STRATEGY_POSITION_CHART_METRICS);
35
+ /**
36
+ * {@link ChartMetric}, every metric either kind of subject can chart.
37
+ **/
38
+ const chartMetricSchema = zod_v4.z.union([
39
+ poolOpportunityChartMetricSchema,
40
+ strategyOpportunityChartMetricSchema,
41
+ poolPositionChartMetricSchema,
42
+ strategyPositionChartMetricSchema
43
+ ]);
44
+ /**
45
+ * {@link ChartQuery}
46
+ **/
47
+ const chartQuerySchema = zod_v4.z.object({
48
+ metrics: zod_v4.z.array(chartMetricSchema).readonly().refine((metrics) => metrics.length > 0, { error: "a chart read needs at least one metric" }).refine((metrics) => new Set(metrics).size === metrics.length, { error: "a chart read needs distinct metrics" }),
49
+ range: chartRangeSchema
50
+ });
51
+ /**
52
+ * {@link ChartQuery} as a URL can carry it: the metrics comma-joined, since
53
+ * repeated `?metrics=` entries would order differently between clients and give
54
+ * one request two cache keys.
55
+ **/
56
+ const chartQueryParamsSchema = zod_v4.z.object({
57
+ metrics: zod_v4.z.string().regex(/^\w+(,\w+)*$/),
58
+ range: chartRangeSchema
59
+ });
60
+ /**
61
+ * Codec for {@link ChartQuery} to encode/decode to/from url query parameters.
62
+ *
63
+ * The one place the wire form of a chart request is decided. The SDK encodes
64
+ * with it, the backend decodes with it, and the checks that a read names at
65
+ * least one metric and names none of them twice ride along in both directions —
66
+ * so a bad request fails before it is issued, not after a round trip.
67
+ **/
68
+ const chartQueryCodec = zod_v4.z.codec(chartQueryParamsSchema, chartQuerySchema, {
69
+ decode: (params) => ({
70
+ metrics: params.metrics.split(","),
71
+ range: params.range
72
+ }),
73
+ encode: (query) => ({
74
+ metrics: query.metrics.join(","),
75
+ range: query.range
76
+ })
77
+ });
78
+ /**
79
+ * {@link ChartDenomination}
80
+ **/
81
+ const chartDenominationSchema = zod_v4.z.discriminatedUnion("unit", [
82
+ zod_v4.z.object({ unit: zod_v4.z.literal("bps") }),
83
+ zod_v4.z.object({ unit: zod_v4.z.literal("usd") }),
84
+ zod_v4.z.object({ unit: zod_v4.z.literal("scalar") }),
85
+ zod_v4.z.object({
86
+ unit: zod_v4.z.literal("token"),
87
+ base: require_model_primitives_schema.tokenSchema
88
+ }),
89
+ zod_v4.z.object({
90
+ unit: zod_v4.z.literal("ratio"),
91
+ base: require_model_primitives_schema.tokenSchema,
92
+ quote: require_model_primitives_schema.tokenSchema
93
+ })
94
+ ]);
95
+ /**
96
+ * {@link ChartValue}. `null` is a gap, never a zero.
97
+ **/
98
+ const chartValueSchema = zod_v4.z.number().nullable();
99
+ /**
100
+ * {@link ChartSeries}
101
+ **/
102
+ const chartSeriesSchema = zod_v4.z.union([zod_v4.z.intersection(zod_v4.z.object({
103
+ status: zod_v4.z.literal("ok"),
104
+ values: zod_v4.z.array(chartValueSchema)
105
+ }), chartDenominationSchema), zod_v4.z.object({
106
+ status: zod_v4.z.literal("unavailable"),
107
+ reason: zod_v4.z.object({
108
+ code: zod_v4.z.enum(require_model_charts.CHART_UNAVAILABLE_CODES),
109
+ message: zod_v4.z.string().optional()
110
+ })
111
+ })]);
112
+ /**
113
+ * {@link ChartWindow}
114
+ **/
115
+ const chartWindowSchema = zod_v4.z.object({
116
+ range: chartRangeSchema,
117
+ from: require_model_primitives_schema.timestampSchema,
118
+ to: require_model_primitives_schema.timestampSchema
119
+ });
120
+ const gridSamplingSchema = zod_v4.z.object({
121
+ kind: zod_v4.z.literal("grid"),
122
+ intervalSeconds: zod_v4.z.number().int().positive()
123
+ });
124
+ /**
125
+ * A bundle whose series are keyed by `keys`.
126
+ *
127
+ * `z.record` over a literal union is what enforces the metric set: a key that
128
+ * was not asked for is rejected, and one that was but is missing fails as an
129
+ * absent value. Exactly-once therefore needs no counting — an object cannot
130
+ * hold the same key twice.
131
+ **/
132
+ function chartBundleSchemaWith(keys, expectedRange) {
133
+ return zod_v4.z.object({
134
+ window: chartWindowSchema,
135
+ sampling: gridSamplingSchema,
136
+ timestamps: zod_v4.z.array(require_model_primitives_schema.timestampSchema),
137
+ series: zod_v4.z.record(keys, chartSeriesSchema)
138
+ }).superRefine((bundle, ctx) => checkChartBundle(bundle, ctx, expectedRange));
139
+ }
140
+ /**
141
+ * The invariants a bundle upholds beyond its shape, checked on every read so a
142
+ * backend that breaks one is rejected rather than plotted:
143
+ *
144
+ * - each available series holds exactly one value per timestamp, which is what
145
+ * makes two series of a bundle comparable at an index;
146
+ * - a series' unit is the one {@link CHART_METRIC_UNITS} gives the metric it is
147
+ * keyed by, so a consumer can format from either without them disagreeing;
148
+ * - the window's bounds are the axis' own, so a chart drawn from `window` and a
149
+ * chart drawn from `timestamps` cover the same span;
150
+ * - timestamps lie on the declared grid and are exactly one interval apart;
151
+ * - when validating a read, the response names the range that was requested.
152
+ **/
153
+ function checkChartBundle(bundle, ctx, expectedRange) {
154
+ const { sampling, timestamps, window, series } = bundle;
155
+ const entries = Object.entries(series);
156
+ for (const [metric, chart] of entries) {
157
+ if (chart.status !== "ok") continue;
158
+ if (chart.values.length !== timestamps.length) ctx.addIssue({
159
+ code: "custom",
160
+ path: [
161
+ "series",
162
+ metric,
163
+ "values"
164
+ ],
165
+ message: `series "${metric}" holds ${chart.values.length} values for ${timestamps.length} timestamps`
166
+ });
167
+ if (require_model_charts.CHART_METRIC_UNITS[metric] !== chart.unit) ctx.addIssue({
168
+ code: "custom",
169
+ path: [
170
+ "series",
171
+ metric,
172
+ "unit"
173
+ ],
174
+ message: `metric "${metric}" is ${require_model_charts.CHART_METRIC_UNITS[metric]}, not ${chart.unit}`
175
+ });
176
+ }
177
+ const first = timestamps.at(0);
178
+ const last = timestamps.at(-1);
179
+ if (first !== void 0 && first !== window.from) ctx.addIssue({
180
+ code: "custom",
181
+ path: ["window", "from"],
182
+ message: `window starts at ${window.from} but the axis starts at ${first}`
183
+ });
184
+ if (last !== void 0 && last !== window.to) ctx.addIssue({
185
+ code: "custom",
186
+ path: ["window", "to"],
187
+ message: `window ends at ${window.to} but the axis ends at ${last}`
188
+ });
189
+ if (expectedRange !== void 0 && window.range !== expectedRange) ctx.addIssue({
190
+ code: "custom",
191
+ path: ["window", "range"],
192
+ message: `requested range ${expectedRange}, received ${window.range}`
193
+ });
194
+ for (let i = 0; i < timestamps.length; i += 1) {
195
+ const timestamp = timestamps[i];
196
+ if (timestamp % sampling.intervalSeconds !== 0) ctx.addIssue({
197
+ code: "custom",
198
+ path: ["timestamps", i],
199
+ message: `timestamp ${timestamp} is not on the ${sampling.intervalSeconds}-second grid`
200
+ });
201
+ const previous = timestamps[i - 1];
202
+ if (previous !== void 0 && timestamp - previous !== sampling.intervalSeconds) ctx.addIssue({
203
+ code: "custom",
204
+ path: ["timestamps", i],
205
+ message: `timestamps are not ${sampling.intervalSeconds} seconds apart`
206
+ });
207
+ }
208
+ }
209
+ /**
210
+ * The schema one chart read is decoded with: a {@link ChartBundle} keyed by the
211
+ * requested distinct metrics, all of them and nothing else, for the requested
212
+ * range.
213
+ *
214
+ * Pinning the metrics is what upholds the `ChartBundle<Metrics>` a caller gets
215
+ * back — a response that answers a different question fails validation rather
216
+ * than being cast into the requested shape. The declared return type is the one
217
+ * the key schema actually enforces, which the compiler cannot see through a
218
+ * schema built from a runtime list.
219
+ **/
220
+ function chartBundleSchemaFor(metrics, range) {
221
+ if (metrics.length === 0) throw new RangeError("a chart read needs at least one metric");
222
+ if (new Set(metrics).size !== metrics.length) throw new RangeError("a chart read needs distinct metrics");
223
+ const literals = metrics.map((metric) => zod_v4.z.literal(metric));
224
+ return chartBundleSchemaWith(zod_v4.z.union(literals), range);
225
+ }
226
+ //#endregion
227
+ exports.chartBundleSchemaFor = chartBundleSchemaFor;
228
+ exports.chartDenominationSchema = chartDenominationSchema;
229
+ exports.chartMetricSchema = chartMetricSchema;
230
+ exports.chartQueryCodec = chartQueryCodec;
231
+ exports.chartQueryParamsSchema = chartQueryParamsSchema;
232
+ exports.chartQuerySchema = chartQuerySchema;
233
+ exports.chartRangeSchema = chartRangeSchema;
234
+ exports.chartSeriesSchema = chartSeriesSchema;
235
+ exports.chartValueSchema = chartValueSchema;
236
+ exports.chartWindowSchema = chartWindowSchema;
237
+ exports.poolOpportunityChartMetricSchema = poolOpportunityChartMetricSchema;
238
+ exports.poolPositionChartMetricSchema = poolPositionChartMetricSchema;
239
+ exports.strategyOpportunityChartMetricSchema = strategyOpportunityChartMetricSchema;
240
+ exports.strategyPositionChartMetricSchema = strategyPositionChartMetricSchema;
@@ -1,34 +1,48 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_model_charts = require("./charts.js");
3
+ const require_model_primitives_schema = require("./primitives.schema.js");
4
+ const require_model_charts_schema = require("./charts.schema.js");
2
5
  require("./curators.js");
3
6
  const require_model_curators_schema = require("./curators.schema.js");
4
7
  const require_model_filters = require("./filters.js");
5
8
  const require_model_filters_schema = require("./filters.schema.js");
6
- const require_model_history = require("./history.js");
7
- const require_model_primitives_schema = require("./primitives.schema.js");
8
- const require_model_opportunities_schema = require("./opportunities.schema.js");
9
- const require_model_liquidations_schema = require("./liquidations.schema.js");
10
- const require_model_positions_schema = require("./positions.schema.js");
11
- const require_model_history_schema = require("./history.schema.js");
12
9
  const require_model_liquidations = require("./liquidations.js");
10
+ const require_model_liquidations_schema = require("./liquidations.schema.js");
13
11
  const require_model_opportunities = require("./opportunities.js");
12
+ const require_model_opportunities_schema = require("./opportunities.schema.js");
14
13
  const require_model_positions = require("./positions.js");
14
+ const require_model_positions_schema = require("./positions.schema.js");
15
15
  require("./primitives.js");
16
16
  require("./response.js");
17
17
  const require_model_response_schema = require("./response.schema.js");
18
+ exports.CHART_METRIC_UNITS = require_model_charts.CHART_METRIC_UNITS;
19
+ exports.CHART_RANGES = require_model_charts.CHART_RANGES;
20
+ exports.CHART_UNAVAILABLE_CODES = require_model_charts.CHART_UNAVAILABLE_CODES;
18
21
  exports.FILTER_ALL = require_model_filters.FILTER_ALL;
19
- exports.POOL_HISTORY_METRICS = require_model_history.POOL_HISTORY_METRICS;
20
- exports.POOL_POSITION_HISTORY_METRICS = require_model_history.POOL_POSITION_HISTORY_METRICS;
21
- exports.STRATEGY_HISTORY_METRICS = require_model_history.STRATEGY_HISTORY_METRICS;
22
- exports.STRATEGY_POSITION_HISTORY_METRICS = require_model_history.STRATEGY_POSITION_HISTORY_METRICS;
22
+ exports.POOL_OPPORTUNITY_CHART_METRICS = require_model_charts.POOL_OPPORTUNITY_CHART_METRICS;
23
+ exports.POOL_POSITION_CHART_METRICS = require_model_charts.POOL_POSITION_CHART_METRICS;
24
+ exports.STRATEGY_OPPORTUNITY_CHART_METRICS = require_model_charts.STRATEGY_OPPORTUNITY_CHART_METRICS;
25
+ exports.STRATEGY_POSITION_CHART_METRICS = require_model_charts.STRATEGY_POSITION_CHART_METRICS;
23
26
  exports.amountSchema = require_model_primitives_schema.amountSchema;
24
27
  exports.apyBreakdownSchema = require_model_opportunities_schema.apyBreakdownSchema;
25
28
  exports.assetTypeSchema = require_model_primitives_schema.assetTypeSchema;
26
29
  exports.booleanParamSchema = require_model_filters_schema.booleanParamSchema;
30
+ exports.borrowRateBreakdownSchema = require_model_positions_schema.borrowRateBreakdownSchema;
27
31
  exports.bpsSchema = require_model_primitives_schema.bpsSchema;
28
32
  exports.chainFailedSchema = require_model_response_schema.chainFailedSchema;
29
33
  exports.chainIdSchema = require_model_primitives_schema.chainIdSchema;
30
34
  exports.chainMetadataSchema = require_model_response_schema.chainMetadataSchema;
31
35
  exports.chainSucceededSchema = require_model_response_schema.chainSucceededSchema;
36
+ exports.chartBundleSchemaFor = require_model_charts_schema.chartBundleSchemaFor;
37
+ exports.chartDenominationSchema = require_model_charts_schema.chartDenominationSchema;
38
+ exports.chartMetricSchema = require_model_charts_schema.chartMetricSchema;
39
+ exports.chartQueryCodec = require_model_charts_schema.chartQueryCodec;
40
+ exports.chartQueryParamsSchema = require_model_charts_schema.chartQueryParamsSchema;
41
+ exports.chartQuerySchema = require_model_charts_schema.chartQuerySchema;
42
+ exports.chartRangeSchema = require_model_charts_schema.chartRangeSchema;
43
+ exports.chartSeriesSchema = require_model_charts_schema.chartSeriesSchema;
44
+ exports.chartValueSchema = require_model_charts_schema.chartValueSchema;
45
+ exports.chartWindowSchema = require_model_charts_schema.chartWindowSchema;
32
46
  exports.curatorNameSchema = require_model_curators_schema.curatorNameSchema;
33
47
  exports.curatorSchema = require_model_curators_schema.curatorSchema;
34
48
  exports.dataSourceSchema = require_model_response_schema.dataSourceSchema;
@@ -36,11 +50,6 @@ exports.delayedReceivedAssetSchema = require_model_liquidations_schema.delayedRe
36
50
  exports.encodeFlag = require_model_filters_schema.encodeFlag;
37
51
  exports.filterAllSchema = require_model_filters_schema.filterAllSchema;
38
52
  exports.filterable = require_model_filters_schema.filterable;
39
- exports.historyChartMetadataSchema = require_model_history_schema.historyChartMetadataSchema;
40
- exports.historyMetricSchema = require_model_history_schema.historyMetricSchema;
41
- exports.historyPointSchema = require_model_history_schema.historyPointSchema;
42
- exports.historyRangeSchema = require_model_history_schema.historyRangeSchema;
43
- exports.historySeriesSchema = require_model_history_schema.historySeriesSchema;
44
53
  exports.instantReceivedAssetSchema = require_model_liquidations_schema.instantReceivedAssetSchema;
45
54
  exports.isFilterSet = require_model_filters.isFilterSet;
46
55
  exports.leverageSchema = require_model_primitives_schema.leverageSchema;
@@ -58,7 +67,6 @@ exports.opportunityDetailSchema = require_model_opportunities_schema.opportunity
58
67
  exports.opportunityFilterQueryParamsSchema = require_model_opportunities_schema.opportunityFilterQueryParamsSchema;
59
68
  exports.opportunityFilterQuerySchema = require_model_opportunities_schema.opportunityFilterQuerySchema;
60
69
  exports.opportunityFilterSchema = require_model_opportunities_schema.opportunityFilterSchema;
61
- exports.opportunityHistoryQuerySchema = require_model_history_schema.opportunityHistoryQuerySchema;
62
70
  exports.opportunityId = require_model_opportunities.opportunityId;
63
71
  exports.opportunityKeySchema = require_model_opportunities_schema.opportunityKeySchema;
64
72
  exports.opportunityKindSchema = require_model_opportunities_schema.opportunityKindSchema;
@@ -68,12 +76,12 @@ exports.pointRewardsSchema = require_model_opportunities_schema.pointRewardsSche
68
76
  exports.pointsProgramPnLSchema = require_model_positions_schema.pointsProgramPnLSchema;
69
77
  exports.pointsProgramSchema = require_model_opportunities_schema.pointsProgramSchema;
70
78
  exports.pointsRewardsPnLSchema = require_model_positions_schema.pointsRewardsPnLSchema;
71
- exports.poolHistoryMetricSchema = require_model_history_schema.poolHistoryMetricSchema;
79
+ exports.poolOpportunityChartMetricSchema = require_model_charts_schema.poolOpportunityChartMetricSchema;
72
80
  exports.poolOpportunityDetailSchema = require_model_opportunities_schema.poolOpportunityDetailSchema;
73
81
  exports.poolOpportunityId = require_model_opportunities.poolOpportunityId;
74
82
  exports.poolOpportunityKeySchema = require_model_opportunities_schema.poolOpportunityKeySchema;
75
83
  exports.poolOpportunitySchema = require_model_opportunities_schema.poolOpportunitySchema;
76
- exports.poolPositionHistoryMetricSchema = require_model_history_schema.poolPositionHistoryMetricSchema;
84
+ exports.poolPositionChartMetricSchema = require_model_charts_schema.poolPositionChartMetricSchema;
77
85
  exports.poolPositionId = require_model_positions.poolPositionId;
78
86
  exports.poolPositionKeySchema = require_model_positions_schema.poolPositionKeySchema;
79
87
  exports.poolPositionSchema = require_model_positions_schema.poolPositionSchema;
@@ -81,8 +89,6 @@ exports.positionCollateralSchema = require_model_positions_schema.positionCollat
81
89
  exports.positionFilterQueryParamsSchema = require_model_positions_schema.positionFilterQueryParamsSchema;
82
90
  exports.positionFilterQuerySchema = require_model_positions_schema.positionFilterQuerySchema;
83
91
  exports.positionFilterSchema = require_model_positions_schema.positionFilterSchema;
84
- exports.positionHistoryMetricSchema = require_model_history_schema.positionHistoryMetricSchema;
85
- exports.positionHistoryQuerySchema = require_model_history_schema.positionHistoryQuerySchema;
86
92
  exports.positionId = require_model_positions.positionId;
87
93
  exports.positionKeySchema = require_model_positions_schema.positionKeySchema;
88
94
  exports.positionKindSchema = require_model_positions_schema.positionKindSchema;
@@ -97,12 +103,12 @@ exports.responseMetadataSchema = require_model_response_schema.responseMetadataS
97
103
  exports.responseSchema = require_model_response_schema.responseSchema;
98
104
  exports.rewardsPnLSchema = require_model_positions_schema.rewardsPnLSchema;
99
105
  exports.rewardsSchema = require_model_opportunities_schema.rewardsSchema;
100
- exports.strategyHistoryMetricSchema = require_model_history_schema.strategyHistoryMetricSchema;
106
+ exports.strategyOpportunityChartMetricSchema = require_model_charts_schema.strategyOpportunityChartMetricSchema;
101
107
  exports.strategyOpportunityDetailSchema = require_model_opportunities_schema.strategyOpportunityDetailSchema;
102
108
  exports.strategyOpportunityId = require_model_opportunities.strategyOpportunityId;
103
109
  exports.strategyOpportunityKeySchema = require_model_opportunities_schema.strategyOpportunityKeySchema;
104
110
  exports.strategyOpportunitySchema = require_model_opportunities_schema.strategyOpportunitySchema;
105
- exports.strategyPositionHistoryMetricSchema = require_model_history_schema.strategyPositionHistoryMetricSchema;
111
+ exports.strategyPositionChartMetricSchema = require_model_charts_schema.strategyPositionChartMetricSchema;
106
112
  exports.strategyPositionId = require_model_positions.strategyPositionId;
107
113
  exports.strategyPositionKeySchema = require_model_positions_schema.strategyPositionKeySchema;
108
114
  exports.strategyPositionSchema = require_model_positions_schema.strategyPositionSchema;