kucoin-api 0.0.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/README.md +256 -40
  2. package/dist/cjs/FuturesClient.d.ts +246 -0
  3. package/dist/cjs/FuturesClient.js +261 -0
  4. package/dist/cjs/FuturesClient.js.map +1 -0
  5. package/dist/cjs/SpotClient.d.ts +692 -0
  6. package/dist/cjs/SpotClient.js +745 -0
  7. package/dist/cjs/SpotClient.js.map +1 -0
  8. package/dist/cjs/WebsocketClient.d.ts +77 -0
  9. package/dist/cjs/WebsocketClient.js +337 -0
  10. package/dist/cjs/WebsocketClient.js.map +1 -0
  11. package/dist/cjs/index.d.ts +22 -0
  12. package/dist/cjs/index.js +39 -0
  13. package/dist/cjs/index.js.map +1 -0
  14. package/dist/cjs/lib/BaseRestClient.d.ts +42 -0
  15. package/dist/cjs/lib/BaseRestClient.js +268 -0
  16. package/dist/cjs/lib/BaseRestClient.js.map +1 -0
  17. package/dist/cjs/lib/BaseWSClient.d.ts +168 -0
  18. package/dist/cjs/lib/BaseWSClient.js +622 -0
  19. package/dist/cjs/lib/BaseWSClient.js.map +1 -0
  20. package/dist/cjs/lib/misc-util.d.ts +1 -0
  21. package/dist/cjs/lib/misc-util.js +8 -0
  22. package/dist/cjs/lib/misc-util.js.map +1 -0
  23. package/dist/cjs/lib/requestUtils.d.ts +35 -0
  24. package/dist/cjs/lib/requestUtils.js +54 -0
  25. package/dist/cjs/lib/requestUtils.js.map +1 -0
  26. package/dist/cjs/lib/webCryptoAPI.d.ts +10 -0
  27. package/dist/cjs/lib/webCryptoAPI.js +57 -0
  28. package/dist/cjs/lib/webCryptoAPI.js.map +1 -0
  29. package/dist/cjs/lib/websocket/WsStore.d.ts +63 -0
  30. package/dist/cjs/lib/websocket/WsStore.js +254 -0
  31. package/dist/cjs/lib/websocket/WsStore.js.map +1 -0
  32. package/dist/cjs/lib/websocket/WsStore.types.d.ts +50 -0
  33. package/dist/cjs/lib/websocket/WsStore.types.js +14 -0
  34. package/dist/cjs/lib/websocket/WsStore.types.js.map +1 -0
  35. package/dist/cjs/lib/websocket/logger.d.ts +6 -0
  36. package/dist/cjs/lib/websocket/logger.js +16 -0
  37. package/dist/cjs/lib/websocket/logger.js.map +1 -0
  38. package/dist/cjs/lib/websocket/websocket-util.d.ts +30 -0
  39. package/dist/cjs/lib/websocket/websocket-util.js +19 -0
  40. package/dist/cjs/lib/websocket/websocket-util.js.map +1 -0
  41. package/dist/cjs/package.json +3 -0
  42. package/dist/cjs/types/request/futures.types.d.ts +183 -0
  43. package/dist/cjs/types/request/futures.types.js +7 -0
  44. package/dist/cjs/types/request/futures.types.js.map +1 -0
  45. package/dist/cjs/types/request/spot-account.d.ts +56 -0
  46. package/dist/cjs/types/request/spot-account.js +3 -0
  47. package/dist/cjs/types/request/spot-account.js.map +1 -0
  48. package/dist/cjs/types/request/spot-earn.d.ts +27 -0
  49. package/dist/cjs/types/request/spot-earn.js +8 -0
  50. package/dist/cjs/types/request/spot-earn.js.map +1 -0
  51. package/dist/cjs/types/request/spot-funding.d.ts +88 -0
  52. package/dist/cjs/types/request/spot-funding.js +10 -0
  53. package/dist/cjs/types/request/spot-funding.js.map +1 -0
  54. package/dist/cjs/types/request/spot-margin-trading.d.ts +169 -0
  55. package/dist/cjs/types/request/spot-margin-trading.js +10 -0
  56. package/dist/cjs/types/request/spot-margin-trading.js.map +1 -0
  57. package/dist/cjs/types/request/spot-trading.d.ts +214 -0
  58. package/dist/cjs/types/request/spot-trading.js +10 -0
  59. package/dist/cjs/types/request/spot-trading.js.map +1 -0
  60. package/dist/cjs/types/response/futures.types.d.ts +501 -0
  61. package/dist/cjs/types/response/futures.types.js +7 -0
  62. package/dist/cjs/types/response/futures.types.js.map +1 -0
  63. package/dist/cjs/types/response/shared.types.d.ts +9 -0
  64. package/dist/cjs/types/response/shared.types.js +3 -0
  65. package/dist/cjs/types/response/shared.types.js.map +1 -0
  66. package/dist/cjs/types/response/spot-account.d.ts +140 -0
  67. package/dist/cjs/types/response/spot-account.js +3 -0
  68. package/dist/cjs/types/response/spot-account.js.map +1 -0
  69. package/dist/cjs/types/response/spot-earn.d.ts +74 -0
  70. package/dist/cjs/types/response/spot-earn.js +8 -0
  71. package/dist/cjs/types/response/spot-earn.js.map +1 -0
  72. package/dist/cjs/types/response/spot-funding.d.ts +176 -0
  73. package/dist/cjs/types/response/spot-funding.js +10 -0
  74. package/dist/cjs/types/response/spot-funding.js.map +1 -0
  75. package/dist/cjs/types/response/spot-margin-trading.d.ts +257 -0
  76. package/dist/cjs/types/response/spot-margin-trading.js +10 -0
  77. package/dist/cjs/types/response/spot-margin-trading.js.map +1 -0
  78. package/dist/cjs/types/response/spot-trading.d.ts +388 -0
  79. package/dist/cjs/types/response/spot-trading.js +10 -0
  80. package/dist/cjs/types/response/spot-trading.js.map +1 -0
  81. package/dist/cjs/types/response/spot-vip.d.ts +38 -0
  82. package/dist/cjs/types/response/spot-vip.js +10 -0
  83. package/dist/cjs/types/response/spot-vip.js.map +1 -0
  84. package/dist/cjs/types/response/ws.d.ts +11 -0
  85. package/dist/cjs/types/response/ws.js +3 -0
  86. package/dist/cjs/types/response/ws.js.map +1 -0
  87. package/dist/cjs/types/websockets/client.d.ts +46 -0
  88. package/dist/cjs/types/websockets/client.js +3 -0
  89. package/dist/cjs/types/websockets/client.js.map +1 -0
  90. package/dist/cjs/types/websockets/events.d.ts +5 -0
  91. package/dist/cjs/types/websockets/events.js +3 -0
  92. package/dist/cjs/types/websockets/events.js.map +1 -0
  93. package/dist/cjs/types/websockets/requests.d.ts +8 -0
  94. package/dist/cjs/types/websockets/requests.js +3 -0
  95. package/dist/cjs/types/websockets/requests.js.map +1 -0
  96. package/dist/cjs/types/websockets/wsAPI.d.ts +9 -0
  97. package/dist/cjs/types/websockets/wsAPI.js +3 -0
  98. package/dist/cjs/types/websockets/wsAPI.js.map +1 -0
  99. package/dist/mjs/FuturesClient.d.ts +246 -0
  100. package/dist/mjs/FuturesClient.js +257 -0
  101. package/dist/mjs/FuturesClient.js.map +1 -0
  102. package/dist/mjs/SpotClient.d.ts +692 -0
  103. package/dist/mjs/SpotClient.js +741 -0
  104. package/dist/mjs/SpotClient.js.map +1 -0
  105. package/dist/mjs/WebsocketClient.d.ts +77 -0
  106. package/dist/mjs/WebsocketClient.js +333 -0
  107. package/dist/mjs/WebsocketClient.js.map +1 -0
  108. package/dist/mjs/index.d.ts +22 -0
  109. package/dist/mjs/index.js +23 -0
  110. package/dist/mjs/index.js.map +1 -0
  111. package/dist/mjs/lib/BaseRestClient.d.ts +42 -0
  112. package/dist/mjs/lib/BaseRestClient.js +261 -0
  113. package/dist/mjs/lib/BaseRestClient.js.map +1 -0
  114. package/dist/mjs/lib/BaseWSClient.d.ts +168 -0
  115. package/dist/mjs/lib/BaseWSClient.js +615 -0
  116. package/dist/mjs/lib/BaseWSClient.js.map +1 -0
  117. package/dist/mjs/lib/misc-util.d.ts +1 -0
  118. package/dist/mjs/lib/misc-util.js +4 -0
  119. package/dist/mjs/lib/misc-util.js.map +1 -0
  120. package/dist/mjs/lib/requestUtils.d.ts +35 -0
  121. package/dist/mjs/lib/requestUtils.js +49 -0
  122. package/dist/mjs/lib/requestUtils.js.map +1 -0
  123. package/dist/mjs/lib/webCryptoAPI.d.ts +10 -0
  124. package/dist/mjs/lib/webCryptoAPI.js +52 -0
  125. package/dist/mjs/lib/webCryptoAPI.js.map +1 -0
  126. package/dist/mjs/lib/websocket/WsStore.d.ts +63 -0
  127. package/dist/mjs/lib/websocket/WsStore.js +249 -0
  128. package/dist/mjs/lib/websocket/WsStore.js.map +1 -0
  129. package/dist/mjs/lib/websocket/WsStore.types.d.ts +50 -0
  130. package/dist/mjs/lib/websocket/WsStore.types.js +11 -0
  131. package/dist/mjs/lib/websocket/WsStore.types.js.map +1 -0
  132. package/dist/mjs/lib/websocket/logger.d.ts +6 -0
  133. package/dist/mjs/lib/websocket/logger.js +13 -0
  134. package/dist/mjs/lib/websocket/logger.js.map +1 -0
  135. package/dist/mjs/lib/websocket/websocket-util.d.ts +30 -0
  136. package/dist/mjs/lib/websocket/websocket-util.js +15 -0
  137. package/dist/mjs/lib/websocket/websocket-util.js.map +1 -0
  138. package/dist/mjs/package.json +3 -0
  139. package/dist/mjs/types/request/futures.types.d.ts +183 -0
  140. package/dist/mjs/types/request/futures.types.js +6 -0
  141. package/dist/mjs/types/request/futures.types.js.map +1 -0
  142. package/dist/mjs/types/request/spot-account.d.ts +56 -0
  143. package/dist/mjs/types/request/spot-account.js +2 -0
  144. package/dist/mjs/types/request/spot-account.js.map +1 -0
  145. package/dist/mjs/types/request/spot-earn.d.ts +27 -0
  146. package/dist/mjs/types/request/spot-earn.js +7 -0
  147. package/dist/mjs/types/request/spot-earn.js.map +1 -0
  148. package/dist/mjs/types/request/spot-funding.d.ts +88 -0
  149. package/dist/mjs/types/request/spot-funding.js +9 -0
  150. package/dist/mjs/types/request/spot-funding.js.map +1 -0
  151. package/dist/mjs/types/request/spot-margin-trading.d.ts +169 -0
  152. package/dist/mjs/types/request/spot-margin-trading.js +9 -0
  153. package/dist/mjs/types/request/spot-margin-trading.js.map +1 -0
  154. package/dist/mjs/types/request/spot-trading.d.ts +214 -0
  155. package/dist/mjs/types/request/spot-trading.js +9 -0
  156. package/dist/mjs/types/request/spot-trading.js.map +1 -0
  157. package/dist/mjs/types/response/futures.types.d.ts +501 -0
  158. package/dist/mjs/types/response/futures.types.js +6 -0
  159. package/dist/mjs/types/response/futures.types.js.map +1 -0
  160. package/dist/mjs/types/response/shared.types.d.ts +9 -0
  161. package/dist/mjs/types/response/shared.types.js +2 -0
  162. package/dist/mjs/types/response/shared.types.js.map +1 -0
  163. package/dist/mjs/types/response/spot-account.d.ts +140 -0
  164. package/dist/mjs/types/response/spot-account.js +2 -0
  165. package/dist/mjs/types/response/spot-account.js.map +1 -0
  166. package/dist/mjs/types/response/spot-earn.d.ts +74 -0
  167. package/dist/mjs/types/response/spot-earn.js +7 -0
  168. package/dist/mjs/types/response/spot-earn.js.map +1 -0
  169. package/dist/mjs/types/response/spot-funding.d.ts +176 -0
  170. package/dist/mjs/types/response/spot-funding.js +9 -0
  171. package/dist/mjs/types/response/spot-funding.js.map +1 -0
  172. package/dist/mjs/types/response/spot-margin-trading.d.ts +257 -0
  173. package/dist/mjs/types/response/spot-margin-trading.js +9 -0
  174. package/dist/mjs/types/response/spot-margin-trading.js.map +1 -0
  175. package/dist/mjs/types/response/spot-trading.d.ts +388 -0
  176. package/dist/mjs/types/response/spot-trading.js +9 -0
  177. package/dist/mjs/types/response/spot-trading.js.map +1 -0
  178. package/dist/mjs/types/response/spot-vip.d.ts +38 -0
  179. package/dist/mjs/types/response/spot-vip.js +9 -0
  180. package/dist/mjs/types/response/spot-vip.js.map +1 -0
  181. package/dist/mjs/types/response/ws.d.ts +11 -0
  182. package/dist/mjs/types/response/ws.js +2 -0
  183. package/dist/mjs/types/response/ws.js.map +1 -0
  184. package/dist/mjs/types/websockets/client.d.ts +46 -0
  185. package/dist/mjs/types/websockets/client.js +2 -0
  186. package/dist/mjs/types/websockets/client.js.map +1 -0
  187. package/dist/mjs/types/websockets/events.d.ts +5 -0
  188. package/dist/mjs/types/websockets/events.js +2 -0
  189. package/dist/mjs/types/websockets/events.js.map +1 -0
  190. package/dist/mjs/types/websockets/requests.d.ts +8 -0
  191. package/dist/mjs/types/websockets/requests.js +2 -0
  192. package/dist/mjs/types/websockets/requests.js.map +1 -0
  193. package/dist/mjs/types/websockets/wsAPI.d.ts +9 -0
  194. package/dist/mjs/types/websockets/wsAPI.js +2 -0
  195. package/dist/mjs/types/websockets/wsAPI.js.map +1 -0
  196. package/package.json +70 -14
  197. package/LICENSE +0 -21
  198. package/index.js +0 -192
  199. package/test.js +0 -122
