ccxt 4.2.40 → 4.2.42

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 (44) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +261 -58
  3. package/dist/ccxt.browser.min.js +2 -2
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/binance.js +189 -22
  6. package/dist/cjs/src/bingx.js +22 -3
  7. package/dist/cjs/src/bitforex.js +2 -2
  8. package/dist/cjs/src/bitget.js +9 -2
  9. package/dist/cjs/src/bitrue.js +7 -15
  10. package/dist/cjs/src/currencycom.js +1 -1
  11. package/dist/cjs/src/digifinex.js +4 -1
  12. package/dist/cjs/src/gate.js +4 -1
  13. package/dist/cjs/src/gemini.js +4 -1
  14. package/dist/cjs/src/htx.js +1 -1
  15. package/dist/cjs/src/mexc.js +5 -2
  16. package/dist/cjs/src/phemex.js +4 -1
  17. package/dist/cjs/src/poloniex.js +4 -1
  18. package/dist/cjs/src/pro/cex.js +1 -1
  19. package/dist/cjs/src/pro/gemini.js +1 -1
  20. package/dist/cjs/src/pro/hitbtc.js +1 -1
  21. package/dist/cjs/src/pro/poloniex.js +1 -1
  22. package/js/ccxt.d.ts +1 -1
  23. package/js/ccxt.js +1 -1
  24. package/js/src/base/Exchange.d.ts +20 -20
  25. package/js/src/binance.js +189 -22
  26. package/js/src/bingx.d.ts +1 -0
  27. package/js/src/bingx.js +22 -3
  28. package/js/src/bitforex.js +2 -2
  29. package/js/src/bitget.d.ts +2 -2
  30. package/js/src/bitget.js +9 -2
  31. package/js/src/bitrue.js +7 -15
  32. package/js/src/currencycom.js +1 -1
  33. package/js/src/digifinex.js +4 -1
  34. package/js/src/gate.js +4 -1
  35. package/js/src/gemini.js +4 -1
  36. package/js/src/htx.js +1 -1
  37. package/js/src/mexc.js +5 -2
  38. package/js/src/phemex.js +4 -1
  39. package/js/src/poloniex.js +4 -1
  40. package/js/src/pro/cex.js +1 -1
  41. package/js/src/pro/gemini.js +1 -1
  42. package/js/src/pro/hitbtc.js +1 -1
  43. package/js/src/pro/poloniex.js +1 -1
  44. package/package.json +1 -1
package/README.md CHANGED
@@ -210,13 +210,13 @@ console.log(version, Object.keys(exchanges));
210
210
 
211
211
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
212
212
 
213
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.40/dist/ccxt.browser.js
214
- * unpkg: https://unpkg.com/ccxt@4.2.40/dist/ccxt.browser.js
213
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.42/dist/ccxt.browser.js
214
+ * unpkg: https://unpkg.com/ccxt@4.2.42/dist/ccxt.browser.js
215
215
 
216
216
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
217
217
 
218
218
  ```HTML
219
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.40/dist/ccxt.browser.js"></script>
219
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.42/dist/ccxt.browser.js"></script>
220
220
  ```
221
221
 
222
222
  Creates a global `ccxt` object:
@@ -22325,20 +22325,73 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
22325
22325
  // "time": 1676366446072
22326
22326
  // }
22327
22327
  //
