ccxt 4.4.3 → 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 (120) 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 +39 -12
  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/bitmex.js +11 -10
  13. package/dist/cjs/src/bitso.js +5 -4
  14. package/dist/cjs/src/bitstamp.js +9 -9
  15. package/dist/cjs/src/blofin.js +21 -23
  16. package/dist/cjs/src/bybit.js +21 -20
  17. package/dist/cjs/src/coinbase.js +28 -7
  18. package/dist/cjs/src/coinbaseexchange.js +11 -11
  19. package/dist/cjs/src/coinlist.js +6 -5
  20. package/dist/cjs/src/coinmetro.js +3 -3
  21. package/dist/cjs/src/cryptocom.js +7 -5
  22. package/dist/cjs/src/currencycom.js +6 -6
  23. package/dist/cjs/src/delta.js +5 -5
  24. package/dist/cjs/src/digifinex.js +8 -6
  25. package/dist/cjs/src/gate.js +6 -5
  26. package/dist/cjs/src/hashkey.js +9 -7
  27. package/dist/cjs/src/htx.js +13 -16
  28. package/dist/cjs/src/hyperliquid.js +67 -114
  29. package/dist/cjs/src/kraken.js +8 -6
  30. package/dist/cjs/src/kucoin.js +9 -8
  31. package/dist/cjs/src/luno.js +10 -9
  32. package/dist/cjs/src/mexc.js +35 -2
  33. package/dist/cjs/src/ndax.js +6 -5
  34. package/dist/cjs/src/okcoin.js +18 -27
  35. package/dist/cjs/src/okx.js +18 -26
  36. package/dist/cjs/src/p2b.js +2 -2
  37. package/dist/cjs/src/pro/bybit.js +56 -0
  38. package/dist/cjs/src/pro/mexc.js +83 -0
  39. package/dist/cjs/src/woo.js +7 -6
  40. package/dist/cjs/src/woofipro.js +8 -6
  41. package/dist/cjs/src/xt.js +4 -3
  42. package/dist/cjs/src/zonda.js +6 -5
  43. package/js/ccxt.d.ts +1 -1
  44. package/js/ccxt.js +1 -1
  45. package/js/src/base/Exchange.d.ts +2 -2
  46. package/js/src/base/Exchange.js +2 -2
  47. package/js/src/base/functions/misc.d.ts +2 -1
  48. package/js/src/base/functions/misc.js +11 -1
  49. package/js/src/base/types.d.ts +1 -1
  50. package/js/src/base/ws/WsClient.js +2 -2
  51. package/js/src/binance.d.ts +4 -20
  52. package/js/src/binance.js +39 -12
  53. package/js/src/bingx.js +1 -0
  54. package/js/src/bitfinex2.d.ts +3 -19
  55. package/js/src/bitfinex2.js +7 -6
  56. package/js/src/bitget.d.ts +3 -19
  57. package/js/src/bitget.js +10 -6
  58. package/js/src/bitmex.d.ts +3 -22
  59. package/js/src/bitmex.js +11 -10
  60. package/js/src/bitso.d.ts +3 -19
  61. package/js/src/bitso.js +5 -4
  62. package/js/src/bitstamp.d.ts +3 -35
  63. package/js/src/bitstamp.js +9 -9
  64. package/js/src/blofin.d.ts +3 -15
  65. package/js/src/blofin.js +21 -23
  66. package/js/src/bybit.d.ts +3 -19
  67. package/js/src/bybit.js +21 -20
  68. package/js/src/coinbase.d.ts +3 -19
  69. package/js/src/coinbase.js +28 -7
  70. package/js/src/coinbaseexchange.d.ts +3 -19
  71. package/js/src/coinbaseexchange.js +11 -11
  72. package/js/src/coinlist.d.ts +3 -19
  73. package/js/src/coinlist.js +6 -5
  74. package/js/src/coinmetro.d.ts +3 -19
  75. package/js/src/coinmetro.js +3 -3
  76. package/js/src/cryptocom.d.ts +3 -22
  77. package/js/src/cryptocom.js +7 -5
  78. package/js/src/currencycom.d.ts +3 -3
  79. package/js/src/currencycom.js +6 -6
  80. package/js/src/delta.d.ts +3 -19
  81. package/js/src/delta.js +5 -5
  82. package/js/src/digifinex.d.ts +3 -19
  83. package/js/src/digifinex.js +8 -6
  84. package/js/src/gate.d.ts +3 -19
  85. package/js/src/gate.js +6 -5
  86. package/js/src/hashkey.d.ts +3 -20
  87. package/js/src/hashkey.js +9 -7
  88. package/js/src/htx.d.ts +3 -19
  89. package/js/src/htx.js +13 -16
  90. package/js/src/hyperliquid.d.ts +3 -19
  91. package/js/src/hyperliquid.js +68 -115
  92. package/js/src/kraken.d.ts +5 -24
  93. package/js/src/kraken.js +8 -6
  94. package/js/src/kucoin.d.ts +3 -19
  95. package/js/src/kucoin.js +9 -8
  96. package/js/src/luno.d.ts +4 -20
  97. package/js/src/luno.js +10 -9
  98. package/js/src/mexc.js +35 -2
  99. package/js/src/ndax.d.ts +3 -19
  100. package/js/src/ndax.js +6 -5
  101. package/js/src/okcoin.d.ts +3 -19
  102. package/js/src/okcoin.js +18 -27
  103. package/js/src/okx.d.ts +3 -19
  104. package/js/src/okx.js +18 -26
  105. package/js/src/p2b.js +2 -2
  106. package/js/src/pro/bybit.d.ts +2 -0
  107. package/js/src/pro/bybit.js +56 -0
  108. package/js/src/pro/mexc.d.ts +4 -1
  109. package/js/src/pro/mexc.js +84 -1
  110. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  111. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
  112. package/js/src/woo.d.ts +3 -19
  113. package/js/src/woo.js +7 -6
  114. package/js/src/woofipro.d.ts +3 -19
  115. package/js/src/woofipro.js +8 -6
  116. package/js/src/xt.d.ts +3 -22
  117. package/js/src/xt.js +4 -3
  118. package/js/src/zonda.d.ts +3 -19
  119. package/js/src/zonda.js +6 -5
  120. package/package.json +1 -1
