ccxt 4.1.73 → 4.1.75

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 (53) hide show
  1. package/README.md +6 -8
  2. package/dist/ccxt.browser.js +1108 -1455
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -4
  5. package/dist/cjs/src/base/Exchange.js +31 -4
  6. package/dist/cjs/src/base/ws/Client.js +11 -14
  7. package/dist/cjs/src/bigone.js +38 -9
  8. package/dist/cjs/src/bingx.js +57 -18
  9. package/dist/cjs/src/bitmart.js +33 -11
  10. package/dist/cjs/src/bybit.js +30 -7
  11. package/dist/cjs/src/cex.js +61 -3
  12. package/dist/cjs/src/exmo.js +34 -31
  13. package/dist/cjs/src/gate.js +1 -0
  14. package/dist/cjs/src/gemini.js +21 -19
  15. package/dist/cjs/src/kraken.js +156 -11
  16. package/dist/cjs/src/okx.js +45 -2
  17. package/dist/cjs/src/poloniex.js +27 -25
  18. package/dist/cjs/src/pro/binance.js +60 -8
  19. package/dist/cjs/src/pro/cex.js +317 -10
  20. package/dist/cjs/src/pro/coinbasepro.js +1 -1
  21. package/js/ccxt.d.ts +2 -5
  22. package/js/ccxt.js +2 -4
  23. package/js/src/abstract/kraken.d.ts +2 -0
  24. package/js/src/base/Exchange.d.ts +2 -0
  25. package/js/src/base/Exchange.js +31 -4
  26. package/js/src/base/ws/Client.js +11 -14
  27. package/js/src/bigone.d.ts +1 -0
  28. package/js/src/bigone.js +38 -9
  29. package/js/src/bingx.d.ts +3 -0
  30. package/js/src/bingx.js +58 -19
  31. package/js/src/bitmart.d.ts +1 -0
  32. package/js/src/bitmart.js +33 -11
  33. package/js/src/bybit.d.ts +1 -0
  34. package/js/src/bybit.js +30 -7
  35. package/js/src/cex.d.ts +1 -0
  36. package/js/src/cex.js +61 -3
  37. package/js/src/exmo.d.ts +1 -1
  38. package/js/src/exmo.js +34 -31
  39. package/js/src/gate.js +1 -0
  40. package/js/src/gemini.js +21 -19
  41. package/js/src/kraken.d.ts +2 -0
  42. package/js/src/kraken.js +156 -11
  43. package/js/src/okx.d.ts +2 -0
  44. package/js/src/okx.js +45 -2
  45. package/js/src/poloniex.js +27 -25
  46. package/js/src/pro/binance.d.ts +1 -0
  47. package/js/src/pro/binance.js +61 -9
  48. package/js/src/pro/cex.d.ts +11 -2
  49. package/js/src/pro/cex.js +318 -11
  50. package/js/src/pro/coinbasepro.js +1 -1
  51. package/package.json +1 -1
  52. package/js/src/abstract/tidex.d.ts +0 -28
  53. package/js/src/abstract/tidex.js +0 -11