22328
+ // fetchMyTrades: linear portfolio margin
22329
+ //
22330
+ // {
22331
+ // "symbol": "BTCUSDT",
22332
+ // "id": 4575108247,
22333
+ // "orderId": 261942655610,
22334
+ // "side": "SELL",
22335
+ // "price": "47263.40",
22336
+ // "qty": "0.010",
22337
+ // "realizedPnl": "27.38400000",
22338
+ // "marginAsset": "USDT",
22339
+ // "quoteQty": "472.63",
22340
+ // "commission": "0.18905360",
22341
+ // "commissionAsset": "USDT",
22342
+ // "time": 1707530039409,
22343
+ // "buyer": false,
22344
+ // "maker": false,
22345
+ // "positionSide": "LONG"
22346
+ // }
22347
+ //
22348
+ // fetchMyTrades: inverse portfolio margin
22349
+ //
22350
+ // {
22351
+ // "symbol": "ETHUSD_PERP",
22352
+ // "id": 701907838,
22353
+ // "orderId": 71548909034,
22354
+ // "pair": "ETHUSD",
22355
+ // "side": "SELL",
22356
+ // "price": "2498.15",
22357
+ // "qty": "1",
22358
+ // "realizedPnl": "0.00012517",
22359
+ // "marginAsset": "ETH",
22360
+ // "baseQty": "0.00400296",
22361
+ // "commission": "0.00000160",
22362
+ // "commissionAsset": "ETH",
22363
+ // "time": 1707530317519,
22364
+ // "positionSide": "LONG",
22365
+ // "buyer": false,
22366
+ // "maker": false
22367
+ // }
22368
+ //
22369
+ // fetchMyTrades: spot margin portfolio margin
22370
+ //
22371
+ // {
22372
+ // "symbol": "ADAUSDT",
22373
+ // "id": 470227543,
22374
+ // "orderId": 4421170947,
22375
+ // "price": "0.53880000",
22376
+ // "qty": "10.00000000",
22377
+ // "quoteQty": "5.38800000",
22378
+ // "commission": "0.00538800",
22379
+ // "commissionAsset": "USDT",
22380
+ // "time": 1707545780522,
22381
+ // "isBuyer": false,
22382
+ // "isMaker": false,
22383
+ // "isBestMatch": true
22384
+ // }
22385
+ //
22328
22386
  const timestamp = this.safeInteger2(trade, 'T', 'time');
22329
- const price = this.safeString2(trade, 'p', 'price');
22330
22387
  let amount = this.safeString2(trade, 'q', 'qty');
22331
22388
  amount = this.safeString(trade, 'quantity', amount);
22332
- const cost = this.safeString2(trade, 'quoteQty', 'baseQty'); // inverse futures
22333
22389
  const marketId = this.safeString(trade, 'symbol');
22334
- const isSpotTrade = ('isIsolated' in trade) || ('M' in trade) || ('orderListId' in trade);
22390
+ const isSpotTrade = ('isIsolated' in trade) || ('M' in trade) || ('orderListId' in trade) || ('isMaker' in trade);
22335
22391
  const marketType = isSpotTrade ? 'spot' : 'contract';
22336
22392
  market = this.safeMarket(marketId, market, undefined, marketType);
22337
22393
  const symbol = market['symbol'];
22338
- let id = this.safeString2(trade, 't', 'a');
22339
- id = this.safeString2(trade, 'tradeId', 'id', id);
22340
22394
  let side = undefined;
22341
- const orderId = this.safeString(trade, 'orderId');
22342
22395
  const buyerMaker = this.safeValue2(trade, 'm', 'isBuyerMaker');
22343
22396
  let takerOrMaker = undefined;
22344
22397
  if (buyerMaker !== undefined) {
@@ -22388,14 +22441,14 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
22388
22441
  'timestamp': timestamp,
22389
22442
  'datetime': this.iso8601(timestamp),
22390
22443
  'symbol': symbol,
22391
- 'id': id,
22392
- 'order': orderId,
22444
+ 'id': this.safeStringN(trade, ['t', 'a', 'tradeId', 'id']),
22445
+ 'order': this.safeString(trade, 'orderId'),
22393
22446
  'type': this.safeStringLower(trade, 'type'),
22394
22447
  'side': side,
22395
22448
  'takerOrMaker': takerOrMaker,
22396
- 'price': price,
22449
+ 'price': this.safeString2(trade, 'p', 'price'),
22397
22450
  'amount': amount,
22398
- 'cost': cost,
22451
+ 'cost': this.safeString2(trade, 'quoteQty', 'baseQty'),
22399
22452
  'fee': fee,
22400
22453
  }, market);
22401
22454
  }
@@ -24484,12 +24537,16 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24484
24537
  * @see https://binance-docs.github.io/apidocs/futures/en/#account-trade-list-user_data
24485
24538
  * @see https://binance-docs.github.io/apidocs/delivery/en/#account-trade-list-user_data