package/js/src/bitso.js CHANGED
@@ -194,10 +194,10 @@ export default class bitso extends Exchange {
194
194
  /**
195
195
  * @method
196
196
  * @name bitso#fetchLedger
197
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
198
- * @param {string} code unified currency code, default is undefined
197
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
198
+ * @param {string} [code] unified currency code, default is undefined
199
199
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
200
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
200
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
201
201
  * @param {object} [params] extra parameters specific to the exchange API endpoint
202
202
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
203
203
  */
@@ -306,6 +306,7 @@ export default class bitso extends Exchange {
306
306
  const amount = this.safeString(firstBalance, 'amount');
307
307
  const currencyId = this.safeString(firstBalance, 'currency');
308
308
  const code = this.safeCurrencyCode(currencyId, currency);
309
+ currency = this.safeCurrency(currencyId, currency);
309
310
  const details = this.safeValue(item, 'details', {});
310
311
  let referenceId = this.safeString2(details, 'fid', 'wid');
311
312
  if (referenceId === undefined) {
@@ -330,6 +331,7 @@ export default class bitso extends Exchange {
330
331
  }
331
332
  const timestamp = this.parse8601(this.safeString(item, 'created_at'));
332
333
  return this.safeLedgerEntry({
334
+ 'info': item,
333
335
  'id': this.safeString(item, 'eid'),
334
336
  'direction': direction,
335
337
  'account': undefined,
@@ -344,7 +346,6 @@ export default class bitso extends Exchange {
344
346
  'after': undefined,
345
347
  'status': 'ok',
346
348
  'fee': fee,
347
- 'info': item,
348
349
  }, currency);
349
350
  }
350
351
  async fetchMarkets(params = {}) {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitstamp.js';
2
- import type { Balances, Currencies, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry, int } from './base/types.js';
2
+ import type { Balances, Currencies, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class bitstamp
5
5
  * @augments Exchange
@@ -73,40 +73,8 @@ export default class bitstamp extends Exchange {
73
73
  parseTransactionStatus(status: Str): string;
74
74
  parseOrder(order: Dict, market?: Market): Order;
75
75
  parseLedgerEntryType(type: any): string;
76
- parseLedgerEntry(item: Dict, currency?: Currency): {
77
- id: string;
78
- info: Dict;
79
- timestamp: number;
80
- datetime: string;
81
- direction: string;
82
- account: any;
83
- referenceId: string;
84
- referenceAccount: any;
85
- type: string;
86
- currency: any;
87
- amount: number;
88
- before: any;
89
- after: any;
90
- status: string;
91
- fee: import("./base/types.js").FeeInterface;
92
- } | {
93
- id: string;
94
- info: Dict;
95
- timestamp: number;
96
- datetime: string;
97
- direction: any;
98
- account: any;
99
- referenceId: string;
100
- referenceAccount: any;
101
- type: string;
102
- currency: string;
103
- amount: number;
104
- before: any;
105
- after: any;
106
- status: string;
107
- fee: import("./base/types.js").FeeInterface;
108
- };
109
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
76
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
77
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
110
78
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
111
79
  getCurrencyName(code: any): any;
112
80
  isFiat(code: any): boolean;
@@ -1981,9 +1981,9 @@ export default class bitstamp extends Exchange {
1981
1981
  market = this.getMarketFromTrade(item);
1982
1982
  }
1983
1983
  const direction = (parsedTrade['side'] === 'buy') ? 'in' : 'out';
1984
- return {
1985
- 'id': parsedTrade['id'],
1984
+ return this.safeLedgerEntry({
1986
1985
  'info': item,
1986
+ 'id': parsedTrade['id'],
1987
1987
  'timestamp': parsedTrade['timestamp'],
1988
1988
  'datetime': parsedTrade['datetime'],
1989
1989
  'direction': direction,
@@ -1997,7 +1997,7 @@ export default class bitstamp extends Exchange {
1997
1997
  'after': undefined,
1998
1998
  'status': 'ok',
1999
1999
  'fee': parsedTrade['fee'],
2000
- };
2000
+ }, currency);
2001
2001
  }
2002
2002
  else {
2003
2003
  const parsedTransaction = this.parseTransaction(item, currency);
@@ -2012,9 +2012,9 @@ export default class bitstamp extends Exchange {
2012
2012
  const amount = this.safeString(item, currency['id']);
2013
2013
  direction = Precise.stringGt(amount, '0') ? 'in' : 'out';
2014
2014
  }
2015
- return {
2016
- 'id': parsedTransaction['id'],
2015
+ return this.safeLedgerEntry({
2017
2016
  'info': item,
2017
+ 'id': parsedTransaction['id'],
2018
2018
  'timestamp': parsedTransaction['timestamp'],
2019
2019
  'datetime': parsedTransaction['datetime'],
2020
2020
  'direction': direction,
@@ -2028,18 +2028,18 @@ export default class bitstamp extends Exchange {
2028
2028
  'after': undefined,
2029
2029
  'status': parsedTransaction['status'],
2030
2030
  'fee': parsedTransaction['fee'],
2031
- };
2031
+ }, currency);
2032
2032
  }
2033
2033
  }
2034
2034
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
2035
2035
  /**
2036
2036
  * @method
2037
2037
  * @name bitstamp#fetchLedger
2038
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2038
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2039
2039
  * @see https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions
2040
- * @param {string} code unified currency code, default is undefined
2040
+ * @param {string} [code] unified currency code, default is undefined
2041
2041
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2042
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2042
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2043
2043
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2044
2044
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2045
2045
  */
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/blofin.js';
2
- import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, Str, Transaction, Ticker, OrderBook, Balances, Tickers, Market, Strings, Currency, Position, TransferEntry, Leverage, Leverages, MarginMode, Num, TradingFeeInterface, Dict, int } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, Str, Transaction, Ticker, OrderBook, Balances, Tickers, Market, Strings, Currency, Position, TransferEntry, Leverage, Leverages, MarginMode, Num, TradingFeeInterface, Dict, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class blofin
5
5
  * @augments Exchange
@@ -71,23 +71,11 @@ export default class blofin extends Exchange {
71
71
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
72
72
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
73
73
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
74
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
74
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
75
75
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
76
76
  parseTransactionStatus(status: Str): string;
77
77
  parseLedgerEntryType(type: any): string;
78
- parseLedgerEntry(item: Dict, currency?: Currency): {
79
- id: string;
80
- info: Dict;
81
- timestamp: number;
82
- datetime: string;
83
- fromAccount: string;
84
- toAccount: string;
85
- type: string;
86
- currency: string;
87
- amount: number;
88
- clientId: string;
89
- status: string;
90
- };
78
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
91
79
  parseIds(ids: any): any;
92
80
  cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
93
81
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
package/js/src/blofin.js CHANGED
@@ -1506,15 +1506,15 @@ export default class blofin extends Exchange {
1506
1506
  /**
1507
1507
  * @method
1508
1508
  * @name blofin#fetchLedger
1509
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
1509
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
1510
1510
  * @see https://blofin.com/docs#get-funds-transfer-history
1511
- * @param {string} code unified currency code, default is undefined
1511
+ * @param {string} [code] unified currency code, default is undefined
1512
1512
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1513
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
1513
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
1514
1514
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1515
1515
  * @param {string} [params.marginMode] 'cross' or 'isolated'
1516
1516
  * @param {int} [params.until] the latest time in ms to fetch entries for
1517
- * @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)
1517
+ * @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)
1518
1518
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1519
1519
  */
1520
1520
  await this.loadMarkets();
@@ -1650,29 +1650,27 @@ export default class blofin extends Exchange {
1650
1650
  return this.safeString(types, type, type);
1651
1651
  }
1652
1652
  parseLedgerEntry(item, currency = undefined) {
1653
- const id = this.safeString(item, 'transferId');
1654
- const referenceId = this.safeString(item, 'clientId');
1655
- const fromAccount = this.safeString(item, 'fromAccount');
1656
- const toAccount = this.safeString(item, 'toAccount');
1657
- const type = this.parseLedgerEntryType(this.safeString(item, 'type'));
1658
- const code = this.safeCurrencyCode(this.safeString(item, 'currency'), currency);
1659
- const amountString = this.safeString(item, 'amount');
1660
- const amount = this.parseNumber(amountString);
1653
+ const currencyId = this.safeString(item, 'currency');
1654
+ const code = this.safeCurrencyCode(currencyId, currency);
1655
+ currency = this.safeCurrency(currencyId, currency);
1661
1656
  const timestamp = this.safeInteger(item, 'ts');
1662
- const status = 'ok';
1663
- return {
1664
- 'id': id,
1657
+ return this.safeLedgerEntry({
1665
1658
  'info': item,
1659
+ 'id': this.safeString(item, 'transferId'),
1660
+ 'direction': undefined,
1661
+ 'account': undefined,
1662
+ 'referenceId': this.safeString(item, 'clientId'),
1663
+ 'referenceAccount': undefined,
1664
+ 'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
1665
+ 'currency': code,
1666
+ 'amount': this.safeNumber(item, 'amount'),
1666
1667
  'timestamp': timestamp,
1667
1668
  'datetime': this.iso8601(timestamp),
1668
- 'fromAccount': fromAccount,
1669
- 'toAccount': toAccount,
1670
- 'type': type,
1671
- 'currency': code,
1672
- 'amount': amount,
1673
- 'clientId': referenceId,
1674
- 'status': status,
1675
- };
1669
+ 'before': undefined,
1670
+ 'after': undefined,
1671
+ 'status': 'ok',
1672
+ 'fee': undefined,
1673
+ }, currency);
1676
1674
  }
1677
1675
  parseIds(ids) {
1678
1676
  /**
package/js/src/bybit.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bybit.js';
2
- import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory, Option, OptionChain, TradingFeeInterface, Currencies, TradingFees, CancellationRequest, Position, CrossBorrowRate, Dict, LeverageTier, LeverageTiers, int } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, Order, OHLCV, FundingRateHistory, OpenInterest, OrderRequest, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Liquidation, Leverage, Num, FundingHistory, Option, OptionChain, TradingFeeInterface, Currencies, TradingFees, CancellationRequest, Position, CrossBorrowRate, Dict, LeverageTier, LeverageTiers, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class bybit
5
5
  * @augments Exchange
@@ -109,24 +109,8 @@ export default class bybit extends Exchange {
109
109
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
110
110
  parseTransactionStatus(status: Str): string;
111
111
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
112
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
113
- parseLedgerEntry(item: Dict, currency?: Currency): {
114
- id: string;
115
- currency: string;
116
- account: string;
117
- referenceAccount: any;
118
- referenceId: string;
119
- status: any;
120
- amount: number;
121
- before: number;
122
- after: number;
123
- fee: number;
124
- direction: string;
125
- timestamp: number;
126
- datetime: string;
127
- type: string;
128
- info: Dict;
129
- };
112
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
113
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
130
114
  parseLedgerEntryType(type: any): string;
131
115
  withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
132
116
  fetchPosition(symbol: string, params?: {}): Promise<Position>;
package/js/src/bybit.js CHANGED
@@ -5926,13 +5926,13 @@ export default class bybit extends Exchange {
5926
5926
  /**
5927
5927
  * @method
5928
5928
  * @name bybit#fetchLedger
5929
- * @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
5930
5930
  * @see https://bybit-exchange.github.io/docs/v5/account/transaction-log
5931
5931
  * @see https://bybit-exchange.github.io/docs/v5/account/contract-transaction-log
5932
- * @param {string} code unified currency code, default is undefined
5932
+ * @param {string} [code] unified currency code, default is undefined
5933
5933
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
5934
- * @param {int} [limit] max number of ledger entrys 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 [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)
5936
5936
  * @param {string} [params.subType] if inverse will use v5/account/contract-transaction-log
5937
5937
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5938
5938
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
@@ -6142,6 +6142,7 @@ export default class bybit extends Exchange {
6142
6142
  //
6143
6143
  const currencyId = this.safeString2(item, 'coin', 'currency');
6144
6144
  const code = this.safeCurrencyCode(currencyId, currency);
6145
+ currency = this.safeCurrency(currencyId, currency);
6145
6146
  const amount = this.safeString2(item, 'amount', 'change');
6146
6147
  const after = this.safeString2(item, 'wallet_balance', 'cashBalance');
6147
6148
  const direction = Precise.stringLt(amount, '0') ? 'out' : 'in';
@@ -6154,26 +6155,26 @@ export default class bybit extends Exchange {
6154
6155
  if (timestamp === undefined) {
6155
6156
  timestamp = this.safeInteger(item, 'transactionTime');
6156
6157
  }
6157
- const type = this.parseLedgerEntryType(this.safeString(item, 'type'));
6158
- const id = this.safeString(item, 'id');
6159
- const referenceId = this.safeString(item, 'tx_id');
6160
- return {
6161
- 'id': id,
6162
- 'currency': code,
6158
+ return this.safeLedgerEntry({
6159
+ 'info': item,
6160
+ 'id': this.safeString(item, 'id'),
6161
+ 'direction': direction,
6163
6162
  'account': this.safeString(item, 'wallet_id'),
6163
+ 'referenceId': this.safeString(item, 'tx_id'),
6164
6164
  'referenceAccount': undefined,
6165
- 'referenceId': referenceId,
6166
- 'status': undefined,
6167
- 'amount': this.parseNumber(Precise.stringAbs(amount)),
6168
- 'before': this.parseNumber(before),
6169
- 'after': this.parseNumber(after),
6170
- 'fee': this.parseNumber(this.safeString(item, 'fee')),
6171
- 'direction': direction,
6165
+ 'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
6166
+ 'currency': code,
6167
+ 'amount': this.parseToNumeric(Precise.stringAbs(amount)),
6172
6168
  'timestamp': timestamp,
6173
6169
  'datetime': this.iso8601(timestamp),
6174
- 'type': type,
6175
- 'info': item,
6176
- };
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);
6177
6178
  }
6178
6179
  parseLedgerEntryType(type) {
6179
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>;