kucoin-api 2.0.0 → 2.0.2

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 (51) 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/WebsocketClient.d.ts +1 -0
  8. package/dist/cjs/WebsocketClient.js +23 -22
  9. package/dist/cjs/WebsocketClient.js.map +1 -1
  10. package/dist/cjs/lib/BaseRestClient.d.ts +6 -2
  11. package/dist/cjs/lib/BaseRestClient.js +8 -1
  12. package/dist/cjs/lib/BaseRestClient.js.map +1 -1
  13. package/dist/cjs/lib/requestUtils.d.ts +1 -0
  14. package/dist/cjs/lib/requestUtils.js.map +1 -1
  15. package/dist/cjs/types/request/futures.types.d.ts +68 -16
  16. package/dist/cjs/types/request/spot-account.d.ts +1 -1
  17. package/dist/cjs/types/request/spot-funding.d.ts +0 -2
  18. package/dist/cjs/types/request/spot-trading.d.ts +11 -20
  19. package/dist/cjs/types/response/futures.types.d.ts +118 -58
  20. package/dist/cjs/types/response/spot-account.d.ts +76 -28
  21. package/dist/cjs/types/response/spot-funding.d.ts +34 -32
  22. package/dist/cjs/types/response/spot-margin-trading.d.ts +80 -15
  23. package/dist/cjs/types/response/spot-misc.d.ts +1 -1
  24. package/dist/cjs/types/response/spot-trading.d.ts +100 -74
  25. package/dist/cjs/types/websockets/client.d.ts +4 -0
  26. package/dist/mjs/FuturesClient.d.ts +129 -24
  27. package/dist/mjs/FuturesClient.js +108 -16
  28. package/dist/mjs/FuturesClient.js.map +1 -1
  29. package/dist/mjs/SpotClient.d.ts +80 -85
  30. package/dist/mjs/SpotClient.js +55 -55
  31. package/dist/mjs/SpotClient.js.map +1 -1
  32. package/dist/mjs/WebsocketClient.d.ts +1 -0
  33. package/dist/mjs/WebsocketClient.js +23 -22
  34. package/dist/mjs/WebsocketClient.js.map +1 -1
  35. package/dist/mjs/lib/BaseRestClient.d.ts +6 -2
  36. package/dist/mjs/lib/BaseRestClient.js +8 -1
  37. package/dist/mjs/lib/BaseRestClient.js.map +1 -1
  38. package/dist/mjs/lib/requestUtils.d.ts +1 -0
  39. package/dist/mjs/lib/requestUtils.js.map +1 -1
  40. package/dist/mjs/types/request/futures.types.d.ts +68 -16
  41. package/dist/mjs/types/request/spot-account.d.ts +1 -1
  42. package/dist/mjs/types/request/spot-funding.d.ts +0 -2
  43. package/dist/mjs/types/request/spot-trading.d.ts +11 -20
  44. package/dist/mjs/types/response/futures.types.d.ts +118 -58
  45. package/dist/mjs/types/response/spot-account.d.ts +76 -28
  46. package/dist/mjs/types/response/spot-funding.d.ts +34 -32
  47. package/dist/mjs/types/response/spot-margin-trading.d.ts +80 -15
  48. package/dist/mjs/types/response/spot-misc.d.ts +1 -1
  49. package/dist/mjs/types/response/spot-trading.d.ts +100 -74
  50. package/dist/mjs/types/websockets/client.d.ts +4 -0
  51. package/package.json +2 -2
@@ -1,19 +1,21 @@
1
1
  export interface SpotAccountSummary {
2
2
  level: number;
3
3
  subQuantity: number;
4
- maxDefaultSubQuantity: number;
5
- maxSubQuantity: number;
6
4
  spotSubQuantity: number;
7
5
  marginSubQuantity: number;
8
6
  futuresSubQuantity: number;
7
+ optionSubQuantity: number;
8
+ maxSubQuantity: number;
9
+ maxDefaultSubQuantity: number;
9
10
  maxSpotSubQuantity: number;
10
11
  maxMarginSubQuantity: number;
11
12
  maxFuturesSubQuantity: number;
13
+ maxOptionSubQuantity: number;
12
14
  }