@@ -0,0 +1,741 @@
1
+ import { nanoid } from 'nanoid';
2
+ import { BaseRestClient } from './lib/BaseRestClient.js';
3
+ import { REST_CLIENT_TYPE_ENUM, } from './lib/requestUtils.js';
4
+ /**
5
+ *
6
+ */
7
+ export class SpotClient extends BaseRestClient {
8
+ constructor(restClientOptions = {}, requestOptions = {}) {
9
+ super(restClientOptions, requestOptions);
10
+ return this;
11
+ }
12
+ getClientType() {
13
+ return REST_CLIENT_TYPE_ENUM.main;
14
+ }
15
+ /**
16
+ *
17
+ * Misc Utility Methods
18
+ *
19
+ */
20
+ generateNewOrderID() {
21
+ return nanoid(32);
22
+ }
23
+ getServerTime() {
24
+ return this.get('api/v1/timestamp');
25
+ }
26
+ getServiceStatus() {
27
+ return this.get('api/v1/status');
28
+ }
29
+ /**
30
+ *
31
+ * REST - ACCOUNT - Basic Info
32
+ *
33
+ */
34
+ getAccountSummary() {
35
+ return this.getPrivate('api/v2/user-info');
36
+ }
37
+ /**
38
+ * Get a list of acounts and their balance states (spot/margin/trade_hf)
39
+ *
40
+ * Get Account List - Spot/Margin/trade_hf
41
+ */
42
+ getBalances(params) {
43
+ return this.getPrivate('api/v1/accounts', params);
44
+ }
45
+ getAccountDetail(params) {
46
+ return this.getPrivate(`api/v1/accounts/${params.accountId}`);
47
+ }
48
+ /**
49
+ * Get Account Ledgers - Spot/Margin
50
+ */
51
+ getTransactions(params) {
52
+ return this.getPrivate('api/v1/accounts/ledgers', params);
53
+ }
54
+ /**
55
+ * Get Account Ledgers - trade_hf
56
+ */
57
+ getHFTransactions(params) {
58
+ return this.getPrivate('api/v1/hf/accounts/ledgers', params);
59
+ }
60
+ /**
61
+ * Get Account Ledgers - margin_hf
62
+ */
63
+ getHFMarginTransactions(params) {
64
+ return this.getPrivate('api/v3/hf/margin/account/ledgers', params);
65
+ }
66
+ /**
67
+ *
68
+ * REST - ACCOUNT - Sub-Account
69
+ *
70
+ */
71
+ getSubAccountsV1() {
72
+ return this.getPrivate('api/v1/sub/user');
73
+ }
74
+ getSubAccountsV2(params) {
75
+ return this.getPrivate('api/v2/sub/user', params);
76
+ }
77
+ createSubAccount(params) {
78
+ return this.postPrivate('api/v2/sub/user/created', params);
79
+ }
80
+ getSubAccountBalance(params) {
81
+ return this.getPrivate(`api/v1/sub-accounts/${params.subUserId}`, params);
82
+ }
83
+ getSubAccountBalancesV1() {
84
+ return this.getPrivate('api/v1/sub-accounts');
85
+ }
86
+ getSubAccountBalancesV2(params) {
87
+ return this.getPrivate('api/v2/sub-accounts', params);
88
+ }
89
+ /**
90
+ *
91
+ * REST - ACCOUNT - Sub-Account API
92
+ *
93
+ *
94
+ */
95
+ getSubAPIs(params) {
96
+ return this.getPrivate('api/v1/sub/api-key', params);
97
+ }
98
+ createSubAPI(params) {
99
+ return this.postPrivate('api/v1/sub/api-key', params);
100
+ }
101
+ updateSubAPI(params) {
102
+ return this.postPrivate('api/v1/sub/api-key/update', params);
103
+ }
104
+ deleteSubAPI(params) {
105
+ return this.deletePrivate('api/v1/sub/api-key', params);
106
+ }
107
+ /**
108
+ *
109
+ * REST - FUNDING - Funding overview
110
+ *
111
+ */
112
+ getMarginBalances() {
113
+ return this.getPrivate('api/v1/margin/account');
114
+ }
115
+ getMarginBalance(params) {
116
+ return this.getPrivate('api/v3/margin/accounts', params);
117
+ }
118
+ getIsolatedMarginBalance(params) {
119
+ return this.getPrivate('api/v3/isolated/accounts', params);
120
+ }
121
+ /**
122
+ *
123
+ * REST - FUNDING -Deposit
124
+ *
125
+ */
126
+ createDepositAddress(params) {
127
+ return this.postPrivate('api/v1/deposit-addresses', params);
128
+ }
129
+ getDepositAddressesV2(params) {
130
+ return this.getPrivate('api/v2/deposit-addresses', params);
131
+ }
132
+ getDepositAddressV1(params) {
133
+ return this.getPrivate('api/v1/deposit-addresses', params);
134
+ }
135
+ getDeposits(params) {
136
+ return this.getPrivate('api/v1/deposits', params);
137
+ }
138
+ getHistoricalDepositsV1(params) {
139
+ return this.getPrivate('api/v1/hist-deposits', params);
140
+ }
141
+ /**
142
+ *
143
+ * REST - FUNDING -Withdrawals
144
+ *
145
+ */
146
+ getWithdrawals(params) {
147
+ return this.getPrivate('api/v1/withdrawals', params);
148
+ }
149
+ getHistoricalWithdrawalsV1(params) {
150
+ return this.getPrivate('api/v1/hist-withdrawals', params);
151
+ }
152
+ getWithdrawalQuotas(params) {
153
+ return this.getPrivate('api/v1/withdrawals/quotas', params);
154
+ }
155
+ submitWithdraw(params) {
156
+ return this.postPrivate('api/v1/withdrawals', params);
157
+ }
158
+ cancelWithdrawal(params) {
159
+ return this.deletePrivate(`api/v1/withdrawals/${params.withdrawalId}`);
160
+ }
161
+ /**
162
+ *
163
+ * REST - FUNDING - Transfer
164
+ *
165
+ */
166
+ getTransferable(params) {
167
+ return this.getPrivate('api/v1/accounts/transferable', params);
168
+ }
169
+ submitFlexTransfer(params) {
170
+ return this.postPrivate('api/v3/accounts/universal-transfer', params);
171
+ }
172
+ submitTransferMasterSub(params) {
173
+ return this.postPrivate('api/v2/accounts/sub-transfer', params);
174
+ }
175
+ submitInnerTransfer(params) {
176
+ return this.postPrivate('api/v2/accounts/inner-transfer', params);
177
+ }
178
+ /**
179
+ *
180
+ * REST - FUNDING - Trade Fee
181
+ *
182
+ */
183
+ getBasicUserFee(params) {
184
+ return this.getPrivate('api/v1/base-fee', params);
185
+ }
186
+ getTradingPairFee(params) {
187
+ return this.getPrivate('api/v1/trade-fees', params);
188
+ }
189
+ /**
190
+ *
191
+ * REST - SPOT TRADING -Market data
192
+ *
193
+ */
194
+ getCurrencies() {
195
+ return this.get('api/v3/currencies');
196
+ }
197
+ getCurrency(params) {
198
+ return this.get(`api/v3/currencies/${params.currency}`, params);
199
+ }
200
+ getSymbols(params) {
201
+ return this.get('api/v2/symbols', params);
202
+ }
203
+ getTicker(params) {
204
+ return this.get(`api/v1/market/orderbook/level1`, params);
205
+ }
206
+ getTickers() {
207
+ return this.get('api/v1/market/allTickers');
208
+ }
209
+ get24hrStats(params) {
210
+ return this.get('api/v1/market/stats', params);
211
+ }
212
+ getMarkets() {
213
+ return this.get('api/v1/markets');
214
+ }
215
+ getOrderBookLevel20(params) {
216
+ return this.get(`api/v1/market/orderbook/level2_20`, params);
217
+ }
218
+ getOrderBookLevel100(params) {
219
+ return this.get(`api/v1/market/orderbook/level2_100`, params);
220
+ }
221
+ getFullOrderBook(params) {
222
+ return this.getPrivate('api/v3/market/orderbook/level2', params);
223
+ }
224
+ getTradeHistories(params) {
225
+ return this.get('api/v1/market/histories', params);
226
+ }
227
+ getKlines(params) {
228
+ return this.get('api/v1/market/candles', params);
229
+ }
230
+ getFiatPrice(params) {
231
+ return this.get('api/v1/prices', params);
232
+ }
233
+ /**
234
+ *
235
+ * REST - SPOT TRADING - Spot HF trade
236
+ *
237
+ */
238
+ submitHFOrder(params) {
239
+ return this.postPrivate('api/v1/hf/orders', params);
240
+ }
241
+ submitHFOrderTest() {
242
+ return this.postPrivate('api/v1/hf/orders/test');
243
+ }
244
+ submitHFOrderSync(params) {
245
+ return this.postPrivate('api/v1/hf/orders/sync', params);
246
+ }
247
+ submitHFMultipleOrders(params) {
248
+ return this.postPrivate('api/v1/hf/orders/multi', params);
249
+ }
250
+ submitHFMultipleOrdersSync(params) {
251
+ return this.postPrivate('api/v1/hf/orders/multi/sync', params);
252
+ }
253
+ updateHFOrder(params) {
254
+ return this.postPrivate('api/v1/hf/orders/alter', params);
255
+ }
256
+ cancelHFOrder(params) {
257
+ return this.deletePrivate(`api/v1/hf/orders/${params.orderId}`, params);
258
+ }
259
+ cancelHFOrderSync(params) {
260
+ return this.deletePrivate(`api/v1/hf/orders/sync/${params.orderId}`, params);
261
+ }
262
+ cancelHFOrderByClientOId(params) {
263
+ return this.deletePrivate(`api/v1/hf/orders/client-order/${params.clientOid}`, params);
264
+ }
265
+ cancelHFOrderSyncByClientOId(params) {
266
+ return this.deletePrivate(`api/v1/hf/orders/sync/client-order/${params.clientOid}`, params);
267
+ }
268
+ cancelHFOrdersNumber(params) {
269
+ return this.deletePrivate(`api/v1/hf/orders/cancel/${params.orderId}`, params);
270
+ }
271
+ cancelHFAllOrdersBySymbol(params) {
272
+ return this.deletePrivate(`api/v1/hf/orders`, params);
273
+ }
274
+ cancelHFAllOrders() {
275
+ return this.deletePrivate(`api/v1/hf/orders/cancelAll`);
276
+ }
277
+ getHFActiveOrders(params) {
278
+ return this.getPrivate(`api/v1/hf/orders/active`, params);
279
+ }
280
+ getHFActiveSymbols() {
281
+ return this.getPrivate(`api/v1/hf/orders/active/symbols`);
282
+ }
283
+ getHFCompletedOrders(params) {
284
+ return this.getPrivate(`api/v1/hf/orders/done`, params);
285
+ }
286
+ getHFOrderDetailsByOrderId(params) {
287
+ return this.getPrivate(`api/v1/hf/orders/${params.orderId}`, params);
288
+ }
289
+ getHFOrderDetailsByClientOid(params) {
290
+ return this.getPrivate(`api/v1/hf/orders/client-order/${params.clientOid}`, params);
291
+ }
292
+ cancelHFOrderAutoSetting(params) {
293
+ return this.postPrivate('api/v1/hf/orders/dead-cancel-all', params);
294
+ }
295
+ cancelHFOrderAutoSettingQuery() {
296
+ return this.getPrivate('api/v1/hf/orders/dead-cancel-all/query');
297
+ }
298
+ getHFFilledOrders(params) {
299
+ return this.getPrivate('api/v1/hf/fills', params);
300
+ }
301
+ /**
302
+ *
303
+ * REST - SPOT TRADING - Orders
304
+ *
305
+ */
306
+ // SPOT and MARGIN
307
+ submitOrder(params) {
308
+ return this.postPrivate('api/v1/orders', params);
309
+ }
310
+ // SPOT and MARGIN
311
+ submitOrderTest() {
312
+ return this.postPrivate('api/v1/orders/test');
313
+ }
314
+ //SPOT
315
+ submitMultipleOrders(params) {
316
+ return this.postPrivate('api/v1/orders/multi', params);
317
+ }
318
+ // Used for Spot and Margin Trading: Cancels a single order by orderId.
319
+ cancelOrderById(params) {
320
+ return this.deletePrivate(`api/v1/orders/${params.orderId}`);
321
+ }
322
+ // Used for Spot and Margin Trading: Cancels a single order by clientOid.
323
+ cancelOrderByClientOid(params) {
324
+ return this.deletePrivate(`api/v1/order/client-order/${params.clientOid}`);
325
+ }
326
+ // Used for Spot and Margin Trading: Cancels all open orders.
327
+ cancelAllOrders(params) {
328
+ return this.deletePrivate('api/v1/orders', params);
329
+ }
330
+ // Retrieves the current list of orders. Supports filtering by status and trade type.
331
+ getOrders(params) {
332
+ return this.getPrivate('api/v1/orders', params);
333
+ }
334
+ // Needs General permission, Retrieves a list of the most recent 1000 orders within the last 24 hours, sorted in descending order by time.
335
+ getRecentOrders() {
336
+ return this.getPrivate('api/v1/limit/orders');
337
+ }
338
+ // Needs General Permission, Retrieves the details of a single order by its orderId. Useful for tracking the status and details of specific trades.
339
+ getOrderByOrderId(params) {
340
+ return this.getPrivate(`api/v1/orders/${params.orderId}`);
341
+ }
342
+ // Needs general permission, Retrieves the details of a single order by its clientOid. This is useful for checking the status of orders submitd with a unique client-provided identifier.
343
+ getOrderByClientOid(params) {
344
+ return this.getPrivate(`api/v1/order/client-order/${params.clientOid}`);
345
+ }
346
+ /**
347
+ *
348
+ * REST - SPOT TRADING -Fills
349
+ *
350
+ */
351
+ // General permission, Retrieves a list of fills for your orders, providing details such as the executed price, size, and the fees incurred. Useful for tracking trade executions and their impact on your portfolio.
352
+ getFills(params) {
353
+ return this.getPrivate('api/v1/fills', params);
354
+ }
355
+ // General permission, Retrieves a list of the most recent 1000 fills within the last 24 hours, sorted in descending order by time.
356
+ getRecentFills() {
357
+ return this.getPrivate('api/v1/limit/fills');
358
+ }
359
+ /**
360
+ *
361
+ * REST - SPOT TRADING - Stop order
362
+ *
363
+ */
364
+ // Spot and margin trading, submits a stop order on the platform.
365
+ submitStopOrder(params) {
366
+ return this.postPrivate('api/v1/stop-order', params);
367
+ }
368
+ /**
369
+ * Cancels a single stop order by orderId. Applicable for both spot and margin trading.
370
+ *
371
+ * This endpoint requires the "Spot Trading" or "Margin Trading" permission on your API key.
372
+ */
373
+ // Cancels a single stop order by orderId. Applicable for both spot and margin trading.
374
+ // This endpoint requires the "Spot Trading" or "Margin Trading" permission on your API key.
375
+ cancelStopOrderById(params) {
376
+ return this.deletePrivate(`api/v1/stop-order/${params.orderId}`);
377
+ }
378
+ /**
379
+ * Cancels a stop order by clientOid. Requires "Spot Trading" or "Margin Trading" permission.
380
+ */
381
+ cancelStopOrderByClientOid(params) {
382
+ return this.deletePrivate(`api/v1/stop-order/cancelOrderByClientOid`, params);
383
+ }
384
+ /**
385
+ * Cancels a batch of stop orders. Requires "Spot Trading" or "Margin Trading" permission.
386
+ */
387
+ cancelStopOrders(params) {
388
+ return this.deletePrivate(`api/v1/stop-order/cancel`, params);
389
+ }
390
+ /**
391
+ * Retrieves your current untriggered stop order list, paginated and sorted to show the latest first.
392
+ */
393
+ getStopOrders(params) {
394
+ return this.getPrivate('api/v1/stop-order', params);
395
+ }
396
+ /**
397
+ * Retrieves the details of a single stop order by its orderId.
398
+ */
399
+ getStopOrderByOrderId(params) {
400
+ return this.getPrivate(`api/v1/stop-order/${params.orderId}`);
401
+ }
402
+ /**
403
+ * Retrieves the details of a single stop order by its clientOid.
404
+ */
405
+ getStopOrderByClientOid(params) {
406
+ return this.getPrivate('api/v1/stop-order/queryOrderByClientOid', params);
407
+ }
408
+ /**
409
+ *
410
+ * REST - SPOT TRADING - OCO order
411
+ *
412
+ */
413
+ // submits an OCO (One Cancels the Other) order on the platform.
414
+ submitOCOOrder(params) {
415
+ return this.postPrivate('api/v3/oco/order', params);
416
+ }
417
+ /**
418
+ * Cancels a single OCO order by orderId.
419
+ */
420
+ cancelOCOOrderById(params) {
421
+ return this.deletePrivate(`api/v3/oco/order/${params.orderId}`);
422
+ }
423
+ /**
424
+ * Cancels a single OCO order by clientOid.
425
+ */
426
+ cancelOCOOrderByClientOid(params) {
427
+ return this.deletePrivate(`api/v3/oco/client-order/${params.clientOid}`);
428
+ }
429
+ /**
430
+ * Batch cancels OCO orders through orderIds.
431
+ */
432
+ cancelMultipleOCOOrders(params) {
433
+ return this.deletePrivate('api/v3/oco/orders', params);
434
+ }
435
+ /**
436
+ * Retrieves the details of a single OCO order by its orderId.
437
+ */
438
+ getOCOOrderByOrderId(params) {
439
+ return this.getPrivate(`api/v3/oco/order/${params.orderId}`);
440
+ }
441
+ /**
442
+ * Retrieves the details of a single OCO order by its clientOid.
443
+ */
444
+ getOCOOrderByClientOid(params) {
445
+ return this.getPrivate(`api/v3/oco/client-order/${params.clientOid}`);
446
+ }
447
+ /**
448
+ * Retrieves the details of a single OCO order by its orderId, including detailed information about the individual orders.
449
+ */
450
+ getOCOOrderDetails(params) {
451
+ return this.getPrivate(`api/v3/oco/order/details/${params.orderId}`);
452
+ }
453
+ /**
454
+ * Retrieves your current OCO order list, paginated and sorted to show the latest first.
455
+ */
456
+ getOCOOrders(params) {
457
+ return this.getPrivate('api/v3/oco/orders', params);
458
+ }
459
+ /**
460
+ *
461
+ * REST - MARGIN TRADING -Margin HF trade
462
+ *
463
+ */
464
+ submitHFMarginOrder(params) {
465
+ return this.postPrivate('api/v3/hf/margin/order', params);
466
+ }
467
+ submitHFMarginOrderTest() {
468
+ return this.postPrivate('api/v3/hf/margin/order/test');
469
+ }
470
+ cancelHFMarginOrder(params) {
471
+ return this.deletePrivate(`api/v3/hf/margin/orders/${params.orderId}`, params);
472
+ }
473
+ cancelHFMarginOrderByClientOid(params) {
474
+ return this.deletePrivate(`api/v3/hf/margin/orders/client-order/${params.clientOid}`, params);
475
+ }
476
+ cancelHFAllMarginOrders(params) {
477
+ return this.deletePrivate(`api/v3/hf/margin/orders`, params);
478
+ }
479
+ getHFActiveMarginOrders(params) {
480
+ return this.getPrivate(`api/v3/hf/margin/orders/active`, params);
481
+ }
482
+ getHFMarginFilledOrders(params) {
483
+ return this.getPrivate('api/v3/hf/margin/orders/done', params);
484
+ }
485
+ getHFMarginOrderByOrderId(params) {
486
+ return this.getPrivate(`api/v3/hf/margin/orders/${params.orderId}`, params);
487
+ }
488
+ getHFMarginOrderByClientOid(params) {
489
+ return this.getPrivate(`api/v3/hf/margin/orders/client-order/${params.clientOid}?symbol=${params.symbol}`);
490
+ }
491
+ getHFMarginFills(params) {
492
+ return this.getPrivate('api/v3/hf/margin/fills', params);
493
+ }
494
+ getHFMarginOpenSymbols(params) {
495
+ return this.getPrivate('api/v3/hf/margin/order/active/symbols', params);
496
+ }
497
+ /**
498
+ *
499
+ * REST - MARGIN TRADING - Orders
500
+ *
501
+ */
502
+ submitMarginOrder(params) {
503
+ return this.postPrivate('api/v1/margin/order', params);
504
+ }
505
+ submitMarginOrderTest() {
506
+ return this.postPrivate('api/v1/margin/order/test');
507
+ }
508
+ /**
509
+ *
510
+ * REST - MARGIN TRADING - Margin info
511
+ *
512
+ */
513
+ getMarginLeveragedToken(params) {
514
+ return this.get('api/v3/etf/info', params);
515
+ }
516
+ getMarginMarkPrices() {
517
+ return this.get('api/v3/mark-price/all-symbols');
518
+ }
519
+ getMarginMarkPrice(params) {
520
+ return this.get(`api/v1/mark-price/${params.symbol}/current`);
521
+ }
522
+ getMarginConfigInfo() {
523
+ return this.get('api/v1/margin/config');
524
+ }
525
+ getMarginRiskLimitConfig(params) {
526
+ return this.get('api/v3/margin/currencies', params);
527
+ }
528
+ /**
529
+ *
530
+ * REST - MARGIN TRADING - Isolated Margin
531
+ *
532
+ */
533
+ getIsolatedMarginSymbolsConfig() {
534
+ return this.getPrivate('api/v1/isolated/symbols');
535
+ }
536
+ getIsolatedMarginAccounts(params) {
537
+ return this.getPrivate('api/v1/isolated/accounts', params);
538
+ }
539
+ getIsolatedMarginAccount(params) {
540
+ return this.getPrivate(`api/v1/isolated/account/${params.symbol}`);
541
+ }
542
+ /**
543
+ *
544
+ * REST - MARGIN TRADING - Margin trading(v3)
545
+ *
546
+ */
547
+ marginBorrowV3(params) {
548
+ return this.postPrivate('api/v3/margin/borrow', params);
549
+ }
550
+ marginRepayV3(params) {
551
+ return this.postPrivate('api/v3/margin/repay', params);
552
+ }
553
+ getMarginBorrowHistoryV3(params) {
554
+ return this.getPrivate('api/v3/margin/borrow', params);
555
+ }
556
+ getMarginRepayHistoryV3(params) {
557
+ return this.getPrivate('api/v3/margin/repay', params);
558
+ }
559
+ getMarginInterestRecordsV3(params) {
560
+ return this.getPrivate('api/v3/margin/interest', params);
561
+ }
562
+ getMarginActivePairsV3(params) {
563
+ return this.getPrivate('api/v3/margin/symbols', params);
564
+ }
565
+ updateMarginLeverageV3(params) {
566
+ return this.postPrivate('api/v3/position/update-user-leverage', params);
567
+ }
568
+ /**
569
+ *
570
+ * REST - MARGIN TRADING - Lending market(v3)
571
+ *
572
+ */
573
+ getLendingCurrencyV3(params) {
574
+ return this.get('api/v3/project/list', params);
575
+ }
576
+ getLendingInterestRateV3(params) {
577
+ return this.get('api/v3/project/marketInterestRate', params);
578
+ }
579
+ submitLendingSubscriptionV3(params) {
580
+ return this.postPrivate('api/v3/purchase', params);
581
+ }
582
+ submitLendingRedemptionV3(params) {
583
+ return this.postPrivate('api/v3/redeem', params);
584
+ }
585
+ updateLendingSubscriptionOrdersV3(params) {
586
+ return this.postPrivate('api/v3/lend/purchase/update', params);
587
+ }
588
+ getLendingRedemptionOrdersV3(params) {
589
+ return this.getPrivate('api/v3/redeem/orders', params);
590
+ }
591
+ getLendingSubscriptionOrdersV3(params) {
592
+ return this.getPrivate('api/v3/purchase/orders', params);
593
+ }
594
+ /**
595
+ *
596
+ * REST - EARN -General
597
+ *
598
+ */
599
+ /**
600
+ * Subscribe to Earn Fixed Income Products
601
+ *
602
+ * This endpoint allows subscribing to fixed income products.
603
+ * If the subscription fails, it returns the corresponding error code.
604
+ */
605
+ subscribeEarnFixedIncome(params) {
606
+ return this.postPrivate('api/v1/earn/orders', params);
607
+ }
608
+ /**
609
+ * Initiate redemption by holding ID
610
+ *
611
+ * This endpoint allows initiating redemption by holding ID. If the current holding is fully redeemed or in the process of being redeemed, it indicates that the holding does not exist.
612
+ */
613
+ submitRedemption(params) {
614
+ return this.deletePrivate('api/v1/earn/orders', params);
615
+ }
616
+ /**
617
+ * Get Earn Redeem Preview by Holding ID
618
+ *
619
+ * This endpoint retrieves redemption preview information by holding ID. If the current holding is fully redeemed or in the process of being redeemed, it indicates that the holding does not exist.
620
+ */
621
+ getEarnRedeemPreview(params) {
622
+ return this.getPrivate('api/v1/earn/redeem-preview', params);
623
+ }
624
+ /**
625
+ *
626
+ * REST - EARN -KUCOIN EARN
627
+ *
628
+ */
629
+ /**
630
+ * Get Earn Savings Products
631
+ *
632
+ * This endpoint retrieves savings products. If no savings products are available, an empty list is returned.
633
+ */
634
+ getEarnSavingsProducts(params) {
635
+ return this.getPrivate('api/v1/earn/saving/products', params);
636
+ }
637
+ /**
638
+ * Get Earn Fixed Income Current Holdings
639
+ *
640
+ * This endpoint retrieves current holding assets of fixed income products. If no current holding assets are available, an empty list is returned.
641
+ */
642
+ getEarnFixedIncomeHoldAssets(params) {
643
+ return this.getPrivate('api/v1/earn/hold-assets', params);
644
+ }
645
+ /**
646
+ * Get Earn Limited-Time Promotion Products
647
+ *
648
+ * This endpoint retrieves limited-time promotion products. If no products are available, an empty list is returned.
649
+ */
650
+ getEarnPromotionProducts(params) {
651
+ return this.getPrivate('api/v1/earn/promotion/products', params);
652
+ }
653
+ /**
654
+ *
655
+ * REST - EARN - Staking
656
+ *
657
+ */
658
+ /**
659
+ * Get Earn KCS Staking Products
660
+ *
661
+ * This endpoint retrieves KCS Staking products. If no KCS Staking products are available, an empty list is returned.
662
+ *
663
+ */
664
+ getEarnKcsStakingProducts(params) {
665
+ return this.getPrivate('api/v1/earn/kcs-staking/products', params);
666
+ }
667
+ /**
668
+ * Get Earn Staking Products
669
+ *
670
+ * This endpoint retrieves staking products. If no staking products are available, an empty list is returned.
671
+ */
672
+ getEarnStakingProducts(params) {
673
+ return this.getPrivate('api/v1/earn/staking/products', params);
674
+ }
675
+ /**
676
+ * Get Earn ETH Staking Products
677
+ *
678
+ * This endpoint retrieves ETH Staking products. If no ETH Staking products are available, an empty list is returned.
679
+ *
680
+ */
681
+ getEarnEthStakingProducts() {
682
+ return this.getPrivate('api/v1/earn/eth-staking/products');
683
+ }
684
+ /**
685
+ *
686
+ * REST - VIP LENDING
687
+ */
688
+ /**
689
+ * Get information on off-exchange funding and loans
690
+ *
691
+ * This endpoint is only for querying accounts that are currently involved in loans.
692
+ *
693
+ */
694
+ getOtcLoan() {
695
+ return this.getPrivate('api/v1/otc-loan/loan');
696
+ }
697
+ /**
698
+ * Get information on accounts involved in off-exchange loans
699
+ *
700
+ * This endpoint is only for querying accounts that are currently involved in off-exchange funding and loans.
701
+ */
702
+ getOtcLoanAccounts() {
703
+ return this.getPrivate('api/v1/otc-loan/accounts');
704
+ }
705
+ /**
706
+ *
707
+ * REST - AFFILIATE
708
+ *
709
+ */
710
+ /**
711
+ * Get Affiliate User Rebate Information
712
+ *
713
+ * This endpoint allows getting affiliate user rebate information.
714
+ *
715
+ * @param params - The parameters for the request
716
+ * @returns A promise that resolves to the affiliate user rebate information
717
+ */
718
+ getAffiliateUserRebateInfo(params) {
719
+ return this.getPrivate('api/v2/affiliate/inviter/statistics', params);
720
+ }
721
+ /**
722
+ * Get download link for broker rebate orders
723
+ *
724
+ * trade type 1 = spot, trade type 2 = futures
725
+ */
726
+ getBrokerRebateOrderDownloadLink(params) {
727
+ return this.getPrivate('api/v1/broker/api/rebase/download', params);
728
+ }
729
+ /**
730
+ *
731
+ * WebSockets
732
+ *
733
+ */
734
+ getPublicWSConnectionToken() {
735
+ return this.post('api/v1/bullet-public');
736
+ }
737
+ getPrivateWSConnectionToken() {
738
+ return this.postPrivate('api/v1/bullet-private');
739
+ }
740
+ }
741
+ //# sourceMappingURL=SpotClient.js.map