24486
24539
  * @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-trade-list-user_data
24540
+ * @see https://binance-docs.github.io/apidocs/pm/en/#margin-account-trade-list-user_data
24541
+ * @see https://binance-docs.github.io/apidocs/pm/en/#um-account-trade-list-user_data
24542
+ * @see https://binance-docs.github.io/apidocs/pm/en/#cm-account-trade-list-user_data
24487
24543
  * @param {string} symbol unified market symbol
24488
24544
  * @param {int} [since] the earliest time in ms to fetch trades for
24489
24545
  * @param {int} [limit] the maximum number of trades structures to retrieve
24490
24546
  * @param {object} [params] extra parameters specific to the exchange API endpoint
24491
- * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
24547
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
24492
24548
  * @param {int} [params.until] the latest time in ms to fetch entries for
24549
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch trades for a portfolio margin account
24493
24550
  * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
24494
24551
  */
24495
24552
  await this.loadMarkets();
@@ -24543,8 +24600,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24543
24600
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
24544
24601
  }
24545
24602
  [marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
24603
+ let isPortfolioMargin = undefined;
24604
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchMyTrades', 'papi', 'portfolioMargin', false);
24546
24605
  if (type === 'spot' || type === 'margin') {
24547
- if ((type === 'margin') || (marginMode !== undefined)) {
24606
+ if (isPortfolioMargin) {
24607
+ response = await this.papiGetMarginMyTrades(this.extend(request, params));
24608
+ }
24609
+ else if ((type === 'margin') || (marginMode !== undefined)) {
24548
24610
  if (marginMode === 'isolated') {
24549
24611
  request['isIsolated'] = true;
24550
24612
  }
@@ -24555,10 +24617,20 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24555
24617
  }
24556
24618
  }
24557
24619
  else if (market['linear']) {
24558
- response = await this.fapiPrivateGetUserTrades(this.extend(request, params));
24620
+ if (isPortfolioMargin) {
24621
+ response = await this.papiGetUmUserTrades(this.extend(request, params));
24622
+ }
24623
+ else {
24624
+ response = await this.fapiPrivateGetUserTrades(this.extend(request, params));
24625
+ }
24559
24626
  }
24560
24627
  else if (market['inverse']) {
24561
- response = await this.dapiPrivateGetUserTrades(this.extend(request, params));
24628
+ if (isPortfolioMargin) {
24629
+ response = await this.papiGetCmUserTrades(this.extend(request, params));
24630
+ }
24631
+ else {
24632
+ response = await this.dapiPrivateGetUserTrades(this.extend(request, params));
24633
+ }
24562
24634
  }
24563
24635
  }
24564
24636
  //
@@ -24626,6 +24698,70 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
24626
24698
  // }
24627
24699
  // ]
24628
24700
  //
24701
+ // linear portfolio margin
24702
+ //
24703
+ // [
24704
+ // {
24705
+ // "symbol": "BTCUSDT",
24706
+ // "id": 4575108247,
24707
+ // "orderId": 261942655610,
24708
+ // "side": "SELL",
24709
+ // "price": "47263.40",
24710
+ // "qty": "0.010",
24711
+ // "realizedPnl": "27.38400000",
24712
+ // "marginAsset": "USDT",
24713
+ // "quoteQty": "472.63",
24714
+ // "commission": "0.18905360",
24715
+ // "commissionAsset": "USDT",
24716
+ // "time": 1707530039409,
24717
+ // "buyer": false,
24718
+ // "maker": false,
24719
+ // "positionSide": "LONG"
24720
+ // }
24721
+ // ]
24722
+ //
24723
+ // inverse portfolio margin
24724
+ //
24725
+ // [
24726
+ // {
24727
+ // "symbol": "ETHUSD_PERP",
24728
+ // "id": 701907838,
24729
+ // "orderId": 71548909034,
24730
+ // "pair": "ETHUSD",
24731
+ // "side": "SELL",
24732
+ // "price": "2498.15",
24733
+ // "qty": "1",
24734
+ // "realizedPnl": "0.00012517",
24735
+ // "marginAsset": "ETH",
24736
+ // "baseQty": "0.00400296",
24737
+ // "commission": "0.00000160",
24738
+ // "commissionAsset": "ETH",
24739
+ // "time": 1707530317519,
24740
+ // "positionSide": "LONG",
24741
+ // "buyer": false,
24742
+ // "maker": false
24743
+ // }
24744
+ // ]
24745
+ //
24746
+ // spot margin portfolio margin
24747
+ //
24748
+ // [
24749
+ // {
24750
+ // "symbol": "ADAUSDT",
24751
+ // "id": 470227543,
24752
+ // "orderId": 4421170947,
24753
+ // "price": "0.53880000",
24754
+ // "qty": "10.00000000",
24755
+ // "quoteQty": "5.38800000",
24756
+ // "commission": "0.00538800",
24757
+ // "commissionAsset": "USDT",
24758
+ // "time": 1707545780522,
24759
+ // "isBuyer": false,
24760
+ // "isMaker": false,
24761
+ // "isBestMatch": true
24762
+ // }
24763
+ // ]
24764
+ //
24629
24765
  return this.parseTrades(response, market, since, limit);
24630
24766
  }
