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