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
@@ -3597,8 +3597,10 @@ class xt extends xt$1 {
3597
3597
  const side = this.safeString(item, 'side');
3598
3598
  const direction = (side === 'ADD') ? 'in' : 'out';
3599
3599
  const currencyId = this.safeString(item, 'coin');
3600
+ currency = this.safeCurrency(currencyId, currency);
3600
3601
  const timestamp = this.safeInteger(item, 'createdTime');
3601
- return {
3602
+ return this.safeLedgerEntry({
3603
+ 'info': item,
3602
3604
  'id': this.safeString(item, 'id'),
3603
3605
  'direction': direction,
3604
3606
  'account': undefined,
@@ -3616,8 +3618,7 @@ class xt extends xt$1 {
3616
3618
  'currency': undefined,
3617
3619
  'cost': undefined,
3618
3620
  },
3619
- 'info': item,
3620
- };
3621
+ }, currency);
3621
3622
  }
3622
3623
  parseLedgerEntryType(type) {
3623
3624
  const ledgerType = {
@@ -819,11 +819,11 @@ class zonda extends zonda$1 {
819
819
  /**
820
820
  * @method
821
821
  * @name zonda#fetchLedger
822
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
822
823
  * @see https://docs.zondacrypto.exchange/reference/operations-history
823
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
824
- * @param {string} code unified currency code, default is undefined
824
+ * @param {string} [code] unified currency code, default is undefined
825
825
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
826
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
826
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
827
827
  * @param {object} [params] extra parameters specific to the exchange API endpoint
828
828
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
829
829
  */
@@ -1117,6 +1117,7 @@ class zonda extends zonda$1 {
1117
1117
  const timestamp = this.safeInteger(item, 'time');
1118
1118
  const balance = this.safeValue(item, 'balance', {});
1119
1119
  const currencyId = this.safeString(balance, 'currency');
1120
+ currency = this.safeCurrency(currencyId, currency);
1120
1121
  const change = this.safeValue(item, 'change', {});
1121
1122
  let amount = this.safeString(change, 'total');
1122
1123
  let direction = 'in';
@@ -1128,7 +1129,7 @@ class zonda extends zonda$1 {
1128
1129
  // that can be used to enrich the transfers with txid, address etc (you need to use info.detailId as a parameter)
1129
1130
  const fundsBefore = this.safeValue(item, 'fundsBefore', {});
1130
1131
  const fundsAfter = this.safeValue(item, 'fundsAfter', {});
1131
- return {
1132
+ return this.safeLedgerEntry({
1132
1133
  'info': item,
1133
1134
  'id': this.safeString(item, 'historyId'),
1134
1135
  'direction': direction,
@@ -1144,7 +1145,7 @@ class zonda extends zonda$1 {
1144
1145
  'timestamp': timestamp,
1145
1146
  'datetime': this.iso8601(timestamp),
1146
1147
  'fee': undefined,
1147
- };
1148
+ }, currency);
1148
1149
  }
1149
1150
  parseLedgerEntryType(type) {
1150
1151
  const types = {
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
7
- declare const version = "4.4.2";
7
+ declare const version = "4.4.3";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.4.3';
41
+ const version = '4.4.4';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -756,7 +756,7 @@ export default class Exchange {
756
756
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
757
757
  parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
758
758
  parseAccount(account: Dict): Account;
759
- parseLedgerEntry(item: Dict, currency?: Currency): object;
759
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
760
760
  parseOrder(order: Dict, market?: Market): Order;
761
761
  fetchCrossBorrowRates(params?: {}): Promise<CrossBorrowRates>;
762
762
  fetchIsolatedBorrowRates(params?: {}): Promise<IsolatedBorrowRates>;
@@ -888,7 +888,7 @@ export default class Exchange {
888
888
  parseTrades(trades: any[], market?: Market, since?: Int, limit?: Int, params?: {}): Trade[];
889
889
  parseTransactions(transactions: any[], currency?: Currency, since?: Int, limit?: Int, params?: {}): Transaction[];
890
890
  parseTransfers(transfers: any[], currency?: Currency, since?: Int, limit?: Int, params?: {}): TransferEntry[];
891
- parseLedger(data: any, currency?: Currency, since?: Int, limit?: Int, params?: {}): any;
891
+ parseLedger(data: any, currency?: Currency, since?: Int, limit?: Int, params?: {}): LedgerEntry[];
892
892
  nonce(): number;
893
893
  setHeaders(headers: any): any;
894
894
  marketId(symbol: string): string;
@@ -7,7 +7,7 @@
7
7
  // ----------------------------------------------------------------------------
8
8
  /* eslint-disable */
9
9
  import * as functions from './functions.js';
10
- const { isNode, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sortBy2, safeFloat2, groupBy, aggregate, uuid, unCamelCase, precisionFromString, Throttler, capitalize, now, decimalToPrecision, safeValue, safeValue2, safeString, safeString2, seconds, milliseconds, binaryToBase16, numberToBE, base16ToBinary, iso8601, omit, isJsonEncodedObject, safeInteger, sum, omitZero, implodeParams, extractParams, json, merge, binaryConcat, hash, ecdsa, arrayConcat, encode, urlencode, hmac, numberToString, parseTimeframe, safeInteger2, safeStringLower, parse8601, yyyymmdd, safeStringUpper, safeTimestamp, binaryConcatArray, uuidv1, numberToLE, ymdhms, stringToBase64, decode, uuid22, safeIntegerProduct2, safeIntegerProduct, safeStringLower2, yymmdd, base58ToBinary, binaryToBase58, safeTimestamp2, rawencode, keysort, inArray, isEmpty, ordered, filterBy, uuid16, safeFloat, base64ToBinary, safeStringUpper2, urlencodeWithArrayRepeat, microseconds, binaryToBase64, strip, toArray, safeFloatN, safeIntegerN, safeIntegerProductN, safeTimestampN, safeValueN, safeStringN, safeStringLowerN, safeStringUpperN, urlencodeNested, urlencodeBase64, parseDate, ymd, base64ToString, crc32, packb, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS, sleep } = functions;
10
+ const { isNode, selfIsDefined, deepExtend, extend, clone, flatten, unique, indexBy, sortBy, sortBy2, safeFloat2, groupBy, aggregate, uuid, unCamelCase, precisionFromString, Throttler, capitalize, now, decimalToPrecision, safeValue, safeValue2, safeString, safeString2, seconds, milliseconds, binaryToBase16, numberToBE, base16ToBinary, iso8601, omit, isJsonEncodedObject, safeInteger, sum, omitZero, implodeParams, extractParams, json, merge, binaryConcat, hash, ecdsa, arrayConcat, encode, urlencode, hmac, numberToString, parseTimeframe, safeInteger2, safeStringLower, parse8601, yyyymmdd, safeStringUpper, safeTimestamp, binaryConcatArray, uuidv1, numberToLE, ymdhms, stringToBase64, decode, uuid22, safeIntegerProduct2, safeIntegerProduct, safeStringLower2, yymmdd, base58ToBinary, binaryToBase58, safeTimestamp2, rawencode, keysort, inArray, isEmpty, ordered, filterBy, uuid16, safeFloat, base64ToBinary, safeStringUpper2, urlencodeWithArrayRepeat, microseconds, binaryToBase64, strip, toArray, safeFloatN, safeIntegerN, safeIntegerProductN, safeTimestampN, safeValueN, safeStringN, safeStringLowerN, safeStringUpperN, urlencodeNested, urlencodeBase64, parseDate, ymd, base64ToString, crc32, packb, TRUNCATE, ROUND, DECIMAL_PLACES, NO_PADDING, TICK_SIZE, SIGNIFICANT_DIGITS, sleep } = functions;
11
11
  import { keys as keysFunc, values as valuesFunc, vwap as vwapFunc } from './functions.js';
12
12
  // import exceptions from "./errors.js"
13
13
  import { // eslint-disable-line object-curly-newline
@@ -621,7 +621,7 @@ export default class Exchange {
621
621
  }
622
622
  }
623
623
  else {
624
- this.fetchImplementation = self.fetch;
624
+ this.fetchImplementation = (selfIsDefined()) ? self.fetch : fetch;
625
625
  this.AbortError = DOMException;
626
626
  this.FetchError = TypeError;
627
627
  }
@@ -5,4 +5,5 @@ declare const extractParams: (string: string) => string[];
5
5
  declare const implodeParams: (string: string, params: Dictionary<any> | any[]) => string;
6
6
  declare function vwap(baseVolume: number, quoteVolume: number): Num;
7
7
  declare function aggregate(bidasks: any): number[][];
8
- export { aggregate, parseTimeframe, roundTimeframe, implodeParams, extractParams, vwap, };
8
+ declare function selfIsDefined(): boolean;
9
+ export { aggregate, parseTimeframe, roundTimeframe, implodeParams, extractParams, vwap, selfIsDefined };
@@ -87,5 +87,15 @@ function aggregate(bidasks) {
87
87
  }
88
88
  return Object.keys(result).map((price) => [parseFloat(price), parseFloat(result[price])]); // TODO: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}', No index signature with a parameter of type 'string' was found on type '{}'.ts(7053)
89
89
  }
90
- export { aggregate, parseTimeframe, roundTimeframe, implodeParams, extractParams, vwap, };
90
+ function selfIsDefined() {
91
+ let selfIsDefined = false;
92
+ try {
93
+ selfIsDefined = self !== undefined;
94
+ }
95
+ catch (e) {
96
+ selfIsDefined = false;
97
+ }
98
+ return selfIsDefined;
99
+ }
100
+ export { aggregate, parseTimeframe, roundTimeframe, implodeParams, extractParams, vwap, selfIsDefined };
91
101
  /* ------------------------------------------------------------------------ */
@@ -324,8 +324,8 @@ export interface LeverageTier {
324
324
  info: any;
325
325
  }
326
326
  export interface LedgerEntry {
327
- id?: Str;
328
327
  info: any;
328
+ id?: Str;
329
329
  timestamp?: number;
330
330
  datetime?: Str;
331
331
  direction?: Str;
@@ -7,10 +7,10 @@
7
7
  // eslint-disable-next-line no-shadow
8
8
  import WebSocket from 'ws';
9
9
  import Client from './Client.js';
10
- import { sleep, isNode, milliseconds, } from '../../base/functions.js';
10
+ import { sleep, isNode, milliseconds, selfIsDefined, } from '../../base/functions.js';
11
11
  import { Future } from './Future.js';
12
12
  // eslint-disable-next-line no-restricted-globals
13
- const WebSocketPlatform = isNode ? WebSocket : self.WebSocket;
13
+ const WebSocketPlatform = isNode || !selfIsDefined() ? WebSocket : self.WebSocket;
14
14
  export default class WsClient extends Client {
15
15
  constructor() {
16
16
  super(...arguments);
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/binance.js';
2
- import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface, MarginMode, MarginModes, Leverage, Leverages, Num, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate, IsolatedBorrowRates, IsolatedBorrowRate, Dict, LeverageTier, LeverageTiers, int } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface, MarginMode, MarginModes, Leverage, Leverages, Num, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate, IsolatedBorrowRates, IsolatedBorrowRate, Dict, LeverageTier, LeverageTiers, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class binance
5
5
  * @augments Exchange
@@ -246,25 +246,9 @@ export default class binance extends Exchange {
246
246
  datetime: string;
247
247
  };
248
248
  parseSettlements(settlements: any, market: any): any[];
249
- fetchLedgerEntry(id: string, code?: Str, params?: {}): Promise<any>;
250
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
251
- parseLedgerEntry(item: Dict, currency?: Currency): {
252
- id: string;
253
- direction: any;
254
- account: any;
255
- referenceAccount: any;
256
- referenceId: string;
257
- type: string;
258
- currency: string;
259
- amount: number;
260
- timestamp: number;
261
- datetime: string;
262
- before: any;
263
- after: any;
264
- status: any;
265
- fee: any;
266
- info: Dict;
267
- };
249
+ fetchLedgerEntry(id: string, code?: Str, params?: {}): Promise<LedgerEntry>;
250
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
251
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
268
252
  parseLedgerEntryType(type: any): string;
269
253
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
270
254
  url: any;
package/js/src/binance.js CHANGED
@@ -11222,17 +11222,42 @@ export default class binance extends Exchange {
11222
11222
  return result;
11223
11223
  }
11224
11224
  async fetchLedgerEntry(id, code = undefined, params = {}) {
11225
+ /**
11226
+ * @method
11227
+ * @name binance#fetchLedgerEntry
11228
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
11229
+ * @see https://developers.binance.com/docs/derivatives/option/account/Account-Funding-Flow
11230
+ * @param {string} id the identification number of the ledger entry
11231
+ * @param {string} code unified currency code
11232
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
11233
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
11234
+ */
11225
11235
  await this.loadMarkets();
11226
11236
  let type = undefined;
11227
11237
  [type, params] = this.handleMarketTypeAndParams('fetchLedgerEntry', undefined, params);
11228
- const query = {
11229
- 'recordId': id,
11230
- 'type': type,
11231
- };
11232
11238
  if (type !== 'option') {
11233
- throw new BadRequest(this.id + ' fetchLedgerEntry () can only be used for type option');
11239
+ throw new BadRequest(this.id + ' fetchLedgerEntry() can only be used for type option');
11234
11240
  }
11235
- return await this.fetchLedger(code, undefined, undefined, this.extend(query, params));
11241
+ this.checkRequiredArgument('fetchLedgerEntry', code, 'code');
11242
+ const currency = this.currency(code);
11243
+ const request = {
11244
+ 'recordId': id,
11245
+ 'currency': currency['id'],
11246
+ };
11247
+ const response = await this.eapiPrivateGetBill(this.extend(request, params));
11248
+ //
11249
+ // [
11250
+ // {
11251
+ // "id": "1125899906845701870",
11252
+ // "asset": "USDT",
11253
+ // "amount": "-0.16518203",
11254
+ // "type": "FEE",
11255
+ // "createDate": 1676621042489
11256
+ // }
11257
+ // ]
11258
+ //
11259
+ const first = this.safeDict(response, 0, response);
11260
+ return this.parseLedgerEntry(first, currency);
11236
11261
  }
11237
11262
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
11238
11263
  /**
@@ -11244,9 +11269,9 @@ export default class binance extends Exchange {
11244
11269
  * @see https://developers.binance.com/docs/derivatives/coin-margined-futures/account/Get-Income-History
11245
11270
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-UM-Income-History
11246
11271
  * @see https://developers.binance.com/docs/derivatives/portfolio-margin/account/Get-CM-Income-History
11247
- * @param {string} code unified currency code
11272
+ * @param {string} [code] unified currency code
11248
11273
  * @param {int} [since] timestamp in ms of the earliest ledger entry
11249
- * @param {int} [limit] max number of ledger entrys to return
11274
+ * @param {int} [limit] max number of ledger entries to return
11250
11275
  * @param {object} [params] extra parameters specific to the exchange API endpoint
11251
11276
  * @param {int} [params.until] timestamp in ms of the latest ledger entry
11252
11277
  * @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)
@@ -11372,16 +11397,19 @@ export default class binance extends Exchange {
11372
11397
  direction = 'in';
11373
11398
  }
11374
11399
  const currencyId = this.safeString(item, 'asset');
11400
+ const code = this.safeCurrencyCode(currencyId, currency);
11401
+ currency = this.safeCurrency(currencyId, currency);
11375
11402
  const timestamp = this.safeInteger2(item, 'createDate', 'time');
11376
11403
  const type = this.safeString2(item, 'type', 'incomeType');
11377
- return {
11404
+ return this.safeLedgerEntry({
11405
+ 'info': item,
11378
11406
  'id': this.safeString2(item, 'id', 'tranId'),
11379
11407
  'direction': direction,
11380
11408
  'account': undefined,
11381
11409
  'referenceAccount': undefined,
11382
11410
  'referenceId': this.safeString(item, 'tradeId'),
11383
11411
  'type': this.parseLedgerEntryType(type),
11384
- 'currency': this.safeCurrencyCode(currencyId, currency),
11412
+ 'currency': code,
11385
11413
  'amount': this.parseNumber(amount),
11386
11414
  'timestamp': timestamp,
11387
11415
  'datetime': this.iso8601(timestamp),
@@ -11389,8 +11417,7 @@ export default class binance extends Exchange {
11389
11417
  'after': undefined,
11390
11418
  'status': undefined,
11391
11419
  'fee': undefined,
11392
- 'info': item,
11393
- };
11420
+ }, currency);
11394
11421
  }
11395
11422
  parseLedgerEntryType(type) {
11396
11423
  const ledgerType = {
package/js/src/bingx.js CHANGED
@@ -468,6 +468,7 @@ export default class bingx extends Exchange {
468
468
  'commonCurrencies': {
469
469
  'SNOW': 'Snowman',
470
470
  'OMNI': 'OmniCat',
471
+ 'NAP': '$NAP', // NAP on SOL = SNAP
471
472
  },
472
473
  'options': {
473
474
  'defaultType': 'spot',
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitfinex2.js';
2
- import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderBook, Str, Transaction, Ticker, Balances, Tickers, Strings, Currency, Market, OpenInterest, Liquidation, OrderRequest, Num, MarginModification, Currencies, TradingFees, Dict } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderBook, Str, Transaction, Ticker, Balances, Tickers, Strings, Currency, Market, OpenInterest, Liquidation, OrderRequest, Num, MarginModification, Currencies, TradingFees, Dict, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class bitfinex2
5
5
  * @augments Exchange
@@ -79,24 +79,8 @@ export default class bitfinex2 extends Exchange {
79
79
  };
80
80
  handleErrors(statusCode: any, statusText: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
81
81
  parseLedgerEntryType(type: Str): string;
82
- parseLedgerEntry(item: Dict, currency?: Currency): {
83
- id: string;
84
- direction: any;
85
- account: any;
86
- referenceId: string;
87
- referenceAccount: any;
88
- type: any;
89
- currency: string;
90
- amount: number;
91
- timestamp: number;
92
- datetime: string;
93
- before: any;
94
- after: number;
95
- status: any;
96
- fee: any;
97
- info: Dict;
98
- };
99
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
82
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
83
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
100
84
  fetchFundingRate(symbol: string, params?: {}): Promise<any>;
101
85
  fetchFundingRates(symbols?: Strings, params?: {}): Promise<{}>;
102
86
  fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
@@ -2920,6 +2920,7 @@ export default class bitfinex2 extends Exchange {
2920
2920
  const id = this.safeString(itemList, 0);
2921
2921
  const currencyId = this.safeString(itemList, 1);
2922
2922
  const code = this.safeCurrencyCode(currencyId, currency);
2923
+ currency = this.safeCurrency(currencyId, currency);
2923
2924
  const timestamp = this.safeInteger(itemList, 3);
2924
2925
  const amount = this.safeNumber(itemList, 5);
2925
2926
  const after = this.safeNumber(itemList, 6);
@@ -2929,7 +2930,8 @@ export default class bitfinex2 extends Exchange {
2929
2930
  const first = this.safeStringLower(parts, 0);
2930
2931
  type = this.parseLedgerEntryType(first);
2931
2932
  }
2932
- return {
2933
+ return this.safeLedgerEntry({
2934
+ 'info': item,
2933
2935
  'id': id,
2934
2936
  'direction': undefined,
2935
2937
  'account': undefined,
@@ -2944,18 +2946,17 @@ export default class bitfinex2 extends Exchange {
2944
2946
  'after': after,
2945
2947
  'status': undefined,
2946
2948
  'fee': undefined,
2947
- 'info': item,
2948
- };
2949
+ }, currency);
2949
2950
  }
2950
2951
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
2951
2952
  /**
2952
2953
  * @method
2953
2954
  * @name bitfinex2#fetchLedger
2954
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2955
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2955
2956
  * @see https://docs.bitfinex.com/reference/rest-auth-ledgers
2956
- * @param {string} code unified currency code, default is undefined
2957
+ * @param {string} [code] unified currency code, default is undefined
2957
2958
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2958
- * @param {int} [limit] max number of ledger entrys to return, default is undefined max is 2500
2959
+ * @param {int} [limit] max number of ledger entries to return, default is undefined, max is 2500
2959
2960
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2960
2961
  * @param {int} [params.until] timestamp in ms of the latest ledger entry
2961
2962
  * @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)
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitget.js';
2
- import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position, Liquidation, TransferEntry, Leverage, MarginMode, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate, IsolatedBorrowRate, Dict, LeverageTier, int } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Balances, Str, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position, Liquidation, TransferEntry, Leverage, MarginMode, Num, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate, IsolatedBorrowRate, Dict, LeverageTier, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class bitget
5
5
  * @augments Exchange
@@ -70,24 +70,8 @@ export default class bitget extends Exchange {
70
70
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
71
71
  fetchCanceledOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
72
72
  fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
73
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
74
- parseLedgerEntry(item: Dict, currency?: Currency): {
75
- info: Dict;
76
- id: string;
77
- timestamp: number;
78
- datetime: string;
79
- direction: string;
80
- account: any;
81
- referenceId: any;
82
- referenceAccount: any;
83
- type: string;
84
- currency: string;
85
- amount: number;
86
- before: any;
87
- after: number;
88
- status: any;
89
- fee: number;
90
- };
73
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
74
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
91
75
  parseLedgerType(type: any): string;
92
76
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
93
77
  fetchPosition(symbol: string, params?: {}): Promise<Position>;
package/js/src/bitget.js CHANGED
@@ -5904,12 +5904,12 @@ export default class bitget extends Exchange {
5904
5904
  /**
5905
5905
  * @method
5906
5906
  * @name bitget#fetchLedger
5907
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
5907
5908
  * @see https://www.bitget.com/api-doc/spot/account/Get-Account-Bills
5908
5909
  * @see https://www.bitget.com/api-doc/contract/account/Get-Account-Bill
5909
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
5910
- * @param {string} code unified currency code, default is undefined
5910
+ * @param {string} [code] unified currency code, default is undefined
5911
5911
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
5912
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
5912
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
5913
5913
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5914
5914
  * @param {int} [params.until] end time in ms
5915
5915
  * @param {string} [params.symbol] *contract only* unified market symbol
@@ -6049,6 +6049,7 @@ export default class bitget extends Exchange {
6049
6049
  //
6050
6050
  const currencyId = this.safeString(item, 'coin');
6051
6051
  const code = this.safeCurrencyCode(currencyId, currency);
6052
+ currency = this.safeCurrency(currencyId, currency);
6052
6053
  const timestamp = this.safeInteger(item, 'cTime');
6053
6054
  const after = this.safeNumber(item, 'balance');
6054
6055
  const fee = this.safeNumber2(item, 'fees', 'fee');
@@ -6058,7 +6059,7 @@ export default class bitget extends Exchange {
6058
6059
  if (amountRaw.indexOf('-') >= 0) {
6059
6060
  direction = 'out';
6060
6061
  }
6061
- return {
6062
+ return this.safeLedgerEntry({
6062
6063
  'info': item,
6063
6064
  'id': this.safeString(item, 'billId'),
6064
6065
  'timestamp': timestamp,
@@ -6073,8 +6074,11 @@ export default class bitget extends Exchange {
6073
6074
  'before': undefined,
6074
6075
  'after': after,
6075
6076
  'status': undefined,
6076
- 'fee': fee,
6077
- };
6077
+ 'fee': {
6078
+ 'currency': code,
6079
+ 'cost': fee,
6080
+ },
6081
+ }, currency);
6078
6082
  }
6079
6083
  parseLedgerType(type) {
6080
6084
  const types = {
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/bitmex.js';
2
- import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, Liquidation, OrderBook, Balances, Str, Dict, Transaction, Ticker, Tickers, Market, Strings, Currency, Leverage, Leverages, Num, Currencies, int } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, Liquidation, OrderBook, Balances, Str, Dict, Transaction, Ticker, Tickers, Market, Strings, Currency, Leverage, Leverages, Num, Currencies, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class bitmex
5
5
  * @augments Exchange
@@ -23,27 +23,8 @@ export default class bitmex extends Exchange {
23
23
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
24
24
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
25
25
  parseLedgerEntryType(type: any): string;
26
- parseLedgerEntry(item: Dict, currency?: Currency): {
27
- id: string;
28
- info: Dict;
29
- timestamp: number;
30
- datetime: string;
31
- direction: any;
32
- account: string;
33
- referenceId: string;
34
- referenceAccount: any;
35
- type: string;
36
- currency: string;
37
- amount: string;
38
- before: number;
39
- after: number;
40
- status: string;
41
- fee: {
42
- cost: number;
43
- currency: string;
44
- };
45
- };
46
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
26
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
27
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
47
28
  fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
48
29
  parseTransactionStatus(status: Str): string;
49
30
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
package/js/src/bitmex.js CHANGED
@@ -1146,6 +1146,7 @@ export default class bitmex extends Exchange {
1146
1146
  const type = this.parseLedgerEntryType(this.safeString(item, 'transactType'));
1147
1147
  const currencyId = this.safeString(item, 'currency');
1148
1148
  const code = this.safeCurrencyCode(currencyId, currency);
1149
+ currency = this.safeCurrency(currencyId, currency);
1149
1150
  const amountString = this.safeString(item, 'amount');
1150
1151
  let amount = this.convertToRealAmount(code, amountString);
1151
1152
  let timestamp = this.parse8601(this.safeString(item, 'transactTime'));
@@ -1160,14 +1161,14 @@ export default class bitmex extends Exchange {
1160
1161
  feeCost = this.convertToRealAmount(code, feeCost);
1161
1162
  }
1162
1163
  const fee = {
1163
- 'cost': this.parseNumber(feeCost),
1164
+ 'cost': this.parseToNumeric(feeCost),
1164
1165
  'currency': code,
1165
1166
  };
1166
1167
  let after = this.safeString(item, 'walletBalance');
1167
1168
  if (after !== undefined) {
1168
1169
  after = this.convertToRealAmount(code, after);
1169
1170
  }
1170
- const before = this.parseNumber(Precise.stringSub(this.numberToString(after), this.numberToString(amount)));
1171
+ const before = this.parseToNumeric(Precise.stringSub(this.numberToString(after), this.numberToString(amount)));
1171
1172
  let direction = undefined;
1172
1173
  if (Precise.stringLt(amountString, '0')) {
1173
1174
  direction = 'out';
@@ -1177,9 +1178,9 @@ export default class bitmex extends Exchange {
1177
1178
  direction = 'in';
1178
1179
  }
1179
1180
  const status = this.parseTransactionStatus(this.safeString(item, 'transactStatus'));
1180
- return {
1181
- 'id': id,
1181
+ return this.safeLedgerEntry({
1182
1182
  'info': item,
1183
+ 'id': id,
1183
1184
  'timestamp': timestamp,
1184
1185
  'datetime': this.iso8601(timestamp),
1185
1186
  'direction': direction,
@@ -1188,22 +1189,22 @@ export default class bitmex extends Exchange {
1188
1189
  'referenceAccount': referenceAccount,
1189
1190
  'type': type,
1190
1191
  'currency': code,
1191
- 'amount': amount,
1192
+ 'amount': this.parseToNumeric(amount),
1192
1193
  'before': before,
1193
- 'after': this.parseNumber(after),
1194
+ 'after': this.parseToNumeric(after),
1194
1195
  'status': status,
1195
1196
  'fee': fee,
1196
- };
1197
+ }, currency);
1197
1198
  }
1198
1199
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
1199
1200
  /**
1200
1201
  * @method
1201
1202
  * @name bitmex#fetchLedger
1202
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
1203
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
1203
1204
  * @see https://www.bitmex.com/api/explorer/#!/User/User_getWalletHistory
1204
- * @param {string} code unified currency code, default is undefined
1205
+ * @param {string} [code] unified currency code, default is undefined
1205
1206
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1206
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
1207
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
1207
1208
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1208
1209
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1209
1210
  */
package/js/src/bitso.d.ts CHANGED
@@ -1,30 +1,14 @@
1
1
  import Exchange from './abstract/bitso.js';
2
- import type { Balances, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, TradingFees, Transaction, int } from './base/types.js';
2
+ import type { Balances, Currency, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Trade, TradingFees, Transaction, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class bitso
5
5
  * @augments Exchange
6
6
  */
7
7
  export default class bitso extends Exchange {
8
8
  describe(): any;
9
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
9
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
10
10
  parseLedgerEntryType(type: any): string;
11
- parseLedgerEntry(item: Dict, currency?: Currency): {
12
- id: string;
13
- timestamp: number;
14
- datetime: string;
15
- direction: string;
16
- account: string;
17
- referenceId: string;
18
- referenceAccount: string;
19
- type: string;
20
- currency: string;
21
- amount: number;
22
- before: number;
23
- after: number;
24
- status: string;
25
- fee: any;
26
- info: import("./base/types.js").Dictionary<any>;
27
- };
11
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
28
12
  fetchMarkets(params?: {}): Promise<Market[]>;
29
13
  parseBalance(response: any): Balances;
30
14
  fetchBalance(params?: {}): Promise<Balances>;