kucoin-api 2.3.5 → 2.3.6

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.
@@ -1,9 +1,9 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
2
  import { BaseRestClient } from './lib/BaseRestClient.js';
3
3
  import { RestClientOptions, RestClientType } from './lib/requestUtils.js';
4
- import { GetAnnouncementsRequestUTA, GetCurrencyRequestUTA, GetCurrentFundingRateRequestUTA, GetHistoryFundingRateRequestUTA, GetKlinesRequestUTA, GetOrderBookRequestUTA, GetServiceStatusRequestUTA, GetSymbolRequestUTA, GetTickerRequestUTA, GetTradesRequestUTA } from './types/request/uta-types.js';
4
+ import { BatchCancelOrdersRequestUTA, BatchPlaceOrderRequestUTA, CancelOrderRequestUTA, FlexTransferRequestUTA, GetAccountLedgerRequestUTA, GetAccountPositionTiersRequestUTA, GetAnnouncementsRequestUTA, GetClassicAccountRequestUTA, GetCurrencyRequestUTA, GetCurrentFundingRateRequestUTA, GetDCPRequestUTA, GetDepositAddressRequestUTA, GetFeeRateRequestUTA, GetHistoryFundingRateRequestUTA, GetInterestHistoryRequestUTA, GetKlinesRequestUTA, GetOpenOrderListRequestUTA, GetOrderBookRequestUTA, GetOrderDetailsRequestUTA, GetOrderHistoryRequestUTA, GetPositionListRequestUTA, GetPositionsHistoryRequestUTA, GetServiceStatusRequestUTA, GetSubAccountRequestUTA, GetSymbolRequestUTA, GetTickerRequestUTA, GetTradeHistoryRequestUTA, GetTradesRequestUTA, GetTransferQuotasRequestUTA, ModifyLeverageRequestUTA, PlaceOrderRequestUTA, SetAccountModeRequestUTA, SetDCPRequestUTA, SetSubAccountTransferPermissionRequestUTA } from './types/request/uta-types.js';
5
5
  import { APISuccessResponse } from './types/response/shared.types.js';
6
- import { GetAnnouncementsResponseUTA, GetCrossMarginConfigResponseUTA, GetCurrencyResponseUTA, GetCurrentFundingRateResponseUTA, GetHistoryFundingRateResponseUTA, GetKlinesResponseUTA, GetOrderBookResponseUTA, GetServiceStatusResponseUTA, GetSymbolResponseUTA, GetTickerResponseUTA, GetTradesResponseUTA } from './types/response/uta-types.js';
6
+ import { BatchCancelOrdersResponseUTA, BatchPlaceOrderResponseUTA, CancelOrderResponseUTA, DCPResponseUTA, DepositAddressUTA, FlexTransferResponseUTA, GetAccountLedgerResponseClassicUTA, GetAccountLedgerResponseUTA, GetAccountModeResponseUTA, GetAccountOverviewResponseUTA, GetAnnouncementsResponseUTA, GetClassicAccountResponseUTA, GetCrossMarginConfigResponseUTA, GetCurrencyResponseUTA, GetCurrentFundingRateResponseUTA, GetFeeRateResponseUTA, GetHistoryFundingRateResponseUTA, GetInterestHistoryResponseUTA, GetKlinesResponseUTA, GetOpenOrderListResponseUTA, GetOrderBookResponseUTA, GetOrderHistoryResponseUTA, GetPositionsHistoryResponseUTA, GetServiceStatusResponseUTA, GetSubAccountResponseUTA, GetSymbolResponseUTA, GetTickerResponseUTA, GetTradeHistoryResponseUTA, GetTradesResponseUTA, GetTransferQuotasResponseUTA, OrderDetailsUTA, PlaceOrderResponseUTA, PositionTierUTA, PositionUTA, SubAccountTransferPermissionUTA } from './types/response/uta-types.js';
7
7
  /**
8
8
  * Unified Trading Account Client
9
9
  *
@@ -74,4 +74,195 @@ export declare class UnifiedAPIClient extends BaseRestClient {
74
74
  * Get the service status.
75
75
  */