package/js/src/cex.js CHANGED
@@ -31,6 +31,7 @@ export default class cex extends Exchange {
31
31
  'future': false,
32
32
  'option': false,
33
33
  'addMargin': false,
34
+ 'cancelAllOrders': true,
34
35
  'cancelOrder': true,
35
36
  'cancelOrders': false,
36
37
  'createDepositAddress': false,
@@ -466,6 +467,7 @@ export default class cex extends Exchange {
466
467
  /**
467
468
  * @method
468
469
  * @name cex#fetchBalance
470
+ * @see https://docs.cex.io/#account-balance
469
471
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
470
472
  * @param {object} [params] extra parameters specific to the exchange API endpoint
471
473
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
@@ -478,6 +480,7 @@ export default class cex extends Exchange {
478
480
  /**
479
481
  * @method
480
482
  * @name cex#fetchOrderBook
483
+ * @see https://docs.cex.io/#orderbook
481
484
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
482
485
  * @param {string} symbol unified symbol of the market to fetch the order book for
483
486
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -520,6 +523,7 @@ export default class cex extends Exchange {
520
523
  /**
521
524
  * @method
522
525
  * @name cex#fetchOHLCV
526
+ * @see https://docs.cex.io/#historical-ohlcv-chart
523
527
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
524
528
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
525
529
  * @param {string} timeframe the length of time each candle represents
@@ -625,6 +629,7 @@ export default class cex extends Exchange {
625
629
  /**
626
630
  * @method
627
631
  * @name cex#fetchTicker
632
+ * @see https://docs.cex.io/#ticker
628
633
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
629
634
  * @param {string} symbol unified symbol of the market to fetch the ticker for
630
635
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -677,6 +682,7 @@ export default class cex extends Exchange {
677
682
  /**
678
683
  * @method
679
684
  * @name cex#fetchTrades
685
+ * @see https://docs.cex.io/#trade-history
680
686
  * @description get the list of most recent trades for a particular symbol
681
687
  * @param {string} symbol unified symbol of the market to fetch trades for
682
688
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -696,6 +702,7 @@ export default class cex extends Exchange {
696
702
  /**
697
703
  * @method
698
704
  * @name cex#fetchTradingFees
705
+ * @see https://docs.cex.io/#get-my-fee
699
706
  * @description fetch the trading fees for multiple markets
700
707
  * @param {object} [params] extra parameters specific to the exchange API endpoint
701
708
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
@@ -737,6 +744,7 @@ export default class cex extends Exchange {
737
744
  /**
738
745
  * @method
739
746
  * @name cex#createOrder
747
+ * @see https://docs.cex.io/#place-order
740
748
  * @description create a trade order
741
749
  * @see https://cex.io/rest-api#place-order
742
750
  * @param {string} symbol unified symbol of the market to create an order in
@@ -820,6 +828,7 @@ export default class cex extends Exchange {
820
828
  /**
821
829
  * @method
822
830
  * @name cex#cancelOrder
831
+ * @see https://docs.cex.io/#cancel-order
823
832
  * @description cancels an open order
824
833
  * @param {string} id order id
825
834
  * @param {string} symbol not used by cex cancelOrder ()
@@ -834,6 +843,36 @@ export default class cex extends Exchange {
834
843
  // 'true'
835
844
  return this.extend(this.parseOrder({}), { 'info': response, 'type': undefined, 'id': id, 'status': 'canceled' });
836
845
  }
846
+ async cancelAllOrders(symbol = undefined, params = {}) {
847
+ /**
848
+ * @method
849
+ * @name cex#cancelAllOrders
850
+ * @see https://docs.cex.io/#cancel-all-orders-for-given-pair
851
+ * @description cancel all open orders in a market
852
+ * @param {string} symbol unified market symbol of the market to cancel orders in
853
+ * @param {object} [params] extra parameters specific to the cex api endpoint
854
+ * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
855
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
856
+ */
857
+ if (symbol === undefined) {
858
+ throw new ArgumentsRequired(this.id + ' cancelAllOrders requires a symbol.');
859
+ }
860
+ await this.loadMarkets();
861
+ const market = this.market(symbol);
862
+ const request = {
863
+ 'pair': market['id'],
864
+ };
865
+ const orders = await this.privatePostCancelOrdersPair(this.extend(request, params));
866
+ //
867
+ // {
868
+ // "e":"cancel_orders",
869
+ // "ok":"ok",
870
+ // "data":[
871
+ // ]
872
+ // }
873
+ //
874
+ return orders;
875
+ }
837
876
  parseOrder(order, market = undefined) {
838
877
  // Depending on the call, 'time' can be a unix int, unix string or ISO string
839
878
  // Yes, really
@@ -847,9 +886,9 @@ export default class cex extends Exchange {
847
886
  timestamp = parseInt(timestamp);
848
887
  }
849
888
  let symbol = undefined;
850
- if (market === undefined) {
851
- const baseId = this.safeString(order, 'symbol1');
852
- const quoteId = this.safeString(order, 'symbol2');
889
+ const baseId = this.safeString(order, 'symbol1');
890
+ const quoteId = this.safeString(order, 'symbol2');
891
+ if (market === undefined && baseId !== undefined && quoteId !== undefined) {
853
892
  const base = this.safeCurrencyCode(baseId);
854
893
  const quote = this.safeCurrencyCode(quoteId);
855
894
  if ((base !== undefined) && (quote !== undefined)) {
@@ -1104,6 +1143,7 @@ export default class cex extends Exchange {
1104
1143
  /**
1105
1144
  * @method
1106
1145
  * @name cex#fetchOpenOrders
1146
+ * @see https://docs.cex.io/#open-orders
1107
1147
  * @description fetch all unfilled currently open orders
1108
1148
  * @param {string} symbol unified market symbol
1109
1149
  * @param {int} [since] the earliest time in ms to fetch open orders for
@@ -1130,6 +1170,7 @@ export default class cex extends Exchange {
1130
1170
  /**
1131
1171
  * @method
1132
1172
  * @name cex#fetchClosedOrders
1173
+ * @see https://docs.cex.io/#archived-orders
1133
1174
  * @description fetches information on multiple closed orders made by the user
1134
1175
  * @param {string} symbol unified market symbol of the market orders were made in
1135
1176
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -1151,6 +1192,7 @@ export default class cex extends Exchange {
1151
1192
  /**
1152
1193
  * @method
1153
1194
  * @name cex#fetchOrder
1195
+ * @see https://docs.cex.io/?python#get-order-details
1154
1196
  * @description fetches information on an order made by the user
1155
1197
  * @param {string} symbol not used by cex fetchOrder
1156
1198
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1268,6 +1310,7 @@ export default class cex extends Exchange {
1268
1310
  /**
1269
1311
  * @method
1270
1312
  * @name cex#fetchOrders
1313
+ * @see https://docs.cex.io/#archived-orders
1271
1314
  * @description fetches information on multiple orders made by the user
1272
1315
  * @param {string} symbol unified market symbol of the market orders were made in
1273
1316
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -1490,6 +1533,20 @@ export default class cex extends Exchange {
1490
1533
  return this.safeString(this.options['order']['status'], status, status);
1491
1534
  }
1492
1535
  async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1536
+ /**
1537
+ * @method
1538
+ * @name cex#editOrderWs
1539
+ * @description edit a trade order
1540
+ * @see https://docs.cex.io/#cancel-replace-order
1541
+ * @param {string} id order id
1542
+ * @param {string} symbol unified symbol of the market to create an order in
1543
+ * @param {string} type 'market' or 'limit'
1544
+ * @param {string} side 'buy' or 'sell'
1545
+ * @param {float} amount how much of the currency you want to trade in units of the base currency
1546
+ * @param {float|undefined} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1547
+ * @param {object} [params] extra parameters specific to the cex api endpoint
1548
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
1549
+ */
1493
1550
  if (amount === undefined) {
1494
1551
  throw new ArgumentsRequired(this.id + ' editOrder() requires a amount argument');
1495
1552
  }
@@ -1513,6 +1570,7 @@ export default class cex extends Exchange {
1513
1570
  /**
1514
1571
  * @method
1515
1572
  * @name cex#fetchDepositAddress
1573
+ * @see https://docs.cex.io/#get-crypto-address
1516
1574
  * @description fetch the deposit address for a currency associated with this account
1517
1575
  * @param {string} code unified currency code
1518
1576
  * @param {object} [params] extra parameters specific to the exchange API endpoint
package/js/src/exmo.d.ts CHANGED
@@ -42,7 +42,7 @@ export default class exmo extends Exchange {
42
42
  total: any;
43
43
  status: string;
44
44
  }>;
45
- fetchTradingFees(params?: {}): Promise<any>;
45
+ fetchTradingFees(params?: {}): Promise<{}>;
46
46
  fetchPrivateTradingFees(params?: {}): Promise<{}>;
47
47
  fetchPublicTradingFees(params?: {}): Promise<{}>;
48
48
  parseFixedFloatValue(input: any): number;
package/js/src/exmo.js CHANGED
@@ -240,14 +240,13 @@ export default class exmo extends Exchange {
240
240
  'position_id': market['id'],
241
241
  'quantity': amount,
242
242
  };
243
- let method = undefined;
243
+ let response = undefined;
244
244
  if (type === 'add') {
245
- method = 'privatePostMarginUserPositionMarginAdd';
245
+ response = await this.privatePostMarginUserPositionMarginAdd(this.extend(request, params));
246
246
  }
247
247
  else if (type === 'reduce') {
248
- method = 'privatePostMarginUserPositionMarginReduce';
248
+ response = await this.privatePostMarginUserPositionMarginRemove(this.extend(request, params));
249
249
  }
250
- const response = await this[method](this.extend(request, params));
251
250
  //
252
251
  // {}
253
252
  //
@@ -306,13 +305,16 @@ export default class exmo extends Exchange {
306
305
  * @param {object} [params] extra parameters specific to the exchange API endpoint
307
306
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
308
307
  */
309
- let method = this.safeString(params, 'method');
308
+ const options = this.safeValue(this.options, 'fetchTradingFees', {});
309
+ const defaultMethod = this.safeString(options, 'method', 'fetchPrivateTradingFees');
310
+ const method = this.safeString(params, 'method', defaultMethod);
310
311
  params = this.omit(params, 'method');
311
- if (method === undefined) {
312
- const options = this.safeValue(this.options, 'fetchTradingFees', {});
313
- method = this.safeString(options, 'method', 'fetchPrivateTradingFees');
312
+ if (method === 'fetchPrivateTradingFees') {
313
+ return await this.fetchPrivateTradingFees(params);
314
+ }
315
+ else {
316
+ return await this.fetchPublicTradingFees(params);
314
317
  }
315
- return await this[method](params);
316
318
  }
317
319
  async fetchPrivateTradingFees(params = {}) {
318
320
  await this.loadMarkets();
@@ -1425,7 +1427,6 @@ export default class exmo extends Exchange {
1425
1427
  // 'client_id': 123, // optional, must be a positive integer
1426
1428
  // 'comment': '', // up to 50 latin symbols, whitespaces, underscores
1427
1429
  };
1428
- let method = isSpot ? 'privatePostOrderCreate' : 'privatePostMarginUserOrderCreate';
1429
1430
  let clientOrderId = this.safeValue2(params, 'client_id', 'clientOrderId');
1430
1431
  if (clientOrderId !== undefined) {
1431
1432
  clientOrderId = this.safeInteger2(params, 'client_id', 'clientOrderId');
@@ -1441,32 +1442,22 @@ export default class exmo extends Exchange {
1441
1442
  throw new ArgumentsRequired(this.id + ' createOrder requires an extra param params["leverage"] for margin orders');
1442
1443
  }
1443
1444
  params = this.omit(params, ['stopPrice', 'stop_price', 'triggerPrice', 'timeInForce', 'client_id', 'clientOrderId']);
1444
- if (triggerPrice !== undefined) {
1445
- if (isSpot) {
1445
+ if (price !== undefined) {
1446
+ request['price'] = this.priceToPrecision(market['symbol'], price);
1447
+ }
1448
+ let response = undefined;
1449
+ if (isSpot) {
1450
+ if (triggerPrice !== undefined) {
1446
1451
  if (type === 'limit') {
1447
1452
  throw new BadRequest(this.id + ' createOrder () cannot create stop limit orders for spot, only stop market');
1448
1453
  }
1449
1454
  else {
1450
- method = 'privatePostStopMarketOrderCreate';
1451
1455
  request['type'] = side;
1452
1456
  request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
1453
1457
  }
1458
+ response = await this.privatePostStopMarketOrderCreate(this.extend(request, params));
1454
1459
  }
1455
1460
  else {
1456
- request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
1457
- if (type === 'limit') {
1458
- request['type'] = 'stop_limit_' + side;
1459
- }
1460
- else if (type === 'market') {
1461
- request['type'] = 'stop_' + side;
1462
- }
1463
- else {
1464
- request['type'] = type;
1465
- }
1466
- }
1467
- }
1468
- else {
1469
- if (isSpot) {
1470
1461
  const execType = this.safeString(params, 'exec_type');
1471
1462
  let isPostOnly = undefined;
1472
1463
  [isPostOnly, params] = this.handlePostOnly(type === 'market', execType === 'post_only', params);
@@ -1484,6 +1475,21 @@ export default class exmo extends Exchange {
1484
1475
  else if (timeInForce !== undefined) {
1485
1476
  request['exec_type'] = timeInForce;
1486
1477
  }
1478
+ response = await this.privatePostOrderCreate(this.extend(request, params));
1479
+ }
1480
+ }
1481
+ else {
1482
+ if (triggerPrice !== undefined) {
1483
+ request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
1484
+ if (type === 'limit') {
1485
+ request['type'] = 'stop_limit_' + side;
1486
+ }
1487
+ else if (type === 'market') {
1488
+ request['type'] = 'stop_' + side;
1489
+ }
1490
+ else {
1491
+ request['type'] = type;
1492
+ }
1487
1493
  }
1488
1494
  else {
1489
1495
  if (type === 'limit' || type === 'market') {
@@ -1493,11 +1499,8 @@ export default class exmo extends Exchange {
1493
1499
  request['type'] = type;
1494
1500
  }
1495
1501
  }
1502
+ response = await this.privatePostMarginUserOrderCreate(this.extend(request, params));
1496
1503
  }
1497
- if (price !== undefined) {
1498
- request['price'] = this.priceToPrecision(market['symbol'], price);
1499
- }
1500
- const response = await this[method](this.extend(request, params));
1501
1504
  return this.parseOrder(response, market);
1502
1505
  }
1503
1506
  async cancelOrder(id, symbol = undefined, params = {}) {
package/js/src/gate.js CHANGED
@@ -50,6 +50,7 @@ export default class gate extends Exchange {
50
50
  'subAccounts': 'https://api.gateio.ws/api/v4',
51
51
  'rebate': 'https://api.gateio.ws/api/v4',
52
52
  'earn': 'https://api.gateio.ws/api/v4',
53
+ 'account': 'https://api.gateio.ws/api/v4',
53
54
  },
54
55
  },
55
56
  'test': {
package/js/src/gemini.js CHANGED
@@ -344,26 +344,28 @@ export default class gemini extends Exchange {
344
344
  const networks = {};
345
345
  const networkId = this.safeString(currency, 9);
346
346
  const networkCode = this.networkIdToCode(networkId);
347
- networks[networkCode] = {
348
- 'info': currency,
349
- 'id': networkId,
350
- 'network': networkCode,
351
- 'active': undefined,
352
- 'deposit': undefined,
353
- 'withdraw': undefined,
354
- 'fee': undefined,
355
- 'precision': precision,
356
- 'limits': {
357
- 'deposit': {
358
- 'min': undefined,
359
- 'max': undefined,
360
- },
361
- 'withdraw': {
362
- 'min': undefined,
363
- 'max': undefined,
347
+ if (networkCode !== undefined) {
348
+ networks[networkCode] = {
349
+ 'info': currency,
350
+ 'id': networkId,
351
+ 'network': networkCode,
352
+ 'active': undefined,
353
+ 'deposit': undefined,
354
+ 'withdraw': undefined,
355
+ 'fee': undefined,
356
+ 'precision': precision,
357
+ 'limits': {
358
+ 'deposit': {
359
+ 'min': undefined,
360
+ 'max': undefined,
361
+ },
362
+ 'withdraw': {
363
+ 'min': undefined,
364
+ 'max': undefined,
365
+ },
364
366
  },
365
- },
366
- };
367
+ };
368
+ }
367
369
  result[code] = {
368
370
  'info': currency,
369
371
  'id': id,
@@ -79,11 +79,13 @@ export default class kraken extends Exchange {
79
79
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
80
80
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
81
81
  parseTransactionStatus(status: any): string;
82
+ parseNetwork(network: any): string;
82
83
  parseTransaction(transaction: any, currency?: Currency): Transaction;
83
84
  parseTransactionsByType(type: any, transactions: any, code?: Str, since?: Int, limit?: Int): any;
84
85
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
85
86
  fetchTime(params?: {}): Promise<number>;
86
87
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
88
+ addPaginationCursorToResult(result: any): any;
87
89
  createDepositAddress(code: string, params?: {}): Promise<{
88
90
  currency: string;
89
91
  address: string;
package/js/src/kraken.js CHANGED
@@ -196,6 +196,8 @@ export default class kraken extends Exchange {
196
196
  'Withdraw': 3,
197
197
  'WithdrawCancel': 3,
198
198
  'WithdrawInfo': 3,
199
+ 'WithdrawMethods': 3,
200
+ 'WithdrawAddresses': 3,
199
201
  'WithdrawStatus': 3,
200
202
  'WalletTransfer': 3,
201
203
  // sub accounts
@@ -326,6 +328,91 @@ export default class kraken extends Exchange {
326
328
  'ZEC': 'Zcash (Transparent)',
327
329
  'ZRX': '0x (ZRX)',
328
330
  },
331
+ 'withdrawMethods': {
332
+ 'Lightning': 'Lightning',
333
+ 'Bitcoin': 'BTC',
334
+ 'Ripple': 'XRP',
335
+ 'Litecoin': 'LTC',
336
+ 'Dogecoin': 'DOGE',
337
+ 'Stellar': 'XLM',
338
+ 'Ethereum': 'ERC20',
339
+ 'Arbitrum One': 'Arbitrum',
340
+ 'Polygon': 'MATIC',
341
+ 'Arbitrum Nova': 'Arbitrum',
342
+ 'Optimism': 'Optimism',
343
+ 'zkSync Era': 'zkSync',
344
+ 'Ethereum Classic': 'ETC',
345
+ 'Zcash': 'ZEC',
346
+ 'Monero': 'XMR',
347
+ 'Tron': 'TRC20',
348
+ 'Solana': 'SOL',
349
+ 'EOS': 'EOS',
350
+ 'Bitcoin Cash': 'BCH',
351
+ 'Cardano': 'ADA',
352
+ 'Qtum': 'QTUM',
353
+ 'Tezos': 'XTZ',
354
+ 'Cosmos': 'ATOM',
355
+ 'Nano': 'NANO',
356
+ 'Siacoin': 'SC',
357
+ 'Lisk': 'LSK',
358
+ 'Waves': 'WAVES',
359
+ 'ICON': 'ICX',
360
+ 'Algorand': 'ALGO',
361
+ 'Polygon - USDC.e': 'MATIC',
362
+ 'Arbitrum One - USDC.e': 'Arbitrum',
363
+ 'Polkadot': 'DOT',
364
+ 'Kava': 'KAVA',
365
+ 'Filecoin': 'FIL',
366
+ 'Kusama': 'KSM',
367
+ 'Flow': 'FLOW',
368
+ 'Energy Web': 'EW',
369
+ 'Mina': 'MINA',
370
+ 'Centrifuge': 'CFG',
371
+ 'Karura': 'KAR',
372
+ 'Moonriver': 'MOVR',
373
+ 'Shiden': 'SDN',
374
+ 'Khala': 'PHA',
375
+ 'Bifrost Kusama': 'BNC',
376
+ 'Songbird': 'SGB',
377
+ 'Terra classic': 'LUNC',
378
+ 'KILT': 'KILT',
379
+ 'Basilisk': 'BSX',
380
+ 'Flare': 'FLR',
381
+ 'Avalanche C-Chain': 'AVAX',
382
+ 'Kintsugi': 'KINT',
383
+ 'Altair': 'AIR',
384
+ 'Moonbeam': 'GLMR',
385
+ 'Acala': 'ACA',
386
+ 'Astar': 'ASTR',
387
+ 'Akash': 'AKT',
388
+ 'Robonomics': 'XRT',
389
+ 'Fantom': 'FTM',
390
+ 'Elrond': 'EGLD',
391
+ 'THORchain': 'RUNE',
392
+ 'Secret': 'SCRT',
393
+ 'Near': 'NEAR',
394
+ 'Internet Computer Protocol': 'ICP',
395
+ 'Picasso': 'PICA',
396
+ 'Crust Shadow': 'CSM',
397
+ 'Integritee': 'TEER',
398
+ 'Parallel Finance': 'PARA',
399
+ 'HydraDX': 'HDX',
400
+ 'Interlay': 'INTR',
401
+ 'Fetch.ai': 'FET',
402
+ 'NYM': 'NYM',
403
+ 'Terra 2.0': 'LUNA2',
404
+ 'Juno': 'JUNO',
405
+ 'Nodle': 'NODL',
406
+ 'Stacks': 'STX',
407
+ 'Ethereum PoW': 'ETHW',
408
+ 'Aptos': 'APT',
409
+ 'Sui': 'SUI',
410
+ 'Genshiro': 'GENS',
411
+ 'Aventus': 'AVT',
412
+ 'Sei': 'SEI',
413
+ 'OriginTrail': 'OTP',
414
+ 'Celestia': 'TIA',
415
+ },
329
416
  },
330
417
  'precisionMode': TICK_SIZE,
331
418
  'exceptions': {
@@ -2072,6 +2159,10 @@ export default class kraken extends Exchange {
2072
2159
  };
2073
2160
  return this.safeString(statuses, status, status);
2074
2161
  }
2162
+ parseNetwork(network) {
2163
+ const withdrawMethods = this.safeValue(this.options, 'withdrawMethods', {});
2164
+ return this.safeString(withdrawMethods, network, network);
2165
+ }
2075
2166
  parseTransaction(transaction, currency = undefined) {
2076
2167
  //
2077
2168
  // fetchDeposits
@@ -2122,6 +2213,8 @@ export default class kraken extends Exchange {
2122
2213
  // "fee": "0.0050000000",
2123
2214
  // "time": 1530481750,
2124
2215
  // "status": "Success"
2216
+ // "key":"Huobi wallet",
2217
+ // "network":"Tron"
2125
2218
  // status-prop: 'on-hold' // this field might not be present in some cases
2126
2219
  // }
2127
2220
  //
@@ -2158,7 +2251,7 @@ export default class kraken extends Exchange {
2158
2251
  'id': id,
2159
2252
  'currency': code,
2160
2253
  'amount': amount,
2161
- 'network': undefined,
2254
+ 'network': this.parseNetwork(this.safeString(transaction, 'network')),
2162
2255
  'address': address,
2163
2256
  'addressTo': undefined,
2164
2257
  'addressFrom': undefined,
@@ -2262,19 +2355,28 @@ export default class kraken extends Exchange {
2262
2355
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
2263
2356
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
2264
2357
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2358
+ * @param {object} [params.end] End timestamp, withdrawals created strictly after will be not be included in the response
2359
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times
2265
2360
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2266
- */
2267
- // https://www.kraken.com/en-us/help/api#withdraw-status
2268
- if (code === undefined) {
2269
- throw new ArgumentsRequired(this.id + ' fetchWithdrawals() requires a currency code argument');
2270
- }
2361
+ */
2271
2362
  await this.loadMarkets();
2272
- const currency = this.currency(code);
2273
- const request = {
2274
- 'asset': currency['id'],
2275
- };
2363
+ let paginate = false;
2364
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
2365
+ if (paginate) {
2366
+ params['cursor'] = true;
2367
+ return await this.fetchPaginatedCallCursor('fetchWithdrawals', code, since, limit, params, 'next_cursor', 'cursor');
2368
+ }
2369
+ const request = {};
2370
+ if (code !== undefined) {
2371
+ const currency = this.currency(code);
2372
+ request['asset'] = currency['id'];
2373
+ }
2374
+ if (since !== undefined) {
2375
+ request['since'] = since.toString();
2376
+ }
2276
2377
  const response = await this.privatePostWithdrawStatus(this.extend(request, params));
2277
2378
  //
2379
+ // with no pagination
2278
2380
  // { error: [],
2279
2381
  // "result": [ { "method": "Ether",
2280
2382
  // "aclass": "currency",
@@ -2286,8 +2388,51 @@ export default class kraken extends Exchange {
2286
2388
  // "fee": "0.0050000000",
2287
2389
  // "time": 1530481750,
2288
2390
  // "status": "Success" } ] }
2391
+ // with pagination
2392
+ // {
2393
+ // "error":[],
2394
+ // "result":{
2395
+ // "withdrawals":[
2396
+ // {
2397
+ // "method":"Tether USD (TRC20)",
2398
+ // "aclass":"currency",
2399
+ // "asset":"USDT",
2400
+ // "refid":"BSNFZU2-MEFN4G-J3NEZV",
2401
+ // "txid":"1c7a642fb7387bbc2c6a2c509fd1ae146937f4cf793b4079a4f0715e3a02615a",
2402
+ // "info":"TQmdxSuC16EhFg8FZWtYgrfFRosoRF7bCp",
2403
+ // "amount":"1996.50000000",
2404
+ // "fee":"2.50000000",
2405
+ // "time":1669126657,
2406
+ // "status":"Success",
2407
+ // "key":"poloniex",
2408
+ // "network":"Tron"
2409
+ // },
2410
+ // ...
2411
+ // ],
2412
+ // "next_cursor":"HgAAAAAAAABGVFRSd3k1LVF4Y0JQY05Gd0xRY0NxenFndHpybkwBAQH2AwEBAAAAAQAAAAAAAAABAAAAAAAZAAAAAAAAAA=="
2413
+ // }
2414
+ // }
2289
2415
  //
2290
- return this.parseTransactionsByType('withdrawal', response['result'], code, since, limit);
2416
+ let rawWithdrawals = undefined;
2417
+ const result = this.safeValue(response, 'result');
2418
+ if (!Array.isArray(result)) {
2419
+ rawWithdrawals = this.addPaginationCursorToResult(result);
2420
+ }
2421
+ else {
2422
+ rawWithdrawals = result;
2423
+ }
2424
+ return this.parseTransactionsByType('withdrawal', rawWithdrawals, code, since, limit);
2425
+ }
2426
+ addPaginationCursorToResult(result) {
2427
+ const cursor = this.safeString(result, 'next_cursor');
2428
+ const data = this.safeValue(result, 'withdrawals');
2429
+ const dataLength = data.length;
2430
+ if (cursor !== undefined && dataLength > 0) {
2431
+ const last = data[dataLength - 1];
2432
+ last['next_cursor'] = cursor;
2433
+ data[dataLength - 1] = last;
2434
+ }
2435
+ return data;
2291
2436
  }
2292
2437
  async createDepositAddress(code, params = {}) {
2293
2438
  /**
package/js/src/okx.d.ts CHANGED
@@ -52,6 +52,8 @@ export default class okx extends Exchange {
52
52
  taker: number;
53
53
  }>;
54
54
  fetchBalance(params?: {}): Promise<Balances>;
55
+ createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
56
+ createMarketSellOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
55
57
  createOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): any;
56
58
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
57
59
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;