ccxt 4.1.59 → 4.1.60

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.
package/dist/cjs/ccxt.js CHANGED
@@ -173,7 +173,7 @@ var woo$1 = require('./src/pro/woo.js');
173
173
 
174
174
  //-----------------------------------------------------------------------------
175
175
  // this is updated by vss.js when building
176
- const version = '4.1.59';
176
+ const version = '4.1.60';
177
177
  Exchange["default"].ccxtVersion = version;
178
178
  const exchanges = {
179
179
  'ace': ace,
@@ -414,7 +414,7 @@ class Exchange {
414
414
  'fetchPermissions': undefined,
415
415
  'fetchPosition': undefined,
416
416
  'fetchPositions': undefined,
417
- 'fetchPositionsBySymbol': undefined,
417
+ 'fetchPositionsForSymbol': undefined,
418
418
  'fetchPositionsRisk': undefined,
419
419
  'fetchPremiumIndexOHLCV': undefined,
420
420
  'fetchStatus': 'emulated',
@@ -3022,16 +3022,16 @@ class Exchange {
3022
3022
  async watchPositionForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
3023
3023
  return this.watchPositions(symbols, since, limit, params);
3024
3024
  }
3025
- async fetchPositionsBySymbol(symbol, params = {}) {
3025
+ async fetchPositionsForSymbol(symbol, params = {}) {
3026
3026
  /**
3027
3027
  * @method
3028
- * @name exchange#fetchPositionsBySymbol
3029
- * @description specifically fetches positions for specific symbol, unlike fetchPositions (which can work with multiple symbols, but because of that, it might be slower & more rate-limit consuming)
3030
- * @param {string} symbol unified market symbol of the market the position is held in
3028
+ * @name exchange#fetchPositionsForSymbol
3029
+ * @description fetches all open positions for specific symbol, unlike fetchPositions (which is designed to work with multiple symbols) so this method might be preffered for ony-market purposes, because of less rate-limit consumption and speed
3030
+ * @param {string} symbol unified market symbol
3031
3031
  * @param {object} params extra parameters specific to the endpoint
3032
- * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} with maximum 3 items - one position for "one-way" mode, and two positions (long & short) for "two-way" (a.k.a. hedge) mode
3032
+ * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} with maximum 3 items - possible one position for "one-way" mode, and possible two positions (long & short) for "two-way" (a.k.a. hedge) mode
3033
3033
  */
3034
- throw new errors.NotSupported(this.id + ' fetchPositionsBySymbol() is not supported yet');
3034
+ throw new errors.NotSupported(this.id + ' fetchPositionsForSymbol() is not supported yet');
3035
3035
  }
3036
3036
  async fetchPositions(symbols = undefined, params = {}) {
3037
3037
  throw new errors.NotSupported(this.id + ' fetchPositions() is not supported yet');
@@ -111,7 +111,7 @@ class Client {
111
111
  if (!this.isOpen()) {
112
112
  const error = new errors.RequestTimeout('Connection to ' + this.url + ' failed due to a connection timeout');
113
113
  this.onError(error);
114
- this.connection.close(platform.isNode ? 1006 : 1000);
114
+ this.connection.close(1006);
115
115
  }
116
116
  }
117
117
  setConnectionTimeout() {
@@ -257,6 +257,7 @@ class binance extends binance$1 {
257
257
  'margin/capital-flow': 10,
258
258
  'margin/delist-schedule': 10,
259
259
  'margin/available-inventory': 0.3334,
260
+ 'margin/leverageBracket': 0.1,
260
261
  'loan/vip/loanable/data': 40,
261
262
  'loan/vip/collateral/data': 40,
262
263
  'loan/vip/request/data': 2.6668,
@@ -231,6 +231,7 @@ class coinbasepro extends coinbasepro$1 {
231
231
  * @method
232
232
  * @name coinbasepro#fetchCurrencies
233
233
  * @description fetches all available currencies on an exchange
234
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getcurrencies
234
235
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
235
236
  * @returns {object} an associative dictionary of currencies
236
237
  */
@@ -301,6 +302,7 @@ class coinbasepro extends coinbasepro$1 {
301
302
  * @method
302
303
  * @name coinbasepro#fetchMarkets
303
304
  * @description retrieves data on all markets for coinbasepro
305
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproducts
304
306
  * @param {object} [params] extra parameters specific to the exchange api endpoint
305
307
  * @returns {object[]} an array of objects representing market data
306
308
  */
@@ -421,6 +423,7 @@ class coinbasepro extends coinbasepro$1 {
421
423
  * @method
422
424
  * @name coinbasepro#fetchAccounts
423
425
  * @description fetch all the accounts associated with a profile
426
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounts
424
427
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
425
428
  * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
426
429
  */
@@ -486,6 +489,7 @@ class coinbasepro extends coinbasepro$1 {
486
489
  * @method
487
490
  * @name coinbasepro#fetchBalance
488
491
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
492
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounts
489
493
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
490
494
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
491
495
  */
@@ -618,6 +622,7 @@ class coinbasepro extends coinbasepro$1 {
618
622
  * @method
619
623
  * @name coinbasepro#fetchTickers
620
624
  * @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
625
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getproduct
621
626
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
622
627
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
623
628
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -853,6 +858,7 @@ class coinbasepro extends coinbasepro$1 {
853
858
  * @method
854
859
  * @name coinbasepro#fetchTradingFees
855
860
  * @description fetch the trading fees for multiple markets
861
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getfees
856
862
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
857
863
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
858
864
  */
@@ -1351,6 +1357,8 @@ class coinbasepro extends coinbasepro$1 {
1351
1357
  * @method
1352
1358
  * @name coinbasepro#deposit
1353
1359
  * @description Creates a new deposit address, as required by coinbasepro
1360
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postdepositpaymentmethod
1361
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postdepositcoinbaseaccount
1354
1362
  * @param {string} code Unified CCXT currency code (e.g. `"USDT"`)
1355
1363
  * @param {float} amount The amount of currency to send in the deposit (e.g. `20`)
1356
1364
  * @param {string} address Not used by coinbasepro
@@ -1392,6 +1400,8 @@ class coinbasepro extends coinbasepro$1 {
1392
1400
  * @method
1393
1401
  * @name coinbasepro#withdraw
1394
1402
  * @description make a withdrawal
1403
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postwithdrawpaymentmethod
1404
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postwithdrawcoinbaseaccount
1395
1405
  * @param {string} code unified currency code
1396
1406
  * @param {float} amount the amount to withdraw
1397
1407
  * @param {string} address the address to withdraw to
@@ -1675,6 +1685,8 @@ class coinbasepro extends coinbasepro$1 {
1675
1685
  * @method
1676
1686
  * @name coinbasepro#fetchDeposits
1677
1687
  * @description fetch all deposits made to an account
1688
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_gettransfers
1689
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounttransfers
1678
1690
  * @param {string} code unified currency code
1679
1691
  * @param {int} [since] the earliest time in ms to fetch deposits for
1680
1692
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -1688,6 +1700,8 @@ class coinbasepro extends coinbasepro$1 {
1688
1700
  * @method
1689
1701
  * @name coinbasepro#fetchWithdrawals
1690
1702
  * @description fetch all withdrawals made from an account
1703
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_gettransfers
1704
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccounttransfers
1691
1705
  * @param {string} code unified currency code
1692
1706
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
1693
1707
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -1798,6 +1812,7 @@ class coinbasepro extends coinbasepro$1 {
1798
1812
  * @method
1799
1813
  * @name coinbasepro#createDepositAddress
1800
1814
  * @description create a currency deposit address
1815
+ * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postcoinbaseaccountaddresses
1801
1816
  * @param {string} code unified currency code of the currency for the deposit address
1802
1817
  * @param {object} [params] extra parameters specific to the coinbasepro api endpoint
1803
1818
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -2220,17 +2220,20 @@ class kucoin extends kucoin$1 {
2220
2220
  throw new errors.BadRequest(this.id + ' cancelAllOrders does not support isolated margin for stop orders');
2221
2221
  }
2222
2222
  }
2223
- let method = 'privateDeleteOrders';
2223
+ let response = undefined;
2224
2224
  if (stop) {
2225
- method = 'privateDeleteStopOrderCancel';
2225
+ response = await this.privateDeleteStopOrderCancel(this.extend(request, query));
2226
2226
  }
2227
2227
  else if (hf) {
2228
2228
  if (symbol === undefined) {
2229
2229
  throw new errors.ArgumentsRequired(this.id + ' cancelAllOrders() requires a symbol parameter for hf orders');
2230
2230
  }
2231
- method = 'privateDeleteHfOrders';
2231
+ response = await this.privateDeleteHfOrders(this.extend(request, query));
2232
+ }
2233
+ else {
2234
+ response = await this.privateDeleteOrders(this.extend(request, query));
2232
2235
  }
2233
- return await this[method](this.extend(request, query));
2236
+ return response;
2234
2237
  }
2235
2238
  async fetchOrdersByStatus(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
2236
2239
  /**
@@ -2287,20 +2290,22 @@ class kucoin extends kucoin$1 {
2287
2290
  if (until) {
2288
2291
  request['endAt'] = until;
2289
2292
  }
2290
- let method = 'privateGetOrders';
2293
+ request['tradeType'] = this.safeString(this.options['marginModes'], marginMode, 'TRADE');
2294
+ let response = undefined;
2291
2295
  if (stop) {
2292
- method = 'privateGetStopOrder';
2296
+ response = await this.privateGetStopOrder(this.extend(request, query));
2293
2297
  }
2294
2298
  else if (hf) {
2295
2299
  if (lowercaseStatus === 'active') {
2296
- method = 'privateGetHfOrdersActive';
2300
+ response = await this.privateGetHfOrdersActive(this.extend(request, query));
2297
2301
  }
2298
2302
  else if (lowercaseStatus === 'done') {
2299
- method = 'privateGetHfOrdersDone';
2303
+ response = await this.privateGetHfOrdersDone(this.extend(request, query));
2300
2304
  }
2301
2305
  }
2302
- request['tradeType'] = this.safeString(this.options['marginModes'], marginMode, 'TRADE');
2303
- const response = await this[method](this.extend(request, query));
2306
+ else {
2307
+ response = await this.privateGetOrders(this.extend(request, query));
2308
+ }
2304
2309
  //
2305
2310
  // {
2306
2311
  // "code": "200000",
@@ -2445,21 +2450,21 @@ class kucoin extends kucoin$1 {
2445
2450
  }
2446
2451
  request['symbol'] = market['id'];
2447
2452
  }
2448
- params = this.omit(params, ['stop', 'hf']);
2449
- let method = 'privateGetOrdersOrderId';
2453
+ params = this.omit(params, ['stop', 'hf', 'clientOid', 'clientOrderId']);
2454
+ let response = undefined;
2450
2455
  if (clientOrderId !== undefined) {
2451
2456
  request['clientOid'] = clientOrderId;
2452
2457
  if (stop) {
2453
- method = 'privateGetStopOrderQueryOrderByClientOid';
2454
2458
  if (symbol !== undefined) {
2455
2459
  request['symbol'] = market['id'];
2456
2460
  }
2461
+ response = await this.privateGetStopOrderQueryOrderByClientOid(this.extend(request, params));
2457
2462
  }
2458
2463
  else if (hf) {
2459
- method = 'privateGetHfOrdersClientOrderClientOid';
2464
+ response = await this.privateGetHfOrdersClientOrderClientOid(this.extend(request, params));
2460
2465
  }
2461
2466
  else {
2462
- method = 'privateGetOrderClientOrderClientOid';
2467
+ response = await this.privateGetOrderClientOrderClientOid(this.extend(request, params));
2463
2468
  }
2464
2469
  }
2465
2470
  else {
@@ -2469,18 +2474,19 @@ class kucoin extends kucoin$1 {
2469
2474
  if (id === undefined) {
2470
2475
  throw new errors.InvalidOrder(this.id + ' fetchOrder() requires an order id');
2471
2476
  }
2477
+ request['orderId'] = id;
2472
2478
  if (stop) {
2473
- method = 'privateGetStopOrderOrderId';
2479
+ response = await this.privateGetStopOrderOrderId(this.extend(request, params));
2474
2480
  }
2475
2481
  else if (hf) {
2476
- method = 'privateGetHfOrdersOrderId';
2482
+ response = await this.privateGetHfOrdersOrderId(this.extend(request, params));
2483
+ }
2484
+ else {
2485
+ response = await this.privateGetOrdersOrderId(this.extend(request, params));
2477
2486
  }
2478
- request['orderId'] = id;
2479
2487
  }
2480
- params = this.omit(params, ['clientOid', 'clientOrderId']);
2481
- const response = await this[method](this.extend(request, params));
2482
2488
  let responseData = this.safeValue(response, 'data');
2483
- if (method === 'privateGetStopOrderQueryOrderByClientOid') {
2489
+ if (Array.isArray(responseData)) {
2484
2490
  responseData = this.safeValue(responseData, 0);
2485
2491
  }
2486
2492
  return this.parseOrder(responseData, market);
@@ -2722,10 +2728,12 @@ class kucoin extends kucoin$1 {
2722
2728
  if (limit !== undefined) {
2723
2729
  request['pageSize'] = limit;
2724
2730
  }
2725
- let method = this.options['fetchMyTradesMethod'];
2731
+ const method = this.options['fetchMyTradesMethod'];
2726
2732
  let parseResponseData = false;
2733
+ let response = undefined;
2734
+ [request, params] = this.handleUntilOption('endAt', request, params);
2727
2735
  if (hf) {
2728
- method = 'privateGetHfFills';
2736
+ response = await this.privateGetHfFills(this.extend(request, params));
2729
2737
  }
2730
2738
  else if (method === 'private_get_fills') {
2731
2739
  // does not return trades earlier than 2019-02-18T00:00:00Z
@@ -2733,26 +2741,18 @@ class kucoin extends kucoin$1 {
2733
2741
  // only returns trades up to one week after the since param
2734
2742
  request['startAt'] = since;
2735
2743
  }
2744
+ response = await this.privateGetFills(this.extend(request, params));
2736
2745
  }
2737
2746
  else if (method === 'private_get_limit_fills') {
2738
2747
  // does not return trades earlier than 2019-02-18T00:00:00Z
2739
2748
  // takes no params
2740
2749
  // only returns first 1000 trades (not only "in the last 24 hours" as stated in the docs)
2741
2750
  parseResponseData = true;
2742
- }
2743
- else if (method === 'private_get_hist_orders') {
2744
- // despite that this endpoint is called `HistOrders`
2745
- // it returns historical trades instead of orders
2746
- // returns trades earlier than 2019-02-18T00:00:00Z only
2747
- if (since !== undefined) {
2748
- request['startAt'] = this.parseToInt(since / 1000);
2749
- }
2751
+ response = await this.privateGetLimitFills(this.extend(request, params));
2750
2752
  }
2751
2753
  else {
2752
2754
  throw new errors.ExchangeError(this.id + ' fetchMyTradesMethod() invalid method');
2753
2755
  }
2754
- [request, params] = this.handleUntilOption('endAt', request, params);
2755
- const response = await this[method](this.extend(request, params));
2756
2756
  //
2757
2757
  // {
2758
2758
  // "currentPage": 1,
@@ -3195,8 +3195,6 @@ class kucoin extends kucoin$1 {
3195
3195
  /**
3196
3196
  * @method
3197
3197
  * @name kucoin#fetchDeposits
3198
- * @see https://docs.kucoin.com/#get-deposit-list
3199
- * @see https://docs.kucoin.com/#get-v1-historical-deposits-list
3200
3198
  * @description fetch all deposits made to an account
3201
3199
  * @see https://docs.kucoin.com/#get-deposit-list
3202
3200
  * @see https://docs.kucoin.com/#get-v1-historical-deposits-list
@@ -3223,19 +3221,19 @@ class kucoin extends kucoin$1 {
3223
3221
  if (limit !== undefined) {
3224
3222
  request['pageSize'] = limit;
3225
3223
  }
3226
- let method = 'privateGetDeposits';
3227
- if (since !== undefined) {
3224
+ [request, params] = this.handleUntilOption('endAt', request, params);
3225
+ let response = undefined;
3226
+ if (since !== undefined && since < 1550448000000) {
3228
3227
  // if since is earlier than 2019-02-18T00:00:00Z
3229
- if (since < 1550448000000) {
3230
- request['startAt'] = this.parseToInt(since / 1000);
3231
- method = 'privateGetHistDeposits';
3232
- }
3233
- else {
3228
+ request['startAt'] = this.parseToInt(since / 1000);
3229
+ response = await this.privateGetHistDeposits(this.extend(request, params));
3230
+ }
3231
+ else {
3232
+ if (since !== undefined) {
3234
3233
  request['startAt'] = since;
3235
3234
  }
3235
+ response = await this.privateGetDeposits(this.extend(request, params));
3236
3236
  }
3237
- [request, params] = this.handleUntilOption('endAt', request, params);
3238
- const response = await this[method](this.extend(request, params));
3239
3237
  //
3240
3238
  // {
3241
3239
  // "code": "200000",
@@ -3307,19 +3305,19 @@ class kucoin extends kucoin$1 {
3307
3305
  if (limit !== undefined) {
3308
3306
  request['pageSize'] = limit;
3309
3307
  }
3310
- let method = 'privateGetWithdrawals';
3311
- if (since !== undefined) {
3308
+ [request, params] = this.handleUntilOption('endAt', request, params);
3309
+ let response = undefined;
3310
+ if (since !== undefined && since < 1550448000000) {
3312
3311
  // if since is earlier than 2019-02-18T00:00:00Z
3313
- if (since < 1550448000000) {
3314
- request['startAt'] = this.parseToInt(since / 1000);
3315
- method = 'privateGetHistWithdrawals';
3316
- }
3317
- else {
3312
+ request['startAt'] = this.parseToInt(since / 1000);
3313
+ response = await this.privateGetHistWithdrawals(this.extend(request, params));
3314
+ }
3315
+ else {
3316
+ if (since !== undefined) {
3318
3317
  request['startAt'] = since;
3319
3318
  }
3319
+ response = await this.privateGetWithdrawals(this.extend(request, params));
3320
3320
  }
3321
- [request, params] = this.handleUntilOption('endAt', request, params);
3322
- const response = await this[method](this.extend(request, params));
3323
3321
  //
3324
3322
  // {
3325
3323
  // "code": "200000",
@@ -3396,26 +3394,26 @@ class kucoin extends kucoin$1 {
3396
3394
  const type = this.safeString(accountsByType, requestedType, requestedType);
3397
3395
  params = this.omit(params, 'type');
3398
3396
  const [marginMode, query] = this.handleMarginModeAndParams('fetchBalance', params);
3399
- let method = 'privateGetAccounts';
3397
+ let response = undefined;
3400
3398
  const request = {};
3401
3399
  const isolated = (marginMode === 'isolated') || (type === 'isolated');
3402
3400
  const cross = (marginMode === 'cross') || (type === 'cross');
3403
3401
  if (isolated) {
3404
- method = 'privateGetIsolatedAccounts';
3405
3402
  if (currency !== undefined) {
3406
3403
  request['balanceCurrency'] = currency['id'];
3407
3404
  }
3405
+ response = await this.privateGetIsolatedAccounts(this.extend(request, query));
3408
3406
  }
3409
3407
  else if (cross) {
3410
- method = 'privateGetMarginAccount';
3408
+ response = await this.privateGetMarginAccount(this.extend(request, query));
3411
3409
  }
3412
3410
  else {
3413
3411
  if (currency !== undefined) {
3414
3412
  request['currency'] = currency['id'];
3415
3413
  }
3416
3414
  request['type'] = type;
3415
+ response = await this.privateGetAccounts(this.extend(request, query));
3417
3416
  }
3418
- const response = await this[method](this.extend(request, query));
3419
3417
  //
3420
3418
  // Spot and Cross
3421
3419
  //
@@ -3955,43 +3953,37 @@ class kucoin extends kucoin$1 {
3955
3953
  marginMode = 'cross'; // cross as default marginMode
3956
3954
  }
3957
3955
  const request = {};
3958
- let method = 'privateGetMarginBorrowOutstanding';
3956
+ let response = undefined;
3957
+ if (code !== undefined) {
3958
+ const currency = this.currency(code);
3959
+ request['quoteCurrency'] = currency['id'];
3960
+ }
3959
3961
  if (marginMode === 'isolated') {
3960
- if (code !== undefined) {
3961
- const currency = this.currency(code);
3962
- request['balanceCurrency'] = currency['id'];
3963
- }
3964
- method = 'privateGetIsolatedAccounts';
3962
+ response = await this.privateGetIsolatedAccounts(this.extend(request, params));
3965
3963
  }
3966
3964
  else {
3967
- if (code !== undefined) {
3968
- const currency = this.currency(code);
3969
- request['currency'] = currency['id'];
3970
- }
3965
+ response = await this.privateGetMarginAccounts(this.extend(request, params));
3971
3966
  }
3972
- const response = await this[method](this.extend(request, params));
3973
3967
  //
3974
3968
  // Cross
3975
3969
  //
3976
3970
  // {
3977
3971
  // "code": "200000",
3978
3972
  // "data": {
3979
- // "currentPage": 1,
3980
- // "pageSize": 10,
3981
- // "totalNum": 1,
3982
- // "totalPage": 1,
3983
- // "items": [
3973
+ // "totalAssetOfQuoteCurrency": "0",
3974
+ // "totalLiabilityOfQuoteCurrency": "0",
3975
+ // "debtRatio": "0",
3976
+ // "status": "EFFECTIVE",
3977
+ // "accounts": [
3984
3978
  // {
3985
- // "tradeId": "62e1e320ff219600013b44e2",
3986
- // "currency": "USDT",
3987
- // "principal": "100",
3988
- // "accruedInterest": "0.00016667",
3989
- // "liability": "100.00016667",
3990
- // "repaidSize": "0",
3991
- // "dailyIntRate": "0.00004",
3992
- // "term": 7,
3993
- // "createdAt": 1658970912000,
3994
- // "maturityTime": 1659575713000
3979
+ // "currency": "1INCH",
3980
+ // "total": "0",
3981
+ // "available": "0",
3982
+ // "hold": "0",
3983
+ // "liability": "0",
3984
+ // "maxBorrowSize": "0",
3985
+ // "borrowEnabled": true,
3986
+ // "transferInEnabled": true
3995
3987
  // }
3996
3988
  // ]
3997
3989
  // }
@@ -4006,34 +3998,38 @@ class kucoin extends kucoin$1 {
4006
3998
  // "liabilityConversionBalance": "0.01480001",
4007
3999
  // "assets": [
4008
4000
  // {
4009
- // "symbol": "NKN-USDT",
4010
- // "status": "CLEAR",
4001
+ // "symbol": "MANA-USDT",
4011
4002
  // "debtRatio": "0",
4003
+ // "status": "BORROW",
4012
4004
  // "baseAsset": {
4013
- // "currency": "NKN",
4014
- // "totalBalance": "0",
4015
- // "holdBalance": "0",
4016
- // "availableBalance": "0",
4017
- // "liability": "0",
4018
- // "interest": "0",
4019
- // "borrowableAmount": "0"
4005
+ // "currency": "MANA",
4006
+ // "borrowEnabled": true,
4007
+ // "repayEnabled": true,
4008
+ // "transferEnabled": true,
4009
+ // "borrowed": "0",
4010
+ // "totalAsset": "0",
4011
+ // "available": "0",
4012
+ // "hold": "0",
4013
+ // "maxBorrowSize": "1000"
4020
4014
  // },
4021
4015
  // "quoteAsset": {
4022
4016
  // "currency": "USDT",
4023
- // "totalBalance": "0",
4024
- // "holdBalance": "0",
4025
- // "availableBalance": "0",
4026
- // "liability": "0",
4027
- // "interest": "0",
4028
- // "borrowableAmount": "0"
4017
+ // "borrowEnabled": true,
4018
+ // "repayEnabled": true,
4019
+ // "transferEnabled": true,
4020
+ // "borrowed": "0",
4021
+ // "totalAsset": "0",
4022
+ // "available": "0",
4023
+ // "hold": "0",
4024
+ // "maxBorrowSize": "50000"
4029
4025
  // }
4030
- // },
4026
+ // }
4031
4027
  // ]
4032
4028
  // }
4033
4029
  // }
4034
4030
  //
4035
4031
  const data = this.safeValue(response, 'data', {});
4036
- const assets = (marginMode === 'isolated') ? this.safeValue(data, 'assets', []) : this.safeValue(data, 'items', []);
4032
+ const assets = (marginMode === 'isolated') ? this.safeValue(data, 'assets', []) : this.safeValue(data, 'accounts', []);
4037
4033
  return this.parseBorrowInterests(assets, undefined);
4038
4034
  }
4039
4035
  parseBorrowInterest(info, market = undefined) {
@@ -4041,43 +4037,45 @@ class kucoin extends kucoin$1 {
4041
4037
  // Cross
4042
4038
  //
4043
4039
  // {
4044
- // "tradeId": "62e1e320ff219600013b44e2",
4045
- // "currency": "USDT",
4046
- // "principal": "100",
4047
- // "accruedInterest": "0.00016667",
4048
- // "liability": "100.00016667",
4049
- // "repaidSize": "0",
4050
- // "dailyIntRate": "0.00004",
4051
- // "term": 7,
4052
- // "createdAt": 1658970912000,
4053
- // "maturityTime": 1659575713000
4054
- // },
4040
+ // "currency": "1INCH",
4041
+ // "total": "0",
4042
+ // "available": "0",
4043
+ // "hold": "0",
4044
+ // "liability": "0",
4045
+ // "maxBorrowSize": "0",
4046
+ // "borrowEnabled": true,
4047
+ // "transferInEnabled": true
4048
+ // }
4055
4049
  //
4056
4050
  // Isolated
4057
4051
  //
4058
4052
  // {
4059
- // "symbol": "BTC-USDT",
4060
- // "status": "CLEAR",
4053
+ // "symbol": "MANA-USDT",
4061
4054
  // "debtRatio": "0",
4055
+ // "status": "BORROW",
4062
4056
  // "baseAsset": {
4063
- // "currency": "BTC",
4064
- // "totalBalance": "0",
4065
- // "holdBalance": "0",
4066
- // "availableBalance": "0",
4067
- // "liability": "0",
4068
- // "interest": "0",
4069
- // "borrowableAmount": "0.0592"
4057
+ // "currency": "MANA",
4058
+ // "borrowEnabled": true,
4059
+ // "repayEnabled": true,
4060
+ // "transferEnabled": true,
4061
+ // "borrowed": "0",
4062
+ // "totalAsset": "0",
4063
+ // "available": "0",
4064
+ // "hold": "0",
4065
+ // "maxBorrowSize": "1000"
4070
4066
  // },
4071
4067
  // "quoteAsset": {
4072
4068
  // "currency": "USDT",
4073
- // "totalBalance": "149.99991731",
4074
- // "holdBalance": "0",
4075
- // "availableBalance": "149.99991731",
4076
- // "liability": "0",
4077
- // "interest": "0",
4078
- // "borrowableAmount": "1349"
4069
+ // "borrowEnabled": true,
4070
+ // "repayEnabled": true,
4071
+ // "transferEnabled": true,
4072
+ // "borrowed": "0",
4073
+ // "totalAsset": "0",
4074
+ // "available": "0",
4075
+ // "hold": "0",
4076
+ // "maxBorrowSize": "50000"
4079
4077
  // }
4080
- // },
4078
+ // }
4081
4079
  //
4082
4080
  const marketId = this.safeString(info, 'symbol');
4083
4081
  const marginMode = (marketId === undefined) ? 'cross' : 'isolated';
@@ -4094,7 +4092,7 @@ class kucoin extends kucoin$1 {
4094
4092
  currencyId = this.safeString(isolatedBase, 'currency');
4095
4093
  }
4096
4094
  else {
4097
- amountBorrowed = this.safeNumber(info, 'principal');
4095
+ amountBorrowed = this.safeNumber(info, 'liability');
4098
4096
  interest = this.safeNumber(info, 'accruedInterest');
4099
4097
  currencyId = this.safeString(info, 'currency');
4100
4098
  }