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/js/src/bybit.js CHANGED
@@ -7,7 +7,7 @@
7
7
  // ---------------------------------------------------------------------------
8
8
  import Exchange from './abstract/bybit.js';
9
9
  import { TICK_SIZE } from './base/functions/number.js';
10
- import { AuthenticationError, ExchangeError, ArgumentsRequired, PermissionDenied, InvalidOrder, OrderNotFound, InsufficientFunds, BadRequest, RateLimitExceeded, InvalidNonce, NotSupported, RequestTimeout, MarginModeAlreadySet, NoChange, ManualInteractionNeeded } from './base/errors.js';
10
+ import { AuthenticationError, ExchangeError, ArgumentsRequired, PermissionDenied, InvalidOrder, OrderNotFound, InsufficientFunds, BadRequest, RateLimitExceeded, InvalidNonce, NotSupported, RequestTimeout, MarginModeAlreadySet, NoChange, ManualInteractionNeeded, BadSymbol } from './base/errors.js';
11
11
  import { Precise } from './base/Precise.js';
12
12
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
13
13
  import { rsa } from './base/functions/rsa.js';
@@ -979,6 +979,7 @@ export default class bybit extends Exchange {
979
979
  '3200300': InsufficientFunds, // {"retCode":3200300,"retMsg":"Insufficient margin balance.","result":null,"retExtMap":{}}
980
980
  },
