ccxt 4.2.58 → 4.2.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.
Files changed (92) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +3 -3
  3. package/build.sh +1 -1
  4. package/cleanup.sh +3 -0
  5. package/dist/ccxt.browser.js +716 -382
  6. package/dist/ccxt.browser.min.js +3 -3
  7. package/dist/cjs/ccxt.js +1 -1
  8. package/dist/cjs/src/ascendex.js +10 -12
  9. package/dist/cjs/src/base/Exchange.js +2 -0
  10. package/dist/cjs/src/binance.js +2 -2
  11. package/dist/cjs/src/bingx.js +41 -3
  12. package/dist/cjs/src/bitfinex2.js +21 -4
  13. package/dist/cjs/src/bitget.js +10 -3
  14. package/dist/cjs/src/bitmart.js +41 -23
  15. package/dist/cjs/src/bitmex.js +1 -1
  16. package/dist/cjs/src/blofin.js +60 -2
  17. package/dist/cjs/src/coinbase.js +24 -14
  18. package/dist/cjs/src/hitbtc.js +1 -1
  19. package/dist/cjs/src/htx.js +4 -1
  20. package/dist/cjs/src/kraken.js +42 -39
  21. package/dist/cjs/src/kucoinfutures.js +1 -0
  22. package/dist/cjs/src/lbank.js +1 -1
  23. package/dist/cjs/src/mexc.js +1 -1
  24. package/dist/cjs/src/okx.js +1 -1
  25. package/dist/cjs/src/phemex.js +1 -1
  26. package/dist/cjs/src/pro/binance.js +17 -4
  27. package/dist/cjs/src/pro/bitfinex2.js +1 -1
  28. package/dist/cjs/src/pro/bitget.js +1 -1
  29. package/dist/cjs/src/pro/bitmart.js +51 -89
  30. package/dist/cjs/src/pro/bitvavo.js +1 -1
  31. package/dist/cjs/src/pro/bybit.js +1 -1
  32. package/dist/cjs/src/pro/coinex.js +1 -1
  33. package/dist/cjs/src/pro/cryptocom.js +1 -1
  34. package/dist/cjs/src/pro/deribit.js +201 -84
  35. package/dist/cjs/src/pro/gate.js +1 -1
  36. package/dist/cjs/src/pro/independentreserve.js +1 -1
  37. package/dist/cjs/src/pro/kraken.js +1 -1
  38. package/dist/cjs/src/pro/kucoinfutures.js +1 -1
  39. package/dist/cjs/src/pro/mexc.js +5 -3
  40. package/dist/cjs/src/pro/okx.js +1 -1
  41. package/dist/cjs/src/pro/woo.js +1 -1
  42. package/dist/cjs/src/wazirx.js +6 -1
  43. package/dist/cjs/src/woo.js +159 -79
  44. package/js/ccxt.d.ts +1 -1
  45. package/js/ccxt.js +1 -1
  46. package/js/src/abstract/blofin.d.ts +1 -0
  47. package/js/src/abstract/wazirx.d.ts +5 -0
  48. package/js/src/ascendex.d.ts +2 -2
  49. package/js/src/ascendex.js +10 -12
  50. package/js/src/base/Exchange.js +2 -0
  51. package/js/src/binance.js +2 -2
  52. package/js/src/bingx.d.ts +3 -1
  53. package/js/src/bingx.js +41 -3
  54. package/js/src/bitfinex2.js +21 -4
  55. package/js/src/bitget.js +10 -3
  56. package/js/src/bitmart.d.ts +9 -2
  57. package/js/src/bitmart.js +41 -23
  58. package/js/src/bitmex.js +1 -1
  59. package/js/src/blofin.d.ts +2 -1
  60. package/js/src/blofin.js +60 -2
  61. package/js/src/coinbase.js +24 -14
  62. package/js/src/hitbtc.js +1 -1
  63. package/js/src/htx.js +4 -1
  64. package/js/src/kraken.js +42 -39
  65. package/js/src/kucoinfutures.js +1 -0
  66. package/js/src/lbank.js +1 -1
  67. package/js/src/mexc.js +1 -1
  68. package/js/src/okx.js +1 -1
  69. package/js/src/phemex.js +1 -1
  70. package/js/src/pro/binance.js +17 -4
  71. package/js/src/pro/bitfinex2.js +1 -1
  72. package/js/src/pro/bitget.js +1 -1
  73. package/js/src/pro/bitmart.d.ts +2 -2
  74. package/js/src/pro/bitmart.js +51 -89
  75. package/js/src/pro/bitvavo.js +1 -1
  76. package/js/src/pro/bybit.js +1 -1
  77. package/js/src/pro/coinex.js +1 -1
  78. package/js/src/pro/cryptocom.js +1 -1
  79. package/js/src/pro/deribit.d.ts +5 -0
  80. package/js/src/pro/deribit.js +202 -85
  81. package/js/src/pro/gate.js +1 -1
  82. package/js/src/pro/independentreserve.js +1 -1
  83. package/js/src/pro/kraken.js +1 -1
  84. package/js/src/pro/kucoinfutures.js +1 -1
  85. package/js/src/pro/mexc.js +6 -4
  86. package/js/src/pro/okx.js +1 -1
  87. package/js/src/pro/woo.js +1 -1
  88. package/js/src/wazirx.js +6 -1
  89. package/js/src/woo.d.ts +8 -0
  90. package/js/src/woo.js +159 -79
  91. package/package.json +1 -1
  92. package/skip-tests.json +44 -18
