ccxt 4.1.74 → 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.
@@ -11668,6 +11668,10 @@ class Exchange {
11668
11668
  if (cursorValue === undefined) {
11669
11669
  break;
11670
11670
  }
11671
+ const lastTimestamp = this.safeInteger(last, 'timestamp');
11672
+ if (lastTimestamp !== undefined && lastTimestamp < since) {
11673
+ break;
11674
+ }
11671
11675
  }
11672
11676
  catch (e) {
11673
11677
  errors += 1;
@@ -11720,10 +11724,10 @@ class Exchange {
11720
11724
  const first = this.safeValue(result, 0);
11721
11725
  if (first !== undefined) {
11722
11726
  if ('timestamp' in first) {
11723
- return this.sortBy(result, 'timestamp');
11727
+ return this.sortBy(result, 'timestamp', true);
11724
11728
  }
11725
11729
  if ('id' in first) {
11726
- return this.sortBy(result, 'id');
11730
+ return this.sortBy(result, 'id', true);
11727
11731
  }
11728
11732
  }
11729
11733
  return result;
@@ -14393,23 +14397,20 @@ class Client {
14393
14397
  // MessageEvent {isTrusted: true, data: "{"e":"depthUpdate","E":1581358737706,"s":"ETHBTC",…"0.06200000"]],"a":[["0.02261300","0.00000000"]]}", origin: "wss://stream.binance.com:9443", lastEventId: "", source: null, …}
14394
14398
  let message = messageEvent.data;
14395
14399
  let arrayBuffer;
14396
- if (this.gunzip || this.inflate) {
14397
- if (typeof message === 'string') {
14398
- arrayBuffer = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_6__/* .utf8 */ .KA.decode(message);
14399
- }
14400
- else {
14400
+ if (typeof message !== 'string') {
14401
+ if (this.gunzip || this.inflate) {
14401
14402
  arrayBuffer = new Uint8Array(message.buffer.slice(message.byteOffset, message.byteOffset + message.byteLength));
14403
+ if (this.gunzip) {
14404
+ arrayBuffer = (0,_static_dependencies_fflake_browser_js__WEBPACK_IMPORTED_MODULE_0__/* .gunzipSync */ ._Z)(arrayBuffer);
14405
+ }
14406
+ else if (this.inflate) {
14407
+ arrayBuffer = (0,_static_dependencies_fflake_browser_js__WEBPACK_IMPORTED_MODULE_0__/* .inflateSync */ .n)(arrayBuffer);
14408
+ }
14409
+ message = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_6__/* .utf8 */ .KA.encode(arrayBuffer);
14402
14410
  }
14403
- if (this.gunzip) {
14404
- arrayBuffer = (0,_static_dependencies_fflake_browser_js__WEBPACK_IMPORTED_MODULE_0__/* .gunzipSync */ ._Z)(arrayBuffer);
14405
- }
14406
- else if (this.inflate) {
14407
- arrayBuffer = (0,_static_dependencies_fflake_browser_js__WEBPACK_IMPORTED_MODULE_0__/* .inflateSync */ .n)(arrayBuffer);
14411
+ else {
14412
+ message = message.toString();
14408
14413
  }
14409
- message = _static_dependencies_scure_base_index_js__WEBPACK_IMPORTED_MODULE_6__/* .utf8 */ .KA.encode(arrayBuffer);
14410
- }
14411
- if (typeof message !== 'string') {
14412
- message = message.toString();
14413
14414
  }
14414
14415
  try {
14415
14416
  if ((0,_base_functions_js__WEBPACK_IMPORTED_MODULE_7__/* .isJsonEncodedObject */ .Dd)(message)) {
@@ -15045,6 +15046,8 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
15045
15046
  'option': undefined,
15046
15047
  'cancelAllOrders': true,
15047
15048
  'cancelOrder': true,
15049
+ 'createMarketBuyOrderWithCost': true,
15050
+ 'createMarketSellOrderWithCost': false,
15048
15051
  'createOrder': true,
15049
15052
  'createPostOnlyOrder': true,
15050
15053
  'createStopLimitOrder': true,
@@ -16167,6 +16170,20 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
16167
16170
  'trades': undefined,
16168
16171
  }, market);
16169
16172
  }
16173
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
16174
+ /**
16175
+ * @method
16176
+ * @name bigone#createMarketBuyOrderWithCost
16177
+ * @see https://open.big.one/docs/spot_orders.html#create-order
16178
+ * @description create a market buy order by providing the symbol and cost
16179
+ * @param {string} symbol unified symbol of the market to create an order in
16180
+ * @param {float} cost how much you want to trade in units of the quote currency
16181
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
16182
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
16183
+ */
16184
+ params['createMarketBuyOrderRequiresPrice'] = false;
16185
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
16186
+ }
16170
16187
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
16171
16188
  /**
16172
16189
  * @method
@@ -16194,7 +16211,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
16194
16211
  const requestSide = isBuy ? 'BID' : 'ASK';
16195
16212
  let uppercaseType = type.toUpperCase();
16196
16213
  const isLimit = uppercaseType === 'LIMIT';
16197
- const exchangeSpecificParam = this.safeValue(params, 'post_only');
16214
+ const exchangeSpecificParam = this.safeValue(params, 'post_only', false);
16198
16215
  let postOnly = undefined;
16199
16216
  [postOnly, params] = this.handlePostOnly((uppercaseType === 'MARKET'), exchangeSpecificParam, params);
16200
16217
  const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
@@ -16218,21 +16235,34 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
16218
16235
  request['post_only'] = true;
16219
16236
  }
16220
16237
  }
16238
+ request['amount'] = this.amountToPrecision(symbol, amount);
16221
16239
  }
16222
16240
  else {
16223
- const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice');
16224
- if (createMarketBuyOrderRequiresPrice && (side === 'buy')) {
16225
- if (price === undefined) {
16226
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter');
16241
+ if (isBuy) {
16242
+ let createMarketBuyOrderRequiresPrice = true;
16243
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
16244
+ const cost = this.safeNumber(params, 'cost');
16245
+ params = this.omit(params, 'cost');
16246
+ if (createMarketBuyOrderRequiresPrice) {
16247
+ if ((price === undefined) && (cost === undefined)) {
16248
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
16249
+ }
16250
+ else {
16251
+ const amountString = this.numberToString(amount);
16252
+ const priceString = this.numberToString(price);
16253
+ const quoteAmount = this.parseToNumeric(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString));
16254
+ const costRequest = (cost !== undefined) ? cost : quoteAmount;
16255
+ request['amount'] = this.costToPrecision(symbol, costRequest);
16256
+ }
16227
16257
  }
16228
16258
  else {
16229
- const amountString = this.numberToString(amount);
16230
- const priceString = this.numberToString(price);
16231
- amount = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString));
16259
+ request['amount'] = this.costToPrecision(symbol, amount);
16232
16260
  }
16233
16261
  }
16262
+ else {
16263
+ request['amount'] = this.amountToPrecision(symbol, amount);
16264
+ }
16234
16265
  }
16235
- request['amount'] = this.amountToPrecision(symbol, amount);
16236
16266
  if (triggerPrice !== undefined) {
16237
16267
  request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
16238
16268
  request['operator'] = isBuy ? 'GTE' : 'LTE';
@@ -26889,6 +26919,9 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
26889
26919
  'cancelAllOrders': true,
26890
26920
  'cancelOrder': true,
26891
26921
  'cancelOrders': true,
26922
+ 'createMarketBuyOrderWithCost': true,
26923
+ 'createMarketOrderWithCost': true,
26924
+ 'createMarketSellOrderWithCost': true,
26892
26925
  'createOrder': true,
26893
26926
  'createOrders': true,
26894
26927
  'fetchBalance': true,
@@ -28481,6 +28514,46 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28481
28514
  'takeProfitPrice': undefined,
28482
28515
  });
28483
28516
  }
28517
+ async createMarketOrderWithCost(symbol, side, cost, params = {}) {
28518
+ /**
28519
+ * @method
28520
+ * @name bingx#createMarketOrderWithCost
28521
+ * @description create a market order by providing the symbol, side and cost
28522
+ * @param {string} symbol unified symbol of the market to create an order in
28523
+ * @param {string} side 'buy' or 'sell'
28524
+ * @param {float} cost how much you want to trade in units of the quote currency
28525
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
28526
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
28527
+ */
28528
+ params['quoteOrderQty'] = cost;
28529
+ return await this.createOrder(symbol, 'market', side, cost, undefined, params);
28530
+ }
28531
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
28532
+ /**
28533
+ * @method
28534
+ * @name bingx#createMarketBuyOrderWithCost
28535
+ * @description create a market buy order by providing the symbol and cost
28536
+ * @param {string} symbol unified symbol of the market to create an order in
28537
+ * @param {float} cost how much you want to trade in units of the quote currency
28538
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
28539
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
28540
+ */
28541
+ params['quoteOrderQty'] = cost;
28542
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
28543
+ }
28544
+ async createMarketSellOrderWithCost(symbol, cost, params = {}) {
28545
+ /**
28546
+ * @method
28547
+ * @name bingx#createMarketSellOrderWithCost
28548
+ * @description create a market sell order by providing the symbol and cost
28549
+ * @param {string} symbol unified symbol of the market to create an order in
28550
+ * @param {float} cost how much you want to trade in units of the quote currency
28551
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
28552
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
28553
+ */
28554
+ params['quoteOrderQty'] = cost;
28555
+ return await this.createOrder(symbol, 'market', 'sell', cost, undefined, params);
28556
+ }
28484
28557
  createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
28485
28558
  /**
28486
28559
  * @method
@@ -28516,26 +28589,21 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28516
28589
  if (postOnly || (timeInForce === 'POC')) {
28517
28590
  request['timeInForce'] = 'POC';
28518
28591
  }
28519
- const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
28520
- if (isMarketOrder && (side === 'buy')) {
28521
- if (createMarketBuyOrderRequiresPrice) {
28522
- if (price === undefined) {
28523
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter');
28524
- }
28525
- else {
28526
- const amountString = this.numberToString(amount);
28527
- const priceString = this.numberToString(price);
28528
- const cost = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString));
28529
- request['quoteOrderQty'] = this.parseToNumeric(this.priceToPrecision(symbol, cost));
28530
- }
28592
+ const cost = this.safeNumber2(params, 'cost', 'quoteOrderQty');
28593
+ params = this.omit(params, 'cost');
28594
+ if (cost !== undefined) {
28595
+ request['quoteOrderQty'] = this.parseToNumeric(this.costToPrecision(symbol, cost));
28596
+ }
28597
+ else {
28598
+ if (market['spot'] && isMarketOrder && (price !== undefined)) {
28599
+ // keep the legacy behavior, to avoid breaking the old spot-market-buying code
28600
+ const calculatedCost = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(this.numberToString(amount), this.numberToString(price));
28601
+ request['quoteOrderQty'] = this.parseToNumeric(calculatedCost);
28531
28602
  }
28532
28603
  else {
28533
- request['quoteOrderQty'] = this.parseToNumeric(this.priceToPrecision(symbol, amount));
28604
+ request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
28534
28605
  }
28535
28606
  }
28536
- else {
28537
- request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
28538
- }
28539
28607
  if (!isMarketOrder) {
28540
28608
  request['price'] = this.parseToNumeric(this.priceToPrecision(symbol, price));
28541
28609
  }
@@ -28610,8 +28678,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28610
28678
  * @method
28611
28679
  * @name bingx#createOrder
28612
28680
  * @description create a trade order
28613
- * @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Create%20an%20Order
28614
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Trade%20order
28681
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Create%20an%20Order
28682
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Trade%20order
28615
28683
  * @param {string} symbol unified symbol of the market to create an order in
28616
28684
  * @param {string} type 'market' or 'limit'
28617
28685
  * @param {string} side 'buy' or 'sell'
@@ -28624,6 +28692,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
28624
28692
  * @param {float} [params.triggerPrice] *swap only* triggerPrice at which the attached take profit / stop loss order will be triggered
28625
28693
  * @param {float} [params.stopLossPrice] *swap only* stop loss trigger price
28626
28694
  * @param {float} [params.takeProfitPrice] *swap only* take profit trigger price
28695
+ * @param {float} [params.cost] the quote quantity that can be used as an alternative for the amount
28627
28696
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
28628
28697
  */
28629
28698
  await this.loadMarkets();
@@ -48350,6 +48419,9 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
48350
48419
  'cancelAllOrders': true,
48351
48420
  'cancelOrder': true,
48352
48421
  'cancelOrders': false,
48422
+ 'createMarketBuyOrderWithCost': true,
48423
+ 'createMarketOrderWithCost': false,
48424
+ 'createMarketSellOrderWithCost': false,
48353
48425
  'createOrder': true,
48354
48426
  'createPostOnlyOrder': true,
48355
48427
  'createStopLimitOrder': false,
@@ -50475,12 +50547,31 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
50475
50547
  const statuses = this.safeValue(statusesByType, type, {});
50476
50548
  return this.safeString(statuses, status, status);
50477
50549
  }
50550
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
50551
+ /**
50552
+ * @method
50553
+ * @name bitmart#createMarketBuyOrderWithCost
50554
+ * @description create a market buy order by providing the symbol and cost
50555
+ * @see https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
50556
+ * @param {string} symbol unified symbol of the market to create an order in
50557
+ * @param {float} cost how much you want to trade in units of the quote currency
50558
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
50559
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
50560
+ */
50561
+ await this.loadMarkets();
50562
+ const market = this.market(symbol);
50563
+ if (!market['spot']) {
50564
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
50565
+ }
50566
+ params['createMarketBuyOrderRequiresPrice'] = false;
50567
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
50568
+ }
50478
50569
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
50479
50570
  /**
50480
50571
  * @method
50481
50572
  * @name bitmart#createOrder
50482
50573
  * @description create a trade order
50483
- * @see https://developer-pro.bitmart.com/en/spot/#place-spot-order
50574
+ * @see https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
50484
50575
  * @see https://developer-pro.bitmart.com/en/spot/#place-margin-order
50485
50576
  * @see https://developer-pro.bitmart.com/en/futures/#submit-order-signed
50486
50577
  * @param {string} symbol unified symbol of the market to create an order in
@@ -50657,18 +50748,18 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
50657
50748
  else if (isMarketOrder) {
50658
50749
  // for market buy it requires the amount of quote currency to spend
50659
50750
  if (side === 'buy') {
50660
- let notional = this.safeNumber(params, 'notional');
50661
- const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
50751
+ let notional = this.safeNumber2(params, 'cost', 'notional');
50752
+ params = this.omit(params, 'cost');
50753
+ let createMarketBuyOrderRequiresPrice = true;
50754
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
50662
50755
  if (createMarketBuyOrderRequiresPrice) {
50663
- if (price !== undefined) {
50664
- if (notional === undefined) {
50665
- const amountString = this.numberToString(amount);
50666
- const priceString = this.numberToString(price);
50667
- notional = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString));
50668
- }
50756
+ if ((price === undefined) && (notional === undefined)) {
50757
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument or in the "notional" extra parameter (the exchange-specific behaviour)');
50669
50758
  }
50670
- else if (notional === undefined) {
50671
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + " createOrder () requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply a price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options['createMarketBuyOrderRequiresPrice'] = false and supply the total cost value in the 'amount' argument or in the 'notional' extra parameter (the exchange-specific behaviour)");
50759
+ else {
50760
+ const amountString = this.numberToString(amount);
50761
+ const priceString = this.numberToString(price);
50762
+ notional = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString));
50672
50763
  }
50673
50764
  }
50674
50765
  else {
@@ -121937,6 +122028,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
121937
122028
  'subAccounts': 'https://api.gateio.ws/api/v4',
121938
122029
  'rebate': 'https://api.gateio.ws/api/v4',
121939
122030
  'earn': 'https://api.gateio.ws/api/v4',
122031
+ 'account': 'https://api.gateio.ws/api/v4',
121940
122032
  },
121941
122033
  },
121942
122034
  'test': {
@@ -129239,26 +129331,28 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
129239
129331
  const networks = {};
129240
129332
  const networkId = this.safeString(currency, 9);
129241
129333
  const networkCode = this.networkIdToCode(networkId);
129242
- networks[networkCode] = {
129243
- 'info': currency,
129244
- 'id': networkId,
129245
- 'network': networkCode,
129246
- 'active': undefined,
129247
- 'deposit': undefined,
129248
- 'withdraw': undefined,
129249
- 'fee': undefined,
129250
- 'precision': precision,
129251
- 'limits': {
129252
- 'deposit': {
129253
- 'min': undefined,
129254
- 'max': undefined,
129255
- },
129256
- 'withdraw': {
129257
- 'min': undefined,
129258
- 'max': undefined,
129334
+ if (networkCode !== undefined) {
129335
+ networks[networkCode] = {
129336
+ 'info': currency,
129337
+ 'id': networkId,
129338
+ 'network': networkCode,
129339
+ 'active': undefined,
129340
+ 'deposit': undefined,
129341
+ 'withdraw': undefined,
129342
+ 'fee': undefined,
129343
+ 'precision': precision,
129344
+ 'limits': {
129345
+ 'deposit': {
129346
+ 'min': undefined,
129347
+ 'max': undefined,
129348
+ },
129349
+ 'withdraw': {
129350
+ 'min': undefined,
129351
+ 'max': undefined,
129352
+ },
129259
129353
  },
129260
- },
129261
- };
129354
+ };
129355
+ }
129262
129356
  result[code] = {
129263
129357
  'info': currency,
129264
129358
  'id': id,
@@ -150648,6 +150742,91 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
150648
150742
  'ZEC': 'Zcash (Transparent)',
150649
150743
  'ZRX': '0x (ZRX)',
150650
150744
  },
150745
+ 'withdrawMethods': {
150746
+ 'Lightning': 'Lightning',
150747
+ 'Bitcoin': 'BTC',
150748
+ 'Ripple': 'XRP',
150749
+ 'Litecoin': 'LTC',
150750
+ 'Dogecoin': 'DOGE',
150751
+ 'Stellar': 'XLM',
150752
+ 'Ethereum': 'ERC20',
150753
+ 'Arbitrum One': 'Arbitrum',
150754
+ 'Polygon': 'MATIC',
150755
+ 'Arbitrum Nova': 'Arbitrum',
150756
+ 'Optimism': 'Optimism',
150757
+ 'zkSync Era': 'zkSync',
150758
+ 'Ethereum Classic': 'ETC',
150759
+ 'Zcash': 'ZEC',
150760
+ 'Monero': 'XMR',
150761
+ 'Tron': 'TRC20',
150762
+ 'Solana': 'SOL',
150763
+ 'EOS': 'EOS',
150764
+ 'Bitcoin Cash': 'BCH',
150765
+ 'Cardano': 'ADA',
150766
+ 'Qtum': 'QTUM',
150767
+ 'Tezos': 'XTZ',
150768
+ 'Cosmos': 'ATOM',
150769
+ 'Nano': 'NANO',
150770
+ 'Siacoin': 'SC',
150771
+ 'Lisk': 'LSK',
150772
+ 'Waves': 'WAVES',
150773
+ 'ICON': 'ICX',
150774
+ 'Algorand': 'ALGO',
150775
+ 'Polygon - USDC.e': 'MATIC',
150776
+ 'Arbitrum One - USDC.e': 'Arbitrum',
150777
+ 'Polkadot': 'DOT',
150778
+ 'Kava': 'KAVA',
150779
+ 'Filecoin': 'FIL',
150780
+ 'Kusama': 'KSM',
150781
+ 'Flow': 'FLOW',
150782
+ 'Energy Web': 'EW',
150783
+ 'Mina': 'MINA',
150784
+ 'Centrifuge': 'CFG',
150785
+ 'Karura': 'KAR',
150786
+ 'Moonriver': 'MOVR',
150787
+ 'Shiden': 'SDN',
150788
+ 'Khala': 'PHA',
150789
+ 'Bifrost Kusama': 'BNC',
150790
+ 'Songbird': 'SGB',
150791
+ 'Terra classic': 'LUNC',
150792
+ 'KILT': 'KILT',
150793
+ 'Basilisk': 'BSX',
150794
+ 'Flare': 'FLR',
150795
+ 'Avalanche C-Chain': 'AVAX',
150796
+ 'Kintsugi': 'KINT',
150797
+ 'Altair': 'AIR',
150798
+ 'Moonbeam': 'GLMR',
150799
+ 'Acala': 'ACA',
150800
+ 'Astar': 'ASTR',
150801
+ 'Akash': 'AKT',
150802
+ 'Robonomics': 'XRT',
150803
+ 'Fantom': 'FTM',
150804
+ 'Elrond': 'EGLD',
150805
+ 'THORchain': 'RUNE',
150806
+ 'Secret': 'SCRT',
150807
+ 'Near': 'NEAR',
150808
+ 'Internet Computer Protocol': 'ICP',
150809
+ 'Picasso': 'PICA',
150810
+ 'Crust Shadow': 'CSM',
150811
+ 'Integritee': 'TEER',
150812
+ 'Parallel Finance': 'PARA',
150813
+ 'HydraDX': 'HDX',
150814
+ 'Interlay': 'INTR',
150815
+ 'Fetch.ai': 'FET',
150816
+ 'NYM': 'NYM',
150817
+ 'Terra 2.0': 'LUNA2',
150818
+ 'Juno': 'JUNO',
150819
+ 'Nodle': 'NODL',
150820
+ 'Stacks': 'STX',
150821
+ 'Ethereum PoW': 'ETHW',
150822
+ 'Aptos': 'APT',
150823
+ 'Sui': 'SUI',
150824
+ 'Genshiro': 'GENS',
150825
+ 'Aventus': 'AVT',
150826
+ 'Sei': 'SEI',
150827
+ 'OriginTrail': 'OTP',
150828
+ 'Celestia': 'TIA',
150829
+ },
150651
150830
  },
150652
150831
  'precisionMode': _base_functions_number_js__WEBPACK_IMPORTED_MODULE_1__/* .TICK_SIZE */ .sh,
