@reyaxyz/api-sdk 0.10.0 → 0.11.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.
@@ -61,14 +61,14 @@ var AccountClient = /** @class */ (function (_super) {
61
61
  return _super !== null && _super.apply(this, arguments) || this;
62
62
  }
63
63
  /**
64
- * Asynchronously retrieves a list of collateral accounts associated with a specific address.
64
+ * Asynchronously retrieves a list of margin accounts associated with a specific address.
65
65
  *
66
66
  * This method makes a request to the API endpoint to fetch collateral account data. The data is filtered
67
67
  * based on the provided Ethereum address. An optional limit can be specified to control the number of
68
68
  * collateral accounts returned in the response.
69
69
  *
70
70
  * @param {GetMarginAccountsParams} params
71
- * @returns {Promise<MarginAccountEntity[]>} A promise that resolves to the response containing the margin
71
+ * @returns {Promise<GetMarginAccountsResult>} A promise that resolves to the response containing the margin
72
72
  * account data.
73
73
  * @memberof account
74
74
  * */
@@ -88,19 +88,37 @@ var AccountClient = /** @class */ (function (_super) {
88
88
  * associated with the provided Ethereum address. The account is identified using the collateral account number.
89
89
  *
90
90
  * @param {GetMarginAccountParams} params
91
- * @returns {Promise<MarginAccountEntity>} A promise that resolves to the response containing the detailed
91
+ * @returns {Promise<GetMarginAccountResult>} A promise that resolves to the response containing the detailed
92
92
  * information of the specified margin account.
93
93
  * @memberof account
94
94
  */
95
- AccountClient.prototype.getCollateralAccount = function (params) {
95
+ AccountClient.prototype.getMarginAccount = function (params) {
96
96
  return __awaiter(this, void 0, void 0, function () {
97
97
  var uri;
98
98
  return __generator(this, function (_a) {
99
- uri = "/api/accounts/".concat(params.address, "/collateralAccount/").concat(params.marginAccountNumber);
99
+ uri = "/api/accounts/".concat(params.address, "/marginAccount/").concat(params.marginAccountId);
100
100
  return [2 /*return*/, this.get(uri)];
101
101
  });
102
102
  });
103
103
  };
104
+ AccountClient.prototype.getPositionsForMarginAccount = function (params) {
105
+ return __awaiter(this, void 0, void 0, function () {
106
+ var uri;
107
+ return __generator(this, function (_a) {
108
+ uri = "/api/accounts/".concat(params.address, "/marginAccount/").concat(params.marginAccountId, "/positions");
109
+ return [2 /*return*/, this.get(uri, { limit: params.limit })];
110
+ });
111
+ });
112
+ };
113
+ AccountClient.prototype.getPositionsHistoryForMarginAccount = function (params) {
114
+ return __awaiter(this, void 0, void 0, function () {
115
+ var uri;
116
+ return __generator(this, function (_a) {
117
+ uri = "/api/accounts/".concat(params.address, "/marginAccount/").concat(params.marginAccountId, "/positions/history");
118
+ return [2 /*return*/, this.get(uri, { limit: params.limit })];
119
+ });
120
+ });
121
+ };
104
122
  return AccountClient;
105
123
  }(rest_1.default));
106
124
  exports.default = AccountClient;
@@ -1 +1 @@
1
- {"version":3,"file":"account.js","sourceRoot":"/","sources":["clients/modules/account.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,gDAAgC;AAEhC;IAA2C,iCAAU;IAArD;;IAuCA,CAAC;IAtCC;;;;;;;;;;;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,4CAAoB,GAA1B,UACE,MAA8B;;;;gBAExB,GAAG,GAAG,wBAAiB,MAAM,CAAC,OAAO,gCAAsB,MAAM,CAAC,mBAAmB,CAAE,CAAC;gBAC9F,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IACH,oBAAC;AAAD,CAAC,AAvCD,CAA2C,cAAU,GAuCpD","sourcesContent":["import {\n GetMarginAccountParams,\n GetMarginAccountsParams,\n MarginAccountEntity,\n} from '../types';\nimport RestClient from './rest';\n\nexport default class AccountClient extends RestClient {\n /**\n * Asynchronously retrieves a list of collateral 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<MarginAccountEntity[]>} 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<MarginAccountEntity[]> {\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<MarginAccountEntity>} A promise that resolves to the response containing the detailed\n * information of the specified margin account.\n * @memberof account\n */\n\n async getCollateralAccount(\n params: GetMarginAccountParams,\n ): Promise<MarginAccountEntity> {\n const uri = `/api/accounts/${params.address}/collateralAccount/${params.marginAccountNumber}`;\n return this.get(uri);\n }\n}\n"]}
1
+ {"version":3,"file":"account.js","sourceRoot":"/","sources":["clients/modules/account.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,gDAAgC;AAEhC;IAA2C,iCAAU;IAArD;;IAqDA,CAAC;IApDC;;;;;;;;;;;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;IACH,oBAAC;AAAD,CAAC,AArDD,CAA2C,cAAU,GAqDpD","sourcesContent":["import {\n GetMarginAccountParams,\n GetMarginAccountResult,\n GetMarginAccountsParams,\n GetMarginAccountsResult,\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"]}
@@ -66,8 +66,7 @@ var MarketsClient = /** @class */ (function (_super) {
66
66
  * This method makes a request to the API to fetch data for markets. If a specific market is provided as a parameter,
67
67
  * it fetches data for that particular market; otherwise, it fetches data for all available markets.
68
68
  *
69
- * @param {GetMarketsParams} [params] - The specific market ticker identifier for which data is requested. This parameter is optional.
70
- * @returns {Promise<MarketEntity[]>} A promise that resolves to the response containing market data.
69
+ * @returns {Promise<GetMarketsResult>} A promise that resolves to the response containing market data.
71
70
  * @memberof MarketsClient
72
71
  *
73
72
  * @example
@@ -78,12 +77,21 @@ var MarketsClient = /** @class */ (function (_super) {
78
77
  * // Fetch data for a specific market
79
78
  * const specificMarketData = await market.getMarkets('ETH-USDC');
80
79
  */
81
- MarketsClient.prototype.getMarkets = function (params) {
80
+ MarketsClient.prototype.getMarkets = function () {
82
81
  return __awaiter(this, void 0, void 0, function () {
83
82
  var uri;
84
83
  return __generator(this, function (_a) {
85
84
  uri = '/api/markets';
86
- return [2 /*return*/, this.get(uri, { id: params === null || params === void 0 ? void 0 : params.id })];
85
+ return [2 /*return*/, this.get(uri)];
86
+ });
87
+ });
88
+ };
89
+ MarketsClient.prototype.getMarket = function (params) {
90
+ return __awaiter(this, void 0, void 0, function () {
91
+ var uri;
92
+ return __generator(this, function (_a) {
93
+ uri = "/api/markets/".concat(params.id);
94
+ return [2 /*return*/, this.get(uri)];
87
95
  });
88
96
  });
89
97
  };
@@ -93,38 +101,34 @@ var MarketsClient = /** @class */ (function (_super) {
93
101
  * This method fetches historical candlestick (or OHLC - Open, High, Low, Close) data for a given market.
94
102
  * The data can be filtered by time range (fromISO and toISO) and resolution.
95
103
  *
96
- * @param {number} marketId - The market identifier for which candlestick data is to be retrieved.
97
- * @param {CandlesResolution} resolution - The granularity of the candlestick data (e.g., '1MIN', '5MIN', '1HR').
98
- * @param {string|null} [fromISO] - The start time for the range of candlestick data in ISO 8601 format. Optional.
99
- * @param {string|null} [toISO] - The end time for the range of candlestick data in ISO 8601 format. Optional.
100
- * @param {number|null} [limit] - The maximum number of candlestick data points to retrieve. Optional.
104
+ * @param {GetCandlesParams} params
101
105
  * @returns {Promise<MarketCandlesResponse>} A promise that resolves to the market candlestick data.
102
106
  * @memberof MarketsClient
103
107
  *
104
108
  * @example
105
109
  * const marketCandles = await market.getMarketCandles('BTC-USD', '1HR', '2023-01-01T00:00:00Z', '2023-01-02T00:00:00Z');
106
110
  */
107
- MarketsClient.prototype.getMarketCandles = function (marketId, resolution, fromISO, toISO, limit) {
111
+ MarketsClient.prototype.getMarketCandles = function (params) {
108
112
  return __awaiter(this, void 0, void 0, function () {
109
113
  var uri;
110
114
  return __generator(this, function (_a) {
111
- uri = "/api/markets/candles/".concat(marketId);
115
+ uri = "/api/markets/candles/".concat(params.marketId);
112
116
  return [2 /*return*/, this.get(uri, {
113
- resolution: resolution,
114
- fromISO: fromISO,
115
- toISO: toISO,
116
- limit: limit,
117
+ resolution: params.resolution,
118
+ fromISO: params.fromISO,
119
+ toISO: params.toISO,
120
+ limit: params.limit,
117
121
  })];
118
122
  });
119
123
  });
120
124
  };
121
- MarketsClient.prototype.getPerpetualMarketTrades = function (marketId, limit) {
125
+ MarketsClient.prototype.getMarketTradingHistory = function (params) {
122
126
  return __awaiter(this, void 0, void 0, function () {
123
127
  var uri;
124
128
  return __generator(this, function (_a) {
125
- uri = "/api/trades/".concat(marketId);
129
+ uri = "/api/trades/".concat(params.marketId);
126
130
  return [2 /*return*/, this.get(uri, {
127
- limit: limit,
131
+ limit: params.limit,
128
132
  })];
129
133
  });
130
134
  });
@@ -1 +1 @@
1
- {"version":3,"file":"markets.js","sourceRoot":"/","sources":["clients/modules/markets.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,gDAAgC;AAEhC;IAA2C,iCAAU;IAArD;;IAoEA,CAAC;IAnEC;;;;;;;;;;;;;;;;;OAiBG;IAEG,kCAAU,GAAhB,UAAiB,MAAyB;;;;gBAClC,GAAG,GAAG,cAAc,CAAC;gBAC3B,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,EAAE,EAAE,CAAC,EAAC;;;KAC1C;IAED;;;;;;;;;;;;;;;;OAgBG;IAEG,wCAAgB,GAAtB,UACE,QAA4B,EAC5B,UAA6B,EAC7B,OAAuB,EACvB,KAAqB,EACrB,KAAqB;;;;gBAEf,GAAG,GAAG,+BAAwB,QAAQ,CAAE,CAAC;gBAC/C,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,UAAU,YAAA;wBACV,OAAO,SAAA;wBACP,KAAK,OAAA;wBACL,KAAK,OAAA;qBACN,CAAC,EAAC;;;KACJ;IAEK,gDAAwB,GAA9B,UACE,QAAgB,EAChB,KAAqB;;;;gBAEf,GAAG,GAAG,sBAAe,QAAQ,CAAE,CAAC;gBACtC,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,KAAK,OAAA;qBACN,CAAC,EAAC;;;KACJ;IACH,oBAAC;AAAD,CAAC,AApED,CAA2C,cAAU,GAoEpD","sourcesContent":["import {\n CandlesResolution,\n GetMarketsParams,\n MarketCandlesResponse,\n MarketEntity,\n TradesResponse,\n} from '../types';\nimport RestClient from './rest';\n\nexport default class MarketsClient extends RestClient {\n /**\n * Asynchronously retrieves market data from the API.\n *\n * This method makes a request to the API to fetch data for markets. If a specific market is provided as a parameter,\n * it fetches data for that particular market; otherwise, it fetches data for all available markets.\n *\n * @param {GetMarketsParams} [params] - The specific market ticker identifier for which data is requested. This parameter is optional.\n * @returns {Promise<MarketEntity[]>} A promise that resolves to the response containing market data.\n * @memberof MarketsClient\n *\n * @example\n * // Fetch data for all markets\n * const allMarketsData = await market.getMarkets();\n *\n * @example\n * // Fetch data for a specific market\n * const specificMarketData = await market.getMarkets('ETH-USDC');\n */\n\n async getMarkets(params?: GetMarketsParams): Promise<MarketEntity[]> {\n const uri = '/api/markets';\n return this.get(uri, { id: params?.id });\n }\n\n /**\n * Retrieves candlestick data for a specified market.\n *\n * This method fetches historical candlestick (or OHLC - Open, High, Low, Close) data for a given market.\n * The data can be filtered by time range (fromISO and toISO) and resolution.\n *\n * @param {number} marketId - The market identifier for which candlestick data is to be retrieved.\n * @param {CandlesResolution} resolution - The granularity of the candlestick data (e.g., '1MIN', '5MIN', '1HR').\n * @param {string|null} [fromISO] - The start time for the range of candlestick data in ISO 8601 format. Optional.\n * @param {string|null} [toISO] - The end time for the range of candlestick data in ISO 8601 format. Optional.\n * @param {number|null} [limit] - The maximum number of candlestick data points to retrieve. Optional.\n * @returns {Promise<MarketCandlesResponse>} A promise that resolves to the market candlestick data.\n * @memberof MarketsClient\n *\n * @example\n * const marketCandles = await market.getMarketCandles('BTC-USD', '1HR', '2023-01-01T00:00:00Z', '2023-01-02T00:00:00Z');\n */\n\n async getMarketCandles(\n marketId: MarketEntity['id'],\n resolution: CandlesResolution,\n fromISO?: string | null,\n toISO?: string | null,\n limit?: number | null,\n ): Promise<MarketCandlesResponse> {\n const uri = `/api/markets/candles/${marketId}`;\n return this.get(uri, {\n resolution,\n fromISO,\n toISO,\n limit,\n });\n }\n\n async getPerpetualMarketTrades(\n marketId: number,\n limit?: number | null,\n ): Promise<TradesResponse> {\n const uri = `/api/trades/${marketId}`;\n return this.get(uri, {\n limit,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"markets.js","sourceRoot":"/","sources":["clients/modules/markets.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,gDAAgC;AAEhC;IAA2C,iCAAU;IAArD;;IA+DA,CAAC;IA9DC;;;;;;;;;;;;;;;;OAgBG;IAEG,kCAAU,GAAhB;;;;gBACQ,GAAG,GAAG,cAAc,CAAC;gBAC3B,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IAEK,iCAAS,GAAf,UAAgB,MAAuB;;;;gBAC/B,GAAG,GAAG,uBAAgB,MAAM,CAAC,EAAE,CAAE,CAAC;gBACxC,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IAED;;;;;;;;;;;;OAYG;IAEG,wCAAgB,GAAtB,UACE,MAAwB;;;;gBAElB,GAAG,GAAG,+BAAwB,MAAM,CAAC,QAAQ,CAAE,CAAC;gBACtD,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,UAAU,EAAE,MAAM,CAAC,UAAU;wBAC7B,OAAO,EAAE,MAAM,CAAC,OAAO;wBACvB,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,KAAK,EAAE,MAAM,CAAC,KAAK;qBACpB,CAAC,EAAC;;;KACJ;IAEK,+CAAuB,GAA7B,UACE,MAAqC;;;;gBAE/B,GAAG,GAAG,sBAAe,MAAM,CAAC,QAAQ,CAAE,CAAC;gBAC7C,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;wBACnB,KAAK,EAAE,MAAM,CAAC,KAAK;qBACpB,CAAC,EAAC;;;KACJ;IACH,oBAAC;AAAD,CAAC,AA/DD,CAA2C,cAAU,GA+DpD","sourcesContent":["import {\n GetCandlesParams,\n GetMarketParams,\n GetMarketResult,\n GetMarketsResult,\n GetMarketTradingHistoryParams,\n GetTradingHistoryResult,\n MarketCandlesResponse,\n} from '../types';\nimport RestClient from './rest';\n\nexport default class MarketsClient extends RestClient {\n /**\n * Asynchronously retrieves market data from the API.\n *\n * This method makes a request to the API to fetch data for markets. If a specific market is provided as a parameter,\n * it fetches data for that particular market; otherwise, it fetches data for all available markets.\n *\n * @returns {Promise<GetMarketsResult>} A promise that resolves to the response containing market data.\n * @memberof MarketsClient\n *\n * @example\n * // Fetch data for all markets\n * const allMarketsData = await market.getMarkets();\n *\n * @example\n * // Fetch data for a specific market\n * const specificMarketData = await market.getMarkets('ETH-USDC');\n */\n\n async getMarkets(): Promise<GetMarketsResult> {\n const uri = '/api/markets';\n return this.get(uri);\n }\n\n async getMarket(params: GetMarketParams): Promise<GetMarketResult> {\n const uri = `/api/markets/${params.id}`;\n return this.get(uri);\n }\n\n /**\n * Retrieves candlestick data for a specified market.\n *\n * This method fetches historical candlestick (or OHLC - Open, High, Low, Close) data for a given market.\n * The data can be filtered by time range (fromISO and toISO) and resolution.\n *\n * @param {GetCandlesParams} params\n * @returns {Promise<MarketCandlesResponse>} A promise that resolves to the market candlestick data.\n * @memberof MarketsClient\n *\n * @example\n * const marketCandles = await market.getMarketCandles('BTC-USD', '1HR', '2023-01-01T00:00:00Z', '2023-01-02T00:00:00Z');\n */\n\n async getMarketCandles(\n params: GetCandlesParams,\n ): Promise<MarketCandlesResponse> {\n const uri = `/api/markets/candles/${params.marketId}`;\n return this.get(uri, {\n resolution: params.resolution,\n fromISO: params.fromISO,\n toISO: params.toISO,\n limit: params.limit,\n });\n }\n\n async getMarketTradingHistory(\n params: GetMarketTradingHistoryParams,\n ): Promise<GetTradingHistoryResult> {\n const uri = `/api/trades/${params.marketId}`;\n return this.get(uri, {\n limit: params.limit,\n });\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","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 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 tickSizeDecimals: number;\n};\n\nexport type GetMarketsParams = {\n id?: number;\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 marginAccountNumber: 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 interface Position {\n id: number;\n symbol: string;\n side: Side;\n size: number;\n price: number;\n orderStatus: Status;\n markPrice: number;\n unrealisedPnl: number;\n realisedPnl: number;\n liquidationPrice: number;\n fundingRate: string;\n date: string;\n}\n\nexport type Trade = {\n id: number;\n side: Side;\n size: string;\n price: number;\n date: string;\n txId: string;\n};\n\nexport type TradesResponse = {\n trades: Trade[];\n};\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","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 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 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 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"]}
@@ -1,19 +1,19 @@
1
- import { GetMarginAccountParams, GetMarginAccountsParams, MarginAccountEntity } from '../types';
1
+ import { GetMarginAccountParams, GetMarginAccountResult, GetMarginAccountsParams, GetMarginAccountsResult, GetPositionsForMarginAccountParams, GetPositionsForMarginAccountResult, GetPositionsHistoryForMarginAccountParams, GetPositionsHistoryForMarginAccountResult } from '../types';
2
2
  import RestClient from './rest';
3
3
  export default class AccountClient extends RestClient {
4
4
  /**
5
- * Asynchronously retrieves a list of collateral accounts associated with a specific address.
5
+ * Asynchronously retrieves a list of margin accounts associated with a specific address.
6
6
  *
7
7
  * This method makes a request to the API endpoint to fetch collateral account data. The data is filtered
8
8
  * based on the provided Ethereum address. An optional limit can be specified to control the number of
9
9
  * collateral accounts returned in the response.
10
10
  *
11
11
  * @param {GetMarginAccountsParams} params
12
- * @returns {Promise<MarginAccountEntity[]>} A promise that resolves to the response containing the margin
12
+ * @returns {Promise<GetMarginAccountsResult>} A promise that resolves to the response containing the margin
13
13
  * account data.
14
14
  * @memberof account
15
15
  * */
16
- getMarginAccounts(params: GetMarginAccountsParams): Promise<MarginAccountEntity[]>;
16
+ getMarginAccounts(params: GetMarginAccountsParams): Promise<GetMarginAccountsResult>;
17
17
  /**
18
18
  * Asynchronously retrieves details of a specific collateral account for a given Ethereum address.
19
19
  *
@@ -21,10 +21,12 @@ export default class AccountClient extends RestClient {
21
21
  * associated with the provided Ethereum address. The account is identified using the collateral account number.
22
22
  *
23
23
  * @param {GetMarginAccountParams} params
24
- * @returns {Promise<MarginAccountEntity>} A promise that resolves to the response containing the detailed
24
+ * @returns {Promise<GetMarginAccountResult>} A promise that resolves to the response containing the detailed
25
25
  * information of the specified margin account.
26
26
  * @memberof account
27
27
  */
28
- getCollateralAccount(params: GetMarginAccountParams): Promise<MarginAccountEntity>;
28
+ getMarginAccount(params: GetMarginAccountParams): Promise<GetMarginAccountResult>;
29
+ getPositionsForMarginAccount(params: GetPositionsForMarginAccountParams): Promise<GetPositionsForMarginAccountResult>;
30
+ getPositionsHistoryForMarginAccount(params: GetPositionsHistoryForMarginAccountParams): Promise<GetPositionsHistoryForMarginAccountResult>;
29
31
  }
30
32
  //# 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,uBAAuB,EACvB,mBAAmB,EACpB,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,mBAAmB,EAAE,CAAC;IAKjC;;;;;;;;;;OAUG;IAEG,oBAAoB,CACxB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,mBAAmB,CAAC;CAIhC"}
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,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;CAItD"}
@@ -1,4 +1,4 @@
1
- import { CandlesResolution, GetMarketsParams, MarketCandlesResponse, MarketEntity, TradesResponse } from '../types';
1
+ import { GetCandlesParams, GetMarketParams, GetMarketResult, GetMarketsResult, GetMarketTradingHistoryParams, GetTradingHistoryResult, MarketCandlesResponse } from '../types';
2
2
  import RestClient from './rest';
3
3
  export default class MarketsClient extends RestClient {
4
4
  /**
@@ -7,8 +7,7 @@ export default class MarketsClient extends RestClient {
7
7
  * This method makes a request to the API to fetch data for markets. If a specific market is provided as a parameter,
8
8
  * it fetches data for that particular market; otherwise, it fetches data for all available markets.
9
9
  *
10
- * @param {GetMarketsParams} [params] - The specific market ticker identifier for which data is requested. This parameter is optional.
11
- * @returns {Promise<MarketEntity[]>} A promise that resolves to the response containing market data.
10
+ * @returns {Promise<GetMarketsResult>} A promise that resolves to the response containing market data.
12
11
  * @memberof MarketsClient
13
12
  *
14
13
  * @example
@@ -19,25 +18,22 @@ export default class MarketsClient extends RestClient {
19
18
  * // Fetch data for a specific market
20
19
  * const specificMarketData = await market.getMarkets('ETH-USDC');
21
20
  */
22
- getMarkets(params?: GetMarketsParams): Promise<MarketEntity[]>;
21
+ getMarkets(): Promise<GetMarketsResult>;
22
+ getMarket(params: GetMarketParams): Promise<GetMarketResult>;
23
23
  /**
24
24
  * Retrieves candlestick data for a specified market.
25
25
  *
26
26
  * This method fetches historical candlestick (or OHLC - Open, High, Low, Close) data for a given market.
27
27
  * The data can be filtered by time range (fromISO and toISO) and resolution.
28
28
  *
29
- * @param {number} marketId - The market identifier for which candlestick data is to be retrieved.
30
- * @param {CandlesResolution} resolution - The granularity of the candlestick data (e.g., '1MIN', '5MIN', '1HR').
31
- * @param {string|null} [fromISO] - The start time for the range of candlestick data in ISO 8601 format. Optional.
32
- * @param {string|null} [toISO] - The end time for the range of candlestick data in ISO 8601 format. Optional.
33
- * @param {number|null} [limit] - The maximum number of candlestick data points to retrieve. Optional.
29
+ * @param {GetCandlesParams} params
34
30
  * @returns {Promise<MarketCandlesResponse>} A promise that resolves to the market candlestick data.
35
31
  * @memberof MarketsClient
36
32
  *
37
33
  * @example
38
34
  * const marketCandles = await market.getMarketCandles('BTC-USD', '1HR', '2023-01-01T00:00:00Z', '2023-01-02T00:00:00Z');
39
35
  */
40
- getMarketCandles(marketId: MarketEntity['id'], resolution: CandlesResolution, fromISO?: string | null, toISO?: string | null, limit?: number | null): Promise<MarketCandlesResponse>;
41
- getPerpetualMarketTrades(marketId: number, limit?: number | null): Promise<TradesResponse>;
36
+ getMarketCandles(params: GetCandlesParams): Promise<MarketCandlesResponse>;
37
+ getMarketTradingHistory(params: GetMarketTradingHistoryParams): Promise<GetTradingHistoryResult>;
42
38
  }
43
39
  //# sourceMappingURL=markets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markets.d.ts","sourceRoot":"/","sources":["clients/modules/markets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,UAAU,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD;;;;;;;;;;;;;;;;;OAiBG;IAEG,UAAU,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAKpE;;;;;;;;;;;;;;;;OAgBG;IAEG,gBAAgB,CACpB,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,EAC5B,UAAU,EAAE,iBAAiB,EAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,EACvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GACpB,OAAO,CAAC,qBAAqB,CAAC;IAU3B,wBAAwB,CAC5B,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GACpB,OAAO,CAAC,cAAc,CAAC;CAM3B"}
1
+ {"version":3,"file":"markets.d.ts","sourceRoot":"/","sources":["clients/modules/markets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,6BAA6B,EAC7B,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAClB,OAAO,UAAU,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU;IACnD;;;;;;;;;;;;;;;;OAgBG;IAEG,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAKvC,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAKlE;;;;;;;;;;;;OAYG;IAEG,gBAAgB,CACpB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,qBAAqB,CAAC;IAU3B,uBAAuB,CAC3B,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,uBAAuB,CAAC;CAMpC"}
@@ -40,8 +40,17 @@ export type MarketEntity = {
40
40
  description: string;
41
41
  tickSizeDecimals: number;
42
42
  };
43
- export type GetMarketsParams = {
44
- id?: number;
43
+ export type GetMarketsResult = MarketEntity[];
44
+ export type GetMarketResult = MarketEntity;
45
+ export type GetMarketParams = {
46
+ id: MarketEntity['id'];
47
+ };
48
+ export type GetCandlesParams = {
49
+ marketId: MarketEntity['id'];
50
+ resolution: CandlesResolution;
51
+ fromISO?: string | null;
52
+ toISO?: string | null;
53
+ limit?: number | null;
45
54
  };
46
55
  export type Status = 'OPEN' | 'CLOSED' | 'LIQUIDATED' | 'FILLED';
47
56
  export type Side = 'LONG' | 'SHORT';
@@ -51,7 +60,12 @@ export type GetMarginAccountsParams = {
51
60
  };
52
61
  export type GetMarginAccountParams = {
53
62
  address: string;
54
- marginAccountNumber: number;
63
+ marginAccountId: MarginAccountEntity['id'];
64
+ };
65
+ export type GetPositionsForMarginAccountParams = {
66
+ address: string;
67
+ marginAccountId: MarginAccountEntity['id'];
68
+ limit?: number;
55
69
  };
56
70
  export type MarginAccountEntity = {
57
71
  id: number;
@@ -67,29 +81,56 @@ export type MarginAccountEntity = {
67
81
  balanceRUSD: number;
68
82
  }[];
69
83
  };
70
- export interface Position {
84
+ export type GetMarginAccountsResult = MarginAccountEntity[];
85
+ export type GetMarginAccountResult = MarginAccountEntity;
86
+ export type PositionEntity = {
71
87
  id: number;
72
- symbol: string;
73
88
  side: Side;
74
89
  size: number;
75
90
  price: number;
76
- orderStatus: Status;
77
91
  markPrice: number;
78
- unrealisedPnl: number;
79
- realisedPnl: number;
92
+ orderStatus: Status;
93
+ realisedPnl?: number | null;
94
+ unrealisedPnl?: number | null;
80
95
  liquidationPrice: number;
81
- fundingRate: string;
82
- date: string;
83
- }
84
- export type Trade = {
96
+ fundingRate: number;
97
+ market: MarketEntity;
98
+ date: Date;
99
+ };
100
+ export type GetPositionsForMarginAccountResult = {
101
+ positions: PositionEntity[];
102
+ totalUnrealizedPNL: number;
103
+ };
104
+ export type GetMarketTradingHistoryParams = {
105
+ marketId: number;
106
+ limit?: number;
107
+ };
108
+ export type TradingHistoryEntity = {
85
109
  id: number;
86
- side: Side;
87
- size: string;
88
110
  price: number;
89
- date: string;
90
- txId: string;
111
+ priceUnderlyingToken: string;
112
+ size: number;
113
+ sizeUnderlyingToken: string;
114
+ timestampMillisecondsUTC: number;
91
115
  };
92
- export type TradesResponse = {
93
- trades: Trade[];
116
+ export type GetTradingHistoryResult = TradingHistoryEntity[];
117
+ export type GetPositionsHistoryForMarginAccountParams = {
118
+ address: string;
119
+ marginAccountId: MarginAccountEntity['id'];
120
+ limit?: number;
121
+ };
122
+ export type OrderType = 'market';
123
+ export type PositionHistoryType = 'long-trade' | 'short-trade' | 'long-liquidation' | 'short-liquidation';
124
+ export type PositionHistoryEntity = {
125
+ id: number;
126
+ action: PositionHistoryType;
127
+ orderType: OrderType;
128
+ size: number;
129
+ executionPrice: number;
130
+ realisedPnl?: number | null;
131
+ fees: number;
132
+ timestamp: number;
133
+ market: MarketEntity;
94
134
  };
135
+ export type GetPositionsHistoryForMarginAccountResult = PositionHistoryEntity[];
95
136
  //# 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,cAAc,WAAW;IACzB,QAAQ,UAAU;IAClB,UAAU,WAAW;IACrB,OAAO,SAAS;CACjB;AAGD,MAAM,WAAW,MAAM;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,iBAAiB,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,EAAE,MAAM,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAID,MAAM,MAAM,YAAY,GAA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,CAAC;IAClB,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,yCAAyC,GAAG,qBAAqB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/api-sdk",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -36,5 +36,5 @@
36
36
  "axios": "^1.6.2"
37
37
  },
38
38
  "packageManager": "pnpm@8.10.4",
39
- "gitHead": "faa38b7af7e74b04a98215efadbef38fab902665"
39
+ "gitHead": "fd3cc11b3fd31d81704adca09e2816b79d3a9721"
40
40
  }
@@ -1,27 +1,32 @@
1
1
  import {
2
2
  GetMarginAccountParams,
3
+ GetMarginAccountResult,
3
4
  GetMarginAccountsParams,
4
- MarginAccountEntity,
5
+ GetMarginAccountsResult,
6
+ GetPositionsForMarginAccountParams,
7
+ GetPositionsForMarginAccountResult,
8
+ GetPositionsHistoryForMarginAccountParams,
9
+ GetPositionsHistoryForMarginAccountResult,
5
10
  } from '../types';
6
11
  import RestClient from './rest';
7
12
 
8
13
  export default class AccountClient extends RestClient {
9
14
  /**
10
- * Asynchronously retrieves a list of collateral accounts associated with a specific address.
15
+ * Asynchronously retrieves a list of margin accounts associated with a specific address.
11
16
  *
12
17
  * This method makes a request to the API endpoint to fetch collateral account data. The data is filtered
13
18
  * based on the provided Ethereum address. An optional limit can be specified to control the number of
14
19
  * collateral accounts returned in the response.
15
20
  *
16
21
  * @param {GetMarginAccountsParams} params
17
- * @returns {Promise<MarginAccountEntity[]>} A promise that resolves to the response containing the margin
22
+ * @returns {Promise<GetMarginAccountsResult>} A promise that resolves to the response containing the margin
18
23
  * account data.
19
24
  * @memberof account
20
25
  * */
21
26
 
22
27
  async getMarginAccounts(
23
28
  params: GetMarginAccountsParams,
24
- ): Promise<MarginAccountEntity[]> {
29
+ ): Promise<GetMarginAccountsResult> {
25
30
  const uri = `/api/accounts/${params.address}`;
26
31
  return this.get(uri, { limit: params.limit });
27
32
  }
@@ -33,15 +38,29 @@ export default class AccountClient extends RestClient {
33
38
  * associated with the provided Ethereum address. The account is identified using the collateral account number.
34
39
  *
35
40
  * @param {GetMarginAccountParams} params
36
- * @returns {Promise<MarginAccountEntity>} A promise that resolves to the response containing the detailed
41
+ * @returns {Promise<GetMarginAccountResult>} A promise that resolves to the response containing the detailed
37
42
  * information of the specified margin account.
38
43
  * @memberof account
39
44
  */
40
45
 
41
- async getCollateralAccount(
46
+ async getMarginAccount(
42
47
  params: GetMarginAccountParams,
43
- ): Promise<MarginAccountEntity> {
44
- const uri = `/api/accounts/${params.address}/collateralAccount/${params.marginAccountNumber}`;
48
+ ): Promise<GetMarginAccountResult> {
49
+ const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}`;
45
50
  return this.get(uri);
46
51
  }
52
+
53
+ async getPositionsForMarginAccount(
54
+ params: GetPositionsForMarginAccountParams,
55
+ ): Promise<GetPositionsForMarginAccountResult> {
56
+ const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}/positions`;
57
+ return this.get(uri, { limit: params.limit });
58
+ }
59
+
60
+ async getPositionsHistoryForMarginAccount(
61
+ params: GetPositionsHistoryForMarginAccountParams,
62
+ ): Promise<GetPositionsHistoryForMarginAccountResult> {
63
+ const uri = `/api/accounts/${params.address}/marginAccount/${params.marginAccountId}/positions/history`;
64
+ return this.get(uri, { limit: params.limit });
65
+ }
47
66
  }
@@ -1,9 +1,11 @@
1
1
  import {
2
- CandlesResolution,
3
- GetMarketsParams,
2
+ GetCandlesParams,
3
+ GetMarketParams,
4
+ GetMarketResult,
5
+ GetMarketsResult,
6
+ GetMarketTradingHistoryParams,
7
+ GetTradingHistoryResult,
4
8
  MarketCandlesResponse,
5
- MarketEntity,
6
- TradesResponse,
7
9
  } from '../types';
8
10
  import RestClient from './rest';
9
11
 
@@ -14,8 +16,7 @@ export default class MarketsClient extends RestClient {
14
16
  * This method makes a request to the API to fetch data for markets. If a specific market is provided as a parameter,
15
17
  * it fetches data for that particular market; otherwise, it fetches data for all available markets.
16
18
  *
17
- * @param {GetMarketsParams} [params] - The specific market ticker identifier for which data is requested. This parameter is optional.
18
- * @returns {Promise<MarketEntity[]>} A promise that resolves to the response containing market data.
19
+ * @returns {Promise<GetMarketsResult>} A promise that resolves to the response containing market data.
19
20
  * @memberof MarketsClient
20
21
  *
21
22
  * @example
@@ -27,9 +28,14 @@ export default class MarketsClient extends RestClient {
27
28
  * const specificMarketData = await market.getMarkets('ETH-USDC');
28
29
  */
29
30
 
30
- async getMarkets(params?: GetMarketsParams): Promise<MarketEntity[]> {
31
+ async getMarkets(): Promise<GetMarketsResult> {
31
32
  const uri = '/api/markets';
32
- return this.get(uri, { id: params?.id });
33
+ return this.get(uri);
34
+ }
35
+
36
+ async getMarket(params: GetMarketParams): Promise<GetMarketResult> {
37
+ const uri = `/api/markets/${params.id}`;
38
+ return this.get(uri);
33
39
  }
34
40
 
35
41
  /**
@@ -38,11 +44,7 @@ export default class MarketsClient extends RestClient {
38
44
  * This method fetches historical candlestick (or OHLC - Open, High, Low, Close) data for a given market.
39
45
  * The data can be filtered by time range (fromISO and toISO) and resolution.
40
46
  *
41
- * @param {number} marketId - The market identifier for which candlestick data is to be retrieved.
42
- * @param {CandlesResolution} resolution - The granularity of the candlestick data (e.g., '1MIN', '5MIN', '1HR').
43
- * @param {string|null} [fromISO] - The start time for the range of candlestick data in ISO 8601 format. Optional.
44
- * @param {string|null} [toISO] - The end time for the range of candlestick data in ISO 8601 format. Optional.
45
- * @param {number|null} [limit] - The maximum number of candlestick data points to retrieve. Optional.
47
+ * @param {GetCandlesParams} params
46
48
  * @returns {Promise<MarketCandlesResponse>} A promise that resolves to the market candlestick data.
47
49
  * @memberof MarketsClient
48
50
  *
@@ -51,28 +53,23 @@ export default class MarketsClient extends RestClient {
51
53
  */
52
54
 
53
55
  async getMarketCandles(
54
- marketId: MarketEntity['id'],
55
- resolution: CandlesResolution,
56
- fromISO?: string | null,
57
- toISO?: string | null,
58
- limit?: number | null,
56
+ params: GetCandlesParams,
59
57
  ): Promise<MarketCandlesResponse> {
60
- const uri = `/api/markets/candles/${marketId}`;
58
+ const uri = `/api/markets/candles/${params.marketId}`;
61
59
  return this.get(uri, {
62
- resolution,
63
- fromISO,
64
- toISO,
65
- limit,
60
+ resolution: params.resolution,
61
+ fromISO: params.fromISO,
62
+ toISO: params.toISO,
63
+ limit: params.limit,
66
64
  });
67
65
  }
68
66
 
69
- async getPerpetualMarketTrades(
70
- marketId: number,
71
- limit?: number | null,
72
- ): Promise<TradesResponse> {
73
- const uri = `/api/trades/${marketId}`;
67
+ async getMarketTradingHistory(
68
+ params: GetMarketTradingHistoryParams,
69
+ ): Promise<GetTradingHistoryResult> {
70
+ const uri = `/api/trades/${params.marketId}`;
74
71
  return this.get(uri, {
75
- limit,
72
+ limit: params.limit,
76
73
  });
77
74
  }
78
75
  }
@@ -47,9 +47,22 @@ export type MarketEntity = {
47
47
  tickSizeDecimals: number;
48
48
  };
49
49
 
50
- export type GetMarketsParams = {
51
- id?: number;
50
+ export type GetMarketsResult = MarketEntity[];
51
+
52
+ export type GetMarketResult = MarketEntity;
53
+
54
+ export type GetMarketParams = {
55
+ id: MarketEntity['id'];
56
+ };
57
+
58
+ export type GetCandlesParams = {
59
+ marketId: MarketEntity['id'];
60
+ resolution: CandlesResolution;
61
+ fromISO?: string | null;
62
+ toISO?: string | null;
63
+ limit?: number | null;
52
64
  };
65
+
53
66
  // -- Account --
54
67
 
55
68
  export type Status = 'OPEN' | 'CLOSED' | 'LIQUIDATED' | 'FILLED';
@@ -62,7 +75,13 @@ export type GetMarginAccountsParams = {
62
75
 
63
76
  export type GetMarginAccountParams = {
64
77
  address: string;
65
- marginAccountNumber: number;
78
+ marginAccountId: MarginAccountEntity['id'];
79
+ };
80
+
81
+ export type GetPositionsForMarginAccountParams = {
82
+ address: string;
83
+ marginAccountId: MarginAccountEntity['id'];
84
+ limit?: number;
66
85
  };
67
86
 
68
87
  export type MarginAccountEntity = {
@@ -80,30 +99,73 @@ export type MarginAccountEntity = {
80
99
  }[];
81
100
  };
82
101
 
83
- export interface Position {
102
+ export type GetMarginAccountsResult = MarginAccountEntity[];
103
+ export type GetMarginAccountResult = MarginAccountEntity;
104
+
105
+ export type PositionEntity = {
84
106
  id: number;
85
- symbol: string;
86
107
  side: Side;
87
108
  size: number;
88
109
  price: number;
89
- orderStatus: Status;
90
110
  markPrice: number;
91
- unrealisedPnl: number;
92
- realisedPnl: number;
111
+ orderStatus: Status;
112
+ realisedPnl?: number | null;
113
+ unrealisedPnl?: number | null;
93
114
  liquidationPrice: number;
94
- fundingRate: string;
95
- date: string;
96
- }
115
+ fundingRate: number;
116
+ market: MarketEntity;
117
+ date: Date;
118
+ };
119
+
120
+ export type GetPositionsForMarginAccountResult = {
121
+ positions: PositionEntity[];
122
+ totalUnrealizedPNL: number;
123
+ };
97
124
 
98
- export type Trade = {
125
+ // --- Trading History ----
126
+
127
+ export type GetMarketTradingHistoryParams = {
128
+ marketId: number;
129
+ limit?: number;
130
+ };
131
+
132
+ export type TradingHistoryEntity = {
99
133
  id: number;
100
- side: Side;
101
- size: string;
102
134
  price: number;
103
- date: string;
104
- txId: string;
135
+ priceUnderlyingToken: string;
136
+ size: number;
137
+ sizeUnderlyingToken: string;
138
+ timestampMillisecondsUTC: number;
105
139
  };
106
140
 
107
- export type TradesResponse = {
108
- trades: Trade[];
141
+ export type GetTradingHistoryResult = TradingHistoryEntity[];
142
+
143
+ // --- Position History ---
144
+
145
+ export type GetPositionsHistoryForMarginAccountParams = {
146
+ address: string;
147
+ marginAccountId: MarginAccountEntity['id'];
148
+ limit?: number;
149
+ };
150
+
151
+ export type OrderType = 'market';
152
+
153
+ export type PositionHistoryType =
154
+ | 'long-trade'
155
+ | 'short-trade'
156
+ | 'long-liquidation'
157
+ | 'short-liquidation';
158
+
159
+ export type PositionHistoryEntity = {
160
+ id: number;
161
+ action: PositionHistoryType;
162
+ orderType: OrderType;
163
+ size: number;
164
+ executionPrice: number;
165
+ realisedPnl?: number | null;
166
+ fees: number;
167
+ timestamp: number;
168
+ market: MarketEntity;
109
169
  };
170
+
171
+ export type GetPositionsHistoryForMarginAccountResult = PositionHistoryEntity[];