ccxt 4.4.3 → 4.4.5

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 (134) 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 +42 -15
  9. package/dist/cjs/src/binanceus.js +1 -0
  10. package/dist/cjs/src/bingx.js +1 -0
  11. package/dist/cjs/src/bitfinex2.js +7 -6
  12. package/dist/cjs/src/bitget.js +57 -100
  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 +9 -9
  16. package/dist/cjs/src/blofin.js +21 -23
  17. package/dist/cjs/src/bybit.js +100 -26
  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 +7 -5
  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/lykke.js +2 -2
  34. package/dist/cjs/src/mexc.js +42 -3
  35. package/dist/cjs/src/ndax.js +6 -5
  36. package/dist/cjs/src/okcoin.js +18 -27
  37. package/dist/cjs/src/okx.js +18 -26
  38. package/dist/cjs/src/p2b.js +2 -2
  39. package/dist/cjs/src/paradex.js +1 -1
  40. package/dist/cjs/src/pro/binance.js +6 -2
  41. package/dist/cjs/src/pro/binanceus.js +2 -1
  42. package/dist/cjs/src/pro/bybit.js +56 -0
  43. package/dist/cjs/src/pro/hyperliquid.js +16 -1
  44. package/dist/cjs/src/pro/mexc.js +83 -0
  45. package/dist/cjs/src/pro/paradex.js +1 -0
  46. package/dist/cjs/src/woo.js +7 -6
  47. package/dist/cjs/src/woofipro.js +8 -6
  48. package/dist/cjs/src/xt.js +4 -3
  49. package/dist/cjs/src/zonda.js +6 -5
  50. package/js/ccxt.d.ts +1 -1
  51. package/js/ccxt.js +1 -1
  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 +42 -15
  60. package/js/src/binanceus.js +1 -0
  61. package/js/src/bingx.js +1 -0
  62. package/js/src/bitfinex2.d.ts +3 -19
  63. package/js/src/bitfinex2.js +7 -6
  64. package/js/src/bitget.d.ts +3 -20
  65. package/js/src/bitget.js +57 -100
  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 +9 -9
  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 +100 -26
  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 +7 -5
  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/lykke.js +2 -2
  107. package/js/src/mexc.js +42 -3
  108. package/js/src/ndax.d.ts +3 -19
  109. package/js/src/ndax.js +6 -5
  110. package/js/src/okcoin.d.ts +3 -19
  111. package/js/src/okcoin.js +18 -27
  112. package/js/src/okx.d.ts +3 -19
  113. package/js/src/okx.js +18 -26
  114. package/js/src/p2b.js +2 -2
  115. package/js/src/paradex.js +1 -1
  116. package/js/src/pro/binance.d.ts +140 -0
  117. package/js/src/pro/binance.js +6 -2
  118. package/js/src/pro/binanceus.js +2 -1
  119. package/js/src/pro/bybit.d.ts +2 -0
  120. package/js/src/pro/bybit.js +56 -0
  121. package/js/src/pro/hyperliquid.d.ts +1 -0
  122. package/js/src/pro/hyperliquid.js +16 -1
  123. package/js/src/pro/mexc.d.ts +4 -1
  124. package/js/src/pro/mexc.js +84 -1
  125. package/js/src/pro/paradex.js +1 -0
  126. package/js/src/woo.d.ts +3 -19
  127. package/js/src/woo.js +7 -6
  128. package/js/src/woofipro.d.ts +3 -19
  129. package/js/src/woofipro.js +8 -6
  130. package/js/src/xt.d.ts +3 -22
  131. package/js/src/xt.js +4 -3
  132. package/js/src/zonda.d.ts +3 -19
  133. package/js/src/zonda.js +6 -5
  134. package/package.json +1 -1
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
@@ -101,7 +101,7 @@ export default class bybit extends Exchange {
101
101
  'fetchOpenOrders': true,
102
102
  'fetchOption': true,
103
103
  'fetchOptionChain': true,
104
- 'fetchOrder': false,
104
+ 'fetchOrder': true,
105
105
  'fetchOrderBook': true,
106
106
  'fetchOrders': false,
107
107
  'fetchOrderTrades': true,
@@ -4876,14 +4876,87 @@ export default class bybit extends Exchange {
4876
4876
  * @param {string} id the order id
4877
4877
  * @param {string} symbol unified symbol of the market the order was made in
4878
4878
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4879
+ * @param {object} [params.acknowledged] to suppress the warning, set to true
4879
4880
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
4880
4881
  */
4881
- const res = await this.isUnifiedEnabled();
4882
- const enableUnifiedAccount = this.safeBool(res, 1);
4883
- if (enableUnifiedAccount) {
4884
- throw new NotSupported(this.id + ' fetchOrder() is not supported after the 5/02 update for UTA accounts, please use fetchOpenOrder or fetchClosedOrder');
4882
+ await this.loadMarkets();
4883
+ const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
4884
+ const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
4885
+ if (!isUnifiedAccount) {
4886
+ return await this.fetchOrderClassic(id, symbol, params);
4885
4887
  }
4886
- return await this.fetchOrderClassic(id, symbol, params);
4888
+ let acknowledge = false;
4889
+ [acknowledge, params] = this.handleOptionAndParams(params, 'fetchOrder', 'acknowledged');
4890
+ if (!acknowledge) {
4891
+ throw new ArgumentsRequired(this.id + ' fetchOrder() can only access an order if it is in last 500 orders (of any status) for your account. Set params["acknowledged"] = true to hide this warning. Alternatively, we suggest to use fetchOpenOrder or fetchClosedOrder');
4892
+ }
4893
+ const market = this.market(symbol);
4894
+ let marketType = undefined;
4895
+ [marketType, params] = this.getBybitType('fetchOrder', market, params);
4896
+ const request = {
4897
+ 'symbol': market['id'],
4898
+ 'orderId': id,
4899
+ 'category': marketType,
4900
+ };
4901
+ let isTrigger = undefined;
4902
+ [isTrigger, params] = this.handleParamBool2(params, 'trigger', 'stop', false);
4903
+ if (isTrigger) {
4904
+ request['orderFilter'] = 'StopOrder';
4905
+ }
4906
+ const response = await this.privateGetV5OrderRealtime(this.extend(request, params));
4907
+ //
4908
+ // {
4909
+ // "retCode": 0,
4910
+ // "retMsg": "OK",
4911
+ // "result": {
4912
+ // "nextPageCursor": "1321052653536515584%3A1672217748287%2C1321052653536515584%3A1672217748287",
4913
+ // "category": "spot",
4914
+ // "list": [
4915
+ // {
4916
+ // "symbol": "ETHUSDT",
4917
+ // "orderType": "Limit",
4918
+ // "orderLinkId": "1672217748277652",
4919
+ // "orderId": "1321052653536515584",
4920
+ // "cancelType": "UNKNOWN",
4921
+ // "avgPrice": "",
4922
+ // "stopOrderType": "tpslOrder",
4923
+ // "lastPriceOnCreated": "",
4924
+ // "orderStatus": "Cancelled",
4925
+ // "takeProfit": "",
4926
+ // "cumExecValue": "0",
4927
+ // "triggerDirection": 0,
4928
+ // "isLeverage": "0",
4929
+ // "rejectReason": "",
4930
+ // "price": "1000",
4931
+ // "orderIv": "",
4932
+ // "createdTime": "1672217748287",
4933
+ // "tpTriggerBy": "",
4934
+ // "positionIdx": 0,
4935
+ // "timeInForce": "GTC",
4936
+ // "leavesValue": "500",
4937
+ // "updatedTime": "1672217748287",
4938
+ // "side": "Buy",
4939
+ // "triggerPrice": "1500",
4940
+ // "cumExecFee": "0",
4941
+ // "leavesQty": "0",
4942
+ // "slTriggerBy": "",
4943
+ // "closeOnTrigger": false,
4944
+ // "cumExecQty": "0",
4945
+ // "reduceOnly": false,
4946
+ // "qty": "0.5",
4947
+ // "stopLoss": "",
4948
+ // "triggerBy": "1192.5"
4949
+ // }
4950
+ // ]
4951
+ // },
4952
+ // "retExtInfo": {},
4953
+ // "time": 1672219526294
4954
+ // }
4955
+ //
4956
+ const result = this.safeDict(response, 'result', {});
4957
+ const innerList = this.safeList(result, 'list', []);
4958
+ const order = this.safeDict(innerList, 0, {});
4959
+ return this.parseOrder(order, market);
4887
4960
  }
4888
4961
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4889
4962
  const res = await this.isUnifiedEnabled();
@@ -5926,13 +5999,13 @@ export default class bybit extends Exchange {
5926
5999
  /**
5927
6000
  * @method
5928
6001
  * @name bybit#fetchLedger
5929
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
6002
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
5930
6003
  * @see https://bybit-exchange.github.io/docs/v5/account/transaction-log
5931
6004
  * @see https://bybit-exchange.github.io/docs/v5/account/contract-transaction-log
5932
- * @param {string} code unified currency code, default is undefined
6005
+ * @param {string} [code] unified currency code, default is undefined
5933
6006
  * @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)
6007
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
6008
+ * @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
6009
  * @param {string} [params.subType] if inverse will use v5/account/contract-transaction-log
5937
6010
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5938
6011
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
@@ -6142,6 +6215,7 @@ export default class bybit extends Exchange {
6142
6215
  //
6143
6216
  const currencyId = this.safeString2(item, 'coin', 'currency');
6144
6217
  const code = this.safeCurrencyCode(currencyId, currency);
6218
+ currency = this.safeCurrency(currencyId, currency);
6145
6219
  const amount = this.safeString2(item, 'amount', 'change');
6146
6220
  const after = this.safeString2(item, 'wallet_balance', 'cashBalance');
6147
6221
  const direction = Precise.stringLt(amount, '0') ? 'out' : 'in';
@@ -6154,26 +6228,26 @@ export default class bybit extends Exchange {
6154
6228
  if (timestamp === undefined) {
6155
6229
  timestamp = this.safeInteger(item, 'transactionTime');
6156
6230
  }
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,
6231
+ return this.safeLedgerEntry({
6232
+ 'info': item,
6233
+ 'id': this.safeString(item, 'id'),
6234
+ 'direction': direction,
6163
6235
  'account': this.safeString(item, 'wallet_id'),
6236
+ 'referenceId': this.safeString(item, 'tx_id'),
6164
6237
  '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,
6238
+ 'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
6239
+ 'currency': code,
6240
+ 'amount': this.parseToNumeric(Precise.stringAbs(amount)),
6172
6241
  'timestamp': timestamp,
6173
6242
  'datetime': this.iso8601(timestamp),
6174
- 'type': type,
6175
- 'info': item,
6176
- };
6243
+ 'before': this.parseToNumeric(before),
6244
+ 'after': this.parseToNumeric(after),
6245
+ 'status': 'ok',
6246
+ 'fee': {
6247
+ 'currency': code,
6248
+ 'cost': this.parseToNumeric(this.safeString(item, 'fee')),
6249
+ },
6250
+ }, currency);
6177
6251
  }
6178
6252
  parseLedgerEntryType(type) {
6179
6253
  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): {