150653
150832
  'exceptions': {
@@ -152394,6 +152573,10 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
152394
152573
  };
152395
152574
  return this.safeString(statuses, status, status);
152396
152575
  }
152576
+ parseNetwork(network) {
152577
+ const withdrawMethods = this.safeValue(this.options, 'withdrawMethods', {});
152578
+ return this.safeString(withdrawMethods, network, network);
152579
+ }
152397
152580
  parseTransaction(transaction, currency = undefined) {
152398
152581
  //
152399
152582
  // fetchDeposits
@@ -152444,6 +152627,8 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
152444
152627
  // "fee": "0.0050000000",
152445
152628
  // "time": 1530481750,
152446
152629
  // "status": "Success"
152630
+ // "key":"Huobi wallet",
152631
+ // "network":"Tron"
152447
152632
  // status-prop: 'on-hold' // this field might not be present in some cases
152448
152633
  // }
152449
152634
  //
@@ -152480,7 +152665,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
152480
152665
  'id': id,
152481
152666
  'currency': code,
152482
152667
  'amount': amount,
152483
- 'network': undefined,
152668
+ 'network': this.parseNetwork(this.safeString(transaction, 'network')),
152484
152669
  'address': address,
152485
152670
  'addressTo': undefined,
152486
152671
  'addressFrom': undefined,
@@ -152584,19 +152769,28 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
152584
152769
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
152585
152770
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
152586
152771
  * @param {object} [params] extra parameters specific to the exchange API endpoint
152772
+ * @param {object} [params.end] End timestamp, withdrawals created strictly after will be not be included in the response
152773
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times
152587
152774
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
152588
- */
152589
- // https://www.kraken.com/en-us/help/api#withdraw-status
152590
- if (code === undefined) {
152591
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchWithdrawals() requires a currency code argument');
152592
- }
152775
+ */
152593
152776
  await this.loadMarkets();
152594
- const currency = this.currency(code);
152595
- const request = {
152596
- 'asset': currency['id'],
152597
- };
152777
+ let paginate = false;
152778
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
152779
+ if (paginate) {
152780
+ params['cursor'] = true;
152781
+ return await this.fetchPaginatedCallCursor('fetchWithdrawals', code, since, limit, params, 'next_cursor', 'cursor');
152782
+ }
152783
+ const request = {};
152784
+ if (code !== undefined) {
152785
+ const currency = this.currency(code);
152786
+ request['asset'] = currency['id'];
152787
+ }
152788
+ if (since !== undefined) {
152789
+ request['since'] = since.toString();
152790
+ }
152598
152791
  const response = await this.privatePostWithdrawStatus(this.extend(request, params));
152599
152792
  //
152793
+ // with no pagination
152600
152794
  // { error: [],
152601
152795
  // "result": [ { "method": "Ether",
152602
152796
  // "aclass": "currency",
@@ -152608,8 +152802,51 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
152608
152802
  // "fee": "0.0050000000",
152609
152803
  // "time": 1530481750,
152610
152804
  // "status": "Success" } ] }
152805
+ // with pagination
152806
+ // {
152807
+ // "error":[],
152808
+ // "result":{
152809
+ // "withdrawals":[
152810
+ // {
152811
+ // "method":"Tether USD (TRC20)",
152812
+ // "aclass":"currency",
152813
+ // "asset":"USDT",
152814
+ // "refid":"BSNFZU2-MEFN4G-J3NEZV",
152815
+ // "txid":"1c7a642fb7387bbc2c6a2c509fd1ae146937f4cf793b4079a4f0715e3a02615a",
152816
+ // "info":"TQmdxSuC16EhFg8FZWtYgrfFRosoRF7bCp",
152817
+ // "amount":"1996.50000000",
152818
+ // "fee":"2.50000000",
152819
+ // "time":1669126657,
152820
+ // "status":"Success",
152821
+ // "key":"poloniex",
152822
+ // "network":"Tron"
152823
+ // },
152824
+ // ...
152825
+ // ],
152826
+ // "next_cursor":"HgAAAAAAAABGVFRSd3k1LVF4Y0JQY05Gd0xRY0NxenFndHpybkwBAQH2AwEBAAAAAQAAAAAAAAABAAAAAAAZAAAAAAAAAA=="
152827
+ // }
152828
+ // }
152611
152829
  //
152612
- return this.parseTransactionsByType('withdrawal', response['result'], code, since, limit);
152830
+ let rawWithdrawals = undefined;
152831
+ const result = this.safeValue(response, 'result');
152832
+ if (!Array.isArray(result)) {
152833
+ rawWithdrawals = this.addPaginationCursorToResult(result);
152834
+ }
152835
+ else {
152836
+ rawWithdrawals = result;
152837
+ }
152838
+ return this.parseTransactionsByType('withdrawal', rawWithdrawals, code, since, limit);
152839
+ }
152840
+ addPaginationCursorToResult(result) {
152841
+ const cursor = this.safeString(result, 'next_cursor');
152842
+ const data = this.safeValue(result, 'withdrawals');
152843
+ const dataLength = data.length;
152844
+ if (cursor !== undefined && dataLength > 0) {
152845
+ const last = data[dataLength - 1];
152846
+ last['next_cursor'] = cursor;
152847
+ data[dataLength - 1] = last;
152848
+ }
152849
+ return data;
152613
152850
  }
