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/lykke.js CHANGED
@@ -681,9 +681,9 @@ export default class lykke extends Exchange {
681
681
  const currencyId = this.safeString(balance, 'assetId');
682
682
  const code = this.safeCurrencyCode(currencyId);
683
683
  const account = this.account();
684
- const free = this.safeString(balance, 'available');
684
+ const total = this.safeString(balance, 'available');
685
685
  const used = this.safeString(balance, 'reserved');
686
- account['free'] = free;
686
+ account['total'] = total;
687
687
  account['used'] = used;
688
688
  result[code] = account;
689
689
  }
package/js/src/mexc.js CHANGED
@@ -92,7 +92,7 @@ export default class mexc extends Exchange {
92
92
  'fetchOrderBooks': undefined,
93
93
  'fetchOrders': true,
94
94
  'fetchOrderTrades': true,
95
- 'fetchPosition': true,
95
+ 'fetchPosition': 'emulated',
96
96
  'fetchPositionHistory': 'emulated',
97
97
  'fetchPositionMode': true,
98
98
  'fetchPositions': true,
@@ -1017,8 +1017,9 @@ export default class mexc extends Exchange {
1017
1017
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1018
1018
  * @returns {object[]} an array of objects representing market data
1019
1019
  */
1020
- const spotMarket = await this.fetchSpotMarkets(params);
1021
- const swapMarket = await this.fetchSwapMarkets(params);
1020
+ const spotMarketPromise = this.fetchSpotMarkets(params);
1021
+ const swapMarketPromise = this.fetchSwapMarkets(params);
1022
+ const [spotMarket, swapMarket] = await Promise.all([spotMarketPromise, swapMarketPromise]);
1022
1023
  return this.arrayConcat(spotMarket, swapMarket);
1023
1024
  }
1024
1025
  async fetchSpotMarkets(params = {}) {
@@ -1157,7 +1158,10 @@ export default class mexc extends Exchange {
1157
1158
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1158
1159
  * @returns {object[]} an array of objects representing market data
1159
1160
  */
1161
+ const currentRl = this.rateLimit;
1162
+ this.setProperty(this, 'rateLimit', 10); // see comment: https://github.com/ccxt/ccxt/pull/23698
1160
1163
  const response = await this.contractPublicGetDetail(params);
1164
+ this.setProperty(this, 'rateLimit', currentRl);
1161
1165
  //
1162
1166
  // {
1163
1167
  // "success":true,
@@ -2913,6 +2917,9 @@ export default class mexc extends Exchange {
2913
2917
  * @method
2914
2918
  * @name mexc#cancelOrder
2915
2919
  * @description cancels an open order
2920
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#cancel-order
2921
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-the-order-under-maintenance
2922
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-the-stop-limit-trigger-order-under-maintenance
2916
2923
  * @param {string} id order id
2917
2924
  * @param {string} symbol unified symbol of the market the order was made in
2918
2925
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3030,6 +3037,7 @@ export default class mexc extends Exchange {
3030
3037
  * @method
3031
3038
  * @name mexc#cancelOrders
3032
3039
  * @description cancel multiple orders
3040
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-the-order-under-maintenance
3033
3041
  * @param {string[]} ids order ids
3034
3042
  * @param {string} symbol unified market symbol, default is undefined
3035
3043
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3065,6 +3073,9 @@ export default class mexc extends Exchange {
3065
3073
  * @method
3066
3074
  * @name mexc#cancelAllOrders
3067
3075
  * @description cancel all open orders
3076
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#cancel-all-open-orders-on-a-symbol
3077
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-all-orders-under-a-contract-under-maintenance
3078
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#cancel-all-trigger-orders-under-maintenance
3068
3079
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
3069
3080
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3070
3081
  * @param {string} [params.marginMode] only 'isolated' is supported for spot-margin trading
@@ -3468,6 +3479,8 @@ export default class mexc extends Exchange {
3468
3479
  * @method
3469
3480
  * @name mexc#fetchAccounts
3470
3481
  * @description fetch all the accounts associated with a profile
3482
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-information
3483
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-informations-of-user-39-s-asset
3471
3484
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3472
3485
  * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
3473
3486
  */
@@ -3495,6 +3508,8 @@ export default class mexc extends Exchange {
3495
3508
  * @method
3496
3509
  * @name mexc#fetchTradingFees
3497
3510
  * @description fetch the trading fees for multiple markets
3511
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-information
3512
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-informations-of-user-39-s-asset
3498
3513
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3499
3514
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
3500
3515
  */
@@ -3780,6 +3795,8 @@ export default class mexc extends Exchange {
3780
3795
  * @method
3781
3796
  * @name mexc#fetchMyTrades
3782
3797
  * @description fetch all trades made by the user
3798
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-trade-list
3799
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-all-transaction-details-of-the-user-s-order
3783
3800
  * @param {string} symbol unified market symbol
3784
3801
  * @param {int} [since] the earliest time in ms to fetch trades for
3785
3802
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -3870,6 +3887,8 @@ export default class mexc extends Exchange {
3870
3887
  * @method
3871
3888
  * @name mexc#fetchOrderTrades
3872
3889
  * @description fetch all the trades made from a single order
3890
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#account-trade-list
3891
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#query-the-order-based-on-the-order-number
3873
3892
  * @param {string} id order id
3874
3893
  * @param {string} symbol unified market symbol
3875
3894
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -3968,6 +3987,7 @@ export default class mexc extends Exchange {
3968
3987
  * @method
3969
3988
  * @name mexc#reduceMargin
3970
3989
  * @description remove margin from a position
3990
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#increase-or-decrease-margin
3971
3991
  * @param {string} symbol unified market symbol
3972
3992
  * @param {float} amount the amount of margin to remove
3973
3993
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3980,6 +4000,7 @@ export default class mexc extends Exchange {
3980
4000
  * @method
3981
4001
  * @name mexc#addMargin
3982
4002
  * @description add margin
4003
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#increase-or-decrease-margin
3983
4004
  * @param {string} symbol unified market symbol
3984
4005
  * @param {float} amount amount of margin to add
3985
4006
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3992,6 +4013,7 @@ export default class mexc extends Exchange {
3992
4013
  * @method
3993
4014
  * @name mexc#setLeverage
3994
4015
  * @description set the level of leverage for a market
4016
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#switch-leverage
3995
4017
  * @param {float} leverage the rate of leverage
3996
4018
  * @param {string} symbol unified market symbol
3997
4019
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -4025,6 +4047,7 @@ export default class mexc extends Exchange {
4025
4047
  * @method
4026
4048
  * @name mexc#fetchFundingHistory
4027
4049
  * @description fetch the history of funding payments paid and received on this account
4050
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-details-of-user-s-funding-rate
4028
4051
  * @param {string} symbol unified market symbol
4029
4052
  * @param {int} [since] the earliest time in ms to fetch funding history for
4030
4053
  * @param {int} [limit] the maximum number of funding history structures to retrieve
@@ -4140,6 +4163,7 @@ export default class mexc extends Exchange {
4140
4163
  * @method
4141
4164
  * @name mexc#fetchFundingRate
4142
4165
  * @description fetch the current funding rate
4166
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-funding-rate
4143
4167
  * @param {string} symbol unified market symbol
4144
4168
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4145
4169
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -4173,6 +4197,7 @@ export default class mexc extends Exchange {
4173
4197
  * @method
4174
4198
  * @name mexc#fetchFundingRateHistory
4175
4199
  * @description fetches historical funding rate prices
4200
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-funding-rate-history
4176
4201
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
4177
4202
  * @param {int} [since] not used by mexc, but filtered internally by ccxt
4178
4203
  * @param {int} [limit] mexc limit is page_size default 20, maximum is 100
@@ -4746,6 +4771,7 @@ export default class mexc extends Exchange {
4746
4771
  * @method
4747
4772
  * @name mexc#fetchPosition
4748
4773
  * @description fetch data on a single open contract trade position
4774
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-s-history-position-information
4749
4775
  * @param {string} symbol unified market symbol of the market the position is held in, default is undefined
4750
4776
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4751
4777
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -4763,6 +4789,7 @@ export default class mexc extends Exchange {
4763
4789
  * @method
4764
4790
  * @name mexc#fetchPositions
4765
4791
  * @description fetch all open positions
4792
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-s-history-position-information
4766
4793
  * @param {string[]|undefined} symbols list of unified market symbols
4767
4794
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4768
4795
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -4906,6 +4933,16 @@ export default class mexc extends Exchange {
4906
4933
  });
4907
4934
  }
4908
4935
  async fetchTransfer(id, code = undefined, params = {}) {
4936
+ /**
4937
+ * @method
4938
+ * @name mexc#fetchTransfer
4939
+ * @description fetches a transfer
4940
+ * @see https://mexcdevelop.github.io/apidocs/spot_v2_en/#internal-assets-transfer-order-inquiry
4941
+ * @param {string} id transfer id
4942
+ * @param {string} [code] not used by mexc fetchTransfer
4943
+ * @param {object} params extra parameters specific to the exchange api endpoint
4944
+ * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
4945
+ */
4909
4946
  const [marketType, query] = this.handleMarketTypeAndParams('fetchTransfer', undefined, params);
4910
4947
  await this.loadMarkets();
4911
4948
  if (marketType === 'spot') {
@@ -4939,6 +4976,8 @@ export default class mexc extends Exchange {
4939
4976
  * @method
4940
4977
  * @name mexc#fetchTransfers
4941
4978
  * @description fetch a history of internal transfers made on an account
4979
+ * @see https://mexcdevelop.github.io/apidocs/spot_v2_en/#get-internal-assets-transfer-records
4980
+ * @see https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-39-s-asset-transfer-records
4942
4981
  * @param {string} code unified currency code of the currency transferred
4943
4982
  * @param {int} [since] the earliest time in ms to fetch transfers for
4944
4983
  * @param {int} [limit] the maximum number of transfers structures to retrieve
package/js/src/ndax.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/ndax.js';
2
- import type { IndexType, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction, Num, Account, Currencies, Dict, int } from './base/types.js';
2
+ import type { IndexType, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, Transaction, Num, Account, Currencies, Dict, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class ndax
5
5
  * @augments Exchange
@@ -22,24 +22,8 @@ export default class ndax extends Exchange {
22
22
  parseBalance(response: any): Balances;
23
23
  fetchBalance(params?: {}): Promise<Balances>;
24
24
  parseLedgerEntryType(type: any): string;
25
- parseLedgerEntry(item: Dict, currency?: Currency): {
26
- info: Dict;
27
- id: string;
28
- direction: any;
29
- account: string;
30
- referenceId: string;
31
- referenceAccount: string;
32
- type: string;
33
- currency: string;
34
- amount: number;
35
- before: number;
36
- after: number;
37
- status: string;
38
- timestamp: number;
39
- datetime: string;
40
- fee: any;
41
- };
42
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
25
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
26
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
43
27
  parseOrderStatus(status: Str): string;
44
28
  parseOrder(order: Dict, market?: Market): Order;
45
29
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
package/js/src/ndax.js CHANGED
@@ -1141,6 +1141,7 @@ export default class ndax extends Exchange {
1141
1141
  // }
1142
1142
  //
1143
1143
  const currencyId = this.safeString(item, 'ProductId');
1144
+ currency = this.safeCurrency(currencyId, currency);
1144
1145
  const credit = this.safeString(item, 'CR');
1145
1146
  const debit = this.safeString(item, 'DR');
1146
1147
  let amount = undefined;
@@ -1162,7 +1163,7 @@ export default class ndax extends Exchange {
1162
1163
  before = Precise.stringMax('0', Precise.stringSub(after, amount));
1163
1164
  }
1164
1165
  const timestamp = this.safeInteger(item, 'TimeStamp');
1165
- return {
1166
+ return this.safeLedgerEntry({
1166
1167
  'info': item,
1167
1168
  'id': this.safeString(item, 'TransactionId'),
1168
1169
  'direction': direction,
@@ -1178,17 +1179,17 @@ export default class ndax extends Exchange {
1178
1179
  'timestamp': timestamp,
1179
1180
  'datetime': this.iso8601(timestamp),
1180
1181
  'fee': undefined,
1181
- };
1182
+ }, currency);
1182
1183
  }
1183
1184
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
1184
1185
  /**
1185
1186
  * @method
1186
1187
  * @name ndax#fetchLedger
1187
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
1188
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
1188
1189
  * @see https://apidoc.ndax.io/#getaccounttransactions
1189
- * @param {string} code unified currency code, default is undefined
1190
+ * @param {string} [code] unified currency code, default is undefined
1190
1191
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1191
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
1192
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
1192
1193
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1193
1194
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1194
1195
  */
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/okcoin.js';
2
- import type { TransferEntry, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Num, Currencies, Dict, int } from './base/types.js';
2
+ import type { TransferEntry, Balances, Currency, Int, Market, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, Num, Currencies, Dict, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class okcoin
5
5
  * @augments Exchange
@@ -52,25 +52,9 @@ export default class okcoin extends Exchange {
52
52
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
53
53
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
54
54
  fetchOrderTrades(id: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
55
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
55
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
56
56
  parseLedgerEntryType(type: any): string;
57
- parseLedgerEntry(item: Dict, currency?: Currency): {
58
- id: string;
59
- info: Dict;
60
- timestamp: number;
61
- datetime: string;
62
- account: any;
63
- referenceId: string;
64
- referenceAccount: any;
65
- type: string;
66
- currency: string;
67
- symbol: string;
68
- amount: number;
69
- before: any;
70
- after: number;
71
- status: string;
72
- fee: any;
73
- };
57
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
74
58
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
75
59
  url: string;
76
60
  method: string;
package/js/src/okcoin.js CHANGED
@@ -2861,13 +2861,13 @@ export default class okcoin extends Exchange {
2861
2861
  /**
2862
2862
  * @method
2863
2863
  * @name okcoin#fetchLedger
2864
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
2864
2865
  * @see https://www.okcoin.com/docs-v5/en/#rest-api-funding-asset-bills-details
2865
2866
  * @see https://www.okcoin.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days
2866
2867
  * @see https://www.okcoin.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months
2867
- * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2868
- * @param {string} code unified currency code, default is undefined
2868
+ * @param {string} [code] unified currency code, default is undefined
2869
2869
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2870
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
2870
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
2871
2871
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2872
2872
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2873
2873
  */
@@ -3009,46 +3009,37 @@ export default class okcoin extends Exchange {
3009
3009
  // "ts": "1597026383085"
3010
3010
  // }
3011
3011
  //
3012
- const id = this.safeString(item, 'billId');
3013
- const account = undefined;
3014
- const referenceId = this.safeString(item, 'ordId');
3015
- const referenceAccount = undefined;
3016
- const type = this.parseLedgerEntryType(this.safeString(item, 'type'));
3017
- const code = this.safeCurrencyCode(this.safeString(item, 'ccy'), currency);
3018
- const amountString = this.safeString(item, 'balChg');
3019
- const amount = this.parseNumber(amountString);
3012
+ const currencyId = this.safeString(item, 'ccy');
3013
+ const code = this.safeCurrencyCode(currencyId, currency);
3014
+ currency = this.safeCurrency(currencyId, currency);
3020
3015
  const timestamp = this.safeInteger(item, 'ts');
3021
3016
  const feeCostString = this.safeString(item, 'fee');
3022
3017
  let fee = undefined;
3023
3018
  if (feeCostString !== undefined) {
3024
3019
  fee = {
3025
- 'cost': this.parseNumber(Precise.stringNeg(feeCostString)),
3020
+ 'cost': this.parseToNumeric(Precise.stringNeg(feeCostString)),
3026
3021
  'currency': code,
3027
3022
  };
3028
3023
  }
3029
- const before = undefined;
3030
- const afterString = this.safeString(item, 'bal');
3031
- const after = this.parseNumber(afterString);
3032
- const status = 'ok';
3033
3024
  const marketId = this.safeString(item, 'instId');
3034
3025
  const symbol = this.safeSymbol(marketId, undefined, '-');
3035
- return {
3036
- 'id': id,
3026
+ return this.safeLedgerEntry({
3037
3027
  'info': item,
3028
+ 'id': this.safeString(item, 'billId'),
3038
3029
  'timestamp': timestamp,
3039
3030
  'datetime': this.iso8601(timestamp),
3040
- 'account': account,
3041
- 'referenceId': referenceId,
3042
- 'referenceAccount': referenceAccount,
3043
- 'type': type,
3031
+ 'account': undefined,
3032
+ 'referenceId': this.safeString(item, 'ordId'),
3033
+ 'referenceAccount': undefined,
3034
+ 'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
3044
3035
  'currency': code,
3045
3036
  'symbol': symbol,
3046
- 'amount': amount,
3047
- 'before': before,
3048
- 'after': after,
3049
- 'status': status,
3037
+ 'amount': this.safeNumber(item, 'balChg'),
3038
+ 'before': undefined,
3039
+ 'after': this.safeNumber(item, 'bal'),
3040
+ 'status': 'ok',
3050
3041
  'fee': fee,
3051
- };
3042
+ }, currency);
3052
3043
  }
3053
3044
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
3054
3045
  const isArray = Array.isArray(params);
package/js/src/okx.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/okx.js';
2
- import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Balances, Tickers, Market, Greeks, Strings, MarketInterface, Currency, Leverage, Num, Account, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, Conversion, CancellationRequest, Dict, Position, CrossBorrowRate, CrossBorrowRates, LeverageTier, int } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Balances, Tickers, Market, Greeks, Strings, MarketInterface, Currency, Leverage, Num, Account, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, Conversion, CancellationRequest, Dict, Position, CrossBorrowRate, CrossBorrowRates, LeverageTier, int, LedgerEntry } from './base/types.js';
3
3
  /**
4
4
  * @class okx
5
5
  * @augments Exchange
@@ -52,25 +52,9 @@ export default class okx extends Exchange {
52
52
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
53
53
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
54
54
  fetchOrderTrades(id: string, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
55
- fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
55
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<LedgerEntry[]>;
56
56
  parseLedgerEntryType(type: any): string;
57
- parseLedgerEntry(item: Dict, currency?: Currency): {
58
- id: string;
59
- info: Dict;
60
- timestamp: number;
61
- datetime: string;
62
- account: any;
63
- referenceId: string;
64
- referenceAccount: any;
65
- type: string;
66
- currency: string;
67
- symbol: string;
68
- amount: number;
69
- before: any;
70
- after: number;
71
- status: string;
72
- fee: any;
73
- };
57
+ parseLedgerEntry(item: Dict, currency?: Currency): LedgerEntry;
74
58
  parseDepositAddress(depositAddress: any, currency?: Currency): {
75
59
  currency: string;
76
60
  address: string;
package/js/src/okx.js CHANGED
@@ -793,6 +793,7 @@ export default class okx extends Exchange {
793
793
  // SPOT/MARGIN error codes 54000-54999
794
794
  '54000': ExchangeError,
795
795
  '54001': ExchangeError,
796
+ '54011': InvalidOrder,
796
797
  // Trading bot Error Code from 55100 to 55999
797
798
  '55100': InvalidOrder,
798
799
  '55101': InvalidOrder,
@@ -4474,13 +4475,13 @@ export default class okx extends Exchange {
4474
4475
  * @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days
4475
4476
  * @see https://www.okx.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months
4476
4477
  * @see https://www.okx.com/docs-v5/en/#rest-api-funding-asset-bills-details
4477
- * @param {string} code unified currency code, default is undefined
4478
+ * @param {string} [code] unified currency code, default is undefined
4478
4479
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
4479
- * @param {int} [limit] max number of ledger entrys to return, default is undefined
4480
+ * @param {int} [limit] max number of ledger entries to return, default is undefined
4480
4481
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4481
4482
  * @param {string} [params.marginMode] 'cross' or 'isolated'
4482
4483
  * @param {int} [params.until] the latest time in ms to fetch entries for
4483
- * @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)
4484
+ * @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)
4484
4485
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
4485
4486
  */
4486
4487
  await this.loadMarkets();
@@ -4643,14 +4644,9 @@ export default class okx extends Exchange {
4643
4644
  // "ts": "1597026383085"
4644
4645
  // }
4645
4646
  //
4646
- const id = this.safeString(item, 'billId');
4647
- const account = undefined;
4648
- const referenceId = this.safeString(item, 'ordId');
4649
- const referenceAccount = undefined;
4650
- const type = this.parseLedgerEntryType(this.safeString(item, 'type'));
4651
- const code = this.safeCurrencyCode(this.safeString(item, 'ccy'), currency);
4652
- const amountString = this.safeString(item, 'balChg');
4653
- const amount = this.parseNumber(amountString);
4647
+ const currencyId = this.safeString(item, 'ccy');
4648
+ const code = this.safeCurrencyCode(currencyId, currency);
4649
+ currency = this.safeCurrency(currencyId, currency);
4654
4650
  const timestamp = this.safeInteger(item, 'ts');
4655
4651
  const feeCostString = this.safeString(item, 'fee');
4656
4652
  let fee = undefined;
@@ -4660,29 +4656,25 @@ export default class okx extends Exchange {
4660
4656
  'currency': code,
4661
4657
  };
4662
4658
  }
4663
- const before = undefined;
4664
- const afterString = this.safeString(item, 'bal');
4665
- const after = this.parseNumber(afterString);
4666
- const status = 'ok';
4667
4659
  const marketId = this.safeString(item, 'instId');
4668
4660
  const symbol = this.safeSymbol(marketId, undefined, '-');
4669
- return {
4670
- 'id': id,
4661
+ return this.safeLedgerEntry({
4671
4662
  'info': item,
4663
+ 'id': this.safeString(item, 'billId'),
4672
4664
  'timestamp': timestamp,
4673
4665
  'datetime': this.iso8601(timestamp),
4674
- 'account': account,
4675
- 'referenceId': referenceId,
4676
- 'referenceAccount': referenceAccount,
4677
- 'type': type,
4666
+ 'account': undefined,
4667
+ 'referenceId': this.safeString(item, 'ordId'),
4668
+ 'referenceAccount': undefined,
4669
+ 'type': this.parseLedgerEntryType(this.safeString(item, 'type')),
4678
4670
  'currency': code,
4679
4671
  'symbol': symbol,
4680
- 'amount': amount,
4681
- 'before': before,
4682
- 'after': after,
4683
- 'status': status,
4672
+ 'amount': this.safeNumber(item, 'balChg'),
4673
+ 'before': undefined,
4674
+ 'after': this.safeNumber(item, 'bal'),
4675
+ 'status': 'ok',
4684
4676
  'fee': fee,
4685
- };
4677
+ }, currency);
4686
4678
  }
4687
4679
  parseDepositAddress(depositAddress, currency = undefined) {
4688
4680
  //
package/js/src/p2b.js CHANGED
@@ -477,7 +477,7 @@ export default class p2b extends Exchange {
477
477
  async fetchOrderBook(symbol, limit = undefined, params = {}) {
478
478
  /**
479
479
  * @method
480
- * @name p2bfutures#fetchOrderBook
480
+ * @name p2b#fetchOrderBook
481
481
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
482
482
  * @see https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#depth-result
483
483
  * @param {string} symbol unified symbol of the market to fetch the order book for
@@ -646,7 +646,7 @@ export default class p2b extends Exchange {
646
646
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
647
647
  /**
648
648
  * @method
649
- * @name poloniexfutures#fetchOHLCV
649
+ * @name p2b#fetchOHLCV
650
650
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
651
651
  * @see https://github.com/P2B-team/p2b-api-docs/blob/master/api-doc.md#kline
652
652
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
package/js/src/paradex.js CHANGED
@@ -659,7 +659,7 @@ export default class paradex extends Exchange {
659
659
  'low': undefined,
660
660
  'bid': this.safeString(ticker, 'bid'),
661
661
  'bidVolume': undefined,
662
- 'ask': this.safeString(ticker, 'sdk'),
662
+ 'ask': this.safeString(ticker, 'ask'),
663
663
  'askVolume': undefined,
664
664
  'vwap': undefined,
665
665
  'open': undefined,