@reyaxyz/api-sdk 0.18.0 → 0.19.0

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 (38) hide show
  1. package/dist/clients/api-client.js +1 -1
  2. package/dist/clients/api-client.js.map +1 -1
  3. package/dist/clients/helpers/exposure.calculator.js +436 -0
  4. package/dist/clients/helpers/exposure.calculator.js.map +1 -0
  5. package/dist/clients/helpers/number.js +13 -0
  6. package/dist/clients/helpers/number.js.map +1 -0
  7. package/dist/clients/helpers/trade.simulation.types.js +3 -0
  8. package/dist/clients/helpers/trade.simulation.types.js.map +1 -0
  9. package/dist/clients/modules/account.js +11 -0
  10. package/dist/clients/modules/account.js.map +1 -1
  11. package/dist/clients/modules/trade.simulation.js +40 -38
  12. package/dist/clients/modules/trade.simulation.js.map +1 -1
  13. package/dist/clients/types.js.map +1 -1
  14. package/dist/index.js +2 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/types/clients/helpers/exposure.calculator.d.ts +58 -0
  17. package/dist/types/clients/helpers/exposure.calculator.d.ts.map +1 -0
  18. package/dist/types/clients/helpers/number.d.ts +3 -0
  19. package/dist/types/clients/helpers/number.d.ts.map +1 -0
  20. package/dist/types/clients/helpers/trade.simulation.types.d.ts +104 -0
  21. package/dist/types/clients/helpers/trade.simulation.types.d.ts.map +1 -0
  22. package/dist/types/clients/modules/account.d.ts +3 -1
  23. package/dist/types/clients/modules/account.d.ts.map +1 -1
  24. package/dist/types/clients/modules/trade.simulation.d.ts +3 -0
  25. package/dist/types/clients/modules/trade.simulation.d.ts.map +1 -1
  26. package/dist/types/clients/types.d.ts +5 -1
  27. package/dist/types/clients/types.d.ts.map +1 -1
  28. package/dist/types/index.d.ts +2 -0
  29. package/dist/types/index.d.ts.map +1 -1
  30. package/package.json +4 -3
  31. package/src/clients/api-client.ts +1 -1
  32. package/src/clients/helpers/exposure.calculator.ts +792 -0
  33. package/src/clients/helpers/number.ts +8 -0
  34. package/src/clients/helpers/trade.simulation.types.ts +115 -0
  35. package/src/clients/modules/account.ts +11 -0
  36. package/src/clients/modules/trade.simulation.ts +103 -44
  37. package/src/clients/types.ts +8 -1
  38. package/src/index.ts +2 -0
