ccxt 4.4.2 → 4.4.4

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 (137) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/base/Exchange.js +2 -2
  5. package/dist/cjs/src/base/functions/misc.js +11 -0
  6. package/dist/cjs/src/base/functions.js +1 -0
  7. package/dist/cjs/src/base/ws/WsClient.js +2 -1
  8. package/dist/cjs/src/binance.js +49 -22
  9. package/dist/cjs/src/bingx.js +1 -0
  10. package/dist/cjs/src/bitfinex2.js +7 -6
  11. package/dist/cjs/src/bitget.js +10 -6
  12. package/dist/cjs/src/bitmart.js +3 -1
  13. package/dist/cjs/src/bitmex.js +11 -10
  14. package/dist/cjs/src/bitso.js +5 -4
  15. package/dist/cjs/src/bitstamp.js +33 -45
  16. package/dist/cjs/src/blofin.js +21 -23
  17. package/dist/cjs/src/bybit.js +22 -20
  18. package/dist/cjs/src/coinbase.js +28 -7
  19. package/dist/cjs/src/coinbaseexchange.js +11 -11
  20. package/dist/cjs/src/coinlist.js +6 -5
  21. package/dist/cjs/src/coinmetro.js +3 -3
  22. package/dist/cjs/src/cryptocom.js +9 -6
  23. package/dist/cjs/src/currencycom.js +6 -6
  24. package/dist/cjs/src/delta.js +5 -5
  25. package/dist/cjs/src/digifinex.js +8 -6
  26. package/dist/cjs/src/gate.js +6 -5
  27. package/dist/cjs/src/hashkey.js +9 -7
  28. package/dist/cjs/src/htx.js +13 -16
  29. package/dist/cjs/src/hyperliquid.js +67 -114
  30. package/dist/cjs/src/kraken.js +8 -6
  31. package/dist/cjs/src/kucoin.js +9 -8
  32. package/dist/cjs/src/luno.js +10 -9
  33. package/dist/cjs/src/mexc.js +54 -2
  34. package/dist/cjs/src/ndax.js +6 -5
  35. package/dist/cjs/src/okcoin.js +18 -27
  36. package/dist/cjs/src/okx.js +18 -26
  37. package/dist/cjs/src/p2b.js +2 -2
  38. package/dist/cjs/src/pro/bybit.js +56 -0
  39. package/dist/cjs/src/pro/cryptocom.js +191 -21
  40. package/dist/cjs/src/pro/mexc.js +165 -3
  41. package/dist/cjs/src/pro/okx.js +6 -3
  42. package/dist/cjs/src/pro/oxfun.js +75 -0
  43. package/dist/cjs/src/pro/phemex.js +45 -1
  44. package/dist/cjs/src/pro/woofipro.js +67 -0
  45. package/dist/cjs/src/woo.js +7 -6
  46. package/dist/cjs/src/woofipro.js +8 -6
  47. package/dist/cjs/src/xt.js +10 -4
  48. package/dist/cjs/src/zonda.js +6 -5
  49. package/js/ccxt.d.ts +1 -1
  50. package/js/ccxt.js +1 -1
  51. package/js/src/abstract/bitmart.d.ts +1 -0
  52. package/js/src/base/Exchange.d.ts +2 -2
  53. package/js/src/base/Exchange.js +2 -2
  54. package/js/src/base/functions/misc.d.ts +2 -1
  55. package/js/src/base/functions/misc.js +11 -1
  56. package/js/src/base/types.d.ts +1 -1
  57. package/js/src/base/ws/WsClient.js +2 -2
  58. package/js/src/binance.d.ts +4 -20
  59. package/js/src/binance.js +49 -22
  60. package/js/src/bingx.js +1 -0
  61. package/js/src/bitfinex2.d.ts +3 -19
  62. package/js/src/bitfinex2.js +7 -6
  63. package/js/src/bitget.d.ts +3 -19
  64. package/js/src/bitget.js +10 -6
  65. package/js/src/bitmart.js +3 -1
  66. package/js/src/bitmex.d.ts +3 -22
  67. package/js/src/bitmex.js +11 -10
  68. package/js/src/bitso.d.ts +3 -19
  69. package/js/src/bitso.js +5 -4
  70. package/js/src/bitstamp.d.ts +3 -35
  71. package/js/src/bitstamp.js +33 -45
  72. package/js/src/blofin.d.ts +3 -15
  73. package/js/src/blofin.js +21 -23
  74. package/js/src/bybit.d.ts +3 -19
  75. package/js/src/bybit.js +23 -21
  76. package/js/src/coinbase.d.ts +3 -19
  77. package/js/src/coinbase.js +28 -7
  78. package/js/src/coinbaseexchange.d.ts +3 -19
  79. package/js/src/coinbaseexchange.js +11 -11
  80. package/js/src/coinlist.d.ts +3 -19
  81. package/js/src/coinlist.js +6 -5
  82. package/js/src/coinmetro.d.ts +3 -19
  83. package/js/src/coinmetro.js +3 -3
  84. package/js/src/cryptocom.d.ts +3 -22
  85. package/js/src/cryptocom.js +9 -6
  86. package/js/src/currencycom.d.ts +3 -3
  87. package/js/src/currencycom.js +6 -6
  88. package/js/src/delta.d.ts +3 -19
  89. package/js/src/delta.js +5 -5
  90. package/js/src/digifinex.d.ts +3 -19
  91. package/js/src/digifinex.js +8 -6
  92. package/js/src/gate.d.ts +3 -19
  93. package/js/src/gate.js +6 -5
  94. package/js/src/hashkey.d.ts +3 -20
  95. package/js/src/hashkey.js +9 -7
  96. package/js/src/htx.d.ts +3 -19
  97. package/js/src/htx.js +13 -16
  98. package/js/src/hyperliquid.d.ts +3 -19
  99. package/js/src/hyperliquid.js +68 -115
  100. package/js/src/kraken.d.ts +5 -24
  101. package/js/src/kraken.js +8 -6
  102. package/js/src/kucoin.d.ts +3 -19
  103. package/js/src/kucoin.js +9 -8
  104. package/js/src/luno.d.ts +4 -20
  105. package/js/src/luno.js +10 -9
  106. package/js/src/mexc.js +54 -2
  107. package/js/src/ndax.d.ts +3 -19
  108. package/js/src/ndax.js +6 -5
  109. package/js/src/okcoin.d.ts +3 -19
  110. package/js/src/okcoin.js +18 -27
  111. package/js/src/okx.d.ts +3 -19
  112. package/js/src/okx.js +18 -26
  113. package/js/src/p2b.js +2 -2
  114. package/js/src/pro/bybit.d.ts +2 -0
  115. package/js/src/pro/bybit.js +56 -0
  116. package/js/src/pro/cryptocom.d.ts +7 -1
  117. package/js/src/pro/cryptocom.js +191 -21
  118. package/js/src/pro/mexc.d.ts +6 -1
  119. package/js/src/pro/mexc.js +166 -4
  120. package/js/src/pro/okx.js +6 -3
  121. package/js/src/pro/oxfun.d.ts +3 -0
  122. package/js/src/pro/oxfun.js +75 -0
  123. package/js/src/pro/phemex.d.ts +2 -1
  124. package/js/src/pro/phemex.js +45 -1
  125. package/js/src/pro/woofipro.d.ts +3 -0
  126. package/js/src/pro/woofipro.js +67 -0
  127. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  128. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
  129. package/js/src/woo.d.ts +3 -19
  130. package/js/src/woo.js +7 -6
  131. package/js/src/woofipro.d.ts +3 -19
  132. package/js/src/woofipro.js +8 -6
  133. package/js/src/xt.d.ts +3 -22
  134. package/js/src/xt.js +10 -4
  135. package/js/src/zonda.d.ts +3 -19
  136. package/js/src/zonda.js +6 -5
  137. package/package.json +1 -1
