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
@@ -28,6 +28,7 @@ class cex extends cex$1 {
28
28
  'future': false,
29
29
  'option': false,
30
30
  'addMargin': false,
31
+ 'cancelAllOrders': true,
31
32
  'cancelOrder': true,
32
33
  'cancelOrders': false,
33
34
  'createDepositAddress': false,
@@ -463,6 +464,7 @@ class cex extends cex$1 {
463
464
  /**
464
465
  * @method
465
466
  * @name cex#fetchBalance
467
+ * @see https://docs.cex.io/#account-balance
466
468
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
467
469
  * @param {object} [params] extra parameters specific to the exchange API endpoint
468
470
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
@@ -475,6 +477,7 @@ class cex extends cex$1 {
475
477
  /**
476
478
  * @method
477
479
  * @name cex#fetchOrderBook
480
+ * @see https://docs.cex.io/#orderbook
478
481
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
479
482
  * @param {string} symbol unified symbol of the market to fetch the order book for
480
483
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -517,6 +520,7 @@ class cex extends cex$1 {
517
520
  /**
518
521
  * @method
519
522
  * @name cex#fetchOHLCV
523
+ * @see https://docs.cex.io/#historical-ohlcv-chart
520
524
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
521
525
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
522
526
  * @param {string} timeframe the length of time each candle represents
@@ -622,6 +626,7 @@ class cex extends cex$1 {
622
626
  /**
623
627
  * @method
624
628
  * @name cex#fetchTicker
629
+ * @see https://docs.cex.io/#ticker
625
630
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
626
631
  * @param {string} symbol unified symbol of the market to fetch the ticker for
627
632
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -674,6 +679,7 @@ class cex extends cex$1 {
674
679
  /**
675
680
  * @method
676
681
  * @name cex#fetchTrades
682
+ * @see https://docs.cex.io/#trade-history
677
683
  * @description get the list of most recent trades for a particular symbol
678
684
  * @param {string} symbol unified symbol of the market to fetch trades for
679
685
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
@@ -693,6 +699,7 @@ class cex extends cex$1 {
693
699
  /**
694
700
  * @method
695
701
  * @name cex#fetchTradingFees
702
+ * @see https://docs.cex.io/#get-my-fee
696
703
  * @description fetch the trading fees for multiple markets
697
704
  * @param {object} [params] extra parameters specific to the exchange API endpoint
698
705
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
@@ -734,6 +741,7 @@ class cex extends cex$1 {
734
741
  /**
735
742
  * @method
736
743
  * @name cex#createOrder
744
+ * @see https://docs.cex.io/#place-order
737
745
  * @description create a trade order
738
746
  * @see https://cex.io/rest-api#place-order
739
747
  * @param {string} symbol unified symbol of the market to create an order in
@@ -817,6 +825,7 @@ class cex extends cex$1 {
817
825
  /**
818
826
  * @method
819
827
  * @name cex#cancelOrder
828
+ * @see https://docs.cex.io/#cancel-order
820
829
  * @description cancels an open order
821
830
  * @param {string} id order id
822
831
  * @param {string} symbol not used by cex cancelOrder ()
@@ -831,6 +840,36 @@ class cex extends cex$1 {
831
840
  // 'true'
832
841
  return this.extend(this.parseOrder({}), { 'info': response, 'type': undefined, 'id': id, 'status': 'canceled' });
833
842
  }
843
+ async cancelAllOrders(symbol = undefined, params = {}) {
844
+ /**
845
+ * @method
846
+ * @name cex#cancelAllOrders
847
+ * @see https://docs.cex.io/#cancel-all-orders-for-given-pair
848
+ * @description cancel all open orders in a market
849
+ * @param {string} symbol unified market symbol of the market to cancel orders in
850
+ * @param {object} [params] extra parameters specific to the cex api endpoint
851
+ * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
852
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
853
+ */
854
+ if (symbol === undefined) {
855
+ throw new errors.ArgumentsRequired(this.id + ' cancelAllOrders requires a symbol.');
856
+ }
857
+ await this.loadMarkets();
858
+ const market = this.market(symbol);
859
+ const request = {
860
+ 'pair': market['id'],
861
+ };
862
+ const orders = await this.privatePostCancelOrdersPair(this.extend(request, params));
863
+ //
864
+ // {
865
+ // "e":"cancel_orders",
866
+ // "ok":"ok",
867
+ // "data":[
868
+ // ]
869
+ // }
870
+ //
871
+ return orders;
872
+ }
834
873
  parseOrder(order, market = undefined) {
835
874
  // Depending on the call, 'time' can be a unix int, unix string or ISO string
836
875
  // Yes, really
@@ -844,9 +883,9 @@ class cex extends cex$1 {
844
883
  timestamp = parseInt(timestamp);
845
884
  }
846
885
  let symbol = undefined;
847
- if (market === undefined) {
848
- const baseId = this.safeString(order, 'symbol1');
849
- const quoteId = this.safeString(order, 'symbol2');
886
+ const baseId = this.safeString(order, 'symbol1');
887
+ const quoteId = this.safeString(order, 'symbol2');
888
+ if (market === undefined && baseId !== undefined && quoteId !== undefined) {
850
889
  const base = this.safeCurrencyCode(baseId);
851
890
  const quote = this.safeCurrencyCode(quoteId);
852
891
  if ((base !== undefined) && (quote !== undefined)) {
@@ -1101,6 +1140,7 @@ class cex extends cex$1 {
1101
1140
  /**
1102
1141
  * @method
1103
1142
  * @name cex#fetchOpenOrders
1143
+ * @see https://docs.cex.io/#open-orders
1104
1144
  * @description fetch all unfilled currently open orders
1105
1145
  * @param {string} symbol unified market symbol
1106
1146
  * @param {int} [since] the earliest time in ms to fetch open orders for
@@ -1127,6 +1167,7 @@ class cex extends cex$1 {
1127
1167
  /**
1128
1168
  * @method
1129
1169
  * @name cex#fetchClosedOrders
1170
+ * @see https://docs.cex.io/#archived-orders
1130
1171
  * @description fetches information on multiple closed orders made by the user
1131
1172
  * @param {string} symbol unified market symbol of the market orders were made in
1132
1173
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -1148,6 +1189,7 @@ class cex extends cex$1 {
1148
1189
  /**
1149
1190
  * @method
1150
1191
  * @name cex#fetchOrder
1192
+ * @see https://docs.cex.io/?python#get-order-details
1151
1193
  * @description fetches information on an order made by the user
1152
1194
  * @param {string} symbol not used by cex fetchOrder
1153
1195
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1265,6 +1307,7 @@ class cex extends cex$1 {
1265
1307
  /**
1266
1308
  * @method
1267
1309
  * @name cex#fetchOrders
1310
+ * @see https://docs.cex.io/#archived-orders
1268
1311
  * @description fetches information on multiple orders made by the user
1269
1312
  * @param {string} symbol unified market symbol of the market orders were made in
1270
1313
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -1487,6 +1530,20 @@ class cex extends cex$1 {
1487
1530
  return this.safeString(this.options['order']['status'], status, status);
1488
1531
  }
1489
1532
  async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1533
+ /**
1534
+ * @method
1535
+ * @name cex#editOrderWs
1536
+ * @description edit a trade order
1537
+ * @see https://docs.cex.io/#cancel-replace-order
1538
+ * @param {string} id order id
1539
+ * @param {string} symbol unified symbol of the market to create an order in
1540
+ * @param {string} type 'market' or 'limit'
1541
+ * @param {string} side 'buy' or 'sell'
1542
+ * @param {float} amount how much of the currency you want to trade in units of the base currency
1543
+ * @param {float|undefined} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1544
+ * @param {object} [params] extra parameters specific to the cex api endpoint
1545
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/en/latest/manual.html#order-structure}
1546
+ */
1490
1547
  if (amount === undefined) {
1491
1548
  throw new errors.ArgumentsRequired(this.id + ' editOrder() requires a amount argument');
1492
1549
  }
@@ -1510,6 +1567,7 @@ class cex extends cex$1 {
1510
1567
  /**
1511
1568
  * @method
1512
1569
  * @name cex#fetchDepositAddress
1570
+ * @see https://docs.cex.io/#get-crypto-address
1513
1571
  * @description fetch the deposit address for a currency associated with this account
1514
1572
  * @param {string} code unified currency code
1515
1573
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -237,14 +237,13 @@ class exmo extends exmo$1 {
237
237
  'position_id': market['id'],
238
238
  'quantity': amount,
239
239
  };
240
- let method = undefined;
240
+ let response = undefined;
241
241
  if (type === 'add') {
242
- method = 'privatePostMarginUserPositionMarginAdd';
242
+ response = await this.privatePostMarginUserPositionMarginAdd(this.extend(request, params));
243
243
  }
244
244
  else if (type === 'reduce') {
245
- method = 'privatePostMarginUserPositionMarginReduce';
245
+ response = await this.privatePostMarginUserPositionMarginRemove(this.extend(request, params));
246
246
  }
247
- const response = await this[method](this.extend(request, params));
248
247
  //
249
248
  // {}
250
249
  //
@@ -303,13 +302,16 @@ class exmo extends exmo$1 {
303
302
  * @param {object} [params] extra parameters specific to the exchange API endpoint
304
303
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
305
304
  */
306
- let method = this.safeString(params, 'method');
305
+ const options = this.safeValue(this.options, 'fetchTradingFees', {});
306
+ const defaultMethod = this.safeString(options, 'method', 'fetchPrivateTradingFees');
307
+ const method = this.safeString(params, 'method', defaultMethod);
307
308
  params = this.omit(params, 'method');
308
- if (method === undefined) {
309
- const options = this.safeValue(this.options, 'fetchTradingFees', {});
310
- method = this.safeString(options, 'method', 'fetchPrivateTradingFees');
309
+ if (method === 'fetchPrivateTradingFees') {
310
+ return await this.fetchPrivateTradingFees(params);
311
+ }
312
+ else {
313
+ return await this.fetchPublicTradingFees(params);
311
314
  }
312
- return await this[method](params);
313
315
  }
314
316
  async fetchPrivateTradingFees(params = {}) {
315
317
  await this.loadMarkets();
@@ -1422,7 +1424,6 @@ class exmo extends exmo$1 {
1422
1424
  // 'client_id': 123, // optional, must be a positive integer
1423
1425
  // 'comment': '', // up to 50 latin symbols, whitespaces, underscores
1424
1426
  };
1425
- let method = isSpot ? 'privatePostOrderCreate' : 'privatePostMarginUserOrderCreate';
1426
1427
  let clientOrderId = this.safeValue2(params, 'client_id', 'clientOrderId');
1427
1428
  if (clientOrderId !== undefined) {
1428
1429
  clientOrderId = this.safeInteger2(params, 'client_id', 'clientOrderId');
@@ -1438,32 +1439,22 @@ class exmo extends exmo$1 {
1438
1439
  throw new errors.ArgumentsRequired(this.id + ' createOrder requires an extra param params["leverage"] for margin orders');
1439
1440
  }
1440
1441
  params = this.omit(params, ['stopPrice', 'stop_price', 'triggerPrice', 'timeInForce', 'client_id', 'clientOrderId']);
1441
- if (triggerPrice !== undefined) {
1442
- if (isSpot) {
1442
+ if (price !== undefined) {
1443
+ request['price'] = this.priceToPrecision(market['symbol'], price);
1444
+ }
1445
+ let response = undefined;
1446
+ if (isSpot) {
1447
+ if (triggerPrice !== undefined) {
1443
1448
  if (type === 'limit') {
1444
1449
  throw new errors.BadRequest(this.id + ' createOrder () cannot create stop limit orders for spot, only stop market');
1445
1450
  }
1446
1451
  else {
1447
- method = 'privatePostStopMarketOrderCreate';
1448
1452
  request['type'] = side;
1449
1453
  request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
1450
1454
  }
1455
+ response = await this.privatePostStopMarketOrderCreate(this.extend(request, params));
1451
1456
  }
1452
1457
  else {
1453
- request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
1454
- if (type === 'limit') {
1455
- request['type'] = 'stop_limit_' + side;
1456
- }
1457
- else if (type === 'market') {
1458
- request['type'] = 'stop_' + side;
1459
- }
1460
- else {
1461
- request['type'] = type;
1462
- }
1463
- }
1464
- }
1465
- else {
1466
- if (isSpot) {
1467
1458
  const execType = this.safeString(params, 'exec_type');
1468
1459
  let isPostOnly = undefined;
1469
1460
  [isPostOnly, params] = this.handlePostOnly(type === 'market', execType === 'post_only', params);
@@ -1481,6 +1472,21 @@ class exmo extends exmo$1 {
1481
1472
  else if (timeInForce !== undefined) {
1482
1473
  request['exec_type'] = timeInForce;
1483
1474
  }
1475
+ response = await this.privatePostOrderCreate(this.extend(request, params));
1476
+ }
1477
+ }
1478
+ else {
1479
+ if (triggerPrice !== undefined) {
1480
+ request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
1481
+ if (type === 'limit') {
1482
+ request['type'] = 'stop_limit_' + side;
1483
+ }
1484
+ else if (type === 'market') {
1485
+ request['type'] = 'stop_' + side;
1486
+ }
1487
+ else {
1488
+ request['type'] = type;
1489
+ }
1484
1490
  }
1485
1491
  else {
1486
1492
  if (type === 'limit' || type === 'market') {
@@ -1490,11 +1496,8 @@ class exmo extends exmo$1 {
1490
1496
  request['type'] = type;
1491
1497
  }
1492
1498
  }
1499
+ response = await this.privatePostMarginUserOrderCreate(this.extend(request, params));
1493
1500
  }
1494
- if (price !== undefined) {
1495
- request['price'] = this.priceToPrecision(market['symbol'], price);
1496
- }
1497
- const response = await this[method](this.extend(request, params));
1498
1501
  return this.parseOrder(response, market);
1499
1502
  }
1500
1503
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -47,6 +47,7 @@ class gate extends gate$1 {
47
47
  'subAccounts': 'https://api.gateio.ws/api/v4',
48
48
  'rebate': 'https://api.gateio.ws/api/v4',
49
49
  'earn': 'https://api.gateio.ws/api/v4',
50
+ 'account': 'https://api.gateio.ws/api/v4',
50
51
  },
51
52
  },
52
53
  'test': {
@@ -341,26 +341,28 @@ class gemini extends gemini$1 {
341
341
  const networks = {};
342
342
  const networkId = this.safeString(currency, 9);
343
343
  const networkCode = this.networkIdToCode(networkId);
344
- networks[networkCode] = {
345
- 'info': currency,
346
- 'id': networkId,
347
- 'network': networkCode,
348
- 'active': undefined,
349
- 'deposit': undefined,
350
- 'withdraw': undefined,
351
- 'fee': undefined,
352
- 'precision': precision,
353
- 'limits': {
354
- 'deposit': {
355
- 'min': undefined,
356
- 'max': undefined,
357
- },
358
- 'withdraw': {
359
- 'min': undefined,
360
- 'max': undefined,
344
+ if (networkCode !== undefined) {
345
+ networks[networkCode] = {
346
+ 'info': currency,
347
+ 'id': networkId,
348
+ 'network': networkCode,
349
+ 'active': undefined,
350
+ 'deposit': undefined,
351
+ 'withdraw': undefined,
352
+ 'fee': undefined,
353
+ 'precision': precision,
354
+ 'limits': {
355
+ 'deposit': {
356
+ 'min': undefined,
357
+ 'max': undefined,
358
+ },
359
+ 'withdraw': {
360
+ 'min': undefined,
361
+ 'max': undefined,
362
+ },
361
363
  },
362
- },
363
- };
364
+ };
365
+ }
364
366
  result[code] = {
365
367
  'info': currency,
366
368
  'id': id,
@@ -193,6 +193,8 @@ class kraken extends kraken$1 {
193
193
  'Withdraw': 3,
194
194
  'WithdrawCancel': 3,
195
195
  'WithdrawInfo': 3,
196
+ 'WithdrawMethods': 3,
197
+ 'WithdrawAddresses': 3,
196
198
  'WithdrawStatus': 3,
197
199
  'WalletTransfer': 3,
198
200
  // sub accounts
@@ -323,6 +325,91 @@ class kraken extends kraken$1 {
323
325
  'ZEC': 'Zcash (Transparent)',
324
326
  'ZRX': '0x (ZRX)',
325
327
  },
328
+ 'withdrawMethods': {
329
+ 'Lightning': 'Lightning',
330
+ 'Bitcoin': 'BTC',
331
+ 'Ripple': 'XRP',
332
+ 'Litecoin': 'LTC',
333
+ 'Dogecoin': 'DOGE',
334
+ 'Stellar': 'XLM',
335
+ 'Ethereum': 'ERC20',
336
+ 'Arbitrum One': 'Arbitrum',
337
+ 'Polygon': 'MATIC',
338
+ 'Arbitrum Nova': 'Arbitrum',
339
+ 'Optimism': 'Optimism',
340
+ 'zkSync Era': 'zkSync',
341
+ 'Ethereum Classic': 'ETC',
342
+ 'Zcash': 'ZEC',
343
+ 'Monero': 'XMR',
344
+ 'Tron': 'TRC20',
345
+ 'Solana': 'SOL',
346
+ 'EOS': 'EOS',
347
+ 'Bitcoin Cash': 'BCH',
348
+ 'Cardano': 'ADA',
349
+ 'Qtum': 'QTUM',
350
+ 'Tezos': 'XTZ',
351
+ 'Cosmos': 'ATOM',
352
+ 'Nano': 'NANO',
353
+ 'Siacoin': 'SC',
354
+ 'Lisk': 'LSK',
355
+ 'Waves': 'WAVES',
356
+ 'ICON': 'ICX',
357
+ 'Algorand': 'ALGO',
358
+ 'Polygon - USDC.e': 'MATIC',
359
+ 'Arbitrum One - USDC.e': 'Arbitrum',
360
+ 'Polkadot': 'DOT',
361
+ 'Kava': 'KAVA',
362
+ 'Filecoin': 'FIL',
363
+ 'Kusama': 'KSM',
364
+ 'Flow': 'FLOW',
365
+ 'Energy Web': 'EW',
366
+ 'Mina': 'MINA',
367
+ 'Centrifuge': 'CFG',
368
+ 'Karura': 'KAR',
369
+ 'Moonriver': 'MOVR',
370
+ 'Shiden': 'SDN',
371
+ 'Khala': 'PHA',
372
+ 'Bifrost Kusama': 'BNC',
373
+ 'Songbird': 'SGB',
374
+ 'Terra classic': 'LUNC',
375
+ 'KILT': 'KILT',
376
+ 'Basilisk': 'BSX',
377
+ 'Flare': 'FLR',
378
+ 'Avalanche C-Chain': 'AVAX',
379
+ 'Kintsugi': 'KINT',
380
+ 'Altair': 'AIR',
381
+ 'Moonbeam': 'GLMR',
382
+ 'Acala': 'ACA',
383
+ 'Astar': 'ASTR',
384
+ 'Akash': 'AKT',
385
+ 'Robonomics': 'XRT',
386
+ 'Fantom': 'FTM',
387
+ 'Elrond': 'EGLD',
388
+ 'THORchain': 'RUNE',
389
+ 'Secret': 'SCRT',
390
+ 'Near': 'NEAR',
391
+ 'Internet Computer Protocol': 'ICP',
392
+ 'Picasso': 'PICA',
393
+ 'Crust Shadow': 'CSM',
394
+ 'Integritee': 'TEER',
395
+ 'Parallel Finance': 'PARA',
396
+ 'HydraDX': 'HDX',
397
+ 'Interlay': 'INTR',
398
+ 'Fetch.ai': 'FET',
399
+ 'NYM': 'NYM',
400
+ 'Terra 2.0': 'LUNA2',
401
+ 'Juno': 'JUNO',
402
+ 'Nodle': 'NODL',
403
+ 'Stacks': 'STX',
404
+ 'Ethereum PoW': 'ETHW',
405
+ 'Aptos': 'APT',
406
+ 'Sui': 'SUI',
407
+ 'Genshiro': 'GENS',
408
+ 'Aventus': 'AVT',
409
+ 'Sei': 'SEI',
410
+ 'OriginTrail': 'OTP',
411
+ 'Celestia': 'TIA',
412
+ },
326
413
  },
327
414
  'precisionMode': number.TICK_SIZE,
328
415
  'exceptions': {
@@ -2069,6 +2156,10 @@ class kraken extends kraken$1 {
2069
2156
  };
2070
2157
  return this.safeString(statuses, status, status);
2071
2158
  }
2159
+ parseNetwork(network) {
2160
+ const withdrawMethods = this.safeValue(this.options, 'withdrawMethods', {});
2161
+ return this.safeString(withdrawMethods, network, network);
2162
+ }
2072
2163
  parseTransaction(transaction, currency = undefined) {
2073
2164
  //
2074
2165
  // fetchDeposits
@@ -2119,6 +2210,8 @@ class kraken extends kraken$1 {
2119
2210
  // "fee": "0.0050000000",
2120
2211
  // "time": 1530481750,
2121
2212
  // "status": "Success"
2213
+ // "key":"Huobi wallet",
2214
+ // "network":"Tron"
2122
2215
  // status-prop: 'on-hold' // this field might not be present in some cases
2123
2216
  // }
2124
2217
  //
@@ -2155,7 +2248,7 @@ class kraken extends kraken$1 {
2155
2248
  'id': id,
2156
2249
  'currency': code,
2157
2250
  'amount': amount,
2158
- 'network': undefined,
2251
+ 'network': this.parseNetwork(this.safeString(transaction, 'network')),
2159
2252
  'address': address,
2160
2253
  'addressTo': undefined,
2161
2254
  'addressFrom': undefined,
@@ -2259,19 +2352,28 @@ class kraken extends kraken$1 {
2259
2352
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
2260
2353
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
2261
2354
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2355
+ * @param {object} [params.end] End timestamp, withdrawals created strictly after will be not be included in the response
2356
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times
2262
2357
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2263
- */
2264
- // https://www.kraken.com/en-us/help/api#withdraw-status
2265
- if (code === undefined) {
2266
- throw new errors.ArgumentsRequired(this.id + ' fetchWithdrawals() requires a currency code argument');
2267
- }
2358
+ */
2268
2359
  await this.loadMarkets();
2269
- const currency = this.currency(code);
2270
- const request = {
2271
- 'asset': currency['id'],
2272
- };
2360
+ let paginate = false;
2361
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
2362
+ if (paginate) {
2363
+ params['cursor'] = true;
2364
+ return await this.fetchPaginatedCallCursor('fetchWithdrawals', code, since, limit, params, 'next_cursor', 'cursor');
2365
+ }
2366
+ const request = {};
2367
+ if (code !== undefined) {
2368
+ const currency = this.currency(code);
2369
+ request['asset'] = currency['id'];
2370
+ }
2371
+ if (since !== undefined) {
2372
+ request['since'] = since.toString();
2373
+ }
2273
2374
  const response = await this.privatePostWithdrawStatus(this.extend(request, params));
2274
2375
  //
2376
+ // with no pagination
2275
2377
  // { error: [],
2276
2378
  // "result": [ { "method": "Ether",
2277
2379
  // "aclass": "currency",
@@ -2283,8 +2385,51 @@ class kraken extends kraken$1 {
2283
2385
  // "fee": "0.0050000000",
2284
2386
  // "time": 1530481750,
2285
2387
  // "status": "Success" } ] }
2388
+ // with pagination
2389
+ // {
2390
+ // "error":[],
2391
+ // "result":{
2392
+ // "withdrawals":[
2393
+ // {
2394
+ // "method":"Tether USD (TRC20)",
2395
+ // "aclass":"currency",
2396
+ // "asset":"USDT",
2397
+ // "refid":"BSNFZU2-MEFN4G-J3NEZV",
2398
+ // "txid":"1c7a642fb7387bbc2c6a2c509fd1ae146937f4cf793b4079a4f0715e3a02615a",
2399
+ // "info":"TQmdxSuC16EhFg8FZWtYgrfFRosoRF7bCp",
2400
+ // "amount":"1996.50000000",
2401
+ // "fee":"2.50000000",
2402
+ // "time":1669126657,
2403
+ // "status":"Success",
2404
+ // "key":"poloniex",
2405
+ // "network":"Tron"
2406
+ // },
2407
+ // ...
2408
+ // ],
2409
+ // "next_cursor":"HgAAAAAAAABGVFRSd3k1LVF4Y0JQY05Gd0xRY0NxenFndHpybkwBAQH2AwEBAAAAAQAAAAAAAAABAAAAAAAZAAAAAAAAAA=="
2410
+ // }
2411
+ // }
2286
2412
  //
2287
- return this.parseTransactionsByType('withdrawal', response['result'], code, since, limit);
2413
+ let rawWithdrawals = undefined;
2414
+ const result = this.safeValue(response, 'result');
2415
+ if (!Array.isArray(result)) {
2416
+ rawWithdrawals = this.addPaginationCursorToResult(result);
2417
+ }
2418
+ else {
2419
+ rawWithdrawals = result;
2420
+ }
2421
+ return this.parseTransactionsByType('withdrawal', rawWithdrawals, code, since, limit);
2422
+ }
2423
+ addPaginationCursorToResult(result) {
2424
+ const cursor = this.safeString(result, 'next_cursor');
2425
+ const data = this.safeValue(result, 'withdrawals');
2426
+ const dataLength = data.length;
2427
+ if (cursor !== undefined && dataLength > 0) {
2428
+ const last = data[dataLength - 1];
2429
+ last['next_cursor'] = cursor;
2430
+ data[dataLength - 1] = last;
2431
+ }
2432
+ return data;
2288
2433
  }
2289
2434
  async createDepositAddress(code, params = {}) {
2290
2435
  /**
@@ -35,6 +35,8 @@ class okx extends okx$1 {
35
35
  'cancelOrder': true,
36
36
  'cancelOrders': true,
37
37
  'createDepositAddress': false,
38
+ 'createMarketBuyOrderWithCost': true,
39
+ 'createMarketSellOrderWithCost': true,
38
40
  'createOrder': true,
39
41
  'createOrders': true,
40
42
  'createPostOnlyOrder': true,
@@ -2489,6 +2491,46 @@ class okx extends okx$1 {
2489
2491
  //
2490
2492
  return this.parseBalanceByType(marketType, response);
2491
2493
  }
2494
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
2495
+ /**
2496
+ * @method
2497
+ * @name okx#createMarketBuyOrderWithCost
2498
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
2499
+ * @description create a market buy order by providing the symbol and cost
2500
+ * @param {string} symbol unified symbol of the market to create an order in
2501
+ * @param {float} cost how much you want to trade in units of the quote currency
2502
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2503
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2504
+ */
2505
+ await this.loadMarkets();
2506
+ const market = this.market(symbol);
2507
+ if (!market['spot']) {
2508
+ throw new errors.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot markets only');
2509
+ }
2510
+ params['createMarketBuyOrderRequiresPrice'] = false;
2511
+ params['tgtCcy'] = 'quote_ccy';
2512
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
2513
+ }
2514
+ async createMarketSellOrderWithCost(symbol, cost, params = {}) {
2515
+ /**
2516
+ * @method
2517
+ * @name okx#createMarketSellOrderWithCost
2518
+ * @see https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-place-order
2519
+ * @description create a market buy order by providing the symbol and cost
2520
+ * @param {string} symbol unified symbol of the market to create an order in
2521
+ * @param {float} cost how much you want to trade in units of the quote currency
2522
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2523
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2524
+ */
2525
+ await this.loadMarkets();
2526
+ const market = this.market(symbol);
2527
+ if (!market['spot']) {
2528
+ throw new errors.NotSupported(this.id + ' createMarketSellOrderWithCost() supports spot markets only');
2529
+ }
2530
+ params['createMarketBuyOrderRequiresPrice'] = false;
2531
+ params['tgtCcy'] = 'quote_ccy';
2532
+ return await this.createOrder(symbol, 'market', 'sell', cost, undefined, params);
2533
+ }
2492
2534
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
2493
2535
  const market = this.market(symbol);
2494
2536
  const request = {
@@ -2582,8 +2624,10 @@ class okx extends okx$1 {
2582
2624
  // see documentation: https://www.okx.com/docs-v5/en/#rest-api-trade-place-order
2583
2625
  if (tgtCcy === 'quote_ccy') {
2584
2626
  // quote_ccy: sz refers to units of quote currency
2627
+ let createMarketBuyOrderRequiresPrice = true;
2628
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
2585
2629
  let notional = this.safeNumber2(params, 'cost', 'sz');
2586
- const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
2630
+ params = this.omit(params, ['cost', 'sz']);
2587
2631
  if (createMarketBuyOrderRequiresPrice) {
2588
2632
  if (price !== undefined) {
2589
2633
  if (notional === undefined) {
@@ -2601,7 +2645,6 @@ class okx extends okx$1 {
2601
2645
  notional = (notional === undefined) ? amount : notional;
2602
2646
  }
2603
2647
  request['sz'] = this.costToPrecision(symbol, notional);
2604
- params = this.omit(params, ['cost', 'sz']);
2605
2648
  }
2606
2649
  }
2607
2650
  if (marketIOC && contract) {