981
981
  'broad': {
982
+ 'Not supported symbols': BadSymbol,
982
983
  'Request timeout': RequestTimeout,
983
984
  'unknown orderInfo': OrderNotFound,
984
985
  'invalid api_key': AuthenticationError,
@@ -5925,13 +5926,13 @@ export default class bybit extends Exchange {
5925
5926
  /**
5926
5927
  * @method
5927
5928
  * @name bybit#fetchLedger
5928
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
5929
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
5929
5930
  * @see https://bybit-exchange.github.io/docs/v5/account/transaction-log
5930
5931
  * @see https://bybit-exchange.github.io/docs/v5/account/contract-transaction-log
5931
- * @param {string} code unified currency code, default is undefined
5932
+ * @param {string} [code] unified currency code, default is undefined
5932
5933
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
5933
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
5934
- * @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)
5934
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
5935
+ * @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)
5935
5936
  * @param {string} [params.subType] if inverse will use v5/account/contract-transaction-log
5936
5937
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5937
5938
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
@@ -6141,6 +6142,7 @@ export default class bybit extends Exchange {
6141
6142
  //
6142
6143
  const currencyId = this.safeString2(item, 'coin', 'currency');
6143
6144
  const code = this.safeCurrencyCode(currencyId, currency);
6145
+ currency = this.safeCurrency(currencyId, currency);
6144
6146
  const amount = this.safeString2(item, 'amount', 'change');
6145
6147
  const after = this.safeString2(item, 'wallet_balance', 'cashBalance');
6146
6148
  const direction = Precise.stringLt(amount, '0') ? 'out' : 'in';
@@ -6153,26 +6155,26 @@ export default class bybit extends Exchange {
6153
6155
  if (timestamp === undefined) {
6154
6156
  timestamp = this.safeInteger(item, 'transactionTime');
6155
6157
  }
6156
- const type = this.parseLedgerEntryType(this.safeString(item, 'type'));
6157
- const id = this.safeString(item, 'id');
6158
- const referenceId = this.safeString(item, 'tx_id');
6159
- return {
6160
- 'id': id,
6161
- 'currency': code,
6158
+ return this.safeLedgerEntry({
6159
+ 'info': item,
6160
+ 'id': this.safeString(item, 'id'),
6161
+ 'direction': direction,
6162
6162
  'account': this.safeString(item, 'wallet_id'),
6163
+ 'referenceId': this.safeString(item, 'tx_id'),
6163
6164
  'referenceAccount': undefined,
6164
- 'referenceId': referenceId,
6165
- 'status': undefined,
6166
- 'amount': this.parseNumber(Precise.stringAbs(amount)),
6167
- 'before': this.parseNumber(before),
6168
- 'after': this.parseNumber(after),
6169
- 'fee': this.parseNumber(this.safeString(item, 'fee')),
6170
- 'direction': direction,
6165
+ 'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
6166
+ 'currency': code,
6167
+ 'amount': this.parseToNumeric(Precise.stringAbs(amount)),
6171
6168
  'timestamp': timestamp,
6172
6169
  'datetime': this.iso8601(timestamp),
6173
- 'type': type,
6174
- 'info': item,
6175
- };
6170
+ 'before': this.parseToNumeric(before),
6171
+ 'after': this.parseToNumeric(after),
6172
+ 'status': 'ok',
6173
+ 'fee': {
6174
+ 'currency': code,
6175
+ 'cost': this.parseToNumeric(this.safeString(item, 'fee')),
6176
+ },
6177
+ }, currency);
6176
6178
  }
6177
6179
  parseLedgerEntryType(type) {
6178
6180
  const types = {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinbase.js';
2
- import type { Int, OrderSide, OrderType, Order, Trade, OHLCV, Ticker, OrderBook, Str, Transaction, Balances, Tickers, Strings, Market, Currency, Num, Account, Currencies, MarketInterface, Conversion, Dict, int, TradingFees } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Order, Trade, OHLCV, Ticker, OrderBook, Str, Transaction, Balances, Tickers, Strings, Market, Currency, Num, Account, Currencies, MarketInterface, Conversion, Dict, int, TradingFees, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class coinbase
5
5
  * @augments Exchange
@@ -47,26 +47,10 @@ export default class coinbase extends Exchange {
47
47
  parseTicker(ticker: Dict, market?: Market): Ticker;
48
48
  parseCustomBalance(response: any, params?: {}): Balances;
49
49
  fetchBalance(params?: {}): Promise<Balances>;
50
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
50
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
51
51
  parseLedgerEntryStatus(status: any): string;
52
52
  parseLedgerEntryType(type: any): string;
53
- parseLedgerEntry(item: Dict, currency?: Currency): {
54
- info: Dict;
55
- id: string;
56
- timestamp: number;
57
- datetime: string;
58
- direction: any;
59
- account: any;
60
- referenceId: any;
61
- referenceAccount: any;
62
- type: string;
63
- currency: string;
64
- amount: number;
65
- before: any;
66
- after: any;
67
- status: string;
68
- fee: any;
69
- };
53
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
70
54
  findAccountId(code: any, params?: {}): Promise<any>;
71
55
  prepareAccountRequest(limit?: Int, params?: {}): Dict;
72
56
  prepareAccountRequestWithCurrencyCode(code?: Str, limit?: Int, params?: {}): Promise<Dict[]>;
@@ -2260,13 +2260,13 @@ export default class coinbase extends Exchange {
2260
2260
  /**
2261
2261
  * @method
2262
2262
  * @name coinbase#fetchLedger
2263
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2263
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2264
2264
  * @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-transactions#list-transactions
2265
- * @param {string} code unified currency code, default is undefined
2265
+ * @param {string} [code] unified currency code, default is undefined
2266
2266
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2267
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2267
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2268
2268
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2269
- * @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)
2269
+ * @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)
2270
2270
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2271
2271
  */
2272
2272
  await this.loadMarkets();
@@ -2295,8 +2295,28 @@ export default class coinbase extends Exchange {
2295
2295
  const pagination = this.safeDict(response, 'pagination', {});
2296
2296
  const cursor = this.safeString(pagination, 'next_starting_after');
2297
2297
  if ((cursor !== undefined) && (cursor !== '')) {
2298
+ const lastFee = this.safeDict(last, 'fee');
2298
2299
  last['next_starting_after'] = cursor;
2299
- ledger[lastIndex] = last;
2300
+ ledger[lastIndex] = {
2301
+ 'info': this.safeDict(last, 'info'),
2302
+ 'id': this.safeString(last, 'id'),
2303
+ 'timestamp': this.safeInteger(last, 'timestamp'),
2304
+ 'datetime': this.safeString(last, 'datetime'),
2305
+ 'direction': this.safeString(last, 'direction'),
2306
+ 'account': this.safeString(last, 'account'),
2307
+ 'referenceId': undefined,
2308
+ 'referenceAccount': undefined,
2309
+ 'type': this.safeString(last, 'type'),
2310
+ 'currency': this.safeString(last, 'currency'),
2311
+ 'amount': this.safeNumber(last, 'amount'),
2312
+ 'before': undefined,
2313
+ 'after': undefined,
2314
+ 'status': this.safeString(last, 'status'),
2315
+ 'fee': {
2316
+ 'cost': this.safeNumber(lastFee, 'cost'),
2317
+ 'currency': this.safeString(lastFee, 'currency'),
2318
+ },
2319
+ };
2300
2320
  }
2301
2321
  return ledger;
2302
2322
  }
@@ -2576,6 +2596,7 @@ export default class coinbase extends Exchange {
2576
2596
  }
2577
2597
  const currencyId = this.safeString(amountInfo, 'currency');
2578
2598
  const code = this.safeCurrencyCode(currencyId, currency);
2599
+ currency = this.safeCurrency(currencyId, currency);
2579
2600
  //
2580
2601
  // the address and txid do not belong to the unified ledger structure
2581
2602
  //
@@ -2611,7 +2632,7 @@ export default class coinbase extends Exchange {
2611
2632
  accountId = parts[3];
2612
2633
  }
2613
2634
  }
2614
- return {
2635
+ return this.safeLedgerEntry({
2615
2636
  'info': item,
2616
2637
  'id': id,
2617
2638
  'timestamp': timestamp,
@@ -2627,7 +2648,7 @@ export default class coinbase extends Exchange {
2627
2648
  'after': undefined,
2628
2649
  'status': status,
2629
2650
  'fee': fee,
2630
- };
2651
+ }, currency);
2631
2652
  }
2632
2653
  async findAccountId(code, params = {}) {
2633
2654
  await this.loadMarkets();
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinbaseexchange.js';
2
- import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Market, Currency, Num, Account, Currencies, TradingFees, Dict, int } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Strings, Market, Currency, Num, Account, Currencies, TradingFees, Dict, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class coinbaseexchange
5
5
  * @augments Exchange
@@ -41,24 +41,8 @@ export default class coinbaseexchange extends Exchange {
41
41
  fetchPaymentMethods(params?: {}): Promise<any>;
42
42
  withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
43
43
  parseLedgerEntryType(type: any): string;
44
- parseLedgerEntry(item: Dict, currency?: Currency): {
45
- id: string;
46
- currency: string;
47
- account: any;
48
- referenceAccount: any;
49
- referenceId: any;
50
- status: string;
51
- amount: number;
52
- before: number;
53
- after: number;
54
- fee: any;
55
- direction: any;
56
- timestamp: number;
57
- datetime: string;
58
- type: string;
59
- info: Dict;
60
- };
61
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
44
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
45
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
62
46
  fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
63
47
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
64
48
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
@@ -1472,33 +1472,33 @@ export default class coinbaseexchange extends Exchange {
1472
1472
  referenceId = this.safeString(details, 'order_id');
1473
1473
  }
1474
1474
  const status = 'ok';
1475
- return {
1475
+ return this.safeLedgerEntry({
1476
+ 'info': item,
1476
1477
  'id': id,
1477
- 'currency': code,
1478
+ 'timestamp': timestamp,
1479
+ 'datetime': this.iso8601(timestamp),
1480
+ 'direction': direction,
1478
1481
  'account': account,
1479
1482
  'referenceAccount': referenceAccount,
1480
1483
  'referenceId': referenceId,
1481
- 'status': status,
1484
+ 'type': type,
1485
+ 'currency': code,
1482
1486
  'amount': amount,
1483
1487
  'before': before,
1484
1488
  'after': after,
1489
+ 'status': status,
1485
1490
  'fee': undefined,
1486
- 'direction': direction,
1487
- 'timestamp': timestamp,
1488
- 'datetime': this.iso8601(timestamp),
1489
- 'type': type,
1490
- 'info': item,
1491
- };
1491
+ }, currency);
1492
1492
  }
1493
1493
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
1494
1494
  /**
1495
1495
  * @method
1496
1496
  * @name coinbaseexchange#fetchLedger
1497
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
1497
1498
  * @see https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger
1498
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
1499
1499
  * @param {string} code unified currency code, default is undefined
1500
1500
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1501
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
1501
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
1502
1502
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1503
1503
  * @param {int} [params.until] the latest time in ms to fetch trades for
1504
1504
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinlist.js';
2
- import type { Account, Balances, Currencies, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry, int } from './base/types.js';
2
+ import type { Account, Balances, Currencies, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class coinlist
5
5
  * @augments Exchange
@@ -56,24 +56,8 @@ export default class coinlist extends Exchange {
56
56
  withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
57
57
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
58
58
  parseTransactionType(type: any): string;
59
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
60
- parseLedgerEntry(item: Dict, currency?: Currency): {
61
- info: Dict;
62
- id: string;
63
- timestamp: number;
64
- datetime: string;
65
- direction: any;
66
- account: string;
67
- referenceId: any;
68
- referenceAccount: any;
69
- type: string;
70
- currency: string;
71
- amount: number;
72
- before: any;
73
- after: any;
74
- status: string;
75
- fee: any;
76
- };
59
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
60
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
77
61
  parseLedgerEntryType(type: any): string;
78
62
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
79
63
  url: string;
@@ -2087,11 +2087,11 @@ export default class coinlist extends Exchange {
2087
2087
  /**
2088
2088
  * @method
2089
2089
  * @name coinlist#fetchLedger
2090
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2090
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2091
2091
  * @see https://trade-docs.coinlist.co/?javascript--nodejs#get-account-history
2092
- * @param {string} code unified currency code, default is undefined
2092
+ * @param {string} [code] unified currency code, default is undefined
2093
2093
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2094
- * @param {int} [limit] max number of ledger entrys to return (default 200, max 500)
2094
+ * @param {int} [limit] max number of ledger entries to return (default 200, max 500)
2095
2095
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2096
2096
  * @param {int} [params.until] the latest time in ms to fetch entries for
2097
2097
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
@@ -2275,8 +2275,9 @@ export default class coinlist extends Exchange {
2275
2275
  }
2276
2276
  const currencyId = this.safeString(item, 'asset');
2277
2277
  const code = this.safeCurrencyCode(currencyId, currency);
2278
+ currency = this.safeCurrency(currencyId, currency);
2278
2279
  const type = this.parseLedgerEntryType(this.safeString(item, 'type'));
2279
- return {
2280
+ return this.safeLedgerEntry({
2280
2281
  'info': item,
2281
2282
  'id': id,
2282
2283
  'timestamp': timestamp,
@@ -2292,7 +2293,7 @@ export default class coinlist extends Exchange {
2292
2293
  'after': undefined,
2293
2294
  'status': 'ok',
2294
2295
  'fee': undefined,
2295
- };
2296
+ }, currency);
2296
2297
  }
2297
2298
  parseLedgerEntryType(type) {
2298
2299
  const types = {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/coinmetro.js';
2
- import { Balances, Currencies, Currency, Dict, IndexType, int, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade } from './base/types.js';
2
+ import { Balances, Currencies, Currency, Dict, IndexType, int, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class coinmetro
5
5
  * @augments Exchange
@@ -23,24 +23,8 @@ export default class coinmetro extends Exchange {
23
23
  parseTicker(ticker: Dict, market?: Market): Ticker;
24
24
  fetchBalance(params?: {}): Promise<Balances>;
25
25
  parseBalance(balances: any): Balances;
26
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
27
- parseLedgerEntry(item: Dict, currency?: Currency): {
28
- id: string;
29
- timestamp: number;
30
- datetime: string;
31
- direction: string;
32
- account: string;
33
- referenceId: string;
34
- referenceAccount: string;
35
- type: string;
36
- currency: string;
37
- amount: number;
38
- before: number;
39
- after: number;
40
- status: string;
41
- fee: any;
42
- info: import("./base/types.js").Dictionary<any>;
43
- };
26
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
27
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
44
28
  parseLedgerEntryDescription(description: any): any[];
45
29
  parseLedgerEntryType(type: any): string;
46
30
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
@@ -987,11 +987,11 @@ export default class coinmetro extends Exchange {
987
987
  /**
988
988
  * @method
989
989
  * @name coinmetro#fetchLedger
990
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
990
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
991
991
  * @see https://documenter.getpostman.com/view/3653795/SVfWN6KS#4e7831f7-a0e7-4c3e-9336-1d0e5dcb15cf
992
- * @param {string} code unified currency code, default is undefined
992
+ * @param {string} [code] unified currency code, default is undefined
993
993
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
994
- * @param {int} [limit] max number of ledger entrys to return (default 200, max 500)
994
+ * @param {int} [limit] max number of ledger entries to return (default 200, max 500)
995
995
  * @param {object} [params] extra parameters specific to the exchange API endpoint
996
996
  * @param {int} [params.until] the latest time in ms to fetch entries for
997
997
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/cryptocom.js';
2
- import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, Str, Ticker, OrderRequest, Balances, Transaction, OrderBook, Tickers, Strings, Currency, Market, Num, Account, CancellationRequest, Dict, int, TradingFeeInterface, TradingFees } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, Str, Ticker, OrderRequest, Balances, Transaction, OrderBook, Tickers, Strings, Currency, Market, Num, Account, CancellationRequest, Dict, int, TradingFeeInterface, TradingFees, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class cryptocom
5
5
  * @augments Exchange
@@ -44,27 +44,8 @@ export default class cryptocom extends Exchange {
44
44
  customHandleMarginModeAndParams(methodName: any, params?: {}): any[];
45
45
  parseDepositWithdrawFee(fee: any, currency?: Currency): Dict;
46
46
  fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<any>;
47
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
48
- parseLedgerEntry(item: Dict, currency?: Currency): {
49
- id: string;
50
- direction: any;
51
- account: string;
52
- referenceId: string;
53
- referenceAccount: string;
54
- type: string;
55
- currency: string;
56
- amount: number;
57
- timestamp: number;
58
- datetime: string;
59
- before: any;
60
- after: any;
61
- status: any;
62
- fee: {
63
- currency: any;
64
- cost: any;
65
- };
66
- info: Dict;
67
- };
47
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
48
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
68
49
  parseLedgerEntryType(type: any): string;
69
50
  fetchAccounts(params?: {}): Promise<Account[]>;
70
51
  parseAccount(account: any): {
@@ -605,7 +605,7 @@ export default class cryptocom extends Exchange {
605
605
  * @method
606
606
  * @name cryptocom#fetchTickers
607
607
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
608
- * @see https://exchange-docs.crypto.com/spot/index.html#public-get-ticker
608
+ * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-tickers
609
609
  * @see https://exchange-docs.crypto.com/derivatives/index.html#public-get-tickers
610
610
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
611
611
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1799,6 +1799,7 @@ export default class cryptocom extends Exchange {
1799
1799
  * @method
1800
1800
  * @name cryptocom#fetchDepositAddress
1801
1801
  * @description fetch the deposit address for a currency associated with this account
1802
+ * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-deposit-address
1802
1803
  * @param {string} code unified currency code
1803
1804
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1804
1805
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -2395,7 +2396,7 @@ export default class cryptocom extends Exchange {
2395
2396
  * @name cryptocom#fetchLedger
2396
2397
  * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2397
2398
  * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-transactions
2398
- * @param {string} code unified currency code
2399
+ * @param {string} [code] unified currency code
2399
2400
  * @param {int} [since] timestamp in ms of the earliest ledger entry
2400
2401
  * @param {int} [limit] max number of ledger entries to return
2401
2402
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2476,6 +2477,8 @@ export default class cryptocom extends Exchange {
2476
2477
  //
2477
2478
  const timestamp = this.safeInteger(item, 'event_timestamp_ms');
2478
2479
  const currencyId = this.safeString(item, 'instrument_name');
2480
+ const code = this.safeCurrencyCode(currencyId, currency);
2481
+ currency = this.safeCurrency(currencyId, currency);
2479
2482
  let amount = this.safeString(item, 'transaction_qty');
2480
2483
  let direction = undefined;
2481
2484
  if (Precise.stringLt(amount, '0')) {
@@ -2485,14 +2488,15 @@ export default class cryptocom extends Exchange {
2485
2488
  else {
2486
2489
  direction = 'in';
2487
2490
  }
2488
- return {
2491
+ return this.safeLedgerEntry({
2492
+ 'info': item,
2489
2493
  'id': this.safeString(item, 'order_id'),
2490
2494
  'direction': direction,
2491
2495
  'account': this.safeString(item, 'account_id'),
2492
2496
  'referenceId': this.safeString(item, 'trade_id'),
2493
2497
  'referenceAccount': this.safeString(item, 'trade_match_id'),
2494
2498
  'type': this.parseLedgerEntryType(this.safeString(item, 'journal_type')),
2495
- 'currency': this.safeCurrencyCode(currencyId, currency),
2499
+ 'currency': code,
2496
2500
  'amount': this.parseNumber(amount),
2497
2501
  'timestamp': timestamp,
2498
2502
  'datetime': this.iso8601(timestamp),
@@ -2503,8 +2507,7 @@ export default class cryptocom extends Exchange {
2503
2507
  'currency': undefined,
2504
2508
  'cost': undefined,
2505
2509
  },
2506
- 'info': item,
2507
- };
2510
+ }, currency);
2508
2511
  }
2509
2512
  parseLedgerEntryType(type) {
2510
2513
  const ledgerType = {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/currencycom.js';
2
- import type { Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Leverage, Num, Account, Currencies, TradingFees, Dict, int } from './base/types.js';
2
+ import type { Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Leverage, Num, Account, Currencies, TradingFees, Dict, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class currencycom
5
5
  * @augments Exchange
@@ -39,8 +39,8 @@ export default class currencycom extends Exchange {
39
39
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
40
40
  parseTransactionStatus(status: Str): string;
41
41
  parseTransactionType(type: any): string;
42
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
43
- parseLedgerEntry(item: Dict, currency?: Currency): Dict;
42
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
43
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
44
44
  parseLedgerEntryStatus(status: any): string;
45
45
  parseLedgerEntryType(type: any): string;
46
46
  fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
@@ -1695,11 +1695,11 @@ export default class currencycom extends Exchange {
1695
1695
  /**
1696
1696
  * @method
1697
1697
  * @name currencycom#fetchLedger
1698
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
1698
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
1699
1699
  * @see https://apitradedoc.currency.com/swagger-ui.html#/rest-api/getLedgerUsingGET
1700
- * @param {string} code unified currency code, default is undefined
1700
+ * @param {string} [code] unified currency code, default is undefined
1701
1701
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1702
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
1702
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
1703
1703
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1704
1704
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1705
1705
  */
@@ -1752,13 +1752,14 @@ export default class currencycom extends Exchange {
1752
1752
  const timestamp = this.safeInteger(item, 'timestamp');
1753
1753
  const currencyId = this.safeString(item, 'currency');
1754
1754
  const code = this.safeCurrencyCode(currencyId, currency);
1755
+ currency = this.safeCurrency(currencyId, currency);
1755
1756
  const feeCost = this.safeString(item, 'commission');
1756
1757
  let fee = undefined;
1757
1758
  if (feeCost !== undefined) {
1758
1759
  fee = { 'currency': code, 'cost': feeCost };
1759
1760
  }
1760
1761
  const direction = Precise.stringLt(amountString, '0') ? 'out' : 'in';
1761
- const result = {
1762
+ return this.safeLedgerEntry({
1762
1763
  'id': id,
1763
1764
  'timestamp': timestamp,
1764
1765
  'datetime': this.iso8601(timestamp),
@@ -1774,8 +1775,7 @@ export default class currencycom extends Exchange {
1774
1775
  'status': this.parseLedgerEntryStatus(this.safeString(item, 'status')),
1775
1776
  'fee': fee,
1776
1777
  'info': item,
1777
- };
1778
- return result;
1778
+ }, currency);
1779
1779
  }
1780
1780
  parseLedgerEntryStatus(status) {
1781
1781
  const statuses = {
package/js/src/delta.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/delta.js';
2
- import type { Balances, Currency, Greeks, Int, Market, MarketInterface, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Position, Leverage, MarginMode, Num, Option, MarginModification, Currencies, Dict, int } from './base/types.js';
2
+ import type { Balances, Currency, Greeks, Int, Market, MarketInterface, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Position, Leverage, MarginMode, Num, Option, MarginModification, Currencies, Dict, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class delta
5
5
  * @augments Exchange
@@ -43,25 +43,9 @@ export default class delta extends Exchange {
43
43
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
44
44
  fetchOrdersWithMethod(method: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
45
45
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
46
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
46
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
47
47
  parseLedgerEntryType(type: any): string;
48
- parseLedgerEntry(item: Dict, currency?: Currency): {
49
- info: Dict;
50
- id: string;
51
- direction: any;
52
- account: any;
53
- referenceId: string;
54
- referenceAccount: any;
55
- type: string;
56
- currency: string;
57
- amount: number;
58
- before: number;
59
- after: number;
60
- status: string;
61
- timestamp: number;
62
- datetime: string;
63
- fee: any;
64
- };
48
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
65
49
  fetchDepositAddress(code: string, params?: {}): Promise<{
66
50
  currency: string;
67
51
  address: string;
package/js/src/delta.js CHANGED
@@ -2191,11 +2191,11 @@ export default class delta extends Exchange {
2191
2191
  /**
2192
2192
  * @method
2193
2193
  * @name delta#fetchLedger
2194
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2194
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2195
2195
  * @see https://docs.delta.exchange/#get-wallet-transactions
2196
- * @param {string} code unified currency code, default is undefined
2196
+ * @param {string} [code] unified currency code, default is undefined
2197
2197
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2198
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2198
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2199
2199
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2200
2200
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2201
2201
  */
@@ -2294,7 +2294,7 @@ export default class delta extends Exchange {
2294
2294
  const after = this.safeString(item, 'balance');
2295
2295
  const before = Precise.stringMax('0', Precise.stringSub(after, amount));
2296
2296
  const status = 'ok';
2297
- return {
2297
+ return this.safeLedgerEntry({
2298
2298
  'info': item,
2299
2299
  'id': id,
2300
2300
  'direction': direction,
@@ -2310,7 +2310,7 @@ export default class delta extends Exchange {
2310
2310
  'timestamp': timestamp,
2311
2311
  'datetime': this.iso8601(timestamp),
2312
2312
  'fee': undefined,
2313
- };
2313
+ }, currency);
2314
2314
  }
2315
2315
  async fetchDepositAddress(code, params = {}) {
2316
2316
  /**