@@ -84,10 +84,10 @@ class woo extends woo$1 {
84
84
  'fetchPositionMode': false,
85
85
  'fetchPositions': true,
86
86
  'fetchPremiumIndexOHLCV': false,
87
- 'fetchStatus': false,
87
+ 'fetchStatus': true,
88
88
  'fetchTicker': false,
89
89
  'fetchTickers': false,
90
- 'fetchTime': false,
90
+ 'fetchTime': true,
91
91
  'fetchTrades': true,
92
92
  'fetchTradingFee': false,
93
93
  'fetchTradingFees': true,
@@ -324,6 +324,67 @@ class woo extends woo$1 {
324
324
  'precisionMode': number.TICK_SIZE,
325
325
  });
326
326
  }
327
+ async fetchStatus(params = {}) {
328
+ /**
329
+ * @method
330
+ * @name woo#fetchStatus
331
+ * @description the latest known information on the availability of the exchange API
332
+ * @see https://docs.woo.org/#get-system-maintenance-status-public
333
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
334
+ * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
335
+ */
336
+ const response = await this.v1PublicGetSystemInfo(params);
337
+ //
338
+ // {
339
+ // "success": true,
340
+ // "data": {
341
+ // "status": "0",
342
+ // "msg": "System is functioning properly."
343
+ // },
344
+ // "timestamp": "1709274106602"
345
+ // }
346
+ //
347
+ const data = this.safeDict(response, 'data', {});
348
+ let status = this.safeString(data, 'status');
349
+ if (status === undefined) {
350
+ status = 'error';
351
+ }
352
+ else if (status === '0') {
353
+ status = 'ok';
354
+ }
355
+ else {
356
+ status = 'maintenance';
357
+ }
358
+ return {
359
+ 'status': status,
360
+ 'updated': undefined,
361
+ 'eta': undefined,
362
+ 'url': undefined,
363
+ 'info': response,
364
+ };
365
+ }
366
+ async fetchTime(params = {}) {
367
+ /**
368
+ * @method
369
+ * @name woo#fetchTime
370
+ * @description fetches the current integer timestamp in milliseconds from the exchange server
371
+ * @see https://docs.woo.org/#get-system-maintenance-status-public
372
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
373
+ * @returns {int} the current integer timestamp in milliseconds from the exchange server
374
+ */
375
+ const response = await this.v1PublicGetSystemInfo(params);
376
+ //
377
+ // {
378
+ // "success": true,
379
+ // "data": {
380
+ // "status": "0",
381
+ // "msg": "System is functioning properly."
382
+ // },
383
+ // "timestamp": "1709274106602"
384
+ // }
385
+ //
386
+ return this.safeInteger(response, 'timestamp');
387
+ }
327
388
  async fetchMarkets(params = {}) {
328
389
  /**
329
390
  * @method
@@ -354,7 +415,7 @@ class woo extends woo$1 {
354
415
  // "success": true
355
416
  // }
356
417
  //
357
- const data = this.safeValue(response, 'rows', []);
418
+ const data = this.safeList(response, 'rows', []);
358
419
  return this.parseMarkets(data);
359
420
  }
360
421
  parseMarket(market) {
@@ -490,7 +551,7 @@ class woo extends woo$1 {
490
551
  // ]
491
552
  // }
492
553
  //
493
- const resultResponse = this.safeValue(response, 'rows', {});
554
+ const resultResponse = this.safeList(response, 'rows', []);
494
555
  return this.parseTrades(resultResponse, market, since, limit);
495
556
  }
496
557
  parseTrade(trade, market = undefined) {
@@ -606,7 +667,7 @@ class woo extends woo$1 {
606
667
  // "timestamp": 1673323685109
607
668
  // }
608
669
  //
609
- const data = this.safeValue(response, 'data', {});
670
+ const data = this.safeDict(response, 'data', {});
610
671
  const maker = this.safeString(data, 'makerFeeRate');
611
672
  const taker = this.safeString(data, 'takerFeeRate');
612
673
  const result = {};
@@ -693,7 +754,7 @@ class woo extends woo$1 {
693
754
  // "success": true
694
755
  // }
695
756
  //
696
- const tokenRows = this.safeValue(tokenResponse, 'rows', []);
757
+ const tokenRows = this.safeList(tokenResponse, 'rows', []);
697
758
  const networksByCurrencyId = this.groupBy(tokenRows, 'balance_token');
698
759
  const currencyIds = Object.keys(networksByCurrencyId);
699
760
  for (let i = 0; i < currencyIds.length; i++) {
@@ -853,7 +914,7 @@ class woo extends woo$1 {
853
914
  * @param {string} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
854
915
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
855
916
  */
856
- const reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
917
+ const reduceOnly = this.safeBool2(params, 'reduceOnly', 'reduce_only');
857
918
  params = this.omit(params, ['reduceOnly', 'reduce_only']);
858
919
  const orderType = type.toUpperCase();
859
920
  await this.loadMarkets();
@@ -1024,9 +1085,9 @@ class woo extends woo$1 {
1024
1085
  // },
1025
1086
  // "timestamp": "1686149372216"
1026
1087
  // }
1027
- const data = this.safeValue(response, 'data');
1088
+ const data = this.safeDict(response, 'data');
1028
1089
  if (data !== undefined) {
1029
- const rows = this.safeValue(data, 'rows', []);
1090
+ const rows = this.safeList(data, 'rows', []);
1030
1091
  return this.parseOrder(rows[0], market);
1031
1092
  }
1032
1093
  const order = this.parseOrder(response, market);
@@ -1127,7 +1188,7 @@ class woo extends woo$1 {
1127
1188
  // "timestamp": 0
1128
1189
  // }
1129
1190
  //
1130
- const data = this.safeValue(response, 'data', {});
1191
+ const data = this.safeDict(response, 'data', {});
1131
1192
  return this.parseOrder(data, market);
1132
1193
  }
1133
1194
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -1201,8 +1262,8 @@ class woo extends woo$1 {
1201
1262
  * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1202
1263
  */
1203
1264
  await this.loadMarkets();
1204
- const stop = this.safeValue(params, 'stop');
1205
- params = this.omit(params, 'stop');
1265
+ const stop = this.safeBool2(params, 'stop', 'trigger');
1266
+ params = this.omit(params, ['stop', 'trigger']);
1206
1267
  if (stop) {
1207
1268
  return await this.v3PrivateDeleteAlgoOrdersPending(params);
1208
1269
  }
@@ -1236,8 +1297,8 @@ class woo extends woo$1 {
1236
1297
  */
1237
1298
  await this.loadMarkets();
1238
1299
  const market = (symbol !== undefined) ? this.market(symbol) : undefined;
1239
- const stop = this.safeValue(params, 'stop');
1240
- params = this.omit(params, 'stop');
1300
+ const stop = this.safeBool2(params, 'stop', 'trigger');
1301
+ params = this.omit(params, ['stop', 'trigger']);
1241
1302
  const request = {};
1242
1303
  const clientOrderId = this.safeString2(params, 'clOrdID', 'clientOrderId');
1243
1304
  let response = undefined;
@@ -1311,9 +1372,9 @@ class woo extends woo$1 {
1311
1372
  await this.loadMarkets();
1312
1373
  const request = {};
1313
1374
  let market = undefined;
1314
- const stop = this.safeValue(params, 'stop');
1375
+ const stop = this.safeBool2(params, 'stop', 'trigger');
1315
1376
  const trailing = this.safeBool(params, 'trailing', false);
1316
- params = this.omit(params, ['stop', 'trailing']);
1377
+ params = this.omit(params, ['stop', 'trailing', 'trigger']);
1317
1378
  if (symbol !== undefined) {
1318
1379
  market = this.market(symbol);
1319
1380
  request['symbol'] = market['id'];
@@ -1371,7 +1432,7 @@ class woo extends woo$1 {
1371
1432
  // }
1372
1433
  //
1373
1434
  const data = this.safeValue(response, 'data', response);
1374
- const orders = this.safeValue(data, 'rows');
1435
+ const orders = this.safeList(data, 'rows');
1375
1436
  return this.parseOrders(orders, market, since, limit, params);
1376
1437
  }
1377
1438
  parseTimeInForce(timeInForce) {
@@ -1473,7 +1534,7 @@ class woo extends woo$1 {
1473
1534
  'type': orderType,
1474
1535
  'timeInForce': this.parseTimeInForce(orderType),
1475
1536
  'postOnly': undefined,
1476
- 'reduceOnly': this.safeValue(order, 'reduce_only'),
1537
+ 'reduceOnly': this.safeBool(order, 'reduce_only'),
1477
1538
  'side': side,
1478
1539
  'price': price,
1479
1540
  'stopPrice': stopPrice,
@@ -1631,7 +1692,7 @@ class woo extends woo$1 {
1631
1692
  // }
1632
1693
  //
1633
1694
  }
1634
- const rows = this.safeValue(response, 'rows', []);
1695
+ const rows = this.safeList(response, 'rows', []);
1635
1696
  return this.parseOHLCVs(rows, market, timeframe, since, limit);
1636
1697
  }
1637
1698
  parseOHLCV(ohlcv, market = undefined) {
@@ -1684,7 +1745,7 @@ class woo extends woo$1 {
1684
1745
  // }
1685
1746
  // ]
1686
1747
  // }
1687
- const trades = this.safeValue(response, 'rows', []);
1748
+ const trades = this.safeList(response, 'rows', []);
1688
1749
  return this.parseTrades(trades, market, since, limit, params);
1689
1750
  }
1690
1751
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -1732,7 +1793,7 @@ class woo extends woo$1 {
1732
1793
  // ...
1733
1794
  // ]
1734
1795
  // }
1735
- const trades = this.safeValue(response, 'rows', []);
1796
+ const trades = this.safeList(response, 'rows', []);
1736
1797
  return this.parseTrades(trades, market, since, limit, params);
1737
1798
  }
1738
1799
  async fetchAccounts(params = {}) {
@@ -1760,7 +1821,7 @@ class woo extends woo$1 {
1760
1821
  // "success": true
1761
1822
  // }
1762
1823
  //
1763
- const rows = this.safeValue(response, 'rows', []);
1824
+ const rows = this.safeList(response, 'rows', []);
1764
1825
  return this.parseAccounts(rows, params);
1765
1826
  }
1766
1827
  parseAccount(account) {
@@ -1814,14 +1875,14 @@ class woo extends woo$1 {
1814
1875
  // "timestamp": 1673323746259
1815
1876
  // }
1816
1877
  //
1817
- const data = this.safeValue(response, 'data');
1878
+ const data = this.safeDict(response, 'data');
1818
1879
  return this.parseBalance(data);
1819
1880
  }
1820
1881
  parseBalance(response) {
1821
1882
  const result = {
1822
1883
  'info': response,
1823
1884
  };
1824
- const balances = this.safeValue(response, 'holding', []);
1885
+ const balances = this.safeList(response, 'holding', []);
1825
1886
  for (let i = 0; i < balances.length; i++) {
1826
1887
  const balance = balances[i];
1827
1888
  const code = this.safeCurrencyCode(this.safeString(balance, 'token'));
@@ -2098,6 +2159,7 @@ class woo extends woo$1 {
2098
2159
  /**
2099
2160
  * @method
2100
2161
  * @name woo#transfer
2162
+ * @see https://docs.woo.org/#get-transfer-history
2101
2163
  * @description transfer currency internally between wallets on the same account
2102
2164
  * @param {string} code unified currency code
2103
2165
  * @param {float} amount amount to transfer
@@ -2110,7 +2172,7 @@ class woo extends woo$1 {
2110
2172
  const currency = this.currency(code);
2111
2173
  const request = {
2112
2174
  'token': currency['id'],
2113
- 'amount': this.parseNumber(amount),
2175
+ 'amount': this.parseToNumeric(amount),
2114
2176
  'from_application_id': fromAccount,
2115
2177
  'to_application_id': toAccount,
2116
2178
  };
@@ -2122,7 +2184,7 @@ class woo extends woo$1 {
2122
2184
  // }
2123
2185
  //
2124
2186
  const transfer = this.parseTransfer(response, currency);
2125
- const transferOptions = this.safeValue(this.options, 'transfer', {});
2187
+ const transferOptions = this.safeDict(this.options, 'transfer', {});
2126
2188
  const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
2127
2189
  if (fillResponseFromRequest) {
2128
2190
  transfer['amount'] = amount;
@@ -2136,41 +2198,71 @@ class woo extends woo$1 {
2136
2198
  * @method
2137
2199
  * @name woo#fetchTransfers
2138
2200
  * @description fetch a history of internal transfers made on an account
2201
+ * @see https://docs.woo.org/#get-transfer-history
2139
2202
  * @param {string} code unified currency code of the currency transferred
2140
2203
  * @param {int} [since] the earliest time in ms to fetch transfers for
2141
2204
  * @param {int} [limit] the maximum number of transfers structures to retrieve
2142
2205
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2206
+ * @param {int} [params.until] the latest time in ms to fetch entries for
2143
2207
  * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
2144
2208
  */
2145
- const request = {
2146
- 'type': 'COLLATERAL',
2147
- };
2148
- const [currency, rows] = await this.getAssetHistoryRows(code, since, limit, this.extend(request, params));
2149
- return this.parseTransfers(rows, currency, since, limit, params);
2209
+ const request = {};
2210
+ if (limit !== undefined) {
2211
+ request['size'] = limit;
2212
+ }
2213
+ if (since !== undefined) {
2214
+ request['start_t'] = since;
2215
+ }
2216
+ const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
2217
+ params = this.omit(params, ['until', 'till']);
2218
+ if (until !== undefined) {
2219
+ request['end_t'] = until;
2220
+ }
2221
+ const response = await this.v1PrivateGetAssetMainSubTransferHistory(this.extend(request, params));
2222
+ //
2223
+ // {
2224
+ // "rows": [
2225
+ // {
2226
+ // "id": 46704,
2227
+ // "token": "USDT",
2228
+ // "amount": 30000.00000000,
2229
+ // "status": "COMPLETED",
2230
+ // "from_application_id": "0f1bd3cd-dba2-4563-b8bb-0adb1bfb83a3",
2231
+ // "to_application_id": "c01e6940-a735-4022-9b6c-9d3971cdfdfa",
2232
+ // "from_user": "LeverageLow",
2233
+ // "to_user": "dev",
2234
+ // "created_time": "1709022325.427",
2235
+ // "updated_time": "1709022325.542"
2236
+ // }
2237
+ // ],
2238
+ // "meta": {
2239
+ // "total": 50,
2240
+ // "records_per_page": 25,
2241
+ // "current_page": 1
2242
+ // },
2243
+ // "success": true
2244
+ // }
2245
+ //
2246
+ const data = this.safeList(response, 'rows', []);
2247
+ return this.parseTransfers(data, undefined, since, limit, params);
2150
2248
  }
2151
2249
  parseTransfer(transfer, currency = undefined) {
2152
2250
  //
2153
- // getAssetHistoryRows
2154
- // {
2155
- // "created_time": "1579399877.041", // Unix epoch time in seconds
2156
- // "updated_time": "1579399877.041", // Unix epoch time in seconds
2157
- // "id": "202029292829292",
2158
- // "external_id": "202029292829292",
2159
- // "application_id": null,
2160
- // "token": "ETH",
2161
- // "target_address": "0x31d64B3230f8baDD91dE1710A65DF536aF8f7cDa",
2162
- // "source_address": "0x70fd25717f769c7f9a46b319f0f9103c0d887af0",
2163
- // "extra": "",
2164
- // "type": "BALANCE",
2165
- // "token_side": "DEPOSIT",
2166
- // "amount": 1000,
2167
- // "tx_id": "0x8a74c517bc104c8ebad0c3c3f64b1f302ed5f8bca598ae4459c63419038106b6",
2168
- // "fee_token": null,
2169
- // "fee_amount": null,
2170
- // "status": "CONFIRMING"
2171
- // }
2251
+ // fetchTransfers
2252
+ // {
2253
+ // "id": 46704,
2254
+ // "token": "USDT",
2255
+ // "amount": 30000.00000000,
2256
+ // "status": "COMPLETED",
2257
+ // "from_application_id": "0f1bd3cd-dba2-4563-b8bb-0adb1bfb83a3",
2258
+ // "to_application_id": "c01e6940-a735-4022-9b6c-9d3971cdfdfa",
2259
+ // "from_user": "LeverageLow",
2260
+ // "to_user": "dev",
2261
+ // "created_time": "1709022325.427",
2262
+ // "updated_time": "1709022325.542"
2263
+ // }
2172
2264
  //
2173
- // v1PrivatePostAssetMainSubTransfer
2265
+ // transfer
2174
2266
  // {
2175
2267
  // "success": true,
2176
2268
  // "id": 200
@@ -2179,22 +2271,8 @@ class woo extends woo$1 {
2179
2271
  const networkizedCode = this.safeString(transfer, 'token');
2180
2272
  const currencyDefined = this.getCurrencyFromChaincode(networkizedCode, currency);
2181
2273
  const code = currencyDefined['code'];
2182
- let movementDirection = this.safeStringLower(transfer, 'token_side');
2183
- if (movementDirection === 'withdraw') {
2184
- movementDirection = 'withdrawal';
2185
- }
2186
- let fromAccount = undefined;
2187
- let toAccount = undefined;
2188
- if (movementDirection === 'withdraw') {
2189
- fromAccount = undefined;
2190
- toAccount = 'spot';
2191
- }
2192
- else if (movementDirection === 'deposit') {
2193
- fromAccount = 'spot';
2194
- toAccount = undefined;
2195
- }
2196
2274
  const timestamp = this.safeTimestamp(transfer, 'created_time');
2197
- const success = this.safeValue(transfer, 'success');
2275
+ const success = this.safeBool(transfer, 'success');
2198
2276
  let status = undefined;
2199
2277
  if (success !== undefined) {
2200
2278
  status = success ? 'ok' : 'failed';
@@ -2205,8 +2283,8 @@ class woo extends woo$1 {
2205
2283
  'datetime': this.iso8601(timestamp),
2206
2284
  'currency': code,
2207
2285
  'amount': this.safeNumber(transfer, 'amount'),
2208
- 'fromAccount': fromAccount,
2209
- 'toAccount': toAccount,
2286
+ 'fromAccount': this.safeString(transfer, 'from_application_id'),
2287
+ 'toAccount': this.safeString(transfer, 'to_application_id'),
2210
2288
  'status': this.parseTransferStatus(this.safeString(transfer, 'status', status)),
2211
2289
  'info': transfer,
2212
2290
  };
@@ -2244,11 +2322,11 @@ class woo extends woo$1 {
2244
2322
  if (tag !== undefined) {
2245
2323
  request['extra'] = tag;
2246
2324
  }
2247
- const networks = this.safeValue(this.options, 'networks', {});
2248
- const currencyNetworks = this.safeValue(currency, 'networks', {});
2325
+ const networks = this.safeDict(this.options, 'networks', {});
2326
+ const currencyNetworks = this.safeDict(currency, 'networks', {});
2249
2327
  const network = this.safeStringUpper(params, 'network');
2250
2328
  const networkId = this.safeString(networks, network, network);
2251
- const coinNetwork = this.safeValue(currencyNetworks, networkId, {});
2329
+ const coinNetwork = this.safeDict(currencyNetworks, networkId, {});
2252
2330
  const coinNetworkId = this.safeString(coinNetwork, 'id');
2253
2331
  if (coinNetworkId === undefined) {
2254
2332
  throw new errors.BadRequest(this.id + ' withdraw() require network parameter');
@@ -2334,7 +2412,7 @@ class woo extends woo$1 {
2334
2412
  else {
2335
2413
  this.checkRequiredCredentials();
2336
2414
  if (method === 'POST' && (path === 'algo/order' || path === 'order')) {
2337
- const isSandboxMode = this.safeValue(this.options, 'sandboxMode', false);
2415
+ const isSandboxMode = this.safeBool(this.options, 'sandboxMode', false);
2338
2416
  if (!isSandboxMode) {
2339
2417
  const applicationId = 'bc830de7-50f3-460b-9ee0-f430f83f9dad';
2340
2418
  const brokerId = this.safeString(this.options, 'brokerId', applicationId);
@@ -2376,7 +2454,9 @@ class woo extends woo$1 {
2376
2454
  body = auth;
2377
2455
  }
2378
2456
  else {
2379
- url += '?' + auth;
2457
+ if (Object.keys(params).length) {
2458
+ url += '?' + auth;
2459
+ }
2380
2460
  }
2381
2461
  auth += '|' + ts;
2382
2462
  headers['content-type'] = 'application/x-www-form-urlencoded';
@@ -2393,7 +2473,7 @@ class woo extends woo$1 {
2393
2473
  // 400 Bad Request {"success":false,"code":-1012,"message":"Amount is required for buy market orders when margin disabled."}
2394
2474
  // {"code":"-1011","message":"The system is under maintenance.","success":false}
2395
2475
  //
2396
- const success = this.safeValue(response, 'success');
2476
+ const success = this.safeBool(response, 'success');
2397
2477
  const errorCode = this.safeString(response, 'code');
2398
2478
  if (!success) {
2399
2479
  const feedback = this.id + ' ' + this.json(response);
@@ -2469,7 +2549,7 @@ class woo extends woo$1 {
2469
2549
  // "success":true
2470
2550
  // }
2471
2551
  //
2472
- const result = this.safeValue(response, 'rows', []);
2552
+ const result = this.safeList(response, 'rows', []);
2473
2553
  return this.parseIncomes(result, market, since, limit);
2474
2554
  }
2475
2555
  parseFundingRate(fundingRate, market = undefined) {
@@ -2550,7 +2630,7 @@ class woo extends woo$1 {
2550
2630
  // "timestamp":1653633985646
2551
2631
  // }
2552
2632
  //
2553
- const rows = this.safeValue(response, 'rows', {});
2633
+ const rows = this.safeList(response, 'rows', []);
2554
2634
  const result = this.parseFundingRates(rows);
2555
2635
  return this.filterByArray(result, 'symbol', symbols);
2556
2636
  }
@@ -2604,7 +2684,7 @@ class woo extends woo$1 {
2604
2684
  // "timestamp":1653640814885
2605
2685
  // }
2606
2686
  //
2607
- const result = this.safeValue(response, 'rows');
2687
+ const result = this.safeList(response, 'rows');
2608
2688
  const rates = [];
2609
2689
  for (let i = 0; i < result.length; i++) {
2610
2690
  const entry = result[i];
@@ -2766,8 +2846,8 @@ class woo extends woo$1 {
2766
2846
  // "timestamp": 1673323880342
2767
2847
  // }
2768
2848
  //
2769
- const result = this.safeValue(response, 'data', {});
2770
- const positions = this.safeValue(result, 'positions', []);
2849
+ const result = this.safeDict(response, 'data', {});
2850
+ const positions = this.safeList(result, 'positions', []);
2771
2851
  return this.parsePositions(positions, symbols);
2772
2852
  }
2773
2853
  parsePosition(position, market = undefined) {
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.2.57";
7
+ declare const version = "4.2.59";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.2.58';
41
+ const version = '4.2.60';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -18,6 +18,7 @@ interface Exchange {
18
18
  privateGetAccountBalance(params?: {}): Promise<implicitReturnType>;
19
19
  privateGetAccountPositions(params?: {}): Promise<implicitReturnType>;
20
20
  privateGetAccountLeverageInfo(params?: {}): Promise<implicitReturnType>;
21
+ privateGetAccountBatchLeverageInfo(params?: {}): Promise<implicitReturnType>;
21
22
  privateGetTradeOrdersTpslPending(params?: {}): Promise<implicitReturnType>;
22
23
  privateGetTradeOrdersHistory(params?: {}): Promise<implicitReturnType>;
23
24
  privateGetTradeOrdersTpslHistory(params?: {}): Promise<implicitReturnType>;
@@ -17,6 +17,11 @@ interface Exchange {
17
17
  privateGetOpenOrders(params?: {}): Promise<implicitReturnType>;
18
18
  privateGetOrder(params?: {}): Promise<implicitReturnType>;
19
19
  privateGetMyTrades(params?: {}): Promise<implicitReturnType>;
20
+ privateGetCoins(params?: {}): Promise<implicitReturnType>;
21
+ privateGetCryptoWithdraws(params?: {}): Promise<implicitReturnType>;
22
+ privateGetCryptoDepositsAddress(params?: {}): Promise<implicitReturnType>;
23
+ privateGetSubAccountFundTransferHistory(params?: {}): Promise<implicitReturnType>;
24
+ privateGetSubAccountAccounts(params?: {}): Promise<implicitReturnType>;
20
25
  privatePostOrder(params?: {}): Promise<implicitReturnType>;
21
26
  privatePostOrderTest(params?: {}): Promise<implicitReturnType>;
22
27
  privatePostCreateAuthToken(params?: {}): Promise<implicitReturnType>;
@@ -107,8 +107,8 @@ export default class ascendex extends Exchange {
107
107
  parseTransfer(transfer: any, currency?: Currency): {
108
108
  info: any;
109
109
  id: any;
110
- timestamp: number;
111
- datetime: string;
110
+ timestamp: any;
111
+ datetime: any;
112
112
  currency: string;
113
113
  amount: any;
114
114
  fromAccount: any;
@@ -757,11 +757,10 @@ export default class ascendex extends Exchange {
757
757
  ];
758
758
  }
759
759
  parseBalance(response) {
760
- const timestamp = this.milliseconds();
761
760
  const result = {
762
761
  'info': response,
763
- 'timestamp': timestamp,
764
- 'datetime': this.iso8601(timestamp),
762
+ 'timestamp': undefined,
763
+ 'datetime': undefined,
765
764
  };
766
765
  const balances = this.safeValue(response, 'data', []);
767
766
  for (let i = 0; i < balances.length; i++) {
@@ -775,11 +774,10 @@ export default class ascendex extends Exchange {
775
774
  return this.safeBalance(result);
776
775
  }
777
776
  parseMarginBalance(response) {
778
- const timestamp = this.milliseconds();
779
777
  const result = {
780
778
  'info': response,
781
- 'timestamp': timestamp,
782
- 'datetime': this.iso8601(timestamp),
779
+ 'timestamp': undefined,
780
+ 'datetime': undefined,
783
781
  };
784
782
  const balances = this.safeValue(response, 'data', []);
785
783
  for (let i = 0; i < balances.length; i++) {
@@ -796,11 +794,10 @@ export default class ascendex extends Exchange {
796
794
  return this.safeBalance(result);
797
795
  }
798
796
  parseSwapBalance(response) {
799
- const timestamp = this.milliseconds();
800
797
  const result = {
801
798
  'info': response,
802
- 'timestamp': timestamp,
803
- 'datetime': this.iso8601(timestamp),
799
+ 'timestamp': undefined,
800
+ 'datetime': undefined,
804
801
  };
805
802
  const data = this.safeValue(response, 'data', {});
806
803
  const collaterals = this.safeValue(data, 'collaterals', []);
@@ -822,6 +819,8 @@ export default class ascendex extends Exchange {
822
819
  * @see https://ascendex.github.io/ascendex-pro-api/#margin-account-balance
823
820
  * @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
824
821
  * @param {object} [params] extra parameters specific to the exchange API endpoint
822
+ * @param {string} [params.type] wallet type, 'spot', 'margin', or 'swap'
823
+ * @param {string} [params.marginMode] 'cross' or undefined, for spot margin trading, value of 'isolated' is invalid
825
824
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
826
825
  */
827
826
  await this.loadMarkets();
@@ -3184,12 +3183,11 @@ export default class ascendex extends Exchange {
3184
3183
  //
3185
3184
  const status = this.safeInteger(transfer, 'code');
3186
3185
  const currencyCode = this.safeCurrencyCode(undefined, currency);
3187
- const timestamp = this.milliseconds();
3188
3186
  return {
3189
3187
  'info': transfer,
3190
3188
  'id': undefined,
3191
- 'timestamp': timestamp,
3192
- 'datetime': this.iso8601(timestamp),
3189
+ 'timestamp': undefined,
3190
+ 'datetime': undefined,
3193
3191
  'currency': currencyCode,
3194
3192
  'amount': undefined,
3195
3193
  'fromAccount': undefined,
@@ -3891,6 +3891,8 @@ export default class Exchange {
3891
3891
  params = this.omit(params, [optionName, defaultOptionName]);
3892
3892
  }
3893
3893
  else {
3894
+ // handle routed methods like "watchTrades > watchTradesForSymbols" (or "watchTicker > watchTickers")
3895
+ [methodName, params] = this.handleParamString(params, 'callerMethodName', methodName);
3894
3896
  // check if exchange has properties for this method
3895
3897
  const exchangeWideMethodOptions = this.safeValue(this.options, methodName);
3896
3898
  if (exchangeWideMethodOptions !== undefined) {
package/js/src/binance.js CHANGED
@@ -4813,7 +4813,7 @@ export default class binance extends Exchange {
4813
4813
  let stopPriceIsRequired = false;
4814
4814
  let quantityIsRequired = false;
4815
4815
  if (uppercaseType === 'MARKET') {
4816
- const quoteOrderQty = this.safeValue(this.options, 'quoteOrderQty', true);
4816
+ const quoteOrderQty = this.safeBool(this.options, 'quoteOrderQty', true);
4817
4817
  if (quoteOrderQty) {
4818
4818
  const quoteOrderQtyNew = this.safeValue2(params, 'quoteOrderQty', 'cost');
4819
4819
  const precision = market['precision']['price'];
@@ -10321,7 +10321,7 @@ export default class binance extends Exchange {
10321
10321
  // POST https://fapi.binance.com/fapi/v1/marginType 400 Bad Request
10322
10322
  // binanceusdm
10323
10323
  if (e instanceof MarginModeAlreadySet) {
10324
- const throwMarginModeAlreadySet = this.safeValue(this.options, 'throwMarginModeAlreadySet', false);
10324
+ const throwMarginModeAlreadySet = this.safeBool(this.options, 'throwMarginModeAlreadySet', false);
10325
10325
  if (throwMarginModeAlreadySet) {
10326
10326
  throw e;
10327
10327
  }
package/js/src/bingx.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bingx.js';
2
- import type { TransferEntry, Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position, Dict, Leverage } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position, Dict, Leverage, MarginMode } from './base/types.js';
3
3
  /**
4
4
  * @class bingx
5
5
  * @augments Exchange
@@ -139,6 +139,8 @@ export default class bingx extends Exchange {
139
139
  }>;
140
140
  setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
141
141
  editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: number, price?: number, params?: {}): Promise<Order>;
142
+ fetchMarginMode(symbol: string, params?: {}): Promise<MarginMode>;
143
+ parseMarginMode(marginMode: any, market?: any): MarginMode;
142
144
  sign(path: any, section?: string, method?: string, params?: {}, headers?: any, body?: any): {
143
145
  url: any;
144
146
  method: string;