76
76
  getServiceStatus(params: GetServiceStatusRequestUTA): Promise<APISuccessResponse<GetServiceStatusResponseUTA>>;
77
+ /**
78
+ *
79
+ * REST - Unified Trading Account - Account
80
+ *
81
+ */
82
+ /**
83
+ * Get Account (Classic)
84
+ * Get information for Classic Account (FUNDING, SPOT, FUTURES, CROSS, ISOLATED).
85
+ * Note: AccountType enum value changed from TRADING to SPOT as of 2026.01.17.
86
+ */
87
+ getClassicAccount(params: GetClassicAccountRequestUTA): Promise<APISuccessResponse<GetClassicAccountResponseUTA>>;
88
+ /**
89
+ * Get Account (UTA)
90
+ * Get information for Unified Trading Account.
91
+ */
92
+ getAccount(): Promise<APISuccessResponse<GetClassicAccountResponseUTA>>;
93
+ /**
94
+ * Get Account Overview (UTA)
95
+ * Get account overview for Unified Trading Account.
96
+ */
97
+ getAccountOverview(): Promise<APISuccessResponse<GetAccountOverviewResponseUTA>>;
98
+ /**
99
+ * Get Sub Account
100
+ * Request sub account info via this endpoint.
101
+ */
102
+ getSubAccount(params?: GetSubAccountRequestUTA): Promise<APISuccessResponse<GetSubAccountResponseUTA>>;
103
+ /**
104
+ * Get Transfer Quotas
105
+ * This endpoint returns the transferable balance of a specified account.
106
+ * Note: AccountType enum value changed from TRADING to SPOT as of 2026.01.17.
107
+ */
108
+ getTransferQuotas(params: GetTransferQuotasRequestUTA): Promise<APISuccessResponse<GetTransferQuotasResponseUTA>>;
109
+ /**
110
+ * Flex Transfer
111
+ * This interface can be used for transfers between master- and sub-accounts and transfers.
112
+ * Note: AccountType enum value changed from TRADING to SPOT as of 2026.01.17.
113
+ */
114
+ flexTransfer(params: FlexTransferRequestUTA): Promise<APISuccessResponse<FlexTransferResponseUTA>>;
115
+ /**
116
+ * Set Sub Account Transfer Permission
117
+ * This endpoint supports setting whether the specified sub-account needs to open the SUB_TO_SUB transfer permission.
118
+ */
119
+ setSubAccountTransferPermission(params: SetSubAccountTransferPermissionRequestUTA): Promise<APISuccessResponse<SubAccountTransferPermissionUTA[]>>;
120
+ /**
121
+ * Get Account Mode
122
+ * This interface supports query the list of unified and classic sub-accounts and current account mode.
123
+ */
124
+ getAccountMode(): Promise<APISuccessResponse<GetAccountModeResponseUTA>>;
125
+ /**
126
+ * Set Account Mode
127
+ * This interface supports set account mode to UTA.
128
+ */
129
+ setAccountMode(params: SetAccountModeRequestUTA): Promise<APISuccessResponse<null>>;
130
+ /**
131
+ * Get Fee Rate
132
+ * This interface is for the trading pair's actual fee rate.
133
+ * You can inquire about fee rates of 10 trading pairs each time at most for Spot.
134
+ * Futures only supports 1 symbol at a time.
135
+ */
136
+ getFeeRate(params: GetFeeRateRequestUTA): Promise<APISuccessResponse<GetFeeRateResponseUTA>>;
137
+ /**
138
+ * Get Account Ledger
139
+ * This API endpoint returns all transfer (in and out) records and supports multi-coin queries.
140
+ * The query results are sorted in descending order by createdAt and ID.
141
+ * Note: AccountType enum value changed from TRADING to SPOT as of 2026.01.17.
142
+ * Note: direction values unified to uppercase IN/OUT as of 2026.01.17.
143
+ * Note: For Futures - id changed from Number to String, balance/amount changed from Number to String as of 2026.01.17.
144
+ * Note: ts standardized to nanoseconds as of 2026.01.12.
145
+ */
146
+ getAccountLedger(params: GetAccountLedgerRequestUTA): Promise<APISuccessResponse<GetAccountLedgerResponseUTA | GetAccountLedgerResponseClassicUTA>>;
147
+ /**
148
+ * Get Interest History (UTA)
149
+ * Request the interest records via this endpoint.
150
+ */
151
+ getInterestHistory(params: GetInterestHistoryRequestUTA): Promise<APISuccessResponse<GetInterestHistoryResponseUTA>>;
152
+ /**
153
+ * Modify Leverage (UTA)
154
+ * This interface supports modify leverage of the specified symbol.
155
+ */
156
+ modifyLeverage(params: ModifyLeverageRequestUTA): Promise<APISuccessResponse<null>>;
157
+ /**
158
+ * Get Deposit Address
159
+ * Return a deposit address; when both currency and chain are provided,
160
+ * the address will be created if it does not exist.
161
+ * URL unified to GET /api/ua/v1/asset/deposit/address as of 2026.01.17.
162
+ */
163
+ getDepositAddress(params: GetDepositAddressRequestUTA): Promise<APISuccessResponse<DepositAddressUTA[]>>;
164
+ /**
165
+ *
166
+ * REST - Unified Trading Account - Orders
167
+ *
168
+ */
169
+ /**
170
+ * Place Order
171
+ * This interface can be used to place orders.
172
+ * Supports RPI (Retail Price Improvement) orders for Futures as of 2025.01.02.
173
+ * Note: timeInForce supports 'RPI' value for Futures only (Phase 1).
174
+ * Note: For Classic mode, tradeType is required in query param.
175
+ * Note: For Unified mode, tradeType should not be in query param.
176
+ */
177
+ placeOrder(params: PlaceOrderRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<PlaceOrderResponseUTA>>;
178
+ /**
179
+ * Batch Place Order (Classic)
180
+ * This interface can be used for placing batch orders.
181
+ * URL changed to /api/ua/v1/{accountMode}/order/place-batch as of 2026.01.17.
182
+ * Note: timeInForce supports 'RPI' value for Futures as of 2025.01.02.
183
+ */
184
+ batchPlaceOrder(params: BatchPlaceOrderRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<BatchPlaceOrderResponseUTA>>;
185
+ /**
186
+ * Get Order Details
187
+ * This interface can be used getting single order details.
188
+ * Note: timeInForce returns 'RPI' value for Futures RPI orders as of 2025.01.02.
189
+ * Note: status changed from String to Number for UTA as of 2026.01.17.
190
+ * Note: orderTime/updatedTime standardized to nanoseconds as of 2026.01.12.
191
+ */
192
+ getOrderDetails(params: GetOrderDetailsRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<OrderDetailsUTA>>;
193
+ /**
194
+ * Get Open Order List
195
+ * This interface can be used getting open order list.
196
+ * Note: timeInForce returns 'RPI' value for Futures RPI orders as of 2025.01.02.
197
+ * Note: status changed from String to Number for UTA as of 2026.01.17.
198
+ * Note: orderTime/updatedTime standardized to nanoseconds as of 2026.01.12.
199
+ */
200
+ getOpenOrderList(params: GetOpenOrderListRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<GetOpenOrderListResponseUTA>>;
201
+ /**
202
+ * Get Order History
203
+ * This interface can be used for getting order history.
204
+ * Note: timeInForce returns 'RPI' value for Futures RPI orders as of 2025.01.02.
205
+ * Note: status changed from String to Number for UTA as of 2026.01.17.
206
+ * Note: orderTime/updatedTime standardized to nanoseconds as of 2026.01.12.
207
+ */
208
+ getOrderHistory(params: GetOrderHistoryRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<GetOrderHistoryResponseUTA>>;
209
+ /**
210
+ * Get Trade History
211
+ * This interface can be used for getting trade execution history.
212
+ * Note: executionTime standardized to nanoseconds as of 2026.01.12.
213
+ * Note: isRpiTrade added for Futures as of 2025.01.02.
214
+ */
215
+ getTradeHistory(params: GetTradeHistoryRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<GetTradeHistoryResponseUTA>>;
216
+ /**
217
+ * Cancel Order
218
+ * This interface can be used to cancel orders.
219
+ * Note: ts (timestamp in nanoseconds) only effective for unified account mode.
220
+ */
221
+ cancelOrder(params: CancelOrderRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<CancelOrderResponseUTA>>;
222
+ /**
223
+ * Batch Cancel Orders
224
+ * This interface can be used for batch cancel orders (maximum 20 orders).
225
+ * Note: tradeType required for Classic accounts only; ignored in UTA (UNIFIED) mode.
226
+ * Note: ts (timestamp in nanoseconds) not supported for classic accounts.
227
+ */
228
+ batchCancelOrders(params: BatchCancelOrdersRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<BatchCancelOrdersResponseUTA>>;
229
+ /**
230
+ * Set DCP (Disconnection Protect / Deadman Switch) - Classic Only
231
+ * Set automatic order cancellation after specified time.
232
+ * Call this interface to automatically cancel all orders of the set trading pair after the specified time.
233
+ * Note: Order cancellation delay is between 0 and 10 seconds.
234
+ * Note: timeout range: -1 (unset) or 5 <= timeout <= 86400 seconds.
235
+ */
236
+ setDCP(params: SetDCPRequestUTA): Promise<APISuccessResponse<DCPResponseUTA>>;
237
+ /**
238
+ * Get DCP (Disconnection Protect / Deadman Switch) - Classic Only
239
+ * Get automatic order cancellation settings.
240
+ * If data is empty, it means DCP is not set.
241
+ */
242
+ getDCP(params: GetDCPRequestUTA): Promise<APISuccessResponse<DCPResponseUTA>>;
243
+ /**
244
+ *
245
+ * REST - Unified Trading Account - Positions
246
+ *
247
+ */
248
+ /**
249
+ * Get Position List (UTA)
250
+ * Get the position details of all open positions.
251
+ * Note: creationTime standardized to nanoseconds as of 2026.01.12.
252
+ */
253
+ getPositionList(params?: GetPositionListRequestUTA): Promise<APISuccessResponse<PositionUTA[]>>;
254
+ /**
255
+ * Get Positions History (UTA)
256
+ * Query position history information records.
257
+ * Note: Data retained for up to 3 months.
258
+ * Note: Each query limited to 7 days time range.
259
+ * Note: creationTime and closingTime standardized to nanoseconds as of 2026.01.12.
260
+ */
261
+ getPositionsHistory(params?: GetPositionsHistoryRequestUTA): Promise<APISuccessResponse<GetPositionsHistoryResponseUTA>>;
262
+ /**
263
+ * Get Account Position Tiers
264
+ * Request account position tiers (risk limit) info.
265
+ * Note: Currently only queries of classic - futures isolated margin are supported.
266
+ */
267
+ getAccountPositionTiers(params: GetAccountPositionTiersRequestUTA, accountMode?: 'classic' | 'unified'): Promise<APISuccessResponse<PositionTierUTA[]>>;
77
268
  }
@@ -100,6 +100,264 @@ class UnifiedAPIClient extends BaseRestClient_js_1.BaseRestClient {
100
100
  getServiceStatus(params) {
101
101
  return this.get('api/ua/v1/server/status', params);
102
102
  }
103
+ /**
104
+ *
105
+ * REST - Unified Trading Account - Account
106
+ *
107
+ */
108
+ /**
109
+ * Get Account (Classic)
110
+ * Get information for Classic Account (FUNDING, SPOT, FUTURES, CROSS, ISOLATED).
111
+ * Note: AccountType enum value changed from TRADING to SPOT as of 2026.01.17.
112
+ */
113
+ getClassicAccount(params) {
114
+ return this.getPrivate('api/ua/v1/account/balance', params);
115
+ }
116
+ /**
117
+ * Get Account (UTA)
118
+ * Get information for Unified Trading Account.
119
+ */
120
+ getAccount() {
121
+ return this.getPrivate('api/ua/v1/unified/account/balance');
122
+ }
123
+ /**
124
+ * Get Account Overview (UTA)
125
+ * Get account overview for Unified Trading Account.
126
+ */
127
+ getAccountOverview() {
128
+ return this.getPrivate('api/ua/v1/unified/account/overview');
129
+ }
130
+ /**
131
+ * Get Sub Account
132
+ * Request sub account info via this endpoint.
133
+ */
134
+ getSubAccount(params) {
135
+ return this.getPrivate('api/ua/v1/sub-account/balance', params);
136
+ }
137
+ /**
138
+ * Get Transfer Quotas
139
+ * This endpoint returns the transferable balance of a specified account.
140
+ * Note: AccountType enum value changed from TRADING to SPOT as of 2026.01.17.
141
+ */
142
+ getTransferQuotas(params) {
143
+ return this.getPrivate('api/ua/v1/account/transfer-quota', params);
144
+ }
145
+ /**
146
+ * Flex Transfer
147
+ * This interface can be used for transfers between master- and sub-accounts and transfers.
148
+ * Note: AccountType enum value changed from TRADING to SPOT as of 2026.01.17.
149
+ */
150
+ flexTransfer(params) {
151
+ return this.postPrivate('api/ua/v1/account/transfer', params);
152
+ }
153
+ /**
154
+ * Set Sub Account Transfer Permission
155
+ * This endpoint supports setting whether the specified sub-account needs to open the SUB_TO_SUB transfer permission.
156
+ */
157
+ setSubAccountTransferPermission(params) {
158
+ return this.postPrivate('api/ua/v1/sub-account/canTransferOut', params);
159
+ }
160
+ /**
161
+ * Get Account Mode
162
+ * This interface supports query the list of unified and classic sub-accounts and current account mode.
163
+ */
164
+ getAccountMode() {
165
+ return this.getPrivate('api/ua/v1/account/mode');
166
+ }
167
+ /**
168
+ * Set Account Mode
169
+ * This interface supports set account mode to UTA.
170
+ */
171
+ setAccountMode(params) {
172
+ return this.postPrivate('api/ua/v1/account/mode', params);
173
+ }
174
+ /**
175
+ * Get Fee Rate
176
+ * This interface is for the trading pair's actual fee rate.
177
+ * You can inquire about fee rates of 10 trading pairs each time at most for Spot.
178
+ * Futures only supports 1 symbol at a time.
179
+ */
180
+ getFeeRate(params) {
181
+ return this.getPrivate('api/ua/v1/user/fee-rate', params);
182
+ }
183
+ /**
184
+ * Get Account Ledger
185
+ * This API endpoint returns all transfer (in and out) records and supports multi-coin queries.
186
+ * The query results are sorted in descending order by createdAt and ID.
187
+ * Note: AccountType enum value changed from TRADING to SPOT as of 2026.01.17.
188
+ * Note: direction values unified to uppercase IN/OUT as of 2026.01.17.
189
+ * Note: For Futures - id changed from Number to String, balance/amount changed from Number to String as of 2026.01.17.
190
+ * Note: ts standardized to nanoseconds as of 2026.01.12.
191
+ */
192
+ getAccountLedger(params) {
193
+ return this.getPrivate('api/ua/v1/account/ledger', params);
194
+ }
195
+ /**
196
+ * Get Interest History (UTA)
197
+ * Request the interest records via this endpoint.
198
+ */
199
+ getInterestHistory(params) {
200
+ return this.getPrivate('api/ua/v1/account/interest-history', params);
201
+ }
202
+ /**
203
+ * Modify Leverage (UTA)
204
+ * This interface supports modify leverage of the specified symbol.
205
+ */
206
+ modifyLeverage(params) {
207
+ return this.postPrivate('api/ua/v1/unified/account/modify-leverage', params);
208
+ }
209
+ /**
210
+ * Get Deposit Address
211
+ * Return a deposit address; when both currency and chain are provided,
212
+ * the address will be created if it does not exist.
213
+ * URL unified to GET /api/ua/v1/asset/deposit/address as of 2026.01.17.
214
+ */
215
+ getDepositAddress(params) {
216
+ return this.getPrivate('api/ua/v1/asset/deposit/address', params);
217
+ }
218
+ /**
219
+ *
220
+ * REST - Unified Trading Account - Orders
221
+ *
222
+ */
223
+ /**
224
+ * Place Order
225
+ * This interface can be used to place orders.
226
+ * Supports RPI (Retail Price Improvement) orders for Futures as of 2025.01.02.
227
+ * Note: timeInForce supports 'RPI' value for Futures only (Phase 1).
228
+ * Note: For Classic mode, tradeType is required in query param.
229
+ * Note: For Unified mode, tradeType should not be in query param.
230
+ */
231
+ placeOrder(params, accountMode = 'unified') {
232
+ const { tradeType, ...bodyParams } = params;
233
+ const url = accountMode === 'classic'
234
+ ? `api/ua/v1/${accountMode}/order/place?tradeType=${tradeType}`
235
+ : `api/ua/v1/${accountMode}/order/place`;
236
+ return this.postPrivate(url, bodyParams);
237
+ }
238
+ /**
239
+ * Batch Place Order (Classic)
240
+ * This interface can be used for placing batch orders.
241
+ * URL changed to /api/ua/v1/{accountMode}/order/place-batch as of 2026.01.17.
242
+ * Note: timeInForce supports 'RPI' value for Futures as of 2025.01.02.
243
+ */
244
+ batchPlaceOrder(params, accountMode = 'classic') {
245
+ const url = accountMode === 'classic'
246
+ ? `api/ua/v1/${accountMode}/order/place-batch?tradeType=${params.tradeType}`
247
+ : `api/ua/v1/${accountMode}/order/place-batch`;
248
+ return this.postPrivate(url, params);
249
+ }
250
+ /**
251
+ * Get Order Details
252
+ * This interface can be used getting single order details.
253
+ * Note: timeInForce returns 'RPI' value for Futures RPI orders as of 2025.01.02.
254
+ * Note: status changed from String to Number for UTA as of 2026.01.17.
255
+ * Note: orderTime/updatedTime standardized to nanoseconds as of 2026.01.12.
256
+ */
257
+ getOrderDetails(params, accountMode = 'unified') {
258
+ return this.getPrivate(`api/ua/v1/${accountMode}/order/detail`, params);
259
+ }
260
+ /**
261
+ * Get Open Order List
262
+ * This interface can be used getting open order list.
263
+ * Note: timeInForce returns 'RPI' value for Futures RPI orders as of 2025.01.02.
264
+ * Note: status changed from String to Number for UTA as of 2026.01.17.
265
+ * Note: orderTime/updatedTime standardized to nanoseconds as of 2026.01.12.
266
+ */
267
+ getOpenOrderList(params, accountMode = 'unified') {
268
+ return this.getPrivate(`api/ua/v1/${accountMode}/order/open-list`, params);
269
+ }
270
+ /**
271
+ * Get Order History
272
+ * This interface can be used for getting order history.
273
+ * Note: timeInForce returns 'RPI' value for Futures RPI orders as of 2025.01.02.
274
+ * Note: status changed from String to Number for UTA as of 2026.01.17.
275
+ * Note: orderTime/updatedTime standardized to nanoseconds as of 2026.01.12.
276
+ */
277
+ getOrderHistory(params, accountMode = 'unified') {
278
+ return this.getPrivate(`api/ua/v1/${accountMode}/order/history`, params);
279
+ }
280
+ /**
281
+ * Get Trade History
282
+ * This interface can be used for getting trade execution history.
283
+ * Note: executionTime standardized to nanoseconds as of 2026.01.12.
284
+ * Note: isRpiTrade added for Futures as of 2025.01.02.
285
+ */
286
+ getTradeHistory(params, accountMode = 'unified') {
287
+ return this.getPrivate(`api/ua/v1/${accountMode}/order/execution`, params);
288
+ }
289
+ /**
290
+ * Cancel Order
291
+ * This interface can be used to cancel orders.
292
+ * Note: ts (timestamp in nanoseconds) only effective for unified account mode.
293
+ */
294
+ cancelOrder(params, accountMode = 'unified') {
295
+ const url = accountMode === 'classic'
296
+ ? `api/ua/v1/${accountMode}/order/cancel?tradeType=${params.tradeType}`
297
+ : `api/ua/v1/${accountMode}/order/cancel`;
298
+ return this.postPrivate(url, params);
299
+ }
300
+ /**
301
+ * Batch Cancel Orders
302
+ * This interface can be used for batch cancel orders (maximum 20 orders).
303
+ * Note: tradeType required for Classic accounts only; ignored in UTA (UNIFIED) mode.
304
+ * Note: ts (timestamp in nanoseconds) not supported for classic accounts.
305
+ */
306
+ batchCancelOrders(params, accountMode = 'unified') {
307
+ const url = accountMode === 'classic'
308
+ ? `api/ua/v1/${accountMode}/order/cancel-batch?tradeType=${params.tradeType}`
309
+ : `api/ua/v1/${accountMode}/order/cancel-batch`;
310
+ return this.postPrivate(url, params);
311
+ }
312
+ /**
313
+ * Set DCP (Disconnection Protect / Deadman Switch) - Classic Only
314
+ * Set automatic order cancellation after specified time.
315
+ * Call this interface to automatically cancel all orders of the set trading pair after the specified time.
316
+ * Note: Order cancellation delay is between 0 and 10 seconds.
317
+ * Note: timeout range: -1 (unset) or 5 <= timeout <= 86400 seconds.
318
+ */
319
+ setDCP(params) {
320
+ return this.postPrivate('api/ua/v1/dcp/set', params);
321
+ }
322
+ /**
323
+ * Get DCP (Disconnection Protect / Deadman Switch) - Classic Only
324
+ * Get automatic order cancellation settings.
325
+ * If data is empty, it means DCP is not set.
326
+ */
327
+ getDCP(params) {
328
+ return this.getPrivate('api/ua/v1/dcp/query', params);
329
+ }
330
+ /**
331
+ *
332
+ * REST - Unified Trading Account - Positions
333
+ *
334
+ */
335
+ /**
336
+ * Get Position List (UTA)
337
+ * Get the position details of all open positions.
338
+ * Note: creationTime standardized to nanoseconds as of 2026.01.12.
339
+ */
340
+ getPositionList(params) {
341
+ return this.getPrivate('api/ua/v1/unified/position/open-list', params);
342
+ }
343
+ /**
344
+ * Get Positions History (UTA)
345
+ * Query position history information records.
346
+ * Note: Data retained for up to 3 months.
347
+ * Note: Each query limited to 7 days time range.
348
+ * Note: creationTime and closingTime standardized to nanoseconds as of 2026.01.12.
349
+ */
350
+ getPositionsHistory(params) {
351
+ return this.getPrivate('api/ua/v1/position/history', params);
352
+ }
353
+ /**
354
+ * Get Account Position Tiers
355
+ * Request account position tiers (risk limit) info.
356
+ * Note: Currently only queries of classic - futures isolated margin are supported.
357
+ */
358
+ getAccountPositionTiers(params, accountMode = 'classic') {
359
+ return this.getPrivate(`api/ua/v1/${accountMode}/position/tiers`, params);
360
+ }
103
361
  }
104
362
  exports.UnifiedAPIClient = UnifiedAPIClient;
105
363
  //# sourceMappingURL=UnifiedAPIClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnifiedAPIClient.js","sourceRoot":"","sources":["../../src/UnifiedAPIClient.ts"],"names":[],"mappings":";;;AAEA,+DAAyD;AACzD,2DAI+B;AA4B/B;;;;;GAKG;AACH,MAAa,gBAAiB,SAAQ,kCAAc;IAClD,YACE,oBAAuC,EAAE,EACzC,iBAAqC,EAAE;QAEvC,KAAK,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,aAAa;QACX,OAAO,uCAAqB,CAAC,qBAAqB,CAAC;IACrD,CAAC;IAED;;;;OAIG;IAEH;;;;OAIG;IACH,gBAAgB,CACd,MAAmC;QAEnC,OAAO,IAAI,CAAC,GAAG,CAAC,+BAA+B,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;IAED;;;OAGG;IACH,WAAW,CACT,MAA8B;QAE9B,OAAO,IAAI,CAAC,GAAG,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;IAED;;;OAGG;IACH,UAAU,CACR,MAA2B;QAE3B,OAAO,IAAI,CAAC,GAAG,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,UAAU,CACR,MAA2B;QAE3B,OAAO,IAAI,CAAC,GAAG,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,SAAS,CACP,MAA2B;QAE3B,OAAO,IAAI,CAAC,GAAG,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACH,YAA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AAC,sCAAsC,EAAE,MAAM,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;OAMG;IACH,mBAAmB,CACjB,MAAsC;QAEtC,OAAO,IAAI,CAAC,UAAU,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;IAED;;;;OAIG;IACH,uBAAuB,CACrB,MAAyC,EACzC,cAAqC,SAAS;QAE9C,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,WAAW,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAC5E,CAAC;CACF;AAveD,4CAueC"}
@@ -110,7 +110,13 @@ export interface Order {
110
110
  size?: number;
111
111
  qty?: string;
112
112
  valueQty?: string;
113
- timeInForce?: 'GTC' | 'IOC';
113
+ /**
114
+ * Time in Force. Added 'RPI' as of 2025.01.02
115
+ * - GTC: Good Till Cancel (default)
116
+ * - IOC: Immediate Or Cancel
117
+ * - RPI: Retail Price Improvement Order (Phase 1: Futures only)
118
+ */
119
+ timeInForce?: 'GTC' | 'IOC' | 'RPI';
114
120
  postOnly?: boolean;
115
121
  hidden?: boolean;
116
122
  iceberg?: boolean;
@@ -136,7 +142,13 @@ export interface SLTPOrder {
136
142
  size?: number;
137
143
  qty?: string;
138
144
  valueQty?: string;
139
- timeInForce?: 'GTC' | 'IOC';
145
+ /**
146
+ * Time in Force. Added 'RPI' as of 2025.01.02
147
+ * - GTC: Good Till Cancel (default)
148
+ * - IOC: Immediate Or Cancel
149
+ * - RPI: Retail Price Improvement Order (Phase 1: Futures only)
150
+ */
151
+ timeInForce?: 'GTC' | 'IOC' | 'RPI';
140
152
  postOnly?: boolean;
141
153
  hidden?: boolean;
142
154
  iceberg?: boolean;
@@ -240,7 +252,13 @@ export interface CopyTradeOrderRequest {
240
252
  positionSide?: 'BOTH' | 'LONG' | 'SHORT';
241
253
  price?: string;
242
254
  size: number;
243
- timeInForce?: 'GTC' | 'IOC';
255
+ /**
256
+ * Time in Force. Added 'RPI' as of 2025.01.02
257
+ * - GTC: Good Till Cancel (default)
258
+ * - IOC: Immediate Or Cancel
259
+ * - RPI: Retail Price Improvement Order (Phase 1: Futures only)
260
+ */
261
+ timeInForce?: 'GTC' | 'IOC' | 'RPI';
244
262
  postOnly?: boolean;
245
263
  hidden?: boolean;
246
264
  iceberg?: boolean;