@reyaxyz/api-sdk 0.54.6 → 0.54.7
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/dist/clients/modules/depth-chart.simulation/index.js +3 -3
- package/dist/clients/modules/depth-chart.simulation/index.js.map +1 -1
- package/dist/clients/modules/depth-chart.simulation/types.js.map +1 -1
- package/dist/clients/types.js +1 -0
- package/dist/clients/types.js.map +1 -1
- package/dist/types/clients/modules/depth-chart.simulation/index.d.ts +2 -2
- package/dist/types/clients/modules/depth-chart.simulation/index.d.ts.map +1 -1
- package/dist/types/clients/modules/depth-chart.simulation/types.d.ts +5 -1
- package/dist/types/clients/modules/depth-chart.simulation/types.d.ts.map +1 -1
- package/dist/types/clients/types.d.ts +1 -0
- package/dist/types/clients/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/clients/modules/depth-chart.simulation/index.ts +6 -2
- package/src/clients/modules/depth-chart.simulation/types.ts +6 -1
- package/src/clients/types.ts +1 -0
|
@@ -76,13 +76,13 @@ var DepthChartSimulationClient = /** @class */ (function () {
|
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
};
|
|
79
|
-
DepthChartSimulationClient.prototype.
|
|
80
|
-
if (step === void 0) { step = 10; }
|
|
81
|
-
if (percentageChange === void 0) { percentageChange = 30; }
|
|
79
|
+
DepthChartSimulationClient.prototype.getDepthChart = function (params) {
|
|
82
80
|
// step is in notional
|
|
83
81
|
if (!this.loadedData) {
|
|
84
82
|
throw new Error('Data not loaded. Call arm() first.');
|
|
85
83
|
}
|
|
84
|
+
var step = params.step || 10;
|
|
85
|
+
var percentageChange = params.percentageChange || 30;
|
|
86
86
|
var leftResults = [];
|
|
87
87
|
var rightResults = [];
|
|
88
88
|
for (var delta = 0;; delta += step) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["clients/modules/depth-chart.simulation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;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S,EAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,sBAAS,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CACtE,CAAC;QAEF,IAAM,IAAI,GAAG,IAAA,sBAAS,EAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC;QAEnE,OAAO;YACL,KAAK,EAAE,YAAY,CAAC,QAAQ,EAAE;YAC9B,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE;YAC1B,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE;YAC9C,WAAW,EAAE,0BAA0B,CAAC,8BAA8B,CACpE,IAAI,CAAC,UAAU,CAAC,SAAS,EACzB,YAAY,CAAC,QAAQ,EAAE,CACxB;SACF,CAAC;IACJ,CAAC;IAEM,yDAA8B,GAArC,UACE,KAAa,EACb,cAAsB;QAEtB,iCAAiC;QACjC,IAAM,eAAe,GAAG,cAAc,GAAG,KAAK,CAAC;QAE/C,IAAM,kBAAkB,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QACrD,kCAAkC;QAClC,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC;IACtD,CAAC;IACH,iCAAC;AAAD,CAAC,AA9FD,IA8FC","sourcesContent":["import {\n GetDepthChartParams,\n GetDepthChartResult,\n DepthSimulationLoadDataParams,\n SimulateDepthEntity,\n} from './types';\n\nimport LpClient from '../lp';\nimport { DepthSimulationState } from '@reyaxyz/common';\nimport BigNumber from 'bignumber.js';\n\nexport default class DepthChartSimulationClient {\n private poolId: number | null = null;\n private marketId: number | null = null;\n private loadedData: DepthSimulationState | null = null;\n private lpClient: LpClient;\n constructor(lpClient: LpClient) {\n // Constructor added\n this.lpClient = lpClient;\n }\n\n // Method to asynchronously load data based on marketId and poolId\n async arm(params: DepthSimulationLoadDataParams): Promise<void> {\n this.poolId = params.poolId;\n this.marketId = params.marketId;\n\n this.loadedData = await this.fetchPoolData(this.poolId, this.marketId);\n }\n\n private async fetchPoolData(\n poolId: number,\n marketId: number,\n ): Promise<DepthSimulationState> {\n return this.lpClient.getLpPoolDepthChartSimulationData({\n poolId: poolId,\n marketId: marketId,\n });\n }\n\n getDepthChart(params: GetDepthChartParams): GetDepthChartResult {\n // step is in notional\n if (!this.loadedData) {\n throw new Error('Data not loaded. Call arm() first.');\n }\n const step = params.step || 10;\n const percentageChange = params.percentageChange || 30;\n\n const leftResults: SimulateDepthEntity[] = [];\n const rightResults: SimulateDepthEntity[] = [];\n for (let delta = 0; ; delta += step) {\n const result = this.calculate(delta);\n if (result.priceImpact >= percentageChange) break;\n leftResults.push(result);\n }\n\n for (let delta = 0; ; delta -= step) {\n const result = this.calculate(delta);\n if (result.priceImpact >= percentageChange) break;\n rightResults.push(result);\n }\n\n return {\n leftChart: leftResults.reverse(),\n rightChart: rightResults,\n };\n }\n\n private calculate(delta: number): SimulateDepthEntity {\n if (!this.loadedData) {\n throw new Error('Data not loaded. Call arm() first.');\n }\n\n const n0Delta = BigNumber(this.loadedData.netExposure).plus(delta);\n const maxExposure = n0Delta.gt(0)\n ? BigNumber(this.loadedData.maxLongExposure)\n : BigNumber(this.loadedData.maxShortExposure);\n\n const currentPrice = BigNumber(this.loadedData.spotPrice).times(\n BigNumber(1).minus(n0Delta.div(BigNumber(n0Delta).plus(maxExposure))),\n );\n\n const size = BigNumber(delta).div(this.loadedData.spotPrice).abs();\n\n return {\n price: currentPrice.toNumber(),\n totalSize: size.toNumber(),\n totalCost: size.times(currentPrice).toNumber(),\n priceImpact: DepthChartSimulationClient.calculatePriceChangePercentage(\n this.loadedData.spotPrice,\n currentPrice.toNumber(),\n ),\n };\n }\n\n static calculatePriceChangePercentage(\n price: number,\n estimatedPrice: number,\n ): number {\n // Calculate the price difference\n const priceDifference = estimatedPrice - price;\n\n const absPriceDifference = Math.abs(priceDifference);\n // Calculate the percentage change\n return (absPriceDifference / Math.abs(price)) * 100;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/depth-chart.simulation/types.ts"],"names":[],"mappings":"","sourcesContent":["import { LpPoolEntity, MarketEntity } from '@reyaxyz/common';\n\nexport type DepthSimulationLoadDataParams = {\n poolId: LpPoolEntity['id'];\n marketId: MarketEntity['id'];\n};\n\nexport type SimulateDepthEntity = {\n price: number;\n totalSize: number;\n totalCost: number;\n priceImpact: number;\n};\n\nexport type
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/modules/depth-chart.simulation/types.ts"],"names":[],"mappings":"","sourcesContent":["import { LpPoolEntity, MarketEntity } from '@reyaxyz/common';\n\nexport type DepthSimulationLoadDataParams = {\n poolId: LpPoolEntity['id'];\n marketId: MarketEntity['id'];\n};\n\nexport type SimulateDepthEntity = {\n price: number;\n totalSize: number;\n totalCost: number;\n priceImpact: number;\n};\n\nexport type GetDepthChartResult = {\n leftChart: SimulateDepthEntity[];\n rightChart: SimulateDepthEntity[];\n};\n\nexport type GetDepthChartParams = {\n step?: number;\n percentageChange?: number;\n};\n"]}
|
package/dist/clients/types.js
CHANGED
|
@@ -38,4 +38,5 @@ __exportStar(require("./modules/withdraw-MA.simulation/types"), exports);
|
|
|
38
38
|
__exportStar(require("./modules/transfer-margin-between-MAs.simulation/types"), exports);
|
|
39
39
|
__exportStar(require("./modules/transfer-MA-Pool.simulation/types"), exports);
|
|
40
40
|
__exportStar(require("./modules/funding-rate/types"), exports);
|
|
41
|
+
__exportStar(require("./modules/depth-chart.simulation/types"), exports);
|
|
41
42
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAAqD;AACrD,0CA2ByB;AAzBvB,2GAAA,iBAAiB,OAAA;AAYjB,qGAAA,WAAW,OAAA;AACX,2GAAA,iBAAiB,OAAA;AAGjB,8GAAA,oBAAoB,OAAA;AACpB,yHAAA,+BAA+B,OAAA;AAE/B,oIAAA,0CAA0C,OAAA;AAG1C,6HAAA,mCAAmC,OAAA;AAEnC,uHAAA,6BAA6B,OAAA;AAE/B,0DAAwC;AACxC,qDAAmC;AACnC,0DAAwC;AACxC,yDAAuC;AACvC,mEAAiD;AACjD,wDAAsC;AACtC,iFAA+D;AAC/D,4EAA0D;AAC1D,6EAA2D;AAC3D,yEAAuD;AACvD,yFAAuE;AACvE,8EAA4D;AAC5D,+DAA6C","sourcesContent":["// reexporting what we want to share with integrators\nexport {\n Candle,\n CandlesResolution,\n MarketEntity,\n LpTransactionHistoryEntity,\n TradingHistoryEntity,\n PositionHistoryEntity,\n PositionEntity,\n TransactionHistoryType,\n MarginAccountTransactionHistoryType,\n MarginAccountTransactionHistoryEntity,\n MarginAccountEntity,\n LpPositionEntity,\n LpPoolEntity,\n ReyaChainId,\n MoneyInOutChainId,\n GetLpPoolPerformanceChartDataResult,\n GetLpPoolBalanceChartDataResult,\n LpBalanceGranularity,\n MarginAccountBalanceGranularity,\n GetMarginAccountBalanceChartDataResult,\n MarginAccountCollateralsBalanceGranularity,\n GetMarginAccountCollateralsBalanceChartDataResult,\n GetAllMarginAccountsBalanceChartDataResult,\n AllMarginAccountsBalanceGranularity,\n GetFundingRateChartDataResult,\n FundingRateHistoryGranularity,\n} from '@reyaxyz/common';\nexport * from './modules/account/types';\nexport * from './modules/lp/types';\nexport * from './modules/markets/types';\nexport * from './modules/tokens/types';\nexport * from './modules/trade.simulation/types';\nexport * from './modules/owner/types';\nexport * from './modules/deposit-existing-MA.simulation/types';\nexport * from './modules/deposit-new-MA.simulation/types';\nexport * from './modules/edit-collateral.simulation/types';\nexport * from './modules/withdraw-MA.simulation/types';\nexport * from './modules/transfer-margin-between-MAs.simulation/types';\nexport * from './modules/transfer-MA-Pool.simulation/types';\nexport * from './modules/funding-rate/types';\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAAqD;AACrD,0CA2ByB;AAzBvB,2GAAA,iBAAiB,OAAA;AAYjB,qGAAA,WAAW,OAAA;AACX,2GAAA,iBAAiB,OAAA;AAGjB,8GAAA,oBAAoB,OAAA;AACpB,yHAAA,+BAA+B,OAAA;AAE/B,oIAAA,0CAA0C,OAAA;AAG1C,6HAAA,mCAAmC,OAAA;AAEnC,uHAAA,6BAA6B,OAAA;AAE/B,0DAAwC;AACxC,qDAAmC;AACnC,0DAAwC;AACxC,yDAAuC;AACvC,mEAAiD;AACjD,wDAAsC;AACtC,iFAA+D;AAC/D,4EAA0D;AAC1D,6EAA2D;AAC3D,yEAAuD;AACvD,yFAAuE;AACvE,8EAA4D;AAC5D,+DAA6C;AAC7C,yEAAuD","sourcesContent":["// reexporting what we want to share with integrators\nexport {\n Candle,\n CandlesResolution,\n MarketEntity,\n LpTransactionHistoryEntity,\n TradingHistoryEntity,\n PositionHistoryEntity,\n PositionEntity,\n TransactionHistoryType,\n MarginAccountTransactionHistoryType,\n MarginAccountTransactionHistoryEntity,\n MarginAccountEntity,\n LpPositionEntity,\n LpPoolEntity,\n ReyaChainId,\n MoneyInOutChainId,\n GetLpPoolPerformanceChartDataResult,\n GetLpPoolBalanceChartDataResult,\n LpBalanceGranularity,\n MarginAccountBalanceGranularity,\n GetMarginAccountBalanceChartDataResult,\n MarginAccountCollateralsBalanceGranularity,\n GetMarginAccountCollateralsBalanceChartDataResult,\n GetAllMarginAccountsBalanceChartDataResult,\n AllMarginAccountsBalanceGranularity,\n GetFundingRateChartDataResult,\n FundingRateHistoryGranularity,\n} from '@reyaxyz/common';\nexport * from './modules/account/types';\nexport * from './modules/lp/types';\nexport * from './modules/markets/types';\nexport * from './modules/tokens/types';\nexport * from './modules/trade.simulation/types';\nexport * from './modules/owner/types';\nexport * from './modules/deposit-existing-MA.simulation/types';\nexport * from './modules/deposit-new-MA.simulation/types';\nexport * from './modules/edit-collateral.simulation/types';\nexport * from './modules/withdraw-MA.simulation/types';\nexport * from './modules/transfer-margin-between-MAs.simulation/types';\nexport * from './modules/transfer-MA-Pool.simulation/types';\nexport * from './modules/funding-rate/types';\nexport * from './modules/depth-chart.simulation/types';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GetDepthChartParams, GetDepthChartResult, DepthSimulationLoadDataParams } from './types';
|
|
2
2
|
import LpClient from '../lp';
|
|
3
3
|
export default class DepthChartSimulationClient {
|
|
4
4
|
private poolId;
|
|
@@ -8,7 +8,7 @@ export default class DepthChartSimulationClient {
|
|
|
8
8
|
constructor(lpClient: LpClient);
|
|
9
9
|
arm(params: DepthSimulationLoadDataParams): Promise<void>;
|
|
10
10
|
private fetchPoolData;
|
|
11
|
-
|
|
11
|
+
getDepthChart(params: GetDepthChartParams): GetDepthChartResult;
|
|
12
12
|
private calculate;
|
|
13
13
|
static calculatePriceChangePercentage(price: number, estimatedPrice: number): number;
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/depth-chart.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["clients/modules/depth-chart.simulation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,6BAA6B,EAE9B,MAAM,SAAS,CAAC;AAEjB,OAAO,QAAQ,MAAM,OAAO,CAAC;AAI7B,MAAM,CAAC,OAAO,OAAO,0BAA0B;IAC7C,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,QAAQ,CAAW;gBACf,QAAQ,EAAE,QAAQ;IAMxB,GAAG,CAAC,MAAM,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;YAOjD,aAAa;IAU3B,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB;IA4B/D,OAAO,CAAC,SAAS;IA2BjB,MAAM,CAAC,8BAA8B,CACnC,KAAK,EAAE,MAAM,EACb,cAAc,EAAE,MAAM,GACrB,MAAM;CAQV"}
|
|
@@ -9,8 +9,12 @@ export type SimulateDepthEntity = {
|
|
|
9
9
|
totalCost: number;
|
|
10
10
|
priceImpact: number;
|
|
11
11
|
};
|
|
12
|
-
export type
|
|
12
|
+
export type GetDepthChartResult = {
|
|
13
13
|
leftChart: SimulateDepthEntity[];
|
|
14
14
|
rightChart: SimulateDepthEntity[];
|
|
15
15
|
};
|
|
16
|
+
export type GetDepthChartParams = {
|
|
17
|
+
step?: number;
|
|
18
|
+
percentageChange?: number;
|
|
19
|
+
};
|
|
16
20
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/depth-chart.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/modules/depth-chart.simulation/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,UAAU,EAAE,mBAAmB,EAAE,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC"}
|
|
@@ -12,4 +12,5 @@ export * from './modules/withdraw-MA.simulation/types';
|
|
|
12
12
|
export * from './modules/transfer-margin-between-MAs.simulation/types';
|
|
13
13
|
export * from './modules/transfer-MA-Pool.simulation/types';
|
|
14
14
|
export * from './modules/funding-rate/types';
|
|
15
|
+
export * from './modules/depth-chart.simulation/types';
|
|
15
16
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,YAAY,EACZ,0BAA0B,EAC1B,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACtB,mCAAmC,EACnC,qCAAqC,EACrC,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,mCAAmC,EACnC,+BAA+B,EAC/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3D,cAAc,wCAAwC,CAAC;AACvD,cAAc,wDAAwD,CAAC;AACvE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wCAAwC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/api-sdk",
|
|
3
|
-
"version": "0.54.
|
|
3
|
+
"version": "0.54.7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"bignumber.js": "^9.1.2"
|
|
38
38
|
},
|
|
39
39
|
"packageManager": "pnpm@8.10.4",
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "a08d7f31f0042ef0b16f4091b7d4b72017de361e"
|
|
41
41
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
GetDepthChartParams,
|
|
3
|
+
GetDepthChartResult,
|
|
3
4
|
DepthSimulationLoadDataParams,
|
|
4
5
|
SimulateDepthEntity,
|
|
5
6
|
} from './types';
|
|
@@ -36,11 +37,14 @@ export default class DepthChartSimulationClient {
|
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
getDepthChart(params: GetDepthChartParams): GetDepthChartResult {
|
|
40
41
|
// step is in notional
|
|
41
42
|
if (!this.loadedData) {
|
|
42
43
|
throw new Error('Data not loaded. Call arm() first.');
|
|
43
44
|
}
|
|
45
|
+
const step = params.step || 10;
|
|
46
|
+
const percentageChange = params.percentageChange || 30;
|
|
47
|
+
|
|
44
48
|
const leftResults: SimulateDepthEntity[] = [];
|
|
45
49
|
const rightResults: SimulateDepthEntity[] = [];
|
|
46
50
|
for (let delta = 0; ; delta += step) {
|
|
@@ -12,7 +12,12 @@ export type SimulateDepthEntity = {
|
|
|
12
12
|
priceImpact: number;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export type
|
|
15
|
+
export type GetDepthChartResult = {
|
|
16
16
|
leftChart: SimulateDepthEntity[];
|
|
17
17
|
rightChart: SimulateDepthEntity[];
|
|
18
18
|
};
|
|
19
|
+
|
|
20
|
+
export type GetDepthChartParams = {
|
|
21
|
+
step?: number;
|
|
22
|
+
percentageChange?: number;
|
|
23
|
+
};
|
package/src/clients/types.ts
CHANGED
|
@@ -40,3 +40,4 @@ export * from './modules/withdraw-MA.simulation/types';
|
|
|
40
40
|
export * from './modules/transfer-margin-between-MAs.simulation/types';
|
|
41
41
|
export * from './modules/transfer-MA-Pool.simulation/types';
|
|
42
42
|
export * from './modules/funding-rate/types';
|
|
43
|
+
export * from './modules/depth-chart.simulation/types';
|