kucoin-api 2.0.0 → 2.0.1

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 (33) hide show
  1. package/dist/cjs/FuturesClient.d.ts +129 -24
  2. package/dist/cjs/FuturesClient.js +108 -16
  3. package/dist/cjs/FuturesClient.js.map +1 -1
  4. package/dist/cjs/SpotClient.d.ts +80 -85
  5. package/dist/cjs/SpotClient.js +55 -55
  6. package/dist/cjs/SpotClient.js.map +1 -1
  7. package/dist/cjs/types/request/futures.types.d.ts +68 -16
  8. package/dist/cjs/types/request/spot-account.d.ts +1 -1
  9. package/dist/cjs/types/request/spot-funding.d.ts +0 -2
  10. package/dist/cjs/types/request/spot-trading.d.ts +11 -20
  11. package/dist/cjs/types/response/futures.types.d.ts +118 -58
  12. package/dist/cjs/types/response/spot-account.d.ts +76 -28
  13. package/dist/cjs/types/response/spot-funding.d.ts +34 -32
  14. package/dist/cjs/types/response/spot-margin-trading.d.ts +80 -15
  15. package/dist/cjs/types/response/spot-misc.d.ts +1 -1
  16. package/dist/cjs/types/response/spot-trading.d.ts +100 -74
  17. package/dist/mjs/FuturesClient.d.ts +129 -24
  18. package/dist/mjs/FuturesClient.js +108 -16
  19. package/dist/mjs/FuturesClient.js.map +1 -1
  20. package/dist/mjs/SpotClient.d.ts +80 -85
  21. package/dist/mjs/SpotClient.js +55 -55
  22. package/dist/mjs/SpotClient.js.map +1 -1
  23. package/dist/mjs/types/request/futures.types.d.ts +68 -16
  24. package/dist/mjs/types/request/spot-account.d.ts +1 -1
  25. package/dist/mjs/types/request/spot-funding.d.ts +0 -2
  26. package/dist/mjs/types/request/spot-trading.d.ts +11 -20
  27. package/dist/mjs/types/response/futures.types.d.ts +118 -58
  28. package/dist/mjs/types/response/spot-account.d.ts +76 -28
  29. package/dist/mjs/types/response/spot-funding.d.ts +34 -32
  30. package/dist/mjs/types/response/spot-margin-trading.d.ts +80 -15
  31. package/dist/mjs/types/response/spot-misc.d.ts +1 -1
  32. package/dist/mjs/types/response/spot-trading.d.ts +100 -74
  33. package/package.json +1 -1
@@ -12,18 +12,26 @@
12
12
  */