package/dist/cjs/ccxt.js CHANGED
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
194
194
 
195
195
  //-----------------------------------------------------------------------------
196
196
  // this is updated by vss.js when building
197
- const version = '4.4.2';
197
+ const version = '4.4.4';
198
198
  Exchange["default"].ccxtVersion = version;
199
199
  const exchanges = {
200
200
  'ace': ace,
@@ -50,7 +50,7 @@ function _interopNamespace(e) {
50
50
  }
51
51
 
52
52
  // ----------------------------------------------------------------------------
53
- const { isNode, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sortBy2, safeFloat2, groupBy, aggregate, uuid, unCamelCase, precisionFromString, Throttler, capitalize, now, decimalToPrecision, safeValue, safeValue2, safeString, safeString2, seconds, milliseconds, binaryToBase16, numberToBE, base16ToBinary, iso8601, omit, isJsonEncodedObject, safeInteger, sum, omitZero, implodeParams, extractParams, json, merge, binaryConcat, hash, ecdsa, arrayConcat, encode, urlencode, hmac, numberToString, parseTimeframe, safeInteger2, safeStringLower, parse8601, yyyymmdd, safeStringUpper, safeTimestamp, binaryConcatArray, uuidv1, numberToLE, ymdhms, stringToBase64, decode, uuid22, safeIntegerProduct2, safeIntegerProduct, safeStringLower2, yymmdd, base58ToBinary, binaryToBase58, safeTimestamp2, rawencode, keysort, inArray, isEmpty, ordered, filterBy, uuid16, safeFloat, base64ToBinary, safeStringUpper2, urlencodeWithArrayRepeat, microseconds, binaryToBase64, strip, toArray, safeFloatN, safeIntegerN, safeIntegerProductN, safeTimestampN, safeValueN, safeStringN, safeStringLowerN, safeStringUpperN, urlencodeNested, urlencodeBase64, parseDate, ymd, base64ToString, crc32, packb, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS, sleep } = functions;
53
+ const { isNode, selfIsDefined, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sortBy2, safeFloat2, groupBy, aggregate, uuid, unCamelCase, precisionFromString, Throttler, capitalize, now, decimalToPrecision, safeValue, safeValue2, safeString, safeString2, seconds, milliseconds, binaryToBase16, numberToBE, base16ToBinary, iso8601, omit, isJsonEncodedObject, safeInteger, sum, omitZero, implodeParams, extractParams, json, merge, binaryConcat, hash, ecdsa, arrayConcat, encode, urlencode, hmac, numberToString, parseTimeframe, safeInteger2, safeStringLower, parse8601, yyyymmdd, safeStringUpper, safeTimestamp, binaryConcatArray, uuidv1, numberToLE, ymdhms, stringToBase64, decode, uuid22, safeIntegerProduct2, safeIntegerProduct, safeStringLower2, yymmdd, base58ToBinary, binaryToBase58, safeTimestamp2, rawencode, keysort, inArray, isEmpty, ordered, filterBy, uuid16, safeFloat, base64ToBinary, safeStringUpper2, urlencodeWithArrayRepeat, microseconds, binaryToBase64, strip, toArray, safeFloatN, safeIntegerN, safeIntegerProductN, safeTimestampN, safeValueN, safeStringN, safeStringLowerN, safeStringUpperN, urlencodeNested, urlencodeBase64, parseDate, ymd, base64ToString, crc32, packb, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS, sleep } = functions;
54
54
  // ----------------------------------------------------------------------------
55
55
  /**
56
56
  * @class Exchange
@@ -640,7 +640,7 @@ class Exchange {
640
640
  }
641
641
  }
642
642
  else {
643
- this.fetchImplementation = self.fetch;
643
+ this.fetchImplementation = (selfIsDefined()) ? self.fetch : fetch;
644
644
  this.AbortError = DOMException;
645
645
  this.FetchError = TypeError;
646
646
  }
@@ -86,6 +86,16 @@ function aggregate(bidasks) {
86
86
  }
87
87
  return Object.keys(result).map((price) => [parseFloat(price), parseFloat(result[price])]); // TODO: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}', No index signature with a parameter of type 'string' was found on type '{}'.ts(7053)
88
88
  }
89
+ function selfIsDefined() {
90
+ let selfIsDefined = false;
91
+ try {
92
+ selfIsDefined = self !== undefined;
93
+ }
94
+ catch (e) {
95
+ selfIsDefined = false;
96
+ }
97
+ return selfIsDefined;
98
+ }
89
99
  /* ------------------------------------------------------------------------ */
90
100
 
91
101
  exports.aggregate = aggregate;
@@ -93,4 +103,5 @@ exports.extractParams = extractParams;
93
103
  exports.implodeParams = implodeParams;
94
104
  exports.parseTimeframe = parseTimeframe;
95
105
  exports.roundTimeframe = roundTimeframe;
106
+ exports.selfIsDefined = selfIsDefined;
96
107
  exports.vwap = vwap;
@@ -156,4 +156,5 @@ exports.extractParams = misc.extractParams;
156
156
  exports.implodeParams = misc.implodeParams;
157
157
  exports.parseTimeframe = misc.parseTimeframe;
158
158
  exports.roundTimeframe = misc.roundTimeframe;
159
+ exports.selfIsDefined = misc.selfIsDefined;
159
160
  exports.vwap = misc.vwap;
@@ -6,6 +6,7 @@ var platform = require('../functions/platform.js');
6
6
  require('../functions/encode.js');
7
7
  require('../functions/crypto.js');
8
8
  var time = require('../functions/time.js');
9
+ var misc = require('../functions/misc.js');
9
10
  var Future = require('./Future.js');
10
11
 
11
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -14,7 +15,7 @@ var WebSocket__default = /*#__PURE__*/_interopDefaultLegacy(WebSocket);
14
15
 
15
16
  // eslint-disable-next-line no-shadow
16
17
  // eslint-disable-next-line no-restricted-globals
17
- const WebSocketPlatform = platform.isNode ? WebSocket__default["default"] : self.WebSocket;
18
+ const WebSocketPlatform = platform.isNode || !misc.selfIsDefined() ? WebSocket__default["default"] : self.WebSocket;
18
19
  class WsClient extends Client {
19
20
  constructor() {
20
21
  super(...arguments);
@@ -6400,8 +6400,8 @@ class binance extends binance$1 {
6400
6400
  [marginMode, params] = this.handleMarginModeAndParams('fetchOrders', params);
6401
6401
  let isPortfolioMargin = undefined;
6402
6402
  [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOrders', 'papi', 'portfolioMargin', false);
6403
- const isConditional = this.safeBool2(params, 'stop', 'conditional');
6404
- params = this.omit(params, ['stop', 'conditional', 'type']);
6403
+ const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
6404
+ params = this.omit(params, ['stop', 'trigger', 'conditional', 'type']);
6405
6405
  let request = {
6406
6406
  'symbol': market['id'],
6407
6407
  };
@@ -6670,7 +6670,7 @@ class binance extends binance$1 {
6670
6670
  [marginMode, params] = this.handleMarginModeAndParams('fetchOpenOrders', params);
6671
6671
  let isPortfolioMargin = undefined;
6672
6672
  [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOpenOrders', 'papi', 'portfolioMargin', false);
6673
- const isConditional = this.safeBoolN(params, ['stop', 'conditional', 'trigger']);
6673
+ const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
6674
6674
  if (symbol !== undefined) {
6675
6675
  market = this.market(symbol);
6676
6676
  request['symbol'] = market['id'];
@@ -6687,7 +6687,7 @@ class binance extends binance$1 {
6687
6687
  }
6688
6688
  let subType = undefined;
6689
6689
  [subType, params] = this.handleSubTypeAndParams('fetchOpenOrders', market, params);
6690
- params = this.omit(params, ['type', 'stop', 'conditional', 'trigger']);
6690
+ params = this.omit(params, ['type', 'stop', 'trigger', 'conditional']);
6691
6691
  let response = undefined;
6692
6692
  if (type === 'option') {
6693
6693
  if (since !== undefined) {
@@ -6770,8 +6770,8 @@ class binance extends binance$1 {
6770
6770
  };
6771
6771
  let isPortfolioMargin = undefined;
6772
6772
  [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOpenOrder', 'papi', 'portfolioMargin', false);
6773
- const isConditional = this.safeBoolN(params, ['stop', 'conditional', 'trigger']);
6774
- params = this.omit(params, ['stop', 'conditional', 'trigger']);
6773
+ const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
6774
+ params = this.omit(params, ['stop', 'trigger', 'conditional']);
6775
6775
  const isPortfolioMarginConditional = (isPortfolioMargin && isConditional);
6776
6776
  const orderIdRequest = isPortfolioMarginConditional ? 'strategyId' : 'orderId';
6777
6777
  request[orderIdRequest] = id;
@@ -7086,7 +7086,7 @@ class binance extends binance$1 {
7086
7086
  [marginMode, params] = this.handleMarginModeAndParams('cancelOrder', params);
7087
7087
  let isPortfolioMargin = undefined;
7088
7088
  [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'cancelOrder', 'papi', 'portfolioMargin', false);
7089
- const isConditional = this.safeBool2(params, 'stop', 'conditional');
7089
+ const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
7090
7090
  const request = {
7091
7091
  'symbol': market['id'],
7092
7092
  };
@@ -7112,7 +7112,7 @@ class binance extends binance$1 {
7112
7112
  request['orderId'] = id;
7113
7113
  }
7114
7114
  }
7115
- params = this.omit(params, ['type', 'origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'stop', 'conditional']);
7115
+ params = this.omit(params, ['type', 'origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'stop', 'trigger', 'conditional']);
7116
7116
  let response = undefined;
7117
7117
  if (market['option']) {
7118
7118
  response = await this.eapiPrivateDeleteOrder(this.extend(request, params));
@@ -7190,9 +7190,9 @@ class binance extends binance$1 {
7190
7190
  };
7191
7191
  let isPortfolioMargin = undefined;
7192
7192
  [isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'cancelAllOrders', 'papi', 'portfolioMargin', false);
7193
- const isConditional = this.safeBool2(params, 'stop', 'conditional');
7193
+ const isConditional = this.safeBoolN(params, ['stop', 'trigger', 'conditional']);
7194
7194
  const type = this.safeString(params, 'type', market['type']);
7195
- params = this.omit(params, ['type', 'stop', 'conditional']);
7195
+ params = this.omit(params, ['type', 'stop', 'trigger', 'conditional']);
7196
7196
  let marginMode = undefined;
7197
7197
  [marginMode, params] = this.handleMarginModeAndParams('cancelAllOrders', params);
7198
7198
  let response = undefined;
@@ -11219,17 +11219,42 @@ class binance extends binance$1 {
11219
11219
  return result;
11220
11220
  }
11221
11221
  async fetchLedgerEntry(id, code = undefined, params = {}) {
11222
+ /**
11223
+ * @method
11224
+ * @name binance#fetchLedgerEntry
11225
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
11226
+ * @see https://developers.binance.com/docs/derivatives/option/account/Account-Funding-Flow
11227
+ * @param {string} id the identification number of the ledger entry
11228
+ * @param {string} code unified currency code
11229
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
11230
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
11231
+ */
11222
11232
  await this.loadMarkets();
11223
11233
  let type = undefined;
11224
11234
  [type, params] = this.handleMarketTypeAndParams('fetchLedgerEntry', undefined, params);
11225
- const query = {
11226
- 'recordId': id,
11227
- 'type': type,
11228
- };
11229
11235
  if (type !== 'option') {
11230
- throw new errors.BadRequest(this.id + ' fetchLedgerEntry () can only be used for type option');
11236
+ throw new errors.BadRequest(this.id + ' fetchLedgerEntry() can only be used for type option');
11231
11237
  }
11232
- return await this.fetchLedger(code, undefined, undefined, this.extend(query, params));
11238
+ this.checkRequiredArgument('fetchLedgerEntry', code, 'code');
11239
+ const currency = this.currency(code);
11240
+ const request = {
11241
+ 'recordId': id,
11242
+ 'currency': currency['id'],
11243
+ };
11244
+ const response = await this.eapiPrivateGetBill(this.extend(request, params));
11245
+ //
11246
+ // [
11247
+ // {
11248
+ // "id": "1125899906845701870",
11249
+ // "asset": "USDT",
11250
+ // "amount": "-0.16518203",
11251
+ // "type": "FEE",
11252
+ // "createDate": 1676621042489
11253
+ // }
11254
+ // ]
11255
+ //
11256
+ const first = this.safeDict(response, 0, response);
11257
+ return this.parseLedgerEntry(first, currency);
11233
11258
  }
11234
11259
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
11235
11260
  /**
@@ -11241,9 +11266,9 @@ class binance extends binance$1 {
11241
11266
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Get-Income-History
11242
11267
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Income-History
11243
11268
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Income-History
11244
- * @param {string} code unified currency code
11269
+ * @param {string} [code] unified currency code
11245
11270
  * @param {int} [since] timestamp in ms of the earliest ledger entry
11246
- * @param {int} [limit] max number of ledger entrys to return
11271
+ * @param {int} [limit] max number of ledger entries to return
11247
11272
  * @param {object} [params] extra parameters specific to the exchange API endpoint
11248
11273
  * @param {int} [params.until] timestamp in ms of the latest ledger entry
11249
11274
  * @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)
@@ -11369,16 +11394,19 @@ class binance extends binance$1 {
11369
11394
  direction = 'in';
11370
11395
  }
11371
11396
  const currencyId = this.safeString(item, 'asset');
11397
+ const code = this.safeCurrencyCode(currencyId, currency);
11398
+ currency = this.safeCurrency(currencyId, currency);
11372
11399
  const timestamp = this.safeInteger2(item, 'createDate', 'time');
11373
11400
  const type = this.safeString2(item, 'type', 'incomeType');
11374
- return {
11401
+ return this.safeLedgerEntry({
11402
+ 'info': item,
11375
11403
  'id': this.safeString2(item, 'id', 'tranId'),
11376
11404
  'direction': direction,
11377
11405
  'account': undefined,
11378
11406
  'referenceAccount': undefined,
11379
11407
  'referenceId': this.safeString(item, 'tradeId'),
11380
11408
  'type': this.parseLedgerEntryType(type),
11381
- 'currency': this.safeCurrencyCode(currencyId, currency),
11409
+ 'currency': code,
11382
11410
  'amount': this.parseNumber(amount),
11383
11411
  'timestamp': timestamp,
11384
11412
  'datetime': this.iso8601(timestamp),
@@ -11386,8 +11414,7 @@ class binance extends binance$1 {
11386
11414
  'after': undefined,
11387
11415
  'status': undefined,
11388
11416
  'fee': undefined,
11389
- 'info': item,
11390
- };
11417
+ }, currency);
11391
11418
  }
11392
11419
  parseLedgerEntryType(type) {
11393
11420
  const ledgerType = {
@@ -465,6 +465,7 @@ class bingx extends bingx$1 {
465
465
  'commonCurrencies': {
466
466
  'SNOW': 'Snowman',
467
467
  'OMNI': 'OmniCat',
468
+ 'NAP': '$NAP', // NAP on SOL = SNAP
468
469
  },
469
470
  'options': {
470
471
  'defaultType': 'spot',
@@ -2917,6 +2917,7 @@ class bitfinex2 extends bitfinex2$1 {
2917
2917
  const id = this.safeString(itemList, 0);
2918
2918
  const currencyId = this.safeString(itemList, 1);
2919
2919
  const code = this.safeCurrencyCode(currencyId, currency);
2920
+ currency = this.safeCurrency(currencyId, currency);
2920
2921
  const timestamp = this.safeInteger(itemList, 3);
2921
2922
  const amount = this.safeNumber(itemList, 5);
2922
2923
  const after = this.safeNumber(itemList, 6);
@@ -2926,7 +2927,8 @@ class bitfinex2 extends bitfinex2$1 {
2926
2927
  const first = this.safeStringLower(parts, 0);
2927
2928
  type = this.parseLedgerEntryType(first);
2928
2929
  }
2929
- return {
2930
+ return this.safeLedgerEntry({
2931
+ 'info': item,
2930
2932
  'id': id,
2931
2933
  'direction': undefined,
2932
2934
  'account': undefined,
@@ -2941,18 +2943,17 @@ class bitfinex2 extends bitfinex2$1 {
2941
2943
  'after': after,
2942
2944
  'status': undefined,
2943
2945
  'fee': undefined,
2944
- 'info': item,
2945
- };
2946
+ }, currency);
2946
2947
  }
2947
2948
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
2948
2949
  /**
2949
2950
  * @method
2950
2951
  * @name bitfinex2#fetchLedger
2951
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2952
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2952
2953
  * @see https://docs.bitfinex.com/reference/rest-auth-ledgers
2953
- * @param {string} code unified currency code, default is undefined
2954
+ * @param {string} [code] unified currency code, default is undefined
2954
2955
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2955
- * @param {int} [limit] max number of ledger entrys to return, default is undefined max is 2500
2956
+ * @param {int} [limit] max number of ledger entries to return, default is undefined, max is 2500
2956
2957
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2957
2958
  * @param {int} [params.until] timestamp in ms of the latest ledger entry
2958
2959
  * @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)
@@ -5901,12 +5901,12 @@ class bitget extends bitget$1 {
5901
5901
  /**
5902
5902
  * @method
5903
5903
  * @name bitget#fetchLedger
5904
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
5904
5905
  * @see https://www.bitget.com/api-doc/spot/account/Get-Account-Bills
5905
5906
  * @see https://www.bitget.com/api-doc/contract/account/Get-Account-Bill
5906
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
5907
- * @param {string} code unified currency code, default is undefined
5907
+ * @param {string} [code] unified currency code, default is undefined
5908
5908
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
5909
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
5909
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
5910
5910
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5911
5911
  * @param {int} [params.until] end time in ms
5912
5912
  * @param {string} [params.symbol] *contract only* unified market symbol
@@ -6046,6 +6046,7 @@ class bitget extends bitget$1 {
6046
6046
  //
6047
6047
  const currencyId = this.safeString(item, 'coin');
6048
6048
  const code = this.safeCurrencyCode(currencyId, currency);
6049
+ currency = this.safeCurrency(currencyId, currency);
6049
6050
  const timestamp = this.safeInteger(item, 'cTime');
6050
6051
  const after = this.safeNumber(item, 'balance');
6051
6052
  const fee = this.safeNumber2(item, 'fees', 'fee');
@@ -6055,7 +6056,7 @@ class bitget extends bitget$1 {
6055
6056
  if (amountRaw.indexOf('-') >= 0) {
6056
6057
  direction = 'out';
6057
6058
  }
6058
- return {
6059
+ return this.safeLedgerEntry({
6059
6060
  'info': item,
6060
6061
  'id': this.safeString(item, 'billId'),
6061
6062
  'timestamp': timestamp,
@@ -6070,8 +6071,11 @@ class bitget extends bitget$1 {
6070
6071
  'before': undefined,
6071
6072
  'after': after,
6072
6073
  'status': undefined,
6073
- 'fee': fee,
6074
- };
6074
+ 'fee': {
6075
+ 'currency': code,
6076
+ 'cost': fee,
6077
+ },
6078
+ }, currency);
6075
6079
  }
6076
6080
  parseLedgerType(type) {
6077
6081
  const types = {
@@ -229,6 +229,7 @@ class bitmart extends bitmart$1 {
229
229
  'spot/v4/query/trades': 5,
230
230
  'spot/v4/query/order-trades': 5,
231
231
  'spot/v4/cancel_orders': 3,
232
+ 'spot/v4/cancel_all': 90,
232
233
  'spot/v4/batch_orders': 3,
233
234
  // newer endpoint
234
235
  'spot/v3/cancel_order': 1,
@@ -2964,6 +2965,7 @@ class bitmart extends bitmart$1 {
2964
2965
  * @name bitmart#cancelAllOrders
2965
2966
  * @description cancel all open orders in a market
2966
2967
  * @see https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
2968
+ * @see https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed
2967
2969
  * @see https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
2968
2970
  * @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
2969
2971
  * @param {string} symbol unified market symbol of the market to cancel orders in
@@ -2982,7 +2984,7 @@ class bitmart extends bitmart$1 {
2982
2984
  let type = undefined;
2983
2985
  [type, params] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
2984
2986
  if (type === 'spot') {
2985
- response = await this.privatePostSpotV1CancelOrders(this.extend(request, params));
2987
+ response = await this.privatePostSpotV4CancelAll(this.extend(request, params));
2986
2988
  }
2987
2989
  else if (type === 'swap') {
2988
2990
  if (symbol === undefined) {
@@ -1143,6 +1143,7 @@ class bitmex extends bitmex$1 {
1143
1143
  const type = this.parseLedgerEntryType(this.safeString(item, 'transactType'));
1144
1144
  const currencyId = this.safeString(item, 'currency');
1145
1145
  const code = this.safeCurrencyCode(currencyId, currency);
1146
+ currency = this.safeCurrency(currencyId, currency);
1146
1147
  const amountString = this.safeString(item, 'amount');
1147
1148
  let amount = this.convertToRealAmount(code, amountString);
1148
1149
  let timestamp = this.parse8601(this.safeString(item, 'transactTime'));
@@ -1157,14 +1158,14 @@ class bitmex extends bitmex$1 {
1157
1158
  feeCost = this.convertToRealAmount(code, feeCost);
1158
1159
  }
1159
1160
  const fee = {
1160
- 'cost': this.parseNumber(feeCost),
1161
+ 'cost': this.parseToNumeric(feeCost),
1161
1162
  'currency': code,
1162
1163
  };
1163
1164
  let after = this.safeString(item, 'walletBalance');
1164
1165
  if (after !== undefined) {
1165
1166
  after = this.convertToRealAmount(code, after);
1166
1167
  }
1167
- const before = this.parseNumber(Precise["default"].stringSub(this.numberToString(after), this.numberToString(amount)));
1168
+ const before = this.parseToNumeric(Precise["default"].stringSub(this.numberToString(after), this.numberToString(amount)));
1168
1169
  let direction = undefined;
1169
1170
  if (Precise["default"].stringLt(amountString, '0')) {
1170
1171
  direction = 'out';
@@ -1174,9 +1175,9 @@ class bitmex extends bitmex$1 {
1174
1175
  direction = 'in';
1175
1176
  }
1176
1177
  const status = this.parseTransactionStatus(this.safeString(item, 'transactStatus'));
1177
- return {
1178
- 'id': id,
1178
+ return this.safeLedgerEntry({
1179
1179
  'info': item,
1180
+ 'id': id,
1180
1181
  'timestamp': timestamp,
1181
1182
  'datetime': this.iso8601(timestamp),
1182
1183
  'direction': direction,
@@ -1185,22 +1186,22 @@ class bitmex extends bitmex$1 {
1185
1186
  'referenceAccount': referenceAccount,
1186
1187
  'type': type,
1187
1188
  'currency': code,
1188
- 'amount': amount,
1189
+ 'amount': this.parseToNumeric(amount),
1189
1190
  'before': before,
1190
- 'after': this.parseNumber(after),
1191
+ 'after': this.parseToNumeric(after),
1191
1192
  'status': status,
1192
1193
  'fee': fee,
1193
- };
1194
+ }, currency);
1194
1195
  }
1195
1196
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
1196
1197
  /**
1197
1198
  * @method
1198
1199
  * @name bitmex#fetchLedger
1199
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
1200
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
1200
1201
  * @see https://www.bitmex.com/api/explorer/#!/User/User_getWalletHistory
1201
- * @param {string} code unified currency code, default is undefined
1202
+ * @param {string} [code] unified currency code, default is undefined
1202
1203
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1203
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
1204
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
1204
1205
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1205
1206
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1206
1207
  */
@@ -191,10 +191,10 @@ class bitso extends bitso$1 {
191
191
  /**
192
192
  * @method
193
193
  * @name bitso#fetchLedger
194
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
195
- * @param {string} code unified currency code, default is undefined
194
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
195
+ * @param {string} [code] unified currency code, default is undefined
196
196
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
197
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
197
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
198
198
  * @param {object} [params] extra parameters specific to the exchange API endpoint
199
199
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
200
200
  */
@@ -303,6 +303,7 @@ class bitso extends bitso$1 {
303
303
  const amount = this.safeString(firstBalance, 'amount');
304
304
  const currencyId = this.safeString(firstBalance, 'currency');
305
305
  const code = this.safeCurrencyCode(currencyId, currency);
306
+ currency = this.safeCurrency(currencyId, currency);
306
307
  const details = this.safeValue(item, 'details', {});
307
308
  let referenceId = this.safeString2(details, 'fid', 'wid');
308
309
  if (referenceId === undefined) {
@@ -327,6 +328,7 @@ class bitso extends bitso$1 {
327
328
  }
328
329
  const timestamp = this.parse8601(this.safeString(item, 'created_at'));
329
330
  return this.safeLedgerEntry({
331
+ 'info': item,
330
332
  'id': this.safeString(item, 'eid'),
331
333
  'direction': direction,
332
334
  'account': undefined,
@@ -341,7 +343,6 @@ class bitso extends bitso$1 {
341
343
  'after': undefined,
342
344
  'status': 'ok',
343
345
  'fee': fee,
344
- 'info': item,
345
346
  }, currency);
346
347
  }
347
348
  async fetchMarkets(params = {}) {
@@ -389,46 +389,34 @@ class bitstamp extends bitstamp$1 {
389
389
  'trading': {
390
390
  'tierBased': true,
391
391
  'percentage': true,
392
- 'taker': this.parseNumber('0.005'),
393
- 'maker': this.parseNumber('0.005'),
392
+ 'taker': this.parseNumber('0.004'),
393
+ 'maker': this.parseNumber('0.004'),
394
394
  'tiers': {
395
395
  'taker': [
396
- [this.parseNumber('0'), this.parseNumber('0.005')],
397
- [this.parseNumber('20000'), this.parseNumber('0.0025')],
398
- [this.parseNumber('100000'), this.parseNumber('0.0024')],
399
- [this.parseNumber('200000'), this.parseNumber('0.0022')],
400
- [this.parseNumber('400000'), this.parseNumber('0.0020')],
401
- [this.parseNumber('600000'), this.parseNumber('0.0015')],
402
- [this.parseNumber('1000000'), this.parseNumber('0.0014')],
403
- [this.parseNumber('2000000'), this.parseNumber('0.0013')],
404
- [this.parseNumber('4000000'), this.parseNumber('0.0012')],
405
- [this.parseNumber('20000000'), this.parseNumber('0.0011')],
406
- [this.parseNumber('50000000'), this.parseNumber('0.0010')],
407
- [this.parseNumber('100000000'), this.parseNumber('0.0007')],
408
- [this.parseNumber('500000000'), this.parseNumber('0.0005')],
409
- [this.parseNumber('2000000000'), this.parseNumber('0.0003')],
410
- [this.parseNumber('6000000000'), this.parseNumber('0.0001')],
411
- [this.parseNumber('20000000000'), this.parseNumber('0.00005')],
412
- [this.parseNumber('20000000001'), this.parseNumber('0')],
396
+ [this.parseNumber('0'), this.parseNumber('0.004')],
397
+ [this.parseNumber('10000'), this.parseNumber('0.003')],
398
+ [this.parseNumber('100000'), this.parseNumber('0.002')],
399
+ [this.parseNumber('500000'), this.parseNumber('0.0018')],
400
+ [this.parseNumber('1500000'), this.parseNumber('0.0016')],
401
+ [this.parseNumber('5000000'), this.parseNumber('0.0012')],
402
+ [this.parseNumber('20000000'), this.parseNumber('0.001')],
403
+ [this.parseNumber('50000000'), this.parseNumber('0.0008')],
404
+ [this.parseNumber('100000000'), this.parseNumber('0.0006')],
405
+ [this.parseNumber('250000000'), this.parseNumber('0.0005')],
406
+ [this.parseNumber('1000000000'), this.parseNumber('0.0003')],
413
407
  ],
414
408
  'maker': [
415
- [this.parseNumber('0'), this.parseNumber('0.005')],
416
- [this.parseNumber('20000'), this.parseNumber('0.0025')],
417
- [this.parseNumber('100000'), this.parseNumber('0.0024')],
418
- [this.parseNumber('200000'), this.parseNumber('0.0022')],
419
- [this.parseNumber('400000'), this.parseNumber('0.0020')],
420
- [this.parseNumber('600000'), this.parseNumber('0.0015')],
421
- [this.parseNumber('1000000'), this.parseNumber('0.0014')],
422
- [this.parseNumber('2000000'), this.parseNumber('0.0013')],
423
- [this.parseNumber('4000000'), this.parseNumber('0.0012')],
424
- [this.parseNumber('20000000'), this.parseNumber('0.0011')],
425
- [this.parseNumber('50000000'), this.parseNumber('0.0010')],
426
- [this.parseNumber('100000000'), this.parseNumber('0.0007')],
427
- [this.parseNumber('500000000'), this.parseNumber('0.0005')],
428
- [this.parseNumber('2000000000'), this.parseNumber('0.0003')],
429
- [this.parseNumber('6000000000'), this.parseNumber('0.0001')],
430
- [this.parseNumber('20000000000'), this.parseNumber('0.00005')],
431
- [this.parseNumber('20000000001'), this.parseNumber('0')],
409
+ [this.parseNumber('0'), this.parseNumber('0.003')],
410
+ [this.parseNumber('10000'), this.parseNumber('0.002')],
411
+ [this.parseNumber('100000'), this.parseNumber('0.001')],
412
+ [this.parseNumber('500000'), this.parseNumber('0.0008')],
413
+ [this.parseNumber('1500000'), this.parseNumber('0.0006')],
414
+ [this.parseNumber('5000000'), this.parseNumber('0.0003')],
415
+ [this.parseNumber('20000000'), this.parseNumber('0.002')],
416
+ [this.parseNumber('50000000'), this.parseNumber('0.0001')],
417
+ [this.parseNumber('100000000'), this.parseNumber('0')],
418
+ [this.parseNumber('250000000'), this.parseNumber('0')],
419
+ [this.parseNumber('1000000000'), this.parseNumber('0')],
432
420
  ],
433
421
  },
434
422
  },
@@ -1990,9 +1978,9 @@ class bitstamp extends bitstamp$1 {
1990
1978
  market = this.getMarketFromTrade(item);
1991
1979
  }
1992
1980
  const direction = (parsedTrade['side'] === 'buy') ? 'in' : 'out';
1993
- return {
1994
- 'id': parsedTrade['id'],
1981
+ return this.safeLedgerEntry({
1995
1982
  'info': item,
1983
+ 'id': parsedTrade['id'],
1996
1984
  'timestamp': parsedTrade['timestamp'],
1997
1985
  'datetime': parsedTrade['datetime'],
1998
1986
  'direction': direction,
@@ -2006,7 +1994,7 @@ class bitstamp extends bitstamp$1 {
2006
1994
  'after': undefined,
2007
1995
  'status': 'ok',
2008
1996
  'fee': parsedTrade['fee'],
2009
- };
1997
+ }, currency);
2010
1998
  }
2011
1999
  else {
2012
2000
  const parsedTransaction = this.parseTransaction(item, currency);
@@ -2021,9 +2009,9 @@ class bitstamp extends bitstamp$1 {
2021
2009
  const amount = this.safeString(item, currency['id']);
2022
2010
  direction = Precise["default"].stringGt(amount, '0') ? 'in' : 'out';
2023
2011
  }
2024
- return {
2025
- 'id': parsedTransaction['id'],
2012
+ return this.safeLedgerEntry({
2026
2013
  'info': item,
2014
+ 'id': parsedTransaction['id'],
2027
2015
  'timestamp': parsedTransaction['timestamp'],
2028
2016
  'datetime': parsedTransaction['datetime'],
2029
2017
  'direction': direction,
@@ -2037,18 +2025,18 @@ class bitstamp extends bitstamp$1 {
2037
2025
  'after': undefined,
2038
2026
  'status': parsedTransaction['status'],
2039
2027
  'fee': parsedTransaction['fee'],
2040
- };
2028
+ }, currency);
2041
2029
  }
2042
2030
  }
2043
2031
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
2044
2032
  /**
2045
2033
  * @method
2046
2034
  * @name bitstamp#fetchLedger
2047
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2035
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2048
2036
  * @see https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions
2049
- * @param {string} code unified currency code, default is undefined
2037
+ * @param {string} [code] unified currency code, default is undefined
2050
2038
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2051
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2039
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2052
2040
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2053
2041
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2054
2042
  */