24631
24767
  async fetchMyDustTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -28512,15 +28648,19 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28512
28648
  * @name binance#fetchBorrowInterest
28513
28649
  * @description fetch the interest owed by the user for borrowing currency for margin trading
28514
28650
  * @see https://binance-docs.github.io/apidocs/spot/en/#get-interest-history-user_data
28515
- * @param {string} code unified currency code
28516
- * @param {string} symbol unified market symbol when fetch interest in isolated markets
28651
+ * @see https://binance-docs.github.io/apidocs/pm/en/#get-margin-borrow-loan-interest-history-user_data
28652
+ * @param {string} [code] unified currency code
28653
+ * @param {string} [symbol] unified market symbol when fetch interest in isolated markets
28517
28654
  * @param {int} [since] the earliest time in ms to fetch borrrow interest for
28518
28655
  * @param {int} [limit] the maximum number of structures to retrieve
28519
28656
  * @param {object} [params] extra parameters specific to the exchange API endpoint
28657
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the borrow interest in a portfolio margin account
28520
28658
  * @returns {object[]} a list of [borrow interest structures]{@link https://docs.ccxt.com/#/?id=borrow-interest-structure}
28521
28659
  */
28522
28660
  await this.loadMarkets();
28523
- const request = {};
28661
+ let isPortfolioMargin = undefined;
28662
+ [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchBorrowInterest', 'papi', 'portfolioMargin', false);
28663
+ let request = {};
28524
28664
  let market = undefined;
28525
28665
  if (code !== undefined) {
28526
28666
  const currency = this.currency(code);
@@ -28532,11 +28672,20 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28532
28672
  if (limit !== undefined) {
28533
28673
  request['size'] = limit;
28534
28674
  }
28535
- if (symbol !== undefined) { // Isolated
28536
- market = this.market(symbol);
28537
- request['isolatedSymbol'] = market['id'];
28675
+ [request, params] = this.handleUntilOption('endTime', request, params);
28676
+ let response = undefined;
28677
+ if (isPortfolioMargin) {
28678
+ response = await this.papiGetMarginMarginInterestHistory(this.extend(request, params));
28679
+ }
28680
+ else {
28681
+ if (symbol !== undefined) {
28682
+ market = this.market(symbol);
28683
+ request['isolatedSymbol'] = market['id'];
28684
+ }
28685
+ response = await this.sapiGetMarginInterestHistory(this.extend(request, params));
28538
28686
  }
28539
- const response = await this.sapiGetMarginInterestHistory(this.extend(request, params));
28687
+ //
28688
+ // spot margin
28540
28689
  //
28541
28690
  // {
28542
28691
  // "rows":[
@@ -28553,13 +28702,31 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
28553
28702
  // "total": 1
28554
28703
  // }
28555
28704
  //
28705
+ // spot margin portfolio margin
28706
+ //
28707
+ // {
28708
+ // "total": 49,
28709
+ // "rows": [
28710
+ // {
28711
+ // "txId": 1656187724899910076,
28712
+ // "interestAccuredTime": 1707541200000,
28713
+ // "asset": "USDT",
28714
+ // "rawAsset": "USDT",
28715
+ // "principal": "0.00011146",
28716
+ // "interest": "0.00000001",
28717
+ // "interestRate": "0.00089489",
28718
+ // "type": "PERIODIC"
28719
+ // },
28720
+ // ]
28721
+ // }
28722
+ //
28556
28723
  const rows = this.safeList(response, 'rows');
28557
28724
  const interest = this.parseBorrowInterests(rows, market);
28558
28725
  return this.filterByCurrencySinceLimit(interest, code, since, limit);
28559
28726
  }
28560
28727
  parseBorrowInterest(info, market = undefined) {
28561
28728
  const symbol = this.safeString(info, 'isolatedSymbol');
28562
- const timestamp = this.safeNumber(info, 'interestAccuredTime');
28729
+ const timestamp = this.safeInteger(info, 'interestAccuredTime');
28563
28730
  const marginMode = (symbol === undefined) ? 'cross' : 'isolated';
28564
28731
  return {
28565
28732
  'account': (symbol === undefined) ? 'cross' : symbol,
@@ -31341,6 +31508,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31341
31508
  if (timeInForce === 'IOC') {
31342
31509
  request['timeInForce'] = 'IOC';
31343
31510
  }
31511
+ const triggerPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
31344
31512
  if (isSpot) {
31345
31513
  [postOnly, params] = this.handlePostOnly(isMarketOrder, timeInForce === 'POC', params);
31346
31514
  if (postOnly || (timeInForce === 'POC')) {
@@ -31352,7 +31520,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31352
31520
  request['quoteOrderQty'] = this.parseToNumeric(this.costToPrecision(symbol, cost));
31353
31521
  }
31354
31522
  else {
31355
- if (market['spot'] && isMarketOrder && (price !== undefined)) {
31523
+ if (isMarketOrder && (price !== undefined)) {
31356
31524
  // keep the legacy behavior, to avoid breaking the old spot-market-buying code
31357
31525
  const calculatedCost = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(this.numberToString(amount), this.numberToString(price));
31358
31526
  request['quoteOrderQty'] = this.parseToNumeric(calculatedCost);
@@ -31364,6 +31532,18 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31364
31532
  if (!isMarketOrder) {
31365
31533
  request['price'] = this.parseToNumeric(this.priceToPrecision(symbol, price));
31366
31534
  }
31535
+ if (triggerPrice !== undefined) {
31536
+ if (isMarketOrder && this.safeString(request, 'quoteOrderQty') === undefined) {
31537
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' createOrder() requires the cost parameter (or the amount + price) for placing spot market-buy trigger orders');
31538
+ }
31539
+ request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
31540
+ if (type === 'LIMIT') {
31541
+ request['type'] = 'TRIGGER_LIMIT';
31542
+ }
31543
+ else if (type === 'MARKET') {
31544
+ request['type'] = 'TRIGGER_MARKET';
31545
+ }
31546
+ }
31367
31547
  }
31368
31548
  else {
31369
31549
  [postOnly, params] = this.handlePostOnly(isMarketOrder, timeInForce === 'PostOnly', params);
@@ -31376,7 +31556,6 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31376
31556
  else if (timeInForce === 'FOK') {
31377
31557
  request['timeInForce'] = 'FOK';
31378
31558
  }
31379
- const triggerPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
31380
31559
  const stopLossPrice = this.safeString(params, 'stopLossPrice');
31381
31560
  const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
31382
31561
  const trailingAmount = this.safeString(params, 'trailingAmount');
@@ -31676,6 +31855,13 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31676
31855
  };
31677
31856
  return this.safeString(sides, side, side);
31678
31857
  }
31858
+ parseOrderType(type) {
31859
+ const types = {
31860
+ 'trigger_market': 'market',
31861
+ 'trigger_limit': 'limit',
31862
+ };
31863
+ return this.safeString(types, type, type);
31864
+ }
31679
31865
  parseOrder(order, market = undefined) {
31680
31866
  //
31681
31867
  // spot
@@ -31940,7 +32126,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
31940
32126
  'datetime': this.iso8601(timestamp),
31941
32127
  'lastTradeTimestamp': lastTradeTimestamp,
31942
32128
  'lastUpdateTimestamp': this.safeInteger(order, 'updateTime'),
31943
- 'type': this.safeStringLower2(order, 'type', 'o'),
32129
+ 'type': this.parseOrderType(this.safeStringLower2(order, 'type', 'o')),
31944
32130
  'timeInForce': this.safeString(order, 'timeInForce'),
31945
32131
  'postOnly': undefined,
31946
32132
  'side': this.parseOrderSide(side),
@@ -44023,8 +44209,8 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
44023
44209
  }
44024
44210
  parseOrder(order, market = undefined) {
44025
44211
  const id = this.safeString(order, 'orderId');
44026
- const timestamp = this.safeNumber(order, 'createTime');
44027
- const lastTradeTimestamp = this.safeNumber(order, 'lastTime');
44212
+ const timestamp = this.safeInteger(order, 'createTime');
44213
+ const lastTradeTimestamp = this.safeInteger(order, 'lastTime');
44028
44214
  const symbol = market['symbol'];
44029
44215
  const sideId = this.safeInteger(order, 'tradeType');
44030
44216
  const side = this.parseSide(sideId);
@@ -46693,7 +46879,10 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
46693
46879
  await this.loadMarkets();
46694
46880
  const networkCode = this.safeString2(params, 'chain', 'network');
46695
46881
  params = this.omit(params, 'network');
46696
- const networkId = this.networkCodeToId(networkCode, code);
46882
+ let networkId = undefined;
46883
+ if (networkCode !== undefined) {
46884
+ networkId = this.networkCodeToId(networkCode, code);
46885
+ }
46697
46886
  const currency = this.currency(code);
46698
46887
  const request = {
46699
46888
  'coin': currency['code'],
@@ -46732,11 +46921,15 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
46732
46921
  const currencyId = this.safeString(depositAddress, 'coin');
46733
46922
  const networkId = this.safeString(depositAddress, 'chain');
46734
46923
  const parsedCurrency = this.safeCurrencyCode(currencyId, currency);
46924
+ let network = undefined;
46925
+ if (networkId !== undefined) {
46926
+ network = this.networkIdToCode(networkId, parsedCurrency);
46927
+ }
46735
46928
  return {
46736
46929
  'currency': parsedCurrency,
46737
46930
  'address': this.safeString(depositAddress, 'address'),
46738
46931
  'tag': this.safeString(depositAddress, 'tag'),
46739
- 'network': this.networkIdToCode(networkId, parsedCurrency),
46932
+ 'network': network,
46740
46933
  'info': depositAddress,
46741
46934
  };
46742
46935
  }
@@ -65631,28 +65824,20 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
65631
65824
  this.checkAddress(address);
65632
65825
  await this.loadMarkets();
65633
65826
  const currency = this.currency(code);
65634
- let chainName = this.safeString2(params, 'network', 'chainName');
65635
- if (chainName === undefined) {
65636
- const networks = this.safeValue(currency, 'networks', {});
65637
- const optionsNetworks = this.safeValue(this.options, 'networks', {});
65638
- let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
65639
- network = this.safeString(optionsNetworks, network, network);
65640
- const networkEntry = this.safeValue(networks, network, {});
65641
- chainName = this.safeString(networkEntry, 'id'); // handle ERC20>ETH alias
65642
- if (chainName === undefined) {
65643
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' withdraw() requires a network parameter or a chainName parameter');
65644
- }
65645
- params = this.omit(params, 'network');
65646
- }
65647
65827
  const request = {
65648
- 'coin': currency['id'].toUpperCase(),
65828
+ 'coin': currency['id'],
65649
65829
  'amount': amount,
65650
65830
  'addressTo': address,
65651
- 'chainName': chainName, // 'ERC20', 'TRC20', 'SOL'
65831
+ // 'chainName': chainName, // 'ERC20', 'TRC20', 'SOL'
65652
65832
  // 'addressMark': '', // mark of address
65653
65833
  // 'addrType': '', // type of address
65654
65834
  // 'tag': tag,
65655
65835
  };
65836
+ let networkCode = undefined;
65837
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
65838
+ if (networkCode !== undefined) {
65839
+ request['chainName'] = this.networkCodeToId(networkCode);
65840
+ }
65656
65841
  if (tag !== undefined) {
65657
65842
  request['tag'] = tag;
65658
65843
  }
@@ -117009,7 +117194,7 @@ class currencycom extends _abstract_currencycom_js__WEBPACK_IMPORTED_MODULE_0__/
117009
117194
  //
117010
117195
  market = this.safeMarket(this.safeString(position, 'symbol'), market);
117011
117196
  const symbol = market['symbol'];
117012
- const timestamp = this.safeNumber(position, 'createdTimestamp');
117197
+ const timestamp = this.safeInteger(position, 'createdTimestamp');
117013
117198
  const quantityRaw = this.safeString(position, 'openQuantity');
117014
117199
  const side = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringGt(quantityRaw, '0') ? 'long' : 'short';
117015
117200
  const quantity = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(quantityRaw);
@@ -124258,7 +124443,10 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
124258
124443
  const minFoundPrecision = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMin(feeString, _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMin(minDepositString, minWithdrawString));
124259
124444
  const precision = this.parseNumber(minFoundPrecision);
124260
124445
  const networkId = this.safeString(currency, 'chain');
124261
- const networkCode = this.networkIdToCode(networkId);
124446
+ let networkCode = undefined;
124447
+ if (networkId !== undefined) {
124448
+ networkCode = this.networkIdToCode(networkId);
124449
+ }
124262
124450
  const network = {
124263
124451
  'info': currency,
124264
124452
  'id': networkId,
@@ -132474,7 +132662,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
132474
132662
  const currency = parts[0];
132475
132663
  const code = this.safeCurrencyCode(currency);
132476
132664
  const networkId = this.safeString(entry, 'chain');
132477
- const networkCode = this.networkIdToCode(networkId, code);
132665
+ let networkCode = undefined;
132666
+ if (networkId !== undefined) {
132667
+ networkCode = this.networkIdToCode(networkId, code);
132668
+ }
132478
132669
  const delisted = this.safeValue(entry, 'delisted');
132479
132670
  const withdrawDisabled = this.safeBool(entry, 'withdraw_disabled', false);
132480
132671
  const depositDisabled = this.safeBool(entry, 'deposit_disabled', false);
@@ -138290,7 +138481,10 @@ class gemini extends _abstract_gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
138290
138481
  const precision = this.parseNumber(this.parsePrecision(this.safeString(currency, 5)));
138291
138482
  const networks = {};
138292
138483
  const networkId = this.safeString(currency, 9);
138293
- const networkCode = this.networkIdToCode(networkId);
138484
+ let networkCode = undefined;
138485
+ if (networkId !== undefined) {
138486
+ networkCode = this.networkIdToCode(networkId);
138487
+ }
138294
138488
  if (networkCode !== undefined) {
138295
138489
  networks[networkCode] = {
138296
138490
  'info': currency,
@@ -152427,7 +152621,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
152427
152621
  const marginMode = (marketId === undefined) ? 'cross' : 'isolated';
152428
152622
  market = this.safeMarket(marketId);
152429
152623
  const symbol = this.safeString(market, 'symbol');
152430
- const timestamp = this.safeNumber(info, 'accrued-at');
152624
+ const timestamp = this.safeInteger(info, 'accrued-at');
152431
152625
  return {
152432
152626
  'account': (marginMode === 'isolated') ? symbol : 'cross',
152433
152627
  'symbol': symbol,
@@ -186900,7 +187094,10 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
186900
187094
  'coin': currency['id'],
186901
187095
  };
186902
187096
  const networkCode = this.safeString(params, 'network');
186903
- const networkId = this.networkCodeToId(networkCode, code);
187097
+ let networkId = undefined;
187098
+ if (networkCode !== undefined) {
187099
+ networkId = this.networkCodeToId(networkCode, code);
187100
+ }
186904
187101
  if (networkId !== undefined) {
186905
187102
  request['network'] = networkId;
186906
187103
  }
@@ -187326,7 +187523,7 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
187326
187523
  const marginType = (openType === '1') ? 'isolated' : 'cross';
187327
187524
  const leverage = this.safeNumber(position, 'leverage');
187328
187525
  const liquidationPrice = this.safeNumber(position, 'liquidatePrice');
187329
- const timestamp = this.safeNumber(position, 'updateTime');
187526
+ const timestamp = this.safeInteger(position, 'updateTime');
187330
187527
  return this.safePosition({
187331
187528
  'info': position,
187332
187529
  'id': undefined,
@@ -212055,7 +212252,10 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
212055
212252
  const currency = this.currency(code);
212056
212253
  let networkCode = undefined;
212057
212254
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
212058
- let networkId = this.networkCodeToId(networkCode);
212255
+ let networkId = undefined;
212256
+ if (networkCode !== undefined) {
212257
+ networkId = this.networkCodeToId(networkCode);
212258
+ }
212059
212259
  const stableCoins = this.safeValue(this.options, 'stableCoins');
212060
212260
  if (networkId === undefined) {
212061
212261
  if (!(this.inArray(code, stableCoins))) {
@@ -212852,7 +213052,10 @@ class poloniex extends _abstract_poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
212852
213052
  const code = this.safeCurrencyCode(id);
212853
213053
  const name = this.safeString(currency, 'name');
212854
213054
  const networkId = this.safeString(currency, 'blockchain');
212855
- const networkCode = this.networkIdToCode(networkId, code);
213055
+ let networkCode = undefined;
213056
+ if (networkId !== undefined) {
213057
+ networkCode = this.networkIdToCode(networkId, code);
213058
+ }
212856
213059
  const delisted = this.safeValue(currency, 'delisted');
212857
213060
  const walletEnabled = this.safeString(currency, 'walletState') === 'ENABLED';
212858
213061
  const depositEnabled = this.safeString(currency, 'walletDepositState') === 'ENABLED';
@@ -234698,7 +234901,7 @@ class cex extends _cex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
234698
234901
  trade = trade.split(':');
234699
234902
  }
234700
234903
  const side = this.safeString(trade, 0);
234701
- const timestamp = this.safeNumber(trade, 1);
234904
+ const timestamp = this.safeInteger(trade, 1);
234702
234905
  const amount = this.safeString(trade, 2);
234703
234906
  const price = this.safeString(trade, 3);
234704
234907
  const id = this.safeString(trade, 4);
@@ -244415,7 +244618,7 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
244415
244618
  // "socket_sequence": 139
244416
244619
  // }
244417
244620
  //
244418
- const timestamp = this.safeNumber(order, 'timestampms');
244621
+ const timestamp = this.safeInteger(order, 'timestampms');
244419
244622
  const status = this.safeString(order, 'type');
244420
244623
  const marketId = this.safeString(order, 'symbol');
244421
244624
  const typeId = this.safeString(order, 'order_type');
@@ -244792,7 +244995,7 @@ class hitbtc extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
244792
244995
  await this.loadMarkets();
244793
244996
  await this.authenticate();
244794
244997
  const url = this.urls['api']['ws']['private'];
244795
- const messageHash = this.nonce();
244998
+ const messageHash = this.nonce().toString();
244796
244999
  const subscribe = {
244797
245000
  'method': name,
244798
245001
  'params': params,
@@ -264411,7 +264614,7 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
264411
264614
  * @returns {object} data from the websocket stream
264412
264615
  */
264413
264616
  const url = this.urls['api']['ws']['private'];
264414
- const messageHash = this.nonce();
264617
+ const messageHash = this.nonce().toString();
264415
264618
  const subscribe = {
264416
264619
  'id': messageHash,
264417
264620
  'event': name,
@@ -305069,7 +305272,7 @@ SOFTWARE.
305069
305272
 
305070
305273
  //-----------------------------------------------------------------------------
305071
305274
  // this is updated by vss.js when building
305072
- const version = '4.2.40';
305275
+ const version = '4.2.42';
305073
305276
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
305074
305277
  //-----------------------------------------------------------------------------
305075
305278