@grvt/client 1.6.12 → 1.6.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/TDG/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AxiosRequestConfig } from 'axios';
2
- import type { IAckResponse, IApiAggregatedAccountSummaryResponse, IApiCancelAllOrdersRequest, IApiCancelAllOrdersResponse, IApiCancelOrderRequest, IApiCancelOrderResponse, IApiCreateBulkOrdersRequest, IApiCreateBulkOrdersResponse, IApiCreateOrderRequest, IApiCreateOrderResponse, IApiCrossExchVaultAttestEquityRequest, IApiCrossExchVaultGetInvestorAllocationStatsResponse, IApiCrossExchVaultInvestCancelRequest, IApiCrossExchVaultLockRequest, IApiCrossExchVaultPreInternalTransferCheckRequest, IApiCrossExchVaultPreInternalTransferCheckResponse, IApiCrossExchVaultPreWithdrawCheckRequest, IApiCrossExchVaultPreWithdrawCheckResponse, IApiCrossExchVaultTriggerRedemptionRequest, IApiCrossExchVaultUnlockRequest, IApiCrossExchVaultViewInvestmentQueueRequest, IApiCrossExchVaultViewInvestmentQueueResponse, IApiCrossExchVaultViewPendingInvestmentRequest, IApiCrossExchVaultViewPendingInvestmentResponse, IApiDedustPositionRequest, IApiDedustPositionResponse, IApiDepositHistoryRequest, IApiDepositHistoryResponse, IApiFillHistoryRequest, IApiFillHistoryResponse, IApiFundingAccountSummaryResponse, IApiFundingPaymentHistoryRequest, IApiFundingPaymentHistoryResponse, IApiGetAllInitialLeverageRequest, IApiGetAllInitialLeverageResponse, IApiGetMarginTiersResponse, IApiGetOrderGroupRequest, IApiGetOrderGroupResponse, IApiGetOrderRequest, IApiGetOrderResponse, IApiGetPriceProtectionBandsResponse, IApiOpenOrdersRequest, IApiOpenOrdersResponse, IApiOrderHistoryRequest, IApiOrderHistoryResponse, IApiPositionsRequest, IApiPositionsResponse, IApiPreDepositCheckRequest, IApiPreDepositCheckResponse, IApiPreOrderCheckRequest, IApiPreOrderCheckResponse, IApiQueryAccountPerformanceTrendRequest, IApiQueryAccountPerformanceTrendResponse, IApiQueryAccountTodayPerformanceResponse, IApiQueryListFundingAccountSummaryRequest, IApiQueryListFundingAccountSummaryResponse, IApiQueryListSubAccountSummaryRequest, IApiQueryListSubAccountSummaryResponse, IApiQueryTradingAccountRiskMetricRequest, IApiQueryTradingAccountRiskMetricResponse, IApiQueryTradingPerformanceRequest, IApiQueryTradingPerformanceResponse, IApiQueryTradingPerformanceSummaryRequest, IApiQueryTradingPerformanceSummaryResponse, IApiQueryTradingPerformanceTrendRequest, IApiQueryTradingPerformanceTrendResponse, IApiQueryVaultInvestorHistoryRequest, IApiQueryVaultInvestorHistoryResponse, IApiQueryVaultInvestorHistoryStatsRequest, IApiQueryVaultInvestorHistoryStatsResponse, IApiQueryVaultManagerInvestorHistoryRequest, IApiQueryVaultManagerInvestorHistoryResponse, IApiReplaceOrdersRequest, IApiReplaceOrdersResponse, IApiSetInitialLeverageRequest, IApiSetInitialLeverageResponse, IApiSocializedLossStatusResponse, IApiSubAccountHistoryRequest, IApiSubAccountHistoryResponse, IApiSubAccountSummaryRequest, IApiSubAccountSummaryResponse, IApiTimedAssetExposureRequest, IApiTimedAssetExposureResponse, IApiTransferHistoryRequest, IApiTransferHistoryResponse, IApiTransferRequest, IApiTransferResponse, IApiVaultBurnTokensRequest, IApiVaultInvestorSummaryRequest, IApiVaultInvestorSummaryResponse, IApiVaultInvestRequest, IApiVaultRedeemCancelRequest, IApiVaultRedeemRequest, IApiVaultViewRedemptionQueueRequest, IApiVaultViewRedemptionQueueResponse, IApiWithdrawalHistoryRequest, IApiWithdrawalHistoryResponse, IApiWithdrawalRequest, IConfig } from '../interfaces';
2
+ import type { IAckResponse, IApiAddIsolatedPositionMarginRequest, IApiAddIsolatedPositionMarginResponse, IApiAggregatedAccountSummaryResponse, IApiAuthorizeBuilderRequest, IApiBuilderFillHistoryRequest, IApiBuilderFillHistoryResponse, IApiCancelAllOrdersRequest, IApiCancelAllOrdersResponse, IApiCancelOrderRequest, IApiCancelOrderResponse, IApiCreateBulkOrdersRequest, IApiCreateBulkOrdersResponse, IApiCreateOrderRequest, IApiCreateOrderResponse, IApiCrossExchVaultAttestEquityRequest, IApiCrossExchVaultGetInvestorAllocationStatsResponse, IApiCrossExchVaultInvestCancelRequest, IApiCrossExchVaultLockRequest, IApiCrossExchVaultPreInternalTransferCheckRequest, IApiCrossExchVaultPreInternalTransferCheckResponse, IApiCrossExchVaultPreWithdrawCheckRequest, IApiCrossExchVaultPreWithdrawCheckResponse, IApiCrossExchVaultTriggerRedemptionRequest, IApiCrossExchVaultUnlockRequest, IApiCrossExchVaultViewInvestmentQueueRequest, IApiCrossExchVaultViewInvestmentQueueResponse, IApiCrossExchVaultViewPendingInvestmentRequest, IApiCrossExchVaultViewPendingInvestmentResponse, IApiDedustPositionRequest, IApiDedustPositionResponse, IApiDepositHistoryRequest, IApiDepositHistoryResponse, IApiFillHistoryRequest, IApiFillHistoryResponse, IApiFundingAccountSummaryResponse, IApiFundingPaymentHistoryRequest, IApiFundingPaymentHistoryResponse, IApiGetAllInitialLeverageRequest, IApiGetAllInitialLeverageResponse, IApiGetAuthorizedBuildersResponse, IApiGetIsolatedPositionMarginLimitsRequest, IApiGetIsolatedPositionMarginLimitsResponse, IApiGetMarginTiersResponse, IApiGetOrderGroupRequest, IApiGetOrderGroupResponse, IApiGetOrderRequest, IApiGetOrderResponse, IApiGetPriceProtectionBandsResponse, IApiOpenOrdersRequest, IApiOpenOrdersResponse, IApiOrderHistoryRequest, IApiOrderHistoryResponse, IApiPositionsRequest, IApiPositionsResponse, IApiPreDepositCheckRequest, IApiPreDepositCheckResponse, IApiPreOrderCheckRequest, IApiPreOrderCheckResponse, IApiQueryAccountPerformanceTrendRequest, IApiQueryAccountPerformanceTrendResponse, IApiQueryAccountTodayPerformanceResponse, IApiQueryListFundingAccountSummaryRequest, IApiQueryListFundingAccountSummaryResponse, IApiQueryListSubAccountSummaryRequest, IApiQueryListSubAccountSummaryResponse, IApiQueryTradingAccountRiskMetricRequest, IApiQueryTradingAccountRiskMetricResponse, IApiQueryTradingPerformanceRequest, IApiQueryTradingPerformanceResponse, IApiQueryTradingPerformanceSummaryRequest, IApiQueryTradingPerformanceSummaryResponse, IApiQueryTradingPerformanceTrendRequest, IApiQueryTradingPerformanceTrendResponse, IApiQueryVaultInvestorHistoryRequest, IApiQueryVaultInvestorHistoryResponse, IApiQueryVaultInvestorHistoryStatsRequest, IApiQueryVaultInvestorHistoryStatsResponse, IApiQueryVaultManagerInvestorHistoryRequest, IApiQueryVaultManagerInvestorHistoryResponse, IApiReplaceOrdersRequest, IApiReplaceOrdersResponse, IApiSetInitialLeverageRequest, IApiSetInitialLeverageResponse, IApiSetSubAccountPositionMarginConfigRequest, IApiSetSubAccountPositionMarginConfigResponse, IApiSocializedLossStatusResponse, IApiSubAccountHistoryRequest, IApiSubAccountHistoryResponse, IApiSubAccountSummaryRequest, IApiSubAccountSummaryResponse, IApiTimedAssetExposureRequest, IApiTimedAssetExposureResponse, IApiTransferHistoryRequest, IApiTransferHistoryResponse, IApiTransferRequest, IApiTransferResponse, IApiVaultBurnTokensRequest, IApiVaultInvestorSummaryRequest, IApiVaultInvestorSummaryResponse, IApiVaultInvestRequest, IApiVaultRedeemCancelRequest, IApiVaultRedeemRequest, IApiVaultViewRedemptionQueueRequest, IApiVaultViewRedemptionQueueResponse, IApiWithdrawalHistoryRequest, IApiWithdrawalHistoryResponse, IApiWithdrawalRequest, IConfig } from '../interfaces';
3
3
  export declare class TDG {
4
4
  private readonly _axios;
5
5
  private readonly _fullUrl;
@@ -37,6 +37,15 @@ export declare class TDG {
37
37
  * @see https://api-docs.grvt.io/trading_api/#positions
38
38
  */
39
39
  positions(payload: IApiPositionsRequest, config?: AxiosRequestConfig): Promise<IApiPositionsResponse>;
40
+ setPositionConfig(payload: IApiSetSubAccountPositionMarginConfigRequest, config?: AxiosRequestConfig): Promise<IApiSetSubAccountPositionMarginConfigResponse>;
41
+ addPositionMargin(payload: IApiAddIsolatedPositionMarginRequest, config?: AxiosRequestConfig): Promise<IApiAddIsolatedPositionMarginResponse>;
42
+ getPositionMarginLimits(payload: IApiGetIsolatedPositionMarginLimitsRequest, config?: AxiosRequestConfig): Promise<IApiGetIsolatedPositionMarginLimitsResponse>;
43
+ /**
44
+ * APIs for Builder
45
+ */
46
+ authorizeBuilder(payload: IApiAuthorizeBuilderRequest, config?: AxiosRequestConfig): Promise<IAckResponse>;
47
+ getAuthorizedBuilders(config?: AxiosRequestConfig): Promise<IApiGetAuthorizedBuildersResponse>;
48
+ builderFillHistory(payload: IApiBuilderFillHistoryRequest, config?: AxiosRequestConfig): Promise<IApiBuilderFillHistoryResponse>;
40
49
  /**
41
50
  * @see https://api-docs.grvt.io/trading_api/#sub-account-summary
42
51
  */
package/TDG/index.js CHANGED
@@ -3,7 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TDG = void 0;
4
4
  const interfaces_1 = require("../interfaces");
5
5
  const ack_response_1 = require("../interfaces/codegen/schema-maps/ack_response");
6
+ const api_add_isolated_position_margin_request_1 = require("../interfaces/codegen/schema-maps/api_add_isolated_position_margin_request");
7
+ const api_add_isolated_position_margin_response_1 = require("../interfaces/codegen/schema-maps/api_add_isolated_position_margin_response");
6
8
  const api_aggregated_account_summary_response_1 = require("../interfaces/codegen/schema-maps/api_aggregated_account_summary_response");
9
+ const api_authorize_builder_request_1 = require("../interfaces/codegen/schema-maps/api_authorize_builder_request");
10
+ const api_builder_fill_history_request_1 = require("../interfaces/codegen/schema-maps/api_builder_fill_history_request");
11
+ const api_builder_fill_history_response_1 = require("../interfaces/codegen/schema-maps/api_builder_fill_history_response");
7
12
  const api_cancel_all_orders_request_1 = require("../interfaces/codegen/schema-maps/api_cancel_all_orders_request");
8
13
  const api_cancel_all_orders_response_1 = require("../interfaces/codegen/schema-maps/api_cancel_all_orders_response");
9
14
  const api_cancel_order_request_1 = require("../interfaces/codegen/schema-maps/api_cancel_order_request");
@@ -37,6 +42,9 @@ const api_funding_payment_history_request_1 = require("../interfaces/codegen/sch
37
42
  const api_funding_payment_history_response_1 = require("../interfaces/codegen/schema-maps/api_funding_payment_history_response");
38
43
  const api_get_all_initial_leverage_request_1 = require("../interfaces/codegen/schema-maps/api_get_all_initial_leverage_request");
39
44
  const api_get_all_initial_leverage_response_1 = require("../interfaces/codegen/schema-maps/api_get_all_initial_leverage_response");
45
+ const api_get_authorized_builders_response_1 = require("../interfaces/codegen/schema-maps/api_get_authorized_builders_response");
46
+ const api_get_isolated_position_margin_limits_request_1 = require("../interfaces/codegen/schema-maps/api_get_isolated_position_margin_limits_request");
47
+ const api_get_isolated_position_margin_limits_response_1 = require("../interfaces/codegen/schema-maps/api_get_isolated_position_margin_limits_response");
40
48
  const api_get_margin_tiers_response_1 = require("../interfaces/codegen/schema-maps/api_get_margin_tiers_response");
41
49
  const api_get_order_group_request_1 = require("../interfaces/codegen/schema-maps/api_get_order_group_request");
42
50
  const api_get_order_group_response_1 = require("../interfaces/codegen/schema-maps/api_get_order_group_response");
@@ -78,6 +86,8 @@ const api_replace_orders_request_1 = require("../interfaces/codegen/schema-maps/
78
86
  const api_replace_orders_response_1 = require("../interfaces/codegen/schema-maps/api_replace_orders_response");
79
87
  const api_set_initial_leverage_request_1 = require("../interfaces/codegen/schema-maps/api_set_initial_leverage_request");
80
88
  const api_set_initial_leverage_response_1 = require("../interfaces/codegen/schema-maps/api_set_initial_leverage_response");
89
+ const api_set_sub_account_position_margin_config_request_1 = require("../interfaces/codegen/schema-maps/api_set_sub_account_position_margin_config_request");
90
+ const api_set_sub_account_position_margin_config_response_1 = require("../interfaces/codegen/schema-maps/api_set_sub_account_position_margin_config_response");
81
91
  const api_socialized_loss_status_response_1 = require("../interfaces/codegen/schema-maps/api_socialized_loss_status_response");
82
92
  const api_sub_account_history_request_1 = require("../interfaces/codegen/schema-maps/api_sub_account_history_request");
83
93
  const api_sub_account_history_response_1 = require("../interfaces/codegen/schema-maps/api_sub_account_history_response");
@@ -175,6 +185,39 @@ class TDG {
175
185
  return utils_1.Utils.schemaMap(response.data, api_positions_response_1.API_POSITIONS_RESPONSE_MAP.LITE_TO_FULL);
176
186
  }).catch(utils_1.Utils.coverApiError);
177
187
  }
188
+ setPositionConfig(payload, config) {
189
+ return this._axios.post(this._liteUrl + '/set_position_config', utils_1.Utils.schemaMap(payload, api_set_sub_account_position_margin_config_request_1.API_SET_SUB_ACCOUNT_POSITION_MARGIN_CONFIG_REQUEST_MAP.FULL_TO_LITE, true), config).then((response) => {
190
+ return utils_1.Utils.schemaMap(response.data, api_set_sub_account_position_margin_config_response_1.API_SET_SUB_ACCOUNT_POSITION_MARGIN_CONFIG_RESPONSE_MAP.LITE_TO_FULL);
191
+ }).catch(utils_1.Utils.coverApiError);
192
+ }
193
+ addPositionMargin(payload, config) {
194
+ return this._axios.post(this._liteUrl + '/add_position_margin', utils_1.Utils.schemaMap(payload, api_add_isolated_position_margin_request_1.API_ADD_ISOLATED_POSITION_MARGIN_REQUEST_MAP.FULL_TO_LITE, true), config).then((response) => {
195
+ return utils_1.Utils.schemaMap(response.data, api_add_isolated_position_margin_response_1.API_ADD_ISOLATED_POSITION_MARGIN_RESPONSE_MAP.LITE_TO_FULL);
196
+ }).catch(utils_1.Utils.coverApiError);
197
+ }
198
+ getPositionMarginLimits(payload, config) {
199
+ return this._axios.post(this._liteUrl + '/get_position_margin_limits', utils_1.Utils.schemaMap(payload, api_get_isolated_position_margin_limits_request_1.API_GET_ISOLATED_POSITION_MARGIN_LIMITS_REQUEST_MAP.FULL_TO_LITE, true), config).then((response) => {
200
+ return utils_1.Utils.schemaMap(response.data, api_get_isolated_position_margin_limits_response_1.API_GET_ISOLATED_POSITION_MARGIN_LIMITS_RESPONSE_MAP.LITE_TO_FULL);
201
+ }).catch(utils_1.Utils.coverApiError);
202
+ }
203
+ /**
204
+ * APIs for Builder
205
+ */
206
+ authorizeBuilder(payload, config) {
207
+ return this._axios.post(this._liteUrl + '/authorize_builder', utils_1.Utils.schemaMap(payload, api_authorize_builder_request_1.API_AUTHORIZE_BUILDER_REQUEST_MAP.FULL_TO_LITE, true), config).then((response) => {
208
+ return utils_1.Utils.schemaMap(response.data, ack_response_1.ACK_RESPONSE_MAP.LITE_TO_FULL);
209
+ }).catch(utils_1.Utils.coverApiError);
210
+ }
211
+ getAuthorizedBuilders(config) {
212
+ return this._axios.post(this._liteUrl + '/get_authorized_builders', null, config).then((response) => {
213
+ return utils_1.Utils.schemaMap(response.data, api_get_authorized_builders_response_1.API_GET_AUTHORIZED_BUILDERS_RESPONSE_MAP.LITE_TO_FULL);
214
+ }).catch(utils_1.Utils.coverApiError);
215
+ }
216
+ builderFillHistory(payload, config) {
217
+ return this._axios.post(this._liteUrl + '/builder_fill_history', utils_1.Utils.schemaMap(payload, api_builder_fill_history_request_1.API_BUILDER_FILL_HISTORY_REQUEST_MAP.FULL_TO_LITE, true), config).then((response) => {
218
+ return utils_1.Utils.schemaMap(response.data, api_builder_fill_history_response_1.API_BUILDER_FILL_HISTORY_RESPONSE_MAP.LITE_TO_FULL);
219
+ }).catch(utils_1.Utils.coverApiError);
220
+ }
178
221
  /**
179
222
  * @see https://api-docs.grvt.io/trading_api/#sub-account-summary
180
223
  */
@@ -409,9 +409,14 @@ export interface IApiFindAccountMultiplierRequest {
409
409
  metric?: EMetricType;
410
410
  epoch?: number;
411
411
  status?: EAccountMultiplierStatus;
412
+ page?: number;
413
+ limit?: number;
412
414
  }
413
415
  export interface IApiFindAccountMultiplierResponse {
414
416
  result?: IRewardAccountMultiplier[];
417
+ page?: number;
418
+ limit?: number;
419
+ total?: number;
415
420
  }
416
421
  export interface IApiFindConflictAccountMultiplierResponse {
417
422
  result?: IRewardAccountMultiplier[];
@@ -1986,6 +1991,10 @@ export interface IPositions {
1986
1991
  leverage?: string;
1987
1992
  cumulative_fee?: string;
1988
1993
  cumulative_realized_funding_payment?: string;
1994
+ margin_type?: EPositionMarginType;
1995
+ isolated_balance?: string;
1996
+ isolated_im?: string;
1997
+ isolated_mm?: string;
1989
1998
  }
1990
1999
  export interface IPreMinRedemptions {
1991
2000
  requests?: IVaultRedemptionRequest[];
@@ -9,7 +9,9 @@ exports.API_FIND_ACCOUNT_MULTIPLIER_REQUEST_MAP = Object.freeze({
9
9
  account_type: 'at',
10
10
  metric: 'm',
11
11
  epoch: 'e',
12
- status: 's'
12
+ status: 's',
13
+ page: 'p',
14
+ limit: 'l'
13
15
  },
14
16
  LITE_TO_FULL: {
15
17
  oc: 'off_chain_account_id',
@@ -17,6 +19,8 @@ exports.API_FIND_ACCOUNT_MULTIPLIER_REQUEST_MAP = Object.freeze({
17
19
  at: 'account_type',
18
20
  m: 'metric',
19
21
  e: 'epoch',
20
- s: 'status'
22
+ s: 'status',
23
+ p: 'page',
24
+ l: 'limit'
21
25
  }
22
26
  });
@@ -5,9 +5,15 @@ const reward_account_multiplier_1 = require("./reward_account_multiplier");
5
5
  // Schema map for the 'API_FIND_ACCOUNT_MULTIPLIER_RESPONSE' struct.
6
6
  exports.API_FIND_ACCOUNT_MULTIPLIER_RESPONSE_MAP = Object.freeze({
7
7
  FULL_TO_LITE: {
8
- result: ['r', [reward_account_multiplier_1.REWARD_ACCOUNT_MULTIPLIER_MAP.FULL_TO_LITE]]
8
+ result: ['r', [reward_account_multiplier_1.REWARD_ACCOUNT_MULTIPLIER_MAP.FULL_TO_LITE]],
9
+ page: 'p',
10
+ limit: 'l',
11
+ total: 't'
9
12
  },
10
13
  LITE_TO_FULL: {
11
- r: ['result', [reward_account_multiplier_1.REWARD_ACCOUNT_MULTIPLIER_MAP.LITE_TO_FULL]]
14
+ r: ['result', [reward_account_multiplier_1.REWARD_ACCOUNT_MULTIPLIER_MAP.LITE_TO_FULL]],
15
+ p: 'page',
16
+ l: 'limit',
17
+ t: 'total'
12
18
  }
13
19
  });
@@ -20,7 +20,11 @@ exports.POSITIONS_MAP = Object.freeze({
20
20
  est_liquidation_price: 'el',
21
21
  leverage: 'l',
22
22
  cumulative_fee: 'cf',
23
- cumulative_realized_funding_payment: 'cr'
23
+ cumulative_realized_funding_payment: 'cr',
24
+ margin_type: 'mt',
25
+ isolated_balance: 'ib',
26
+ isolated_im: 'ii',
27
+ isolated_mm: 'im'
24
28
  },
25
29
  LITE_TO_FULL: {
26
30
  et: 'event_time',
@@ -39,6 +43,10 @@ exports.POSITIONS_MAP = Object.freeze({
39
43
  el: 'est_liquidation_price',
40
44
  l: 'leverage',
41
45
  cf: 'cumulative_fee',
42
- cr: 'cumulative_realized_funding_payment'
46
+ cr: 'cumulative_realized_funding_payment',
47
+ mt: 'margin_type',
48
+ ib: 'isolated_balance',
49
+ ii: 'isolated_im',
50
+ im: 'isolated_mm'
43
51
  }
44
52
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grvt/client",
3
- "version": "1.6.12",
3
+ "version": "1.6.13",
4
4
  "description": "Node.js & JavaScript client for GRVT REST APIs & WebSockets",
5
5
  "repository": {
6
6
  "type": "git",