13
15
  export interface Balances {
14
16
  id: string;
15
17
  currency: string;
16
- type: 'main' | 'trade' | 'trade_hf' | 'margin';
18
+ type: 'main' | 'trade';
17
19
  balance: string;
18
20
  available: string;
19
21
  holds: string;
@@ -29,9 +31,10 @@ export interface SpotAccountTransaction {
29
31
  currency: string;
30
32
  amount: string;
31
33
  fee: string;
34
+ tax: string;
32
35
  balance: string;
33
- accountType: 'TRADE_HF';
34
- bizType: 'TRANSFER' | 'TRADE_EXCHANGE';
36
+ accountType: string;
37
+ bizType: string;
35
38
  direction: 'out' | 'in';
36
39
  createdAt: string;
37
40
  context: string;
@@ -53,6 +56,7 @@ export interface AccountHFMarginTransactions {
53
56
  bizType: 'TRANSFER' | 'MARGIN_EXCHANGE' | 'ISOLATED_EXCHANGE' | 'LIQUIDATION' | 'ASSERT_RETURN';
54
57
  direction: 'out' | 'in';
55
58
  createdAt: string;
59
+ tax: string;
56
60
  context: string;
57
61
  }
58
62
  /**
@@ -60,37 +64,45 @@ export interface AccountHFMarginTransactions {
60
64
  * Sub-Account
61
65
  *
62
66
  */
67
+ export interface SubAccountsV2 {
68
+ currentPage: number;
69
+ pageSize: number;
70
+ totalNum: number;
71
+ totalPage: number;
72
+ items: SubAccountInfo[];
73
+ }
63
74
  export interface SubAccountInfo {
64
75
  userId: string;
65
- uid: string | number;
76
+ uid: number;
66
77
  subName: string;
78
+ status: number;
67
79
  type: number;
68
- remarks: string | null;
69
80
  access: string;
70
- status?: number;
71
- createdAt?: number;
72
- }
73
- export interface SubAccountBalance {
74
- currency: string;
75
- balance: string;
76
- available: string;
77
- holds: string;
78
- baseCurrency: string;
79
- baseCurrencyPrice: string;
80
- baseAmount: string;
81
+ createdAt: number;
82
+ remarks: string;
83
+ tradeTypes: string[];
84
+ openedTradeTypes: string[];
85
+ hostedStatus: null | string;
81
86
  }
82
- export interface SubAccountsV2 {
87
+ export interface CreateSubAccount {
83
88
  currentPage: number;
84
89
  pageSize: number;
85
90
  totalNum: number;
86
91
  totalPage: number;
87
- items: SubAccountInfo[];
92
+ items: SubAccountItem[];
88
93
  }
89
- export interface CreateSubAccount {
94
+ export interface SubAccountItem {
95
+ userId: string;
90
96
  uid: number;
91
97
  subName: string;
92
- remarks: string;
98
+ status: number;
99
+ type: number;
93
100
  access: string;
101
+ createdAt: number;
102
+ remarks: string;
103
+ tradeTypes: string[];
104
+ openedTradeTypes: string[];
105
+ hostedStatus: null | string;
94
106
  }
95
107
  export interface SubAccountBalances {
96
108
  subUserId: string;
@@ -99,6 +111,15 @@ export interface SubAccountBalances {
99
111
  tradeAccounts: SubAccountBalance[];
100
112
  marginAccounts: SubAccountBalance[];
101
113
  }
114
+ export interface SubAccountBalance {
115
+ currency: string;
116
+ balance: string;
117
+ available: string;
118
+ holds: string;
119
+ baseCurrency: string;
120
+ baseCurrencyPrice: string;
121
+ baseAmount: string;
122
+ }
102
123
  export interface SubAccountBalancesV2 {
103
124
  currentPage: number;
104
125
  pageSize: number;
@@ -110,6 +131,24 @@ export interface SubAccountBalancesV2 {
110
131
  mainAccounts: SubAccountBalance[];
111
132
  }[];
112
133
  }
134
+ export interface SubAccountBalanceItemV2 {
135
+ subUserId: string;
136
+ subName: string;
137
+ mainAccounts: SubAccountV2Details[];
138
+ tradeAccounts: SubAccountV2Details[];
139
+ marginAccounts: SubAccountV2Details[];
140
+ tradeHFAccounts: string[];
141
+ }
142
+ export interface SubAccountV2Details {
143
+ currency?: string;
144
+ balance?: string;
145
+ available?: string;
146
+ holds?: string;
147
+ baseCurrency?: string;
148
+ baseCurrencyPrice?: string;
149
+ baseAmount?: string;
150
+ tag?: string;
151
+ }
113
152
  /**
114
153
  *
115
154
  * Sub-Account API
@@ -117,17 +156,26 @@ export interface SubAccountBalancesV2 {
117
156
  *
118
157
  */
119
158
  export interface SubAccountAPIInfo {
159
+ subName: string;
160
+ remark: string;
120
161
  apiKey: string;
121
- createdAt: number;
122
- ipWhitelist: string;
162
+ apiVersion: number;
123
163
  permission: string;
124
- remark: string;
125
- subName: string;
164
+ ipWhitelist: string;
165
+ createdAt: number;
166
+ uid: number;
167
+ isMaster: boolean;
126
168
  }
127
- export type CreateSubAPI = SubAccountAPIInfo & {
169
+ export interface CreateSubAPI {
170
+ subName: string;
171
+ remark: string;
172
+ apiKey: string;
128
173
  apiSecret: string;
174
+ apiVersion: number;
129
175
  passphrase: string;
130
- };
176
+ permission: string;
177
+ createdAt: number;
178
+ }
131
179
  export interface UpdateSubAPI {
132
180
  apiKey: string;
133
181
  ipWhitelist: string;
@@ -34,13 +34,6 @@ export interface MarginAccountDetail {
34
34
  borrowEnabled: boolean;
35
35
  transferInEnabled: boolean;
36
36
  }
37
- export interface IsolatedMarginAssetDetail {
38
- symbol: string;
39
- debtRatio: string;
40
- status: 'EFFECTIVE' | 'BANKRUPTCY' | 'LIQUIDATION' | 'REPAY' | 'BORROW';
41
- baseAsset: MarginAssetDetail;
42
- quoteAsset: MarginAssetDetail;
43
- }
44
37
  export interface MarginBalance {
45
38
  totalAssetOfQuoteCurrency: string;
46
39
  totalLiabilityOfQuoteCurrency: string;
@@ -54,6 +47,13 @@ export interface IsolatedMarginBalance {
54
47
  timestamp: number;
55
48
  assets: IsolatedMarginAssetDetail[];
56
49
  }
50
+ export interface IsolatedMarginAssetDetail {
51
+ symbol: string;
52
+ debtRatio: string;
53
+ status: 'EFFECTIVE' | 'BANKRUPTCY' | 'LIQUIDATION' | 'REPAY' | 'BORROW';
54
+ baseAsset: MarginAssetDetail;
55
+ quoteAsset: MarginAssetDetail;
56
+ }
57
57
  /**
58
58
  *
59
59
  * Deposit
@@ -70,26 +70,12 @@ export type DepositAddressV2 = DepositAddress & {
70
70
  export interface DepositAddressV3 {
71
71
  address: string;
72
72
  memo: string;
73
- chainName: string;
74
73
  chainId: string;
75
- contractAddress: string;
74
+ to: 'MAIN' | 'TRADE';
76
75
  expirationDate: number;
77
- to: 'main' | 'trade';
78
- currency: string;
79
- }
80
- export interface DepositItem {
81
- address: string;
82
- memo: string;
83
- amount: string;
84
- fee: string;
85
76
  currency: string;
86
- chain: string;
87
- isInner: boolean;
88
- walletTxId: string;
89
- status: 'PROCESSING' | 'SUCCESS' | 'FAILURE';
90
- remark: string;
91
- createdAt: number;
92
- updatedAt: number;
77
+ contractAddress: string;
78
+ chainName: string;
93
79
  }
94
80
  export interface HistoricalDepositItem {
95
81
  currency: string;
@@ -106,6 +92,21 @@ export interface Deposits {
106
92
  totalPage: number;
107
93
  items: DepositItem[];
108
94
  }
95
+ export interface DepositItem {
96
+ currency?: string;
97
+ chain?: string;
98
+ status?: 'PROCESSING' | 'SUCCESS' | 'FAILURE';
99
+ address?: string;
100
+ memo?: string;
101
+ isInner?: boolean;
102
+ amount?: string;
103
+ fee?: string;
104
+ walletTxId?: string | null;
105
+ createdAt?: number;
106
+ updatedAt?: number;
107
+ remark?: string;
108
+ arrears?: boolean;
109
+ }
109
110
  export interface V1HistoricalDeposits {
110
111
  currentPage: number;
111
112
  pageSize: number;
@@ -166,21 +167,22 @@ export interface HistoricalWithdrawalsV1 {
166
167
  items: HistoricalWithdrawal[];
167
168
  }
168
169
  export interface WithdrawalQuotas {
170
+ currency: string;
169
171
  limitBTCAmount: string;
172
+ usedBTCAmount: string;
170
173
  quotaCurrency: string;
171
- chain: string;
174
+ limitQuotaCurrencyAmount: string;
175
+ usedQuotaCurrencyAmount: string;
172
176
  remainAmount: string;
177
+ availableAmount: string;
178
+ withdrawMinFee: string;
173
179
  innerWithdrawMinFee: string;
174
- usedBTCAmount: string;
175
- limitQuotaCurrencyAmount: string;
176
180
  withdrawMinSize: string;
177
- withdrawMinFee: string;
181
+ isWithdrawEnabled: boolean;
178
182
  precision: number;
183
+ chain: string;
179
184
  reason: string | null;
180
- usedQuotaCurrencyAmount: string;
181
- currency: string;
182
- availableAmount: string;
183
- isWithdrawEnabled: boolean;
185
+ lockedAmount: string;
184
186
  }
185
187
  /**
186
188
  *
@@ -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
  }