@@ -1 +1 @@
1
- {"version":3,"file":"account.js","sourceRoot":"/","sources":["clients/modules/account.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,gDAAgC;AAEhC;IAA2C,iCAAU;IAArD;;IA+DA,CAAC;IA9DC;;;;;;;;;;;SAWK;IAEC,yCAAiB,GAAvB,UACE,MAA+B;;;;gBAEzB,GAAG,GAAG,wBAAiB,MAAM,CAAC,OAAO,CAAE,CAAC;gBAC9C,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,EAAC;;;KAC/C;IAED;;;;;;;;;;OAUG;IAEG,wCAAgB,GAAtB,UACE,MAA8B;;;;gBAExB,GAAG,GAAG,wBAAiB,MAAM,CAAC,OAAO,4BAAkB,MAAM,CAAC,eAAe,CAAE,CAAC;gBACtF,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IAEK,oDAA4B,GAAlC,UACE,MAA0C;;;;gBAEpC,GAAG,GAAG,wBAAiB,MAAM,CAAC,OAAO,4BAAkB,MAAM,CAAC,eAAe,eAAY,CAAC;gBAChG,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,EAAC;;;KAC/C;IAEK,2DAAmC,GAAzC,UACE,MAAiD;;;;gBAE3C,GAAG,GAAG,wBAAiB,MAAM,CAAC,OAAO,4BAAkB,MAAM,CAAC,eAAe,uBAAoB,CAAC;gBACxG,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,EAAC;;;KAC/C;IAEK,gDAAwB,GAA9B,UACE,MAAsC;;;;gBAEhC,GAAG,GAAG,wBAAiB,MAAM,CAAC,eAAe,oBAAiB,CAAC;gBACrE,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;wBACzB,SAAS,EAAE,MAAM,CAAC,SAAS;qBAC5B,CAAC,EAAC;;;KACJ;IACH,oBAAC;AAAD,CAAC,AA/DD,CAA2C,cAAU,GA+DpD","sourcesContent":["import {\n GetMarginAccountParams,\n GetMarginAccountResult,\n GetMarginAccountsParams,\n GetMarginAccountsResult,\n GetMaxOrderSizeAvailableParams,\n GetMaxOrderSizeAvailableResult,\n GetPositionsForMarginAccountParams,\n GetPositionsForMarginAccountResult,\n GetPositionsHistoryForMarginAccountParams,\n GetPositionsHistoryForMarginAccountResult,\n} from '../types';\nimport RestClient from './rest';\n\nexport default class AccountClient extends RestClient {\n /**\n * Asynchronously retrieves a list of margin accounts associated with a specific address.\n *\n * This method makes a request to the API endpoint to fetch collateral account data. The data is filtered\n * based on the provided Ethereum address. An optional limit can be specified to control the number of\n * collateral accounts returned in the response.\n *\n * @param {GetMarginAccountsParams} params\n * @returns {Promise<GetMarginAccountsResult>} A promise that resolves to the response containing the margin\n * account data.\n * @memberof account\n * */\n\n async getMarginAccounts(\n params: GetMarginAccountsParams,\n ): Promise<GetMarginAccountsResult> {\n const uri = `/api/accounts/${params.address}`;\n return this.get(uri, { limit: params.limit });\n }\n\n /**\n * Asynchronously retrieves details of a specific collateral account for a given Ethereum address.\n *\n * This method sends a request to the API to obtain detailed information about a specific collateral account\n * associated with the provided Ethereum address. The account is identified using the collateral account number.\n *\n * @param {GetMarginAccountParams} params\n * @returns {Promise<GetMarginAccountResult>} A promise that resolves to the response containing the detailed\n * information of the specified margin account.\n * @memberof account\n */\n\n async getMarginAccount(\n params: GetMarginAccountParams,\n ): Promise<GetMarginAccountResult> {\n const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}`;\n return this.get(uri);\n }\n\n async getPositionsForMarginAccount(\n params: GetPositionsForMarginAccountParams,\n ): Promise<GetPositionsForMarginAccountResult> {\n const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}/positions`;\n return this.get(uri, { limit: params.limit });\n }\n\n async getPositionsHistoryForMarginAccount(\n params: GetPositionsHistoryForMarginAccountParams,\n ): Promise<GetPositionsHistoryForMarginAccountResult> {\n const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}/positions/history`;\n return this.get(uri, { limit: params.limit });\n }\n\n async getMaxOrderSizeAvailable(\n params: GetMaxOrderSizeAvailableParams,\n ): Promise<GetMaxOrderSizeAvailableResult> {\n const uri = `/api/accounts/${params.marginAccountId}/max-order-size`;\n return this.get(uri, {\n marketId: params.marketId,\n direction: params.direction,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"account.js","sourceRoot":"/","sources":["clients/modules/account.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,gDAAgC;AAGhC;IAA2C,iCAAU;IAArD;;IAwEA,CAAC;IAvEC;;;;;;;;;;;SAWK;IAEC,yCAAiB,GAAvB,UACE,MAA+B;;;;gBAEzB,GAAG,GAAG,wBAAiB,MAAM,CAAC,OAAO,CAAE,CAAC;gBAC9C,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,EAAC;;;KAC/C;IAED;;;;;;;;;;OAUG;IAEG,wCAAgB,GAAtB,UACE,MAA8B;;;;gBAExB,GAAG,GAAG,wBAAiB,MAAM,CAAC,OAAO,4BAAkB,MAAM,CAAC,eAAe,CAAE,CAAC;gBACtF,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IAEK,oDAA4B,GAAlC,UACE,MAA0C;;;;gBAEpC,GAAG,GAAG,wBAAiB,MAAM,CAAC,OAAO,4BAAkB,MAAM,CAAC,eAAe,eAAY,CAAC;gBAChG,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,EAAC;;;KAC/C;IAEK,2DAAmC,GAAzC,UACE,MAAiD;;;;gBAE3C,GAAG,GAAG,wBAAiB,MAAM,CAAC,OAAO,4BAAkB,MAAM,CAAC,eAAe,uBAAoB,CAAC;gBACxG,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,EAAC;;;KAC/C;IAEK,gDAAwB,GAA9B,UACE,MAAsC;;;;gBAEhC,GAAG,GAAG,wBAAiB,MAAM,CAAC,eAAe,oBAAiB,CAAC;gBACrE,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;wBACzB,SAAS,EAAE,MAAM,CAAC,SAAS;qBAC5B,CAAC,EAAC;;;KACJ;IAEK,2DAAmC,GAAzC,UACE,MAAiD;;;;gBAE3C,GAAG,GAAG,wBAAiB,MAAM,CAAC,eAAe,2BAAwB,CAAC;gBAC5E,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;qBAC1B,CAAC,EAAC;;;KACJ;IACH,oBAAC;AAAD,CAAC,AAxED,CAA2C,cAAU,GAwEpD","sourcesContent":["import {\n GetMarginAccountParams,\n GetMarginAccountResult,\n GetMarginAccountsParams,\n GetMarginAccountsResult,\n GetMaxOrderSizeAvailableParams,\n GetMaxOrderSizeAvailableResult,\n GetPositionsForMarginAccountParams,\n GetPositionsForMarginAccountResult,\n GetPositionsHistoryForMarginAccountParams,\n GetPositionsHistoryForMarginAccountResult,\n GetTransactionSimulationInitialDataParams,\n} from '../types';\nimport RestClient from './rest';\nimport { TradeSimulationState } from '../helpers/trade.simulation.types';\n\nexport default class AccountClient extends RestClient {\n /**\n * Asynchronously retrieves a list of margin accounts associated with a specific address.\n *\n * This method makes a request to the API endpoint to fetch collateral account data. The data is filtered\n * based on the provided Ethereum address. An optional limit can be specified to control the number of\n * collateral accounts returned in the response.\n *\n * @param {GetMarginAccountsParams} params\n * @returns {Promise<GetMarginAccountsResult>} A promise that resolves to the response containing the margin\n * account data.\n * @memberof account\n * */\n\n async getMarginAccounts(\n params: GetMarginAccountsParams,\n ): Promise<GetMarginAccountsResult> {\n const uri = `/api/accounts/${params.address}`;\n return this.get(uri, { limit: params.limit });\n }\n\n /**\n * Asynchronously retrieves details of a specific collateral account for a given Ethereum address.\n *\n * This method sends a request to the API to obtain detailed information about a specific collateral account\n * associated with the provided Ethereum address. The account is identified using the collateral account number.\n *\n * @param {GetMarginAccountParams} params\n * @returns {Promise<GetMarginAccountResult>} A promise that resolves to the response containing the detailed\n * information of the specified margin account.\n * @memberof account\n */\n\n async getMarginAccount(\n params: GetMarginAccountParams,\n ): Promise<GetMarginAccountResult> {\n const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}`;\n return this.get(uri);\n }\n\n async getPositionsForMarginAccount(\n params: GetPositionsForMarginAccountParams,\n ): Promise<GetPositionsForMarginAccountResult> {\n const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}/positions`;\n return this.get(uri, { limit: params.limit });\n }\n\n async getPositionsHistoryForMarginAccount(\n params: GetPositionsHistoryForMarginAccountParams,\n ): Promise<GetPositionsHistoryForMarginAccountResult> {\n const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}/positions/history`;\n return this.get(uri, { limit: params.limit });\n }\n\n async getMaxOrderSizeAvailable(\n params: GetMaxOrderSizeAvailableParams,\n ): Promise<GetMaxOrderSizeAvailableResult> {\n const uri = `/api/accounts/${params.marginAccountId}/max-order-size`;\n return this.get(uri, {\n marketId: params.marketId,\n direction: params.direction,\n });\n }\n\n async getTransactionSimulationInitialData(\n params: GetTransactionSimulationInitialDataParams,\n ): Promise<TradeSimulationState> {\n const uri = `/api/accounts/${params.marginAccountId}/trade-simulation-data`;\n return this.get(uri, {\n marketId: params.marketId,\n });\n }\n}\n"]}
@@ -35,43 +35,33 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- // The maximum is inclusive and the minimum is inclusive
40
- function getRandomIntInclusive(min, max) {
41
- min = Math.ceil(min);
42
- max = Math.floor(max);
43
- return Math.floor(Math.random() * (max - min + 1) + min);
44
- }
45
- var randomHealth = function () {
46
- return Math.random() * 100 > 50
47
- ? 'healthy'
48
- : Math.random() * 100 > 50
49
- ? 'danger'
50
- : 'warning';
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
51
40
  };
52
- function getRandomFloat(min, max) {
53
- return Math.random() * (max - min) + min;
54
- }
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ var exposure_calculator_1 = require("../helpers/exposure.calculator");
43
+ var bignumber_js_1 = __importDefault(require("bignumber.js"));
55
44
  var TradeSimulationClient = /** @class */ (function () {
56
- function TradeSimulationClient() {
45
+ function TradeSimulationClient(accountClient) {
57
46
  this.marketId = null;
58
47
  this.accountId = null;
59
48
  this.loadedData = null;
49
+ // Constructor added
50
+ this.accountClient = accountClient;
60
51
  }
61
52
  // Method to asynchronously load data based on marketId and accountId
62
53
  TradeSimulationClient.prototype.arm = function (params) {
63
54
  return __awaiter(this, void 0, void 0, function () {
64
- var marketData;
65
- return __generator(this, function (_a) {
66
- switch (_a.label) {
55
+ var _a;
56
+ return __generator(this, function (_b) {
57
+ switch (_b.label) {
67
58
  case 0:
68
59
  this.marketId = params.marketId;
69
60
  this.accountId = params.marginAccountId;
61
+ _a = this;
70
62
  return [4 /*yield*/, this.fetchMarketData(this.marketId, this.accountId)];
71
63
  case 1:
72
- marketData = _a.sent();
73
- // Store the loaded data
74
- this.loadedData = { marketData: marketData };
64
+ _a.loadedData = _b.sent();
75
65
  return [2 /*return*/];
76
66
  }
77
67
  });
@@ -80,12 +70,10 @@ var TradeSimulationClient = /** @class */ (function () {
80
70
  TradeSimulationClient.prototype.fetchMarketData = function (marketId, accountId) {
81
71
  return __awaiter(this, void 0, void 0, function () {
82
72
  return __generator(this, function (_a) {
83
- switch (_a.label) {
84
- case 0: return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 500); })];
85
- case 1:
86
- _a.sent(); // wait for 500ms
87
- return [2 /*return*/, 1 + marketId + accountId];
88
- }
73
+ return [2 /*return*/, this.accountClient.getTransactionSimulationInitialData({
74
+ marginAccountId: accountId,
75
+ marketId: marketId,
76
+ })];
89
77
  });
90
78
  });
91
79
  };
@@ -94,16 +82,30 @@ var TradeSimulationClient = /** @class */ (function () {
94
82
  if (!this.loadedData) {
95
83
  throw new Error('Data not loaded. Call arm() first.');
96
84
  }
97
- // @todo perform simulation
85
+ var amount = (0, bignumber_js_1.default)(params.amount)
86
+ .div(this.loadedData.exposureDataAccount.oraclePrice)
87
+ .toNumber();
88
+ var userAccountExposure = new exposure_calculator_1.ExposureCommand(this.loadedData.exposureDataAccount.rootCollateralPoolId, this.loadedData.exposureDataAccount.oraclePrice, this.loadedData.exposureDataAccount.rate, this.loadedData.exposureDataAccount.accountBalancePerAsset, this.loadedData.exposureDataAccount.groupedByCollateral, this.loadedData.exposureDataAccount.riskMultipliers, this.loadedData.exposureDataAccount.riskMatrices, this.loadedData.exposureDataAccount.exchangeInfoPerAsset, this.loadedData.exposureDataAccount.positionInfoMarketConfiguration, this.loadedData.exposureDataAccount.uniqueTokenAddresses, this.loadedData.exposureDataAccount.uniqueQuoteCollaterals, this.loadedData.exposureDataAccount.tokenMarginInfoPerAsset, this.loadedData.exposureDataAccount.realizedPnLSum, this.loadedData.exposureDataAccount.unrealizedPnLSum);
89
+ var passivePoolExposure = new exposure_calculator_1.ExposureCommand(this.loadedData.exposureDataPassivePool.rootCollateralPoolId, this.loadedData.exposureDataPassivePool.oraclePrice, this.loadedData.exposureDataPassivePool.rate, this.loadedData.exposureDataPassivePool.accountBalancePerAsset, this.loadedData.exposureDataPassivePool.groupedByCollateral, this.loadedData.exposureDataPassivePool.riskMultipliers, this.loadedData.exposureDataPassivePool.riskMatrices, this.loadedData.exposureDataPassivePool.exchangeInfoPerAsset, this.loadedData.exposureDataPassivePool.positionInfoMarketConfiguration, this.loadedData.exposureDataPassivePool.uniqueTokenAddresses, this.loadedData.exposureDataPassivePool.uniqueQuoteCollaterals, this.loadedData.exposureDataPassivePool.tokenMarginInfoPerAsset, this.loadedData.exposureDataPassivePool.realizedPnLSum, this.loadedData.exposureDataPassivePool.unrealizedPnLSum);
90
+ var slippage = passivePoolExposure.getSlippage(amount, this.loadedData.marketConfiguration, this.loadedData.marketStorage);
91
+ var estimatedPrice = exposure_calculator_1.ExposureCommand.calculateEstimatedPrice(this.loadedData.exposureDataPassivePool.oraclePrice, slippage);
92
+ var fees = exposure_calculator_1.ExposureCommand.calculateFee(this.loadedData.exposureDataAccount.oraclePrice, amount, this.loadedData.feeParameter);
93
+ var oldMarginInfo = userAccountExposure.getUsdNodeMarginInfo;
94
+ var newMarginInfo = userAccountExposure.getUsdNodeMarginInfoPostTrade(amount, this.loadedData.marketStorage.quote_collateral, this.loadedData.marketConfiguration);
95
+ var impliedLeverage = exposure_calculator_1.ExposureCommand.calculateImpliedLeverage(amount * this.loadedData.exposureDataAccount.oraclePrice, oldMarginInfo.marginBalance - oldMarginInfo.initialDelta, newMarginInfo.marginBalance - newMarginInfo.initialDelta);
96
+ var postTradeImr = newMarginInfo.marginBalance - newMarginInfo.initialDelta;
97
+ var liquidationPrice = exposure_calculator_1.ExposureCommand.calculateLiquidation(newMarginInfo, this.loadedData.exposureDataAccount.oraclePrice, amount);
98
+ var marginRatio = exposure_calculator_1.ExposureCommand.getMarginRatio(newMarginInfo) * 100;
99
+ var marginRatioHealth = exposure_calculator_1.ExposureCommand.evaluateHealthStatus(marginRatio);
98
100
  return {
99
- estimatedPrice: getRandomIntInclusive(1000, 100000) + params.amount,
100
- estimatedSlippage: getRandomFloat(0.00001, 0.05),
101
- fees: getRandomIntInclusive(1000, 100000),
102
- impliedLeverage: getRandomIntInclusive(20, 50),
103
- imr: getRandomIntInclusive(1000, 100000),
104
- liquidationPrice: getRandomIntInclusive(1000, 100000),
105
- marginRatio: getRandomIntInclusive(0, 100),
106
- marginRatioHealth: randomHealth(),
101
+ estimatedPrice: estimatedPrice,
102
+ estimatedSlippage: slippage * 100,
103
+ fees: fees,
104
+ impliedLeverage: impliedLeverage,
105
+ imr: postTradeImr,
106
+ liquidationPrice: liquidationPrice.toNumber(),
107
+ marginRatio: marginRatio,
108
+ marginRatioHealth: marginRatioHealth,
107
109
  };
108
110
  };
109
111
  return TradeSimulationClient;
@@ -1 +1 @@
1
- {"version":3,"file":"trade.simulation.js","sourceRoot":"/","sources":["clients/modules/trade.simulation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,wDAAwD;AACxD,SAAS,qBAAqB,CAAC,GAAW,EAAE,GAAW;IACrD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;AAC3D,CAAC;AAED,IAAM,YAAY,GAAG;IACnB,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE;QAC7B,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE;YACxB,CAA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AAC,MAAM;YACnE,iBAAiB,EAAE,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC;YAChD,IAAI,EAAE,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC;YACzC,eAAe,EAAE,qBAAqB,CAAC,EAAE,EAAE,EAAE,CAAC;YAC9C,GAAG,EAAE,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC;YACxC,gBAAgB,EAAE,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC;YACrD,WAAW,EAAE,qBAAqB,CAAC,CAAC,EAAE,GAAG,CAAC;YAC1C,iBAAiB,EAAE,YAAY,EAAE;SACX,CAAC;IAC3B,CAAC;IACH,4BAAC;AAAD,CAAC,AA/CD,IA+CC","sourcesContent":["import {\n SimulateTradeEntity,\n TradeSimulationLoadDataParams,\n TradeSimulationSimulateParams,\n} from '../types';\n\ntype LoadedData = {\n marketData: number;\n};\n\n// The maximum is inclusive and the minimum is inclusive\nfunction getRandomIntInclusive(min: number, max: number) {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1) + min);\n}\n\nconst randomHealth = () => {\n return Math.random() * 100 > 50\n ? 'healthy'\n : Math.random() * 100 > 50\n ? 'danger'\n : 'warning';\n};\n\nfunction getRandomFloat(min: number, max: number): number {\n return Math.random() * (max - min) + min;\n}\n\nexport default class TradeSimulationClient {\n private marketId: number | null = null;\n private accountId: number | null = null;\n private loadedData: LoadedData | null = null;\n\n // Method to asynchronously load data based on marketId and accountId\n async arm(params: TradeSimulationLoadDataParams): Promise<void> {\n this.marketId = params.marketId;\n this.accountId = params.marginAccountId;\n\n // Simulate fetching data (@todo replace this with actual data fetching logic)\n const marketData = await this.fetchMarketData(\n this.marketId,\n this.accountId,\n );\n\n // Store the loaded data\n this.loadedData = { marketData };\n }\n\n private async fetchMarketData(\n marketId: number,\n accountId: number,\n ): Promise<number> {\n await new Promise((resolve) => setTimeout(resolve, 500)); // wait for 500ms\n return 1 + marketId + accountId;\n }\n\n // Synchronous method to simulate operations based on an amount\n simulate(params: TradeSimulationSimulateParams): SimulateTradeEntity {\n if (!this.loadedData) {\n throw new Error('Data not loaded. Call arm() first.');\n }\n\n // @todo perform simulation\n\n return {\n estimatedPrice: getRandomIntInclusive(1000, 100000) + params.amount,\n estimatedSlippage: getRandomFloat(0.00001, 0.05),\n fees: getRandomIntInclusive(1000, 100000),\n impliedLeverage: getRandomIntInclusive(20, 50),\n imr: getRandomIntInclusive(1000, 100000),\n liquidationPrice: getRandomIntInclusive(1000, 100000),\n marginRatio: getRandomIntInclusive(0, 100),\n marginRatioHealth: randomHealth(),\n } as SimulateTradeEntity;\n }\n}\n"]}
1
+ {"version":3,"file":"trade.simulation.js","sourceRoot":"/","sources":["clients/modules/trade.simulation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,sEAAiE;AACjE,8DAAqC;AAErC;IAKE,+BAAY,aAA4B;QAJhC,aAAQ,GAAkB,IAAI,CAAC;QAC/B,cAAS,GAAkB,IAAI,CAAC;QAChC,eAAU,GAAgC,IAAI,CAAC;QAGrD,oBAAoB;QACpB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED,qEAAqE;IAC/D,mCAAG,GAAT,UAAU,MAAqC;;;;;;wBAC7C,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;wBAChC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,eAAe,CAAC;wBAExC,KAAA,IAAI,CAAA;wBAAc,qBAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,EAAA;;wBAA3E,GAAK,UAAU,GAAG,SAAyD,CAAC;;;;;KAC7E;IAEa,+CAAe,GAA7B,UACE,QAAgB,EAChB,SAAiB;;;gBAEjB,sBAAO,IAAI,CAAC,aAAa,CAAC,mCAAmC,CAAC;wBAC5D,eAAe,EAAE,SAAS;wB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,6BAA6B,CACrE,MAAM,EACN,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,gBAAgB,EAC9C,IAAI,CAAC,UAAU,CAAC,mBAAmB,CACpC,CAAC;QAEF,IAAM,eAAe,GAAG,qCAAe,CAAC,wBAAwB,CAC9D,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,WAAW,EACxD,aAAa,CAAC,aAAa,GAAG,aAAa,CAAC,YAAY,EACxD,aAAa,CAAC,aAAa,GAAG,aAAa,CAAC,YAAY,CACzD,CAAC;QAEF,IAAM,YAAY,GAChB,aAAa,CAAC,aAAa,GAAG,aAAa,CAAC,YAAY,CAAC;QAE3D,IAAM,gBAAgB,GAAG,qCAAe,CAAC,oBAAoB,CAC3D,aAAa,EACb,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,WAAW,EAC/C,MAAM,CACP,CAAC;QAEF,IAAM,WAAW,GAAG,qCAAe,CAAC,cAAc,CAAC,aAAa,CAAC,GAAG,GAAG,CAAC;QAExE,IAAM,iBAAiB,GAAG,qCAAe,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;QAE5E,OAAO;YACL,cAAc,EAAE,cAAc;YAC9B,iBAAiB,EAAE,QAAQ,GAAG,GAAG;YACjC,IAAI,EAAE,IAAI;YACV,eAAe,EAAE,eAAe;YAChC,GAAG,EAAE,YAAY;YACjB,gBAAgB,EAAE,gBAAgB,CAAC,QAAQ,EAAE;YAC7C,WAAW,EAAE,WAAW;YACxB,iBAAiB,EAAE,iBAAiB;SACd,CAAC;IAC3B,CAAC;IACH,4BAAC;AAAD,CAAC,AA7HD,IA6HC","sourcesContent":["import {\n SimulateTradeEntity,\n TradeSimulationLoadDataParams,\n TradeSimulationSimulateParams,\n} from '../types';\nimport AccountClient from './account';\nimport { TradeSimulationState } from '../helpers/trade.simulation.types';\nimport { ExposureCommand } from '../helpers/exposure.calculator';\nimport BigNumber from 'bignumber.js';\n\nexport default class TradeSimulationClient {\n private marketId: number | null = null;\n private accountId: number | null = null;\n private loadedData: TradeSimulationState | null = null;\n private accountClient: AccountClient;\n constructor(accountClient: AccountClient) {\n // Constructor added\n this.accountClient = accountClient;\n }\n\n // Method to asynchronously load data based on marketId and accountId\n async arm(params: TradeSimulationLoadDataParams): Promise<void> {\n this.marketId = params.marketId;\n this.accountId = params.marginAccountId;\n\n this.loadedData = await this.fetchMarketData(this.marketId, this.accountId);\n }\n\n private async fetchMarketData(\n marketId: number,\n accountId: number,\n ): Promise<TradeSimulationState> {\n return this.accountClient.getTransactionSimulationInitialData({\n marginAccountId: accountId,\n marketId: marketId,\n });\n }\n\n // Synchronous method to simulate operations based on an amount\n simulate(params: TradeSimulationSimulateParams): SimulateTradeEntity {\n if (!this.loadedData) {\n throw new Error('Data not loaded. Call arm() first.');\n }\n\n const amount = BigNumber(params.amount)\n .div(this.loadedData.exposureDataAccount.oraclePrice)\n .toNumber();\n\n const userAccountExposure = new ExposureCommand(\n this.loadedData.exposureDataAccount.rootCollateralPoolId,\n this.loadedData.exposureDataAccount.oraclePrice,\n this.loadedData.exposureDataAccount.rate,\n this.loadedData.exposureDataAccount.accountBalancePerAsset,\n this.loadedData.exposureDataAccount.groupedByCollateral,\n this.loadedData.exposureDataAccount.riskMultipliers,\n this.loadedData.exposureDataAccount.riskMatrices,\n this.loadedData.exposureDataAccount.exchangeInfoPerAsset,\n this.loadedData.exposureDataAccount.positionInfoMarketConfiguration,\n this.loadedData.exposureDataAccount.uniqueTokenAddresses,\n this.loadedData.exposureDataAccount.uniqueQuoteCollaterals,\n this.loadedData.exposureDataAccount.tokenMarginInfoPerAsset,\n this.loadedData.exposureDataAccount.realizedPnLSum,\n this.loadedData.exposureDataAccount.unrealizedPnLSum,\n );\n\n const passivePoolExposure = new ExposureCommand(\n this.loadedData.exposureDataPassivePool.rootCollateralPoolId,\n this.loadedData.exposureDataPassivePool.oraclePrice,\n this.loadedData.exposureDataPassivePool.rate,\n this.loadedData.exposureDataPassivePool.accountBalancePerAsset,\n this.loadedData.exposureDataPassivePool.groupedByCollateral,\n this.loadedData.exposureDataPassivePool.riskMultipliers,\n this.loadedData.exposureDataPassivePool.riskMatrices,\n this.loadedData.exposureDataPassivePool.exchangeInfoPerAsset,\n this.loadedData.exposureDataPassivePool.positionInfoMarketConfiguration,\n this.loadedData.exposureDataPassivePool.uniqueTokenAddresses,\n this.loadedData.exposureDataPassivePool.uniqueQuoteCollaterals,\n this.loadedData.exposureDataPassivePool.tokenMarginInfoPerAsset,\n this.loadedData.exposureDataPassivePool.realizedPnLSum,\n this.loadedData.exposureDataPassivePool.unrealizedPnLSum,\n );\n\n const slippage = passivePoolExposure.getSlippage(\n amount,\n this.loadedData.marketConfiguration,\n this.loadedData.marketStorage,\n );\n const estimatedPrice = ExposureCommand.calculateEstimatedPrice(\n this.loadedData.exposureDataPassivePool.oraclePrice,\n slippage,\n );\n const fees = ExposureCommand.calculateFee(\n this.loadedData.exposureDataAccount.oraclePrice,\n amount,\n this.loadedData.feeParameter,\n );\n\n const oldMarginInfo = userAccountExposure.getUsdNodeMarginInfo;\n\n const newMarginInfo = userAccountExposure.getUsdNodeMarginInfoPostTrade(\n amount,\n this.loadedData.marketStorage.quote_collateral,\n this.loadedData.marketConfiguration,\n );\n\n const impliedLeverage = ExposureCommand.calculateImpliedLeverage(\n amount * this.loadedData.exposureDataAccount.oraclePrice,\n oldMarginInfo.marginBalance - oldMarginInfo.initialDelta,\n newMarginInfo.marginBalance - newMarginInfo.initialDelta,\n );\n\n const postTradeImr =\n newMarginInfo.marginBalance - newMarginInfo.initialDelta;\n\n const liquidationPrice = ExposureCommand.calculateLiquidation(\n newMarginInfo,\n this.loadedData.exposureDataAccount.oraclePrice,\n amount,\n );\n\n const marginRatio = ExposureCommand.getMarginRatio(newMarginInfo) * 100;\n\n const marginRatioHealth = ExposureCommand.evaluateHealthStatus(marginRatio);\n\n return {\n estimatedPrice: estimatedPrice,\n estimatedSlippage: slippage * 100,\n fees: fees,\n impliedLeverage: impliedLeverage,\n imr: postTradeImr,\n liquidationPrice: liquidationPrice.toNumber(),\n marginRatio: marginRatio,\n marginRatioHealth: marginRatioHealth,\n } as SimulateTradeEntity;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,2CAAsB,CAAA;IACtB,+CAA0B,CAAA;IAC1B,8CAAyB,CAAA;IACzB,uCAAkB,CAAA;IAClB,0CAAqB,CAAA;IACrB,qCAAgB,CAAA;AAClB,CAAC,EARW,iBAAiB,iCAAjB,iBAAiB,QAQ5B;AA2MD,eAAe;AAEf,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,6DAAW,CAAA;IACX,6EAAqB,CAAA;AACvB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B","sourcesContent":["export enum CandlesResolution {\n ONE_MINUTE = '1MIN',\n FIVE_MINUTES = '5MINS',\n FIFTEEN_MINUTES = '15MINS',\n THIRTY_MINUTES = '30MINS',\n ONE_HOUR = '1HOUR',\n FOUR_HOURS = '4HOURS',\n ONE_DAY = '1DAY',\n}\n\n// -- Candles --\nexport interface Candle {\n startedAt: string;\n ticker: string;\n resolution: CandlesResolution;\n low: string;\n high: string;\n open: string;\n close: string;\n baseTokenVolume: string;\n usdVolume: string;\n trades: number;\n startingOpenInterest: string;\n id: string;\n}\n\nexport interface MarketCandlesResponse {\n candles: Candle[];\n}\n\n// -- Markets --\n\nexport type MarketOrderInfo = {\n counterpartyAccountIds: number[];\n exchangeId: number;\n};\n\nexport type MarketEntity = {\n id: number;\n ticker: string;\n underlyingAsset: string;\n quoteToken: string;\n markPrice: number;\n isActive: boolean;\n maxLeverage: number;\n volume24H: number;\n priceChange24H: number;\n priceChange24HPercentage: number;\n openInterest: number;\n fundingRate: number;\n description: string;\n orderInfo: MarketOrderInfo;\n tickSizeDecimals: number;\n};\n\nexport type GetMarketsResult = MarketEntity[];\n\nexport type GetMarketResult = MarketEntity;\n\nexport type GetMarketParams = {\n id: MarketEntity['id'];\n};\n\nexport type GetCandlesParams = {\n marketId: MarketEntity['id'];\n resolution: CandlesResolution;\n fromISO?: string | null;\n toISO?: string | null;\n limit?: number | null;\n};\n\n// -- Account --\n\nexport type Status = 'OPEN' | 'CLOSED' | 'LIQUIDATED' | 'FILLED';\nexport type Side = 'LONG' | 'SHORT';\n\nexport type GetMarginAccountsParams = {\n address: string;\n limit?: number;\n};\n\nexport type GetMarginAccountParams = {\n address: string;\n marginAccountId: MarginAccountEntity['id'];\n};\n\nexport type GetPositionsForMarginAccountParams = {\n address: string;\n marginAccountId: MarginAccountEntity['id'];\n limit?: number;\n};\n\nexport type MarginAccountEntity = {\n id: number;\n name: string;\n marginRatioHealth: 'danger' | 'healthy' | 'warning';\n marginRatioPercentage: number;\n totalBalance: number;\n totalBalanceUnderlyingAsset: string;\n collaterals: {\n token: string;\n percentage: number;\n balance: number;\n balanceRUSD: number;\n }[];\n};\n\nexport type GetMarginAccountsResult = MarginAccountEntity[];\nexport type GetMarginAccountResult = MarginAccountEntity;\n\nexport type PositionEntity = {\n id: number;\n side: Side;\n size: number;\n base: number;\n price: number;\n markPrice: number;\n orderStatus: Status;\n realisedPnl?: number | null;\n unrealisedPnl?: number | null;\n liquidationPrice: number;\n fundingRate: number;\n market: MarketEntity;\n date: Date;\n};\n\nexport type GetPositionsForMarginAccountResult = {\n positions: PositionEntity[];\n totalUnrealizedPNL: number;\n};\n\n// --- Trading History ----\n\nexport type GetMarketTradingHistoryParams = {\n marketId: number;\n limit?: number;\n};\n\nexport type TradingHistoryEntity = {\n id: number;\n price: number;\n priceUnderlyingToken: string;\n size: number;\n sizeUnderlyingToken: string;\n timestampMillisecondsUTC: number;\n};\n\nexport type GetTradingHistoryResult = TradingHistoryEntity[];\n\n// --- Position History ---\n\nexport type GetPositionsHistoryForMarginAccountParams = {\n address: string;\n marginAccountId: MarginAccountEntity['id'];\n limit?: number;\n};\n\nexport type OrderType = 'market';\n\nexport type PositionHistoryType =\n | 'long-trade'\n | 'short-trade'\n | 'long-liquidation'\n | 'short-liquidation';\n\nexport type PositionHistoryEntity = {\n id: number;\n action: PositionHistoryType;\n orderType: OrderType;\n size: number;\n executionPrice: number;\n realisedPnl?: number | null;\n fees: number;\n timestamp: number;\n market: MarketEntity;\n};\n\nexport type GetPositionsHistoryForMarginAccountResult = PositionHistoryEntity[];\n\n// -- Max Order Size --\n\nexport type GetMaxOrderSizeAvailableParams = {\n marketId: MarketEntity['id'];\n marginAccountId: MarginAccountEntity['id'];\n direction: 'long' | 'short';\n};\n\nexport type GetMaxOrderSizeAvailableResult = number;\n\n// --- Trade Simulation ----\n\nexport type SimulateTradeEntity = {\n liquidationPrice: number;\n fees: number;\n estimatedPrice: number;\n estimatedSlippage: number;\n imr: number;\n impliedLeverage: number;\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n};\n\nexport type TradeSimulationLoadDataParams = {\n marketId: MarketEntity['id'];\n marginAccountId: MarginAccountEntity['id'];\n};\n\nexport type TradeSimulationSimulateParams = {\n amount: number; // position size, + for long | - for short\n};\n\n// ---- LP ----\n\nexport enum SupportedChainId {\n mainnet = 1,\n polygonMumbai = 80001,\n}\n\nexport type LpPoolEntity = {\n id: number;\n name: string;\n description: string;\n currentAPY: number;\n balanceSupplied?: number | null;\n balanceChange24H: number;\n tokenAddress: string;\n token: string;\n allowedChainsForLiquidity: number[];\n chainId: SupportedChainId;\n};\n\nexport type GetLpPoolsResult = LpPoolEntity[];\n\nexport type GetLpPoolResult = LpPoolEntity;\n\nexport type GetLpPoolParams = {\n id: LpPoolEntity['id'];\n};\n\nexport type TransactionHistoryType = 'deposit' | 'withdrawal';\n\nexport type LpTransactionHistoryEntity = {\n id: number;\n type: TransactionHistoryType;\n token: string;\n amount: number;\n transactionHash: string;\n timestamp: number;\n};\n\nexport type GetLpPoolTransactionHistoryParams = {\n id: LpPoolEntity['id'];\n limit?: number;\n};\n\nexport type GetLpPoolTransactionHistoryResult = LpTransactionHistoryEntity[];\n\nexport type GetLpPoolPositionParams = {\n id: LpPoolEntity['id'];\n};\n\nexport type LpPositionEntity = {\n id: number;\n deposited: number;\n currentBalance: number;\n pnl: number;\n fundingRate: number;\n};\n\nexport type GetLpPositionsResult = LpPositionEntity[];\n\nexport type GetLpPoolWithdrawBalanceParams = {\n id: LpPoolEntity['id'];\n address: string; // wallet address\n};\n\nexport type GetLpPoolWithdrawBalanceResult = number;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,2CAAsB,CAAA;IACtB,+CAA0B,CAAA;IAC1B,8CAAyB,CAAA;IACzB,uCAAkB,CAAA;IAClB,0CAAqB,CAAA;IACrB,qCAAgB,CAAA;AAClB,CAAC,EARW,iBAAiB,iCAAjB,iBAAiB,QAQ5B;AA2MD,eAAe;AAEf,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,6DAAW,CAAA;IACX,6EAAqB,CAAA;AACvB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B","sourcesContent":["export enum CandlesResolution {\n ONE_MINUTE = '1MIN',\n FIVE_MINUTES = '5MINS',\n FIFTEEN_MINUTES = '15MINS',\n THIRTY_MINUTES = '30MINS',\n ONE_HOUR = '1HOUR',\n FOUR_HOURS = '4HOURS',\n ONE_DAY = '1DAY',\n}\n\n// -- Candles --\nexport interface Candle {\n id: string;\n startedAt: string;\n ticker: string;\n resolution: CandlesResolution;\n low: string;\n high: string;\n open: string;\n close: string;\n baseTokenVolume: string;\n usdVolume: string;\n trades: number;\n startingOpenInterest: string;\n}\n\nexport interface MarketCandlesResponse {\n candles: Candle[];\n}\n\n// -- Markets --\n\nexport type MarketOrderInfo = {\n counterpartyAccountIds: number[];\n exchangeId: number;\n};\n\nexport type MarketEntity = {\n id: number;\n ticker: string;\n underlyingAsset: string;\n quoteToken: string;\n markPrice: number;\n isActive: boolean;\n maxLeverage: number;\n volume24H: number;\n priceChange24H: number;\n priceChange24HPercentage: number;\n openInterest: number;\n fundingRate: number;\n description: string;\n orderInfo: MarketOrderInfo;\n tickSizeDecimals: number;\n};\n\nexport type GetMarketsResult = MarketEntity[];\n\nexport type GetMarketResult = MarketEntity;\n\nexport type GetMarketParams = {\n id: MarketEntity['id'];\n};\n\nexport type GetCandlesParams = {\n marketId: MarketEntity['id'];\n resolution: CandlesResolution;\n fromISO?: string | null;\n toISO?: string | null;\n limit?: number | null;\n};\n\n// -- Account --\n\nexport type Status = 'OPEN' | 'CLOSED' | 'LIQUIDATED' | 'FILLED';\nexport type Side = 'LONG' | 'SHORT';\n\nexport type GetMarginAccountsParams = {\n address: string;\n limit?: number;\n};\n\nexport type GetMarginAccountParams = {\n address: string;\n marginAccountId: MarginAccountEntity['id'];\n};\n\nexport type GetPositionsForMarginAccountParams = {\n address: string;\n marginAccountId: MarginAccountEntity['id'];\n limit?: number;\n};\n\nexport type MarginAccountEntity = {\n id: number;\n name: string;\n marginRatioHealth: 'danger' | 'healthy' | 'warning';\n marginRatioPercentage: number;\n totalBalance: number;\n totalBalanceUnderlyingAsset: string;\n collaterals: {\n token: string;\n percentage: number;\n balance: number;\n balanceRUSD: number;\n }[];\n};\n\nexport type GetMarginAccountsResult = MarginAccountEntity[];\nexport type GetMarginAccountResult = MarginAccountEntity;\n\nexport type PositionEntity = {\n id: number;\n side: Side;\n size: number;\n base: number;\n price: number;\n markPrice: number;\n orderStatus: Status;\n realisedPnl?: number | null;\n unrealisedPnl?: number | null;\n liquidationPrice: number;\n fundingRate: number;\n market: MarketEntity;\n date: Date;\n};\n\nexport type GetPositionsForMarginAccountResult = {\n positions: PositionEntity[];\n totalUnrealizedPNL: number;\n};\n\n// --- Trading History ----\n\nexport type GetMarketTradingHistoryParams = {\n marketId: number;\n limit?: number;\n};\n\nexport type TradingHistoryEntity = {\n id: number;\n price: number;\n priceUnderlyingToken: string;\n size: number;\n sizeUnderlyingToken: string;\n timestampMillisecondsUTC: number;\n};\n\nexport type GetTradingHistoryResult = TradingHistoryEntity[];\n\n// --- Position History ---\n\nexport type GetPositionsHistoryForMarginAccountParams = {\n address: string;\n marginAccountId: MarginAccountEntity['id'];\n limit?: number;\n};\n\nexport type OrderType = 'market';\n\nexport type PositionHistoryType =\n | 'long-trade'\n | 'short-trade'\n | 'long-liquidation'\n | 'short-liquidation';\n\nexport type PositionHistoryEntity = {\n id: number;\n action: PositionHistoryType;\n orderType: OrderType;\n size: number;\n executionPrice: number;\n realisedPnl?: number | null;\n fees: number;\n timestamp: number;\n market: MarketEntity;\n};\n\nexport type GetPositionsHistoryForMarginAccountResult = PositionHistoryEntity[];\n\n// -- Max Order Size --\n\nexport type GetMaxOrderSizeAvailableParams = {\n marketId: MarketEntity['id'];\n marginAccountId: MarginAccountEntity['id'];\n direction: 'long' | 'short';\n};\n\nexport type GetMaxOrderSizeAvailableResult = number;\n\n// --- Trade Simulation ----\n\nexport type SimulateTradeEntity = {\n liquidationPrice: number;\n fees: number;\n estimatedPrice: number;\n estimatedSlippage: number;\n imr: number;\n impliedLeverage: number;\n marginRatio: MarginAccountEntity['marginRatioPercentage'];\n marginRatioHealth: MarginAccountEntity['marginRatioHealth'];\n};\n\nexport type TradeSimulationLoadDataParams = {\n marketId: MarketEntity['id'];\n marginAccountId: MarginAccountEntity['id'];\n};\n\nexport type TradeSimulationSimulateParams = {\n amount: number; // position size, + for long | - for short\n};\n\n// ---- LP ----\n\nexport enum SupportedChainId {\n mainnet = 1,\n polygonMumbai = 80001,\n}\n\nexport type LpPoolEntity = {\n id: number;\n name: string;\n description: string;\n currentAPY: number;\n balanceSupplied?: number | null;\n balanceChange24H: number;\n tokenAddress: string;\n token: string;\n allowedChainsForLiquidity: number[];\n chainId: SupportedChainId;\n};\n\nexport type GetLpPoolsResult = LpPoolEntity[];\n\nexport type GetLpPoolResult = LpPoolEntity;\n\nexport type GetLpPoolParams = {\n id: LpPoolEntity['id'];\n};\n\nexport type TransactionHistoryType = 'deposit' | 'withdrawal';\n\nexport type LpTransactionHistoryEntity = {\n id: number;\n type: TransactionHistoryType;\n token: string;\n amount: number;\n transactionHash: string;\n timestamp: number;\n};\n\nexport type GetLpPoolTransactionHistoryParams = {\n id: LpPoolEntity['id'];\n limit?: number;\n};\n\nexport type GetLpPoolTransactionHistoryResult = LpTransactionHistoryEntity[];\n\nexport type GetLpPoolPositionParams = {\n id: LpPoolEntity['id'];\n};\n\nexport type LpPositionEntity = {\n id: number;\n deposited: number;\n currentBalance: number;\n pnl: number;\n fundingRate: number;\n};\n\nexport type GetLpPositionsResult = LpPositionEntity[];\n\nexport type GetLpPoolWithdrawBalanceParams = {\n id: LpPoolEntity['id'];\n address: string; // wallet address\n};\n\nexport type GetLpPoolWithdrawBalanceResult = number;\n\n// ---- Transaction Simulation ----\n\nexport type GetTransactionSimulationInitialDataParams = {\n marketId: MarketEntity['id'];\n marginAccountId: MarginAccountEntity['id'];\n};\n"]}
package/dist/index.js CHANGED
@@ -18,4 +18,6 @@ exports.ApiClient = void 0;
18
18
  var api_client_1 = require("./clients/api-client");
19
19
  Object.defineProperty(exports, "ApiClient", { enumerable: true, get: function () { return api_client_1.ApiClient; } });
20
20
  __exportStar(require("./clients/types"), exports);
21
+ __exportStar(require("./clients/helpers/exposure.calculator"), exports);
22
+ __exportStar(require("./clients/helpers/trade.simulation.types"), exports);
21
23
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAiD;AAAxC,uGAAA,SAAS,OAAA;AAClB,kDAAgC","sourcesContent":["export { ApiClient } from './clients/api-client';\nexport * from './clients/types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAiD;AAAxC,uGAAA,SAAS,OAAA;AAClB,kDAAgC;AAChC,wEAAsD;AACtD,2EAAyD","sourcesContent":["export { ApiClient } from './clients/api-client';\nexport * from './clients/types';\nexport * from './clients/helpers/exposure.calculator';\nexport * from './clients/helpers/trade.simulation.types';\n"]}
@@ -0,0 +1,58 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { AccountAssetBalance, CollateralInfo, ExchangeInfo, ExposureCommandState, MarginInfo, MarketConfiguration, MarketStorage, PositionInfo, PositionInfoMarketConfiguration, RiskMatrix, RiskMultipliersConfiguration } from './trade.simulation.types';
3
+ export declare class ExposureCommand {
4
+ rootCollateralPoolId: number;
5
+ oraclePrice: number;
6
+ rate: number;
7
+ accountBalancePerAsset: AccountAssetBalance[];
8
+ groupedByCollateral: Record<string, AccountAssetBalance>;
9
+ riskMultipliers: RiskMultipliersConfiguration;
10
+ riskMatrices: RiskMatrix[];
11
+ exchangeInfoPerAsset: ExchangeInfo[];
12
+ positionInfoMarketConfiguration: PositionInfoMarketConfiguration[];
13
+ uniqueTokenAddresses: string[];
14
+ uniqueQuoteCollaterals: string[];
15
+ tokenMarginInfoPerAsset: MarginInfo[];
16
+ realizedPnLSum: BigNumber;
17
+ unrealizedPnLSum: BigNumber;
18
+ constructor(rootCollateralPoolId: number, oraclePrice: number, rate: number, accountBalancePerAsset: AccountAssetBalance[], groupedByCollateral: Record<string, AccountAssetBalance>, riskMultipliers: RiskMultipliersConfiguration, riskMatrices: RiskMatrix[], exchangeInfoPerAsset: ExchangeInfo[], positionInfoMarketConfiguration: PositionInfoMarketConfiguration[], uniqueTokenAddresses: string[], uniqueQuoteCollaterals: string[], tokenMarginInfoPerAsset: MarginInfo[], realizedPnLSum: BigNumber, unrealizedPnLSum: BigNumber);
19
+ getState(): ExposureCommandState;
20
+ get getUsdNodeMarginInfo(): MarginInfo;
21
+ get balancePerAsset(): MarginInfo[];
22
+ getUsdNodeMarginInfoPostTrade(positionAmount: number, collateralAddress: string, marketConfiguration: MarketConfiguration): MarginInfo;
23
+ static calculateTokenMarginInfoPerAsset(groupedByCollateral: Record<string, AccountAssetBalance>, rootCollateralPoolId: number, riskMatrices: RiskMatrix[], riskMultipliers: RiskMultipliersConfiguration, uniqueQuoteCollaterals: Set<string>, realizedPnLSum: BigNumber, unrealizedPnLSum: BigNumber, positionInfoMarketConfiguration: PositionInfoMarketConfiguration[], oraclePrice: number): MarginInfo[];
24
+ static calculateLiquidation(globalMarginInfo: MarginInfo, oraclePrice: number, positionBase: number): BigNumber;
25
+ static calculateImpliedLeverage(notionalExposure: number, oldIMR: number, newIMR: number): number;
26
+ static combineMarginInfo(parentMarginInfo: MarginInfo, sonMarginInfo: MarginInfo, sonParentExchangeInfo: ExchangeInfo): MarginInfo;
27
+ static getUsdNodeMarginInfo(accountCollateralPoolId: number, quoteTokens: string[], exchangeInfoPerAsset: ExchangeInfo[], marginInfoPerToken: MarginInfo[]): MarginInfo;
28
+ static getCollateralInfo(collateralAddress: string, realisedPnl: BigNumber, unrealizedPnL: BigNumber, netDeposits: number): CollateralInfo;
29
+ static getTokenMarginInfo(rootCollateralPoolId: number, riskMatrices: RiskMatrix[], riskMultipliers: RiskMultipliersConfiguration, collateralInfo: CollateralInfo, collateralAddress: string, positions: PositionInfoMarketConfiguration[], oraclePrice: number): MarginInfo;
30
+ static computeLiquidationMarginRequirement(matrix: BigNumber[][], filledExposures: BigNumber[]): number;
31
+ static getBlockExposures(positions: PositionInfoMarketConfiguration[], oraclePrice: number): BigNumber[];
32
+ static getAccountFilledExposures(position: PositionInfo, marketConfiguration: MarketConfiguration, oraclePrice: number): {
33
+ exposure: BigNumber;
34
+ riskMatrixIndex: number;
35
+ };
36
+ static computePricePnL(openBase: BigNumber, openPrice: BigNumber, exitPrice: BigNumber): BigNumber;
37
+ static getMarginRatio(marginInfo: MarginInfo): number;
38
+ static exchangeWithPriceHaircut(quantity: number, price: number, haircut: number): number;
39
+ getSlippage(deltaBase: number, marketConfiguration: MarketConfiguration, marketStorage: MarketStorage): number;
40
+ getMaxExposure(marketConfiguration: MarketConfiguration, marketStorage: MarketStorage): {
41
+ maxExposureShort: number;
42
+ maxExposureLong: number;
43
+ exposures: BigNumber[];
44
+ };
45
+ static computeMaxExposures(riskMatrix: BigNumber[][], exposures: BigNumber[], lmr: number, balance: number, imrMultiplier: number, exposureIndex: number): {
46
+ maxExposureShort: number;
47
+ maxExposureLong: number;
48
+ };
49
+ static solveQuadraticEquation(a: number, b: number, c: number): {
50
+ x1: BigNumber;
51
+ x2: BigNumber;
52
+ };
53
+ static computeC(lmr: number, balance: number, imrMultiplier: number): number;
54
+ static calculateFee(price: number, amount: number, feeParameter: BigNumber): number;
55
+ static calculateEstimatedPrice(price: number, slippage: number): number;
56
+ static evaluateHealthStatus(number: number): "danger" | "healthy" | "warning";
57
+ }
58
+ //# sourceMappingURL=exposure.calculator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exposure.calculator.d.ts","sourceRoot":"/","sources":["clients/helpers/exposure.calculator.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,+BAA+B,EAC/B,UAAU,EACV,4BAA4B,EAC7B,MAAM,0BAA0B,CAAC;AAGlC,qBAAa,eAAe;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB,EAAE,mBAAmB,EAAE,CAAC;IAC9C,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACzD,eAAe,EAAE,4BAA4B,CAAC;IAC9C,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,oBAAoB,EAAE,YA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B,SAAS,EAAE,SAAS;IAOtB,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,UAAU;IAmB5C,MAAM,CAAC,wBAAwB,CAC7B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM;IAYjB,WAAW,CACT,SAAS,EAAE,MAAM,EACjB,mBAAmB,EAAE,mBAAmB,EACxC,aAAa,EAAE,aAAa,GAC3B,MAAM;IAqBT,cAAc,CACZ,mBAAmB,EAAE,mBAAmB,EACxC,aAAa,EAAE,aAAa;;;;;IAmD9B,MAAM,CAAC,mBAAmB,CACxB,UAAU,EAAE,SAAS,EAAE,EAAE,EACzB,SAAS,EAAE,SAAS,EAAE,EACtB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM;;;;IAoCvB,MAAM,CAAC,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;;;IA+B7D,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM;IAe5E,MAAM,CAAC,YAAY,CACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,SAAS,GACtB,MAAM;IAIT,MAAM,CAAC,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAIvE,MAAM,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM;CAU3C"}
@@ -0,0 +1,3 @@
1
+ import BigNumber from 'bignumber.js';
2
+ export declare function amountNormalizer(value: BigNumber | number | string, decimals?: number): BigNumber;
3
+ //# sourceMappingURL=number.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.d.ts","sourceRoot":"/","sources":["clients/helpers/number.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,EAClC,QAAQ,GAAE,MAAW,GACpB,SAAS,CAEX"}
@@ -0,0 +1,104 @@
1
+ import BigNumber from 'bignumber.js';
2
+ export interface MarketStorage {
3
+ market_id: number;
4
+ quote_collateral: string;
5
+ instrument_address: string;
6
+ name: string;
7
+ risk_block_id: number;
8
+ collateral_pool_id: number;
9
+ block_timestamp: number;
10
+ block_number: number;
11
+ }
12
+ export interface MarketConfiguration {
13
+ market_id: number;
14
+ risk_matrix_index: number;
15
+ max_open_interest: number;
16
+ oracle_node_id: string;
17
+ mtm_window: number;
18
+ dutch_config_lambda: number;
19
+ dutch_config_min_base: number;
20
+ slippage_params_phi: number;
21
+ slippage_params_beta: number;
22
+ block_timestamp: number;
23
+ block_number: number;
24
+ }
25
+ export type AccountAssetBalance = {
26
+ accountId: number;
27
+ collateral: string;
28
+ amount: number;
29
+ };
30
+ export interface RiskMultipliersConfiguration {
31
+ collateral_pool_id: number;
32
+ im_multiplier: number;
33
+ mmr_multiplier: number;
34
+ dutch_multiplier: number;
35
+ adl_multiplier: number;
36
+ im_buffer_multiplier: number;
37
+ block_timestamp: number;
38
+ block_number: number;
39
+ }
40
+ export interface RiskMatrix {
41
+ collateral_pool_id: number;
42
+ risk_block_id: number;
43
+ matrix: BigNumber[][];
44
+ }
45
+ export interface ExchangeInfo {
46
+ price: number;
47
+ priceHaircut: number;
48
+ autoExchangeDiscount: number;
49
+ tokenAddress: string;
50
+ }
51
+ export interface PositionInfo {
52
+ base: BigNumber;
53
+ realized_pnl: BigNumber;
54
+ last_price: BigNumber;
55
+ last_timestamp: BigNumber;
56
+ funding_value: BigNumber;
57
+ base_multiplier: BigNumber;
58
+ adl_unwind_price: BigNumber;
59
+ market_id: number;
60
+ }
61
+ export type PositionInfoMarketConfiguration = PositionInfo & {
62
+ market_configuration: MarketConfiguration;
63
+ };
64
+ export interface MarginInfo {
65
+ assetAddress: string;
66
+ marginBalance: number;
67
+ realBalance: number;
68
+ initialDelta: number;
69
+ maintenanceDelta: number;
70
+ liquidationDelta: number;
71
+ dutchDelta: number;
72
+ adlDelta: number;
73
+ initialBufferDelta: number;
74
+ liquidationMarginRequirement: number;
75
+ }
76
+ export interface CollateralInfo {
77
+ netDeposits: number;
78
+ marginBalance: number;
79
+ realBalance: number;
80
+ }
81
+ export type ExposureCommandState = {
82
+ rootCollateralPoolId: number;
83
+ oraclePrice: number;
84
+ rate: number;
85
+ accountBalancePerAsset: AccountAssetBalance[];
86
+ groupedByCollateral: Record<string, AccountAssetBalance>;
87
+ riskMultipliers: RiskMultipliersConfiguration;
88
+ riskMatrices: RiskMatrix[];
89
+ exchangeInfoPerAsset: ExchangeInfo[];
90
+ positionInfoMarketConfiguration: PositionInfoMarketConfiguration[];
91
+ uniqueTokenAddresses: string[];
92
+ uniqueQuoteCollaterals: string[];
93
+ tokenMarginInfoPerAsset: MarginInfo[];
94
+ realizedPnLSum: BigNumber;
95
+ unrealizedPnLSum: BigNumber;
96
+ };
97
+ export type TradeSimulationState = {
98
+ feeParameter: BigNumber;
99
+ marketStorage: MarketStorage;
100
+ marketConfiguration: MarketConfiguration;
101
+ exposureDataAccount: ExposureCommandState;
102
+ exposureDataPassivePool: ExposureCommandState;
103
+ };
104
+ //# sourceMappingURL=trade.simulation.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trade.simulation.types.d.ts","sourceRoot":"/","sources":["clients/helpers/trade.simulation.types.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B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AAU,EAAE,CAAC;IACtC,cAAc,EAAE,SAAS,CAAC;IAC1B,gBAAgB,EAAE,SAAS,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,EAAE,SAAS,CAAC;IACxB,aAAa,EAAE,aAAa,CAAC;IAC7B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,mBAAmB,EAAE,oBAAoB,CAAC;IAC1C,uBAAuB,EAAE,oBAAoB,CAAC;CAC/C,CAAC"}
@@ -1,5 +1,6 @@
1
- import { GetMarginAccountParams, GetMarginAccountResult, GetMarginAccountsParams, GetMarginAccountsResult, GetMaxOrderSizeAvailableParams, GetMaxOrderSizeAvailableResult, GetPositionsForMarginAccountParams, GetPositionsForMarginAccountResult, GetPositionsHistoryForMarginAccountParams, GetPositionsHistoryForMarginAccountResult } from '../types';
1
+ import { GetMarginAccountParams, GetMarginAccountResult, GetMarginAccountsParams, GetMarginAccountsResult, GetMaxOrderSizeAvailableParams, GetMaxOrderSizeAvailableResult, GetPositionsForMarginAccountParams, GetPositionsForMarginAccountResult, GetPositionsHistoryForMarginAccountParams, GetPositionsHistoryForMarginAccountResult, GetTransactionSimulationInitialDataParams } from '../types';
2
2
  import RestClient from './rest';
3
+ import { TradeSimulationState } from '../helpers/trade.simulation.types';
3
4
  export default class AccountClient extends RestClient {
4
5
  /**
5
6
  * Asynchronously retrieves a list of margin accounts associated with a specific address.
@@ -29,5 +30,6 @@ export default class AccountClient extends RestClient {
29
30
  getPositionsForMarginAccount(params: GetPositionsForMarginAccountParams): Promise<GetPositionsForMarginAccountResult>;
30
31
  getPositionsHistoryForMarginAccount(params: GetPositionsHistoryForMarginAccountParams): Promise<GetPositionsHistoryForMarginAccountResult>;
31
32
  getMaxOrderSizeAvailable(params: GetMaxOrderSizeAvailableParams): Promise<GetMaxOrderSizeAvailableResult>;
33
+ getTransactionSimulationInitialData(params: GetTransactionSimulationInitialDataParams): Promise<TradeSimulationState>;
32
34
  }
33
35
  //# sourceMappingURL=account.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.ts","sourceRoot":"/","sources":["clients/modules/account.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,8BAA8B,EAC9B,8BAA8B,EAC9B,kCAAkC,EAClC,kCAAkC,EAClC,yCAAyC,EACzC,yCAAyC,EAC1C,MAAM,UAAU,CAAC;AAClB,OAAO,UAAU,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD;;;;;;;;;;;SAWK;IAEC,iBAAiB,CACrB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC;IAKnC;;;;;;;;;;OAUG;IAEG,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAK5B,4BAA4B,CAChC,MAAM,EAAE,kCAAkC,GACzC,OAAO,CAAC,kCAAkC,CAAC;IAKxC,mCAAmC,CACvC,MAAM,EAAE,yCAAyC,GAChD,OAAO,CAAC,yCAAyC,CAAC;IAK/C,wBAAwB,CAC5B,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,8BAA8B,CAAC;CAO3C"}
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"/","sources":["clients/modules/account.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,8BAA8B,EAC9B,8BAA8B,EAC9B,kCAAkC,EAClC,kCAAkC,EAClC,yCAAyC,EACzC,yCAAyC,EACzC,yCAAyC,EAC1C,MAAM,UAAU,CAAC;AAClB,OAAO,UAAU,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD;;;;;;;;;;;SAWK;IAEC,iBAAiB,CACrB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC;IAKnC;;;;;;;;;;OAUG;IAEG,gBAAgB,CACpB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC;IAK5B,4BAA4B,CAChC,MAAM,EAAE,kCAAkC,GACzC,OAAO,CAAC,kCAAkC,CAAC;IAKxC,mCAAmC,CACvC,MAAM,EAAE,yCAAyC,GAChD,OAAO,CAAC,yCAAyC,CAAC;IAK/C,wBAAwB,CAC5B,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,8BAA8B,CAAC;IAQpC,mCAAmC,CACvC,MAAM,EAAE,yCAAyC,GAChD,OAAO,CAAC,oBAAoB,CAAC;CAMjC"}
@@ -1,8 +1,11 @@
1
1
  import { SimulateTradeEntity, TradeSimulationLoadDataParams, TradeSimulationSimulateParams } from '../types';
2
+ import AccountClient from './account';
2
3
  export default class TradeSimulationClient {
3
4
  private marketId;
4
5
  private accountId;
5
6
  private loadedData;
7
+ private accountClient;
8
+ constructor(accountClient: AccountClient);
6
9
  arm(params: TradeSimulationLoadDataParams): Promise<void>;
7
10
  private fetchMarketData;
8
11
  simulate(params: TradeSimulationSimulateParams): SimulateTradeEntity;
@@ -1 +1 @@
1
- {"version":3,"file":"trade.simulation.d.ts","sourceRoot":"/","sources":["clients/modules/trade.simulation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAyBlB,MAAM,CAAC,OAAO,OAAO,qBAAqB;IACxC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,UAAU,CAA2B;IAGvC,GAAG,CAAC,MAAM,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;YAcjD,eAAe;IAS7B,QAAQ,CAAC,MAAM,EAAE,6BAA6B,GAAG,mBAAmB;CAkBrE"}
1
+ {"version":3,"file":"trade.simulation.d.ts","sourceRoot":"/","sources":["clients/modules/trade.simulation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAClB,OAAO,aAAa,MAAM,WAAW,CAAC;AAKtC,MAAM,CAAC,OAAO,OAAO,qBAAqB;IACxC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,aAAa,CAAgB;gBACzB,aAAa,EAAE,aAAa;IAMlC,GAAG,CAAC,MAAM,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;YAOjD,eAAe;IAW7B,QAAQ,CAAC,MAAM,EAAE,6BAA6B,GAAG,mBAAmB;CAgGrE"}
@@ -8,6 +8,7 @@ export declare enum CandlesResolution {
8
8
  ONE_DAY = "1DAY"
9
9
  }
10
10
  export interface Candle {
11
+ id: string;
11
12
  startedAt: string;
12
13
  ticker: string;
13
14
  resolution: CandlesResolution;
@@ -19,7 +20,6 @@ export interface Candle {
19
20
  usdVolume: string;
20
21
  trades: number;
21
22
  startingOpenInterest: string;
22
- id: string;
23
23
  }
24
24
  export interface MarketCandlesResponse {
25
25
  candles: Candle[];
@@ -213,4 +213,8 @@ export type GetLpPoolWithdrawBalanceParams = {
213
213
  address: string;
214
214
  };
215
215
  export type GetLpPoolWithdrawBalanceResult = number;
216
+ export type GetTransactionSimulationInitialDataParams = {
217
+ marketId: MarketEntity['id'];
218
+ marginAccountId: MarginAccountEntity['id'];
219
+ };
216
220
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["clients/types.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,UAAU,SAAS;IACnB,YAAY,UAAU;IACtB,eAAe,WAAW;IAC1B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M,MAAM,8BAA8B,GAAG,MAAM,CAAC;AAIpD,MAAM,MAAM,yCAAyC,GAAG;IACtD,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,eAAe,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;CAC5C,CAAC"}
@@ -1,3 +1,5 @@
1
1
  export { ApiClient } from './clients/api-client';
2
2
  export * from './clients/types';
3
+ export * from './clients/helpers/exposure.calculator';
4
+ export * from './clients/helpers/trade.simulation.types';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,cAAc,iBAAiB,CAAC;AAChC,cAAc,uCAAuC,CAAC;AACtD,cAAc,0CAA0C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/api-sdk",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -33,8 +33,9 @@
33
33
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
34
34
  },
35
35
  "dependencies": {
36
- "axios": "^1.6.2"
36
+ "axios": "^1.6.2",
37
+ "bignumber.js": "^9.1.2"
37
38
  },
38
39
  "packageManager": "pnpm@8.10.4",
39
- "gitHead": "a6c9835a327dc4ebda467a80acb7991e12c4f28c"
40
+ "gitHead": "d8f0fae6d55cdef6e843c93ac81b69b915154c79"
40
41
  }
@@ -30,7 +30,7 @@ export class ApiClient {
30
30
  this._markets = new MarketsClient(this.apiEndpoint);
31
31
  this._account = new AccountClient(this.apiEndpoint);
32
32
  this._lp = new LpClient(this.apiEndpoint);
33
- this._trade_simulation = new TradeSimulationClient();
33
+ this._trade_simulation = new TradeSimulationClient(this._account);
34
34
  }
35
35
 
36
36
  public static configure(config: ServiceConfig): void {