152614
152851
  async createDepositAddress(code, params = {}) {
152615
152852
  /**
@@ -199698,32 +199935,34 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
199698
199935
  let withdrawAvailable = this.safeValue(result[code], 'withdraw');
199699
199936
  withdrawAvailable = (withdrawEnabled) ? withdrawEnabled : withdrawAvailable;
199700
199937
  const networks = this.safeValue(result[code], 'networks', {});
199701
- networks[networkCode] = {
199702
- 'info': currency,
199703
- 'id': networkId,
199704
- 'network': networkCode,
199705
- 'currencyId': id,
199706
- 'numericId': numericId,
199707
- 'deposit': depositEnabled,
199708
- 'withdraw': withdrawEnabled,
199709
- 'active': active,
199710
- 'fee': this.parseNumber(feeString),
199711
- 'precision': undefined,
199712
- 'limits': {
199713
- 'amount': {
199714
- 'min': undefined,
199715
- 'max': undefined,
199716
- },
199717
- 'withdraw': {
199718
- 'min': undefined,
199719
- 'max': undefined,
199720
- },
199721
- 'deposit': {
199722
- 'min': undefined,
199723
- 'max': undefined,
199938
+ if (networkCode !== undefined) {
199939
+ networks[networkCode] = {
199940
+ 'info': currency,
199941
+ 'id': networkId,
199942
+ 'network': networkCode,
199943
+ 'currencyId': id,
199944
+ 'numericId': numericId,
199945
+ 'deposit': depositEnabled,
199946
+ 'withdraw': withdrawEnabled,
199947
+ 'active': active,
199948
+ 'fee': this.parseNumber(feeString),
199949
+ 'precision': undefined,
199950
+ 'limits': {
199951
+ 'amount': {
199952
+ 'min': undefined,
199953
+ 'max': undefined,
199954
+ },
199955
+ 'withdraw': {
199956
+ 'min': undefined,
199957
+ 'max': undefined,
199958
+ },
199959
+ 'deposit': {
199960
+ 'min': undefined,
199961
+ 'max': undefined,
199962
+ },
199724
199963
  },
199725
- },
199726
- };
199964
+ };
199965
+ }
199727
199966
  result[code]['networks'] = networks;
199728
199967
  const info = this.safeValue(result[code], 'info', []);
199729
199968
  const rawInfo = {};
@@ -204830,6 +205069,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
204830
205069
  'watchOrderBook': true,
204831
205070
  'watchOrderBookForSymbols': true,
204832
205071
  'watchOrders': true,
205072
+ 'watchOrdersForSymbols': true,
204833
205073
  'watchPositions': true,
204834
205074
  'watchTicker': true,
204835
205075
  'watchTickers': true,
@@ -206869,6 +207109,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
206869
207109
  /**
206870
207110
  * @method
206871
207111
  * @name binance#watchOrders
207112
+ * @see https://binance-docs.github.io/apidocs/spot/en/#payload-order-update
206872
207113
  * @description watches information on multiple orders made by the user
206873
207114
  * @param {string} symbol unified market symbol of the market orders were made in
206874
207115
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -206882,7 +207123,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
206882
207123
  if (symbol !== undefined) {
206883
207124
  market = this.market(symbol);
206884
207125
  symbol = market['symbol'];
206885
- messageHash += ':' + symbol;
207126
+ messageHash += '::' + symbol;
206886
207127
  }
206887
207128
  let type = undefined;
206888
207129
  [type, params] = this.handleMarketTypeAndParams('watchOrders', market, params);
@@ -206905,11 +207146,63 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
206905
207146
  this.setBalanceCache(client, type);
206906
207147
  this.setPositionsCache(client, type);
206907
207148
  const message = undefined;
206908
- const orders = await this.watch(url, messageHash, message, type);
207149
+ const newOrder = await this.watch(url, messageHash, message, type);
206909
207150
  if (this.newUpdates) {
206910
- limit = orders.getLimit(symbol, limit);
207151
+ return newOrder;
206911
207152
  }
206912
- return this.filterBySymbolSinceLimit(orders, symbol, since, limit, true);
207153
+ return this.filterBySymbolSinceLimit(this.orders, symbol, since, limit, true);
207154
+ }
207155
+ async watchOrdersForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
207156
+ /**
207157
+ * @method
207158
+ * @name binance#watchOrdersForSymbols
207159
+ * @see https://binance-docs.github.io/apidocs/spot/en/#payload-order-update
207160
+ * @description watches information on multiple orders made by the user
207161
+ * @param {string[]} symbols unified symbol of the market to fetch orders for
207162
+ * @param {int} [since] the earliest time in ms to fetch orders for
207163
+ * @param {int} [limit] the maximum number of trade structures to retrieve
207164
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
207165
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
207166
+ */
207167
+ let marginMode = undefined;
207168
+ [marginMode, params] = this.handleMarginModeAndParams('authenticate', params);
207169
+ const isIsolatedMargin = (marginMode === 'isolated');
207170
+ if (isIsolatedMargin) {
207171
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchOrdersForSymbols does not support isolated margin markets, use watchOrders instead');
207172
+ }
207173
+ await this.loadMarkets();
207174
+ let type = undefined;
207175
+ const market = this.getMarketFromSymbols(symbols);
207176
+ [type, params] = this.handleMarketTypeAndParams('watchOrdersForSymbols', market, params);
207177
+ symbols = this.marketSymbols(symbols, type, true, true, true);
207178
+ let messageHash = 'orders';
207179
+ if (symbols !== undefined) {
207180
+ messageHash = messageHash + '::' + symbols.join(',');
207181
+ }
207182
+ let subType = undefined;
207183
+ [subType, params] = this.handleSubTypeAndParams('watchOrdersForSymbols', market, params);
207184
+ if (this.isLinear(type, subType)) {
207185
+ type = 'future';
207186
+ }
207187
+ else if (this.isInverse(type, subType)) {
207188
+ type = 'delivery';
207189
+ }
207190
+ params = this.extend(params, { 'type': type });
207191
+ await this.authenticate(params);
207192
+ let urlType = type;
207193
+ if (type === 'margin') {
207194
+ urlType = 'spot'; // spot-margin shares the same stream as regular spot
207195
+ }
207196
+ const url = this.urls['api']['ws'][urlType] + '/' + this.options[type]['listenKey'];
207197
+ const client = this.client(url);
207198
+ this.setBalanceCache(client, type);
207199
+ this.setPositionsCache(client, type);
207200
+ const message = undefined;
207201
+ const newOrders = await this.watch(url, messageHash, message, type);
207202
+ if (this.newUpdates) {
207203
+ return newOrders;
207204
+ }
207205
+ return this.filterBySymbolsSinceLimit(this.orders, symbols, since, limit, true);
206913
207206
  }