13
13
  export interface HFMarginOrder {
14
14
  id: string;
15
+ clientOid: string;
15
16
  symbol: string;
16
- opType: 'DEAL';
17
+ opType: string;
17
18
  type: 'limit' | 'market';
18
19
  side: 'buy' | 'sell';
19
20
  price: string;
20
21
  size: string;
21
22
  funds: string;
22
- dealFunds: string;
23
23
  dealSize: string;
24
+ dealFunds: string;
25
+ remainSize: string;
26
+ remainFunds: string;
27
+ cancelledSize: string;
28
+ cancelledFunds: string;
24
29
  fee: string;
25
30
  feeCurrency: string;
26
- stp: string;
31
+ stp?: 'DC' | 'CO' | 'CN' | 'CB' | null;
32
+ stop?: string | null;
33
+ stopTriggered: boolean;
34
+ stopPrice: string;
27
35
  timeInForce: 'GTC' | 'GTT' | 'IOC' | 'FOK';
28
36
  postOnly: boolean;
29
37
  hidden: boolean;
@@ -31,16 +39,17 @@ export interface HFMarginOrder {
31
39
  visibleSize: string;
32
40
  cancelAfter: number;
33
41
  channel: string;
34
- clientOid: string;
35
- remark: string;
36
- tags: string;
37
- active: boolean;
38
- inOrderBook: boolean;
42
+ remark?: string | null;
43
+ tags?: string | null;
39
44
  cancelExist: boolean;
45
+ tradeType: string;
46
+ inOrderBook: boolean;
47
+ tax: string;
48
+ active: boolean;
40
49
  createdAt: number;
41
50
  lastUpdatedAt: number;
42
- tradeType: 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
43
51
  }
52
+ /** @deprecated not used anymore **/
44
53
  export type HFMarginFilledOrder = HFMarginOrder & {
45
54
  inOrderBook: boolean;
46
55
  active: boolean;
@@ -60,10 +69,12 @@ export interface HFMarginTransactionRecord {
60
69
  fee: string;
61
70
  feeRate: string;
62
71
  feeCurrency: string;
63
- type: 'limit' | 'market';
64
72
  stop: string;
73
+ tradeType: 'TRADE' | 'MARGIN_TRADE';
74
+ tax: string;
75
+ taxRate: string;
76
+ type: 'limit' | 'market';
65
77
  createdAt: number;
66
- tradeType: 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
67
78
  }
68
79
  /**
69
80
  *
@@ -80,12 +91,30 @@ export interface SubmitMarginOrderResponse {
80
91
  * Margin info
81
92
  *
82
93
  */
94
+ export interface MarginActivePairsV3 {
95
+ symbol: string;
96
+ name: string;
97
+ enableTrading: boolean;
98
+ market: string;
99
+ baseCurrency: string;
100
+ quoteCurrency: string;
101
+ baseIncrement: string;
102
+ baseMinSize: string;
103
+ baseMaxSize: string;
104
+ quoteIncrement: string;
105
+ quoteMinSize: string;
106
+ quoteMaxSize: string;
107
+ priceIncrement: string;
108
+ feeCurrency: string;
109
+ priceLimitRate: string;
110
+ minFunds: string;
111
+ }
83
112
  export interface MarginLevTokenInfo {
84
113
  currency: string;
85
114
  netAsset: number;
86
115
  targetLeverage: string;
87
116
  actualLeverage: string;
88
- assetsUnderManagement: string;
117
+ issuedSize: string;
89
118
  basket: string;
90
119
  }
91
120
  export interface MarginMarkPrice {
@@ -149,6 +178,8 @@ export interface IsolatedMarginSymbolsConfig {
149
178
  quoteBorrowEnable: boolean;
150
179
  baseTransferInEnable: boolean;
151
180
  quoteTransferInEnable: boolean;
181
+ baseBorrowCoefficient: string;
182
+ quoteBorrowCoefficient: string;
152
183
  }
153
184
  export interface IsolatedMarginAccountInfo {
154
185
  totalConversionBalance: string;
@@ -183,11 +214,26 @@ export interface AssetDetail {
183
214
  * Margin trading(v3)
184
215
  *
185
216
  */
217
+ export interface MarginSubmitOrderV3Response {
218
+ orderId: string;
219
+ clientOid: string;
220
+ borrowSize: string;
221
+ loanApplyId: string;
222
+ }
186
223
  export interface MarginOrderV3 {
224
+ timestamp: number;
187
225
  orderNo: string;
188
226
  actualSize: number;
189
227
  }
190
- export interface MarginHistoryRecord {
228
+ export interface MarginBorrowHistoryV3 {
229
+ timestamp: number;
230
+ currentPage: number;
231
+ pageSize: number;
232
+ totalNum: number;
233
+ totalPage: number;
234
+ items: MarginBorrowHistoryRecord[];
235
+ }
236
+ export interface MarginBorrowHistoryRecord {
191
237
  orderNo: string;
192
238
  symbol: string;
193
239
  currency: string;
@@ -196,13 +242,32 @@ export interface MarginHistoryRecord {
196
242
  status: string;
197
243
  createdTime: number;
198
244
  }
245
+ export interface MarginRepayHistoryV3 {
246
+ timestamp: number;
247
+ currentPage: number;
248
+ pageSize: number;
249
+ totalNum: number;
250
+ totalPage: number;
251
+ items: MarginRepayHistoryRecord[];
252
+ }
253
+ export interface MarginRepayHistoryRecord {
254
+ orderNo: string;
255
+ symbol: string | null;
256
+ currency: string;
257
+ size: string;
258
+ principal: string;
259
+ interest: string;
260
+ status: string;
261
+ createdTime: number;
262
+ }
199
263
  export interface MarginInterestRecord {
200
- createdAt: number;
201
264
  currency: string;
202
- interestAmount: string;
203
265
  dayRatio: string;
266
+ interestAmount: string;
267
+ createdTime: number;
204
268
  }
205
269
  export interface MarginInterestRecords {
270
+ timestamp: number;
206
271
  currentPage: number;
207
272
  pageSize: number;
208
273
  totalNum: number;
@@ -9,8 +9,8 @@ export interface Announcement {
9
9
  }
10
10
  export interface Announcements {
11
11
  totalNum: number;
12
- items: Announcement[];
13
12
  currentPage: number;
14
13
  pageSize: number;
15
14
  totalPage: number;
15
+ items: Announcement[];
16
16
  }
@@ -10,17 +10,6 @@
10
10
  * Market data
11
11
  *
12
12
  */
13
- interface Chain {
14
- chainName: string;
15
- withdrawalMinSize: string;
16
- withdrawalMinFee: string;
17
- isWithdrawEnabled: boolean;
18
- isDepositEnabled: boolean;
19
- confirms: number;
20
- preConfirms: number;
21
- contractAddress: string;
22
- chainId: string;
23
- }
24
13
  export interface CurrencyInfo {
25
14
  currency: string;
26
15
  name: string;
@@ -31,10 +20,23 @@ export interface CurrencyInfo {
31
20
  isMarginEnabled: boolean;
32
21
  isDebitEnabled: boolean;
33
22
  chains: Chain[];
23
+ }
24
+ interface Chain {
25
+ chainName: string;
26
+ withdrawalMinSize: string;
27
+ depositMinSize: string | null;
28
+ withdrawFeeRate: string;
29
+ withdrawalMinFee: string;
30
+ isWithdrawEnabled: boolean;
31
+ isDepositEnabled: boolean;
32
+ confirms: number;
33
+ preConfirms: number;
34
+ contractAddress: string;
34
35
  withdrawPrecision: number;
36
+ maxWithdraw: string | null;
37
+ maxDeposit: string | null;
35
38
  needTag: boolean;
36
- maxWithdraw: string;
37
- maxDeposit: string;
39
+ chainId: string;
38
40
  }
39
41
  export interface SymbolInfo {
40
42
  symbol: string;
@@ -42,7 +44,7 @@ export interface SymbolInfo {
42
44
  baseCurrency: string;
43
45
  quoteCurrency: string;
44
46
  feeCurrency: string;
45
- market: string;
47
+ market: 'USDS' | 'BTC' | 'ALTS';
46
48
  baseMinSize: string;
47
49
  quoteMinSize: string;
48
50
  baseMaxSize: string;
@@ -54,6 +56,10 @@ export interface SymbolInfo {
54
56
  minFunds: string;
55
57
  isMarginEnabled: boolean;
56
58
  enableTrading: boolean;
59
+ feeCategory: 1 | 2 | 3;
60
+ makerFeeCoefficient: string;
61
+ takerFeeCoefficient: string;
62
+ st: boolean;
57
63
  }
58
64
  export interface Ticker {
59
65
  sequence: string;
@@ -65,6 +71,30 @@ export interface Ticker {
65
71
  bestBidSize: string;
66
72
  time: number;
67
73
  }
74
+ export interface AllTickers {
75
+ time: number;
76
+ ticker: Ticker[];
77
+ }
78
+ export interface AllTickersItem {
79
+ symbol: string;
80
+ symbolName: string;
81
+ buy: string;
82
+ bestBidSize: string;
83
+ sell: string;
84
+ bestAskSize: string;
85
+ changeRate: string;
86
+ changePrice: string;
87
+ high: string;
88
+ low: string;
89
+ vol: string;
90
+ volValue: string;
91
+ last: string;
92
+ averagePrice: string;
93
+ takerFeeRate: string;
94
+ makerFeeRate: string;
95
+ takerCoefficient: string;
96
+ makerCoefficient: string;
97
+ }
68
98
  export interface Symbol24hrStats {
69
99
  time: number;
70
100
  symbol: string;
@@ -96,15 +126,7 @@ export interface TradeHistory {
96
126
  size: string;
97
127
  side: string;
98
128
  }
99
- export interface Kline {
100
- startAt: string;
101
- open: string;
102
- close: string;
103
- high: string;
104
- low: string;
105
- volume: string;
106
- amount: string;
107
- }
129
+ export type Kline = [string, string, string, string, string, string, string];
108
130
  /**
109
131
  *
110
132
  * Spot HF trade
@@ -140,7 +162,8 @@ export interface SubmitMultipleHFOrdersSyncResponse {
140
162
  clientOid: string;
141
163
  }
142
164
  export interface SyncCancelHFOrderResponse {
143
- orderId: string;
165
+ clientOid?: string;
166
+ orderId?: string;
144
167
  originSize: string;
145
168
  dealSize: string;
146
169
  remainSize: string;
@@ -162,12 +185,13 @@ export interface AutoCancelHFOrderSettingQueryResponse {
162
185
  }
163
186
  export interface HFFilledOrder {
164
187
  id: number;
165
- symbol: string;
166
- tradeId: number;
167
188
  orderId: string;
168
189
  counterOrderId: string;
169
- side: string;
170
- liquidity: string;
190
+ tradeId: number;
191
+ symbol: string;
192
+ side: 'buy' | 'sell';
193
+ liquidity: 'taker' | 'maker';
194
+ type: 'limit' | 'market';
171
195
  forceTaker: boolean;
172
196
  price: string;
173
197
  size: string;
@@ -177,43 +201,45 @@ export interface HFFilledOrder {
177
201
  feeCurrency: string;
178
202
  stop: string;
179
203
  tradeType: string;
180
- type: string;
204
+ taxRate: string;
205
+ tax: string;
181
206
  createdAt: number;
182
207
  }
183
208
  export interface HFOrder {
184
209
  id: string;
210
+ clientOid: string;
185
211
  symbol: string;
186
212
  opType: string;
187
- type: string;
188
- side: string;
213
+ type: 'limit' | 'market';
214
+ side: 'buy' | 'sell';
189
215
  price: string;
190
216
  size: string;
191
- dealSize: string;
192
- cancelledSize: string;
193
- remainSize: string;
194
217
  funds: string;
218
+ dealSize: string;
195
219
  dealFunds: string;
196
- cancelledFunds: string;
220
+ remainSize: string;
197
221
  remainFunds: string;
222
+ cancelledSize: string;
223
+ cancelledFunds: string;
198
224
  fee: string;
199
225
  feeCurrency: string;
200
- stp: string;
201
- timeInForce: string;
226
+ stp?: 'DC' | 'CO' | 'CN' | 'CB' | null;
227
+ timeInForce: 'GTC' | 'GTT' | 'IOC' | 'FOK';
202
228
  postOnly: boolean;
203
229
  hidden: boolean;
204
230
  iceberg: boolean;
205
231
  visibleSize: string;
206
232
  cancelAfter: number;
207
233
  channel: string;
208
- clientOid: string;
209
- remark: string;
210
- tags: string;
211
- active: boolean;
212
- inOrderBook: boolean;
234
+ remark?: string | null;
235
+ tags?: string | null;
213
236
  cancelExist: boolean;
237
+ tradeType: string;
238
+ inOrderBook: boolean;
239
+ active: boolean;
240
+ tax: string;
214
241
  createdAt: number;
215
242
  lastUpdatedAt: number;
216
- tradeType: string;
217
243
  }
218
244
  /**
219
245
  *
@@ -324,37 +350,37 @@ export interface StopOrders {
324
350
  items: StopOrderItem[];
325
351
  }
326
352
  export interface StopOrderItem {
327
- id: string;
328
- symbol: string;
329
- userId: string;
330
- status: 'NEW' | 'TRIGGERED';
331
- type: 'limit' | 'market';
332
- side: 'buy' | 'sell';
333
- price: string;
334
- size: string;
335
- funds: string | null;
336
- stp: string | null;
337
- timeInForce: 'GTC' | 'GTT' | 'IOC' | 'FOK';
338
- cancelAfter: number;
339
- postOnly: boolean;
340
- hidden: boolean;
341
- iceberg: boolean;
342
- visibleSize: string | null;
343
- channel: string;
344
- clientOid: string;
345
- remark: string | null;
346
- tags: string | null;
347
- orderTime: number;
348
- domainId: string;
349
- tradeSource: 'USER' | 'MARGIN_SYSTEM';
350
- tradeType: 'TRADE' | 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
351
- feeCurrency: string;
352
- takerFeeRate: string;
353
- makerFeeRate: string;
354
- createdAt: number;
355
- stop: 'loss' | 'entry';
356
- stopTriggerTime: number | null;
357
- stopPrice: string;
353
+ id?: string;
354
+ symbol?: string;
355
+ userId?: string;
356
+ status?: 'NEW' | 'TRIGGERED';
357
+ type?: 'limit' | 'market' | 'limit_stop' | 'market_stop';
358
+ side?: 'buy' | 'sell';
359
+ price?: string;
360
+ size?: string;
361
+ funds?: string | null;
362
+ stp?: string | null;
363
+ timeInForce?: 'GTC' | 'GTT' | 'IOC' | 'FOK';
364
+ cancelAfter?: number;
365
+ postOnly?: boolean;
366
+ hidden?: boolean;
367
+ iceberg?: boolean;
368
+ visibleSize?: string | null;
369
+ channel?: string;
370
+ clientOid?: string;
371
+ remark?: string | null;
372
+ tags?: string | null;
373
+ domainId?: string;
374
+ tradeSource?: 'USER' | 'MARGIN_SYSTEM';
375
+ tradeType?: 'TRADE' | 'MARGIN_TRADE' | 'MARGIN_ISOLATED_TRADE';
376
+ feeCurrency?: string;
377
+ takerFeeRate?: string;
378
+ makerFeeRate?: string;
379
+ createdAt?: number;
380
+ stop?: 'loss' | 'entry';
381
+ stopTriggerTime?: number | null;
382
+ stopPrice?: string;
383
+ orderTime?: number;
358
384
  }
359
385
  /**
360
386
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kucoin-api",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Complete & robust Node.js SDK for Kucoin's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
5
5
  "scripts": {
6
6
  "clean": "rm -rf dist",