206914
207207
  parseWsOrder(order, market = undefined) {
206915
207208
  //
@@ -207540,7 +207833,6 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
207540
207833
  }
207541
207834
  }
207542
207835
  handleOrder(client, message) {
207543
- const messageHash = 'orders';
207544
207836
  const parsed = this.parseWsOrder(message);
207545
207837
  const symbol = this.safeString(parsed, 'symbol');
207546
207838
  const orderId = this.safeString(parsed, 'id');
@@ -207569,9 +207861,8 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
207569
207861
  }
207570
207862
  }
207571
207863
  cachedOrders.append(parsed);
207572
- client.resolve(this.orders, messageHash);
207573
- const messageHashSymbol = messageHash + ':' + symbol;
207574
- client.resolve(this.orders, messageHashSymbol);
207864
+ this.resolvePromiseIfMessagehashMatches(client, 'orders::', symbol, parsed);
207865
+ client.resolve(parsed, 'orders');
207575
207866
  }
207576
207867
  }
207577
207868
  handleAcountUpdate(client, message) {
@@ -223884,8 +224175,8 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
223884
224175
  * @param {object} [params] extra parameters specific to the exchange API endpoint
223885
224176
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
223886
224177
  */
223887
- symbols = this.marketSymbols(symbols, undefined, false);
223888
224178
  await this.loadMarkets();
224179
+ symbols = this.marketSymbols(symbols, undefined, false);
223889
224180
  const name = 'user';
223890
224181
  const messageHash = 'multipleOrders::';
223891
224182
  const authentication = this.authenticate();
@@ -287922,7 +288213,7 @@ SOFTWARE.
287922
288213
 
287923
288214
  //-----------------------------------------------------------------------------
287924
288215
  // this is updated by vss.js when building
287925
- const version = '4.1.74';
288216
+ const version = '4.1.75';
287926
288217
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
287927
288218
  //-----------------------------------------------------------------------------
287928
288219