ccxt 4.3.94 → 4.3.96

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 (63) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +8 -8
  3. package/dist/cjs/ccxt.js +1 -7
  4. package/dist/cjs/src/ascendex.js +8 -6
  5. package/dist/cjs/src/base/Exchange.js +3 -7
  6. package/dist/cjs/src/bingx.js +2 -1
  7. package/dist/cjs/src/bitfinex.js +3 -2
  8. package/dist/cjs/src/bitfinex2.js +6 -5
  9. package/dist/cjs/src/blofin.js +0 -1
  10. package/dist/cjs/src/btcturk.js +2 -2
  11. package/dist/cjs/src/bybit.js +8 -2
  12. package/dist/cjs/src/gate.js +3 -2
  13. package/dist/cjs/src/gemini.js +3 -2
  14. package/dist/cjs/src/hyperliquid.js +337 -42
  15. package/dist/cjs/src/independentreserve.js +4 -3
  16. package/dist/cjs/src/indodax.js +3 -0
  17. package/dist/cjs/src/kucoin.js +12 -12
  18. package/dist/cjs/src/mexc.js +78 -154
  19. package/dist/cjs/src/okx.js +2 -1
  20. package/dist/cjs/src/p2b.js +0 -1
  21. package/dist/cjs/src/pro/binance.js +100 -2
  22. package/dist/cjs/src/pro/bybit.js +65 -4
  23. package/dist/cjs/src/pro/cryptocom.js +224 -0
  24. package/dist/cjs/src/pro/okx.js +264 -35
  25. package/dist/cjs/src/tradeogre.js +0 -1
  26. package/js/ccxt.d.ts +2 -8
  27. package/js/ccxt.js +2 -6
  28. package/js/src/abstract/okx.d.ts +2 -0
  29. package/js/src/ascendex.js +8 -6
  30. package/js/src/base/Exchange.d.ts +1 -3
  31. package/js/src/base/Exchange.js +3 -7
  32. package/js/src/bingx.js +2 -1
  33. package/js/src/bitfinex.js +3 -2
  34. package/js/src/bitfinex2.js +6 -5
  35. package/js/src/blofin.js +0 -1
  36. package/js/src/btcturk.d.ts +2 -2
  37. package/js/src/btcturk.js +2 -2
  38. package/js/src/bybit.js +8 -2
  39. package/js/src/gate.js +3 -2
  40. package/js/src/gemini.js +3 -2
  41. package/js/src/hyperliquid.d.ts +25 -0
  42. package/js/src/hyperliquid.js +337 -42
  43. package/js/src/independentreserve.js +4 -3
  44. package/js/src/indodax.js +3 -0
  45. package/js/src/kucoin.d.ts +1 -1
  46. package/js/src/kucoin.js +12 -12
  47. package/js/src/mexc.js +78 -154
  48. package/js/src/okx.js +2 -1
  49. package/js/src/p2b.js +0 -1
  50. package/js/src/pro/binance.d.ts +2 -0
  51. package/js/src/pro/binance.js +100 -2
  52. package/js/src/pro/bybit.d.ts +3 -1
  53. package/js/src/pro/bybit.js +65 -4
  54. package/js/src/pro/cryptocom.d.ts +10 -1
  55. package/js/src/pro/cryptocom.js +225 -1
  56. package/js/src/pro/okx.d.ts +10 -1
  57. package/js/src/pro/okx.js +264 -35
  58. package/js/src/tradeogre.js +0 -1
  59. package/package.json +1 -1
  60. package/js/src/abstract/bitbay.d.ts +0 -56
  61. package/js/src/abstract/bitbay.js +0 -11
  62. package/js/src/abstract/hitbtc3.d.ts +0 -118
  63. package/js/src/abstract/hitbtc3.js +0 -11
@@ -1420,7 +1420,6 @@ export default class Exchange {
1420
1420
  'fetchOrdersWs': undefined,
1421
1421
  'fetchOrderTrades': undefined,
1422
1422
  'fetchOrderWs': undefined,
1423
- 'fetchPermissions': undefined,
1424
1423
  'fetchPosition': undefined,
1425
1424
  'fetchPositionHistory': undefined,
1426
1425
  'fetchPositionsHistory': undefined,
@@ -3453,7 +3452,7 @@ export default class Exchange {
3453
3452
  if (currencyCode === undefined) {
3454
3453
  const currencies = Object.values(this.currencies);
3455
3454
  for (let i = 0; i < currencies.length; i++) {
3456
- const currency = [i];
3455
+ const currency = currencies[i];
3457
3456
  const networks = this.safeDict(currency, 'networks');
3458
3457
  const network = this.safeDict(networks, networkCode);
3459
3458
  networkId = this.safeString(network, 'id');
@@ -3598,13 +3597,13 @@ export default class Exchange {
3598
3597
  'nonce': undefined,
3599
3598
  };
3600
3599
  }
3601
- parseOHLCVs(ohlcvs, market = undefined, timeframe = '1m', since = undefined, limit = undefined) {
3600
+ parseOHLCVs(ohlcvs, market = undefined, timeframe = '1m', since = undefined, limit = undefined, tail = false) {
3602
3601
  const results = [];
3603
3602
  for (let i = 0; i < ohlcvs.length; i++) {
3604
3603
  results.push(this.parseOHLCV(ohlcvs[i], market));
3605
3604
  }
3606
3605
  const sorted = this.sortBy(results, 0);
3607
- return this.filterBySinceLimit(sorted, since, limit, 0);
3606
+ return this.filterBySinceLimit(sorted, since, limit, 0, tail);
3608
3607
  }
3609
3608
  parseLeverageTiers(response, symbols = undefined, marketIdKey = undefined) {
3610
3609
  // marketIdKey should only be undefined when response is a dictionary
@@ -3983,9 +3982,6 @@ export default class Exchange {
3983
3982
  await this.cancelOrderWs(id, symbol);
3984
3983
  return await this.createOrderWs(symbol, type, side, amount, price, params);
3985
3984
  }
3986
- async fetchPermissions(params = {}) {
3987
- throw new NotSupported(this.id + ' fetchPermissions() is not supported yet');
3988
- }
3989
3985
  async fetchPosition(symbol, params = {}) {
3990
3986
  throw new NotSupported(this.id + ' fetchPosition() is not supported yet');
3991
3987
  }
package/js/src/bingx.js CHANGED
@@ -466,7 +466,8 @@ export default class bingx extends Exchange {
466
466
  'broad': {},
467
467
  },
468
468
  'commonCurrencies': {
469
- 'SNOW': 'Snowman', // Snowman vs SnowSwap conflict
469
+ 'SNOW': 'Snowman',
470
+ 'OMNI': 'OmniCat',
470
471
  },
471
472
  'options': {
472
473
  'defaultType': 'spot',
@@ -566,11 +566,11 @@ export default class bitfinex extends Exchange {
566
566
  * @param {object} [params] extra parameters specific to the exchange API endpoint
567
567
  * @returns {object[]} an array of objects representing market data
568
568
  */
569
- const ids = await this.publicGetSymbols();
569
+ const idsPromise = this.publicGetSymbols();
570
570
  //
571
571
  // [ "btcusd", "ltcusd", "ltcbtc" ]
572
572
  //
573
- const details = await this.publicGetSymbolsDetails();
573
+ const detailsPromise = this.publicGetSymbolsDetails();
574
574
  //
575
575
  // [
576
576
  // {
@@ -585,6 +585,7 @@ export default class bitfinex extends Exchange {
585
585
  // },
586
586
  // ]
587
587
  //
588
+ const [ids, details] = await Promise.all([idsPromise, detailsPromise]);
588
589
  const result = [];
589
590
  for (let i = 0; i < details.length; i++) {
590
591
  const market = details[i];
@@ -523,12 +523,13 @@ export default class bitfinex2 extends Exchange {
523
523
  * @param {object} [params] extra parameters specific to the exchange API endpoint
524
524
  * @returns {object[]} an array of objects representing market data
525
525
  */
526
- let spotMarketsInfo = await this.publicGetConfPubInfoPair(params);
527
- let futuresMarketsInfo = await this.publicGetConfPubInfoPairFutures(params);
528
- spotMarketsInfo = this.safeValue(spotMarketsInfo, 0, []);
529
- futuresMarketsInfo = this.safeValue(futuresMarketsInfo, 0, []);
526
+ const spotMarketsInfoPromise = this.publicGetConfPubInfoPair(params);
527
+ const futuresMarketsInfoPromise = this.publicGetConfPubInfoPairFutures(params);
528
+ const marginIdsPromise = this.publicGetConfPubListPairMargin(params);
529
+ let [spotMarketsInfo, futuresMarketsInfo, marginIds] = await Promise.all([spotMarketsInfoPromise, futuresMarketsInfoPromise, marginIdsPromise]);
530
+ spotMarketsInfo = this.safeList(spotMarketsInfo, 0, []);
531
+ futuresMarketsInfo = this.safeList(futuresMarketsInfo, 0, []);
530
532
  const markets = this.arrayConcat(spotMarketsInfo, futuresMarketsInfo);
531
- let marginIds = await this.publicGetConfPubListPairMargin(params);
532
533
  marginIds = this.safeValue(marginIds, 0, []);
533
534
  //
534
535
  // [
package/js/src/blofin.js CHANGED
@@ -103,7 +103,6 @@ export default class blofin extends Exchange {
103
103
  'fetchOrderBooks': false,
104
104
  'fetchOrders': false,
105
105
  'fetchOrderTrades': true,
106
- 'fetchPermissions': undefined,
107
106
  'fetchPosition': true,
108
107
  'fetchPositions': true,
109
108
  'fetchPositionsForSymbol': false,
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/btcturk.js';
2
- import type { Balances, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, int } from './base/types.js';
2
+ import type { Balances, Bool, Dict, Int, Market, Num, OHLCV, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, int } from './base/types.js';
3
3
  /**
4
4
  * @class btcturk
5
5
  * @augments Exchange
@@ -18,7 +18,7 @@ export default class btcturk extends Exchange {
18
18
  fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
19
19
  parseOHLCV(ohlcv: any, market?: Market): OHLCV;
20
20
  fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
21
- parseOHLCVs(ohlcvs: any, market?: any, timeframe?: string, since?: Int, limit?: Int): OHLCV[];
21
+ parseOHLCVs(ohlcvs: any, market?: any, timeframe?: string, since?: Int, limit?: Int, tail?: Bool): OHLCV[];
22
22
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
23
23
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
24
24
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
package/js/src/btcturk.js CHANGED
@@ -643,7 +643,7 @@ export default class btcturk extends Exchange {
643
643
  //
644
644
  return this.parseOHLCVs(response, market, timeframe, since, limit);
645
645
  }
646
- parseOHLCVs(ohlcvs, market = undefined, timeframe = '1m', since = undefined, limit = undefined) {
646
+ parseOHLCVs(ohlcvs, market = undefined, timeframe = '1m', since = undefined, limit = undefined, tail = false) {
647
647
  const results = [];
648
648
  const timestamp = this.safeValue(ohlcvs, 't');
649
649
  const high = this.safeValue(ohlcvs, 'h');
@@ -663,7 +663,7 @@ export default class btcturk extends Exchange {
663
663
  results.push(this.parseOHLCV(ohlcv, market));
664
664
  }
665
665
  const sorted = this.sortBy(results, 0);
666
- return this.filterBySinceLimit(sorted, since, limit, 0);
666
+ return this.filterBySinceLimit(sorted, since, limit, 0, tail);
667
667
  }
668
668
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
669
669
  /**
package/js/src/bybit.js CHANGED
@@ -5931,11 +5931,17 @@ export default class bybit extends Exchange {
5931
5931
  * @param {string} code unified currency code, default is undefined
5932
5932
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
5933
5933
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
5934
- * @param {object} [params] extra parameters specific to the exchange API endpoint
5934
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
5935
5935
  * @param {string} [params.subType] if inverse will use v5/account/contract-transaction-log
5936
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
5936
5937
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
5937
5938
  */
5938
5939
  await this.loadMarkets();
5940
+ let paginate = false;
5941
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
5942
+ if (paginate) {
5943
+ return await this.fetchPaginatedCallCursor('fetchLedger', code, since, limit, params, 'nextPageCursor', 'cursor', undefined, 50);
5944
+ }
5939
5945
  const request = {
5940
5946
  // 'coin': currency['id'],
5941
5947
  // 'currency': currency['id'], // alias
@@ -5988,7 +5994,7 @@ export default class bybit extends Exchange {
5988
5994
  }
5989
5995
  }
5990
5996
  else {
5991
- response = await this.privateGetV2PrivateWalletFundRecords(this.extend(request, params));
5997
+ response = await this.privateGetV5AccountContractTransactionLog(this.extend(request, params));
5992
5998
  }
5993
5999
  //
5994
6000
  // {
package/js/src/gate.js CHANGED
@@ -984,8 +984,9 @@ export default class gate extends Exchange {
984
984
  return this.arrayConcat(markets, optionMarkets);
985
985
  }
986
986
  async fetchSpotMarkets(params = {}) {
987
- const marginResponse = await this.publicMarginGetCurrencyPairs(params);
988
- const spotMarketsResponse = await this.publicSpotGetCurrencyPairs(params);
987
+ const marginPromise = this.publicMarginGetCurrencyPairs(params);
988
+ const spotMarketsPromise = this.publicSpotGetCurrencyPairs(params);
989
+ const [marginResponse, spotMarketsResponse] = await Promise.all([marginPromise, spotMarketsPromise]);
989
990
  const marginMarkets = this.indexBy(marginResponse, 'id');
990
991
  //
991
992
  // Spot
package/js/src/gemini.js CHANGED
@@ -845,8 +845,9 @@ export default class gemini extends Exchange {
845
845
  return this.parseTicker(response, market);
846
846
  }
847
847
  async fetchTickerV1AndV2(symbol, params = {}) {
848
- const tickerA = await this.fetchTickerV1(symbol, params);
849
- const tickerB = await this.fetchTickerV2(symbol, params);
848
+ const tickerPromiseA = this.fetchTickerV1(symbol, params);
849
+ const tickerPromiseB = this.fetchTickerV2(symbol, params);
850
+ const [tickerA, tickerB] = await Promise.all([tickerPromiseA, tickerPromiseB]);
850
851
  return this.deepExtend(tickerA, {
851
852
  'open': tickerB['open'],
852
853
  'high': tickerB['high'],
@@ -65,6 +65,9 @@ export default class hyperliquid extends Exchange {
65
65
  fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
66
66
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
67
67
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
68
+ fetchCanceledOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
69
+ fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
70
+ fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
68
71
  fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
69
72
  parseOrder(order: Dict, market?: Market): Order;
70
73
  parseOrderStatus(status: Str): string;
@@ -85,6 +88,28 @@ export default class hyperliquid extends Exchange {
85
88
  parseTransaction(transaction: Dict, currency?: Currency): Transaction;
86
89
  fetchTradingFee(symbol: string, params?: {}): Promise<TradingFeeInterface>;
87
90
  parseTradingFee(fee: Dict, market?: Market): TradingFeeInterface;
91
+ fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
92
+ parseLedgerEntry(item: Dict, currency?: Currency): {
93
+ id: string;
94
+ direction: any;
95
+ account: any;
96
+ referenceAccount: string;
97
+ referenceId: string;
98
+ type: string;
99
+ currency: any;
100
+ amount: number;
101
+ timestamp: number;
102
+ datetime: string;
103
+ before: any;
104
+ after: any;
105
+ status: any;
106
+ fee: any;
107
+ info: Dict;
108
+ };
109
+ parseLedgerEntryType(type: any): string;
110
+ fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
111
+ fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
112
+ extractTypeFromDelta(data?: any[]): any[];
88
113
  formatVaultAddress(address?: Str): string;
89
114
  handlePublicAddress(methodName: string, params: Dict): any[];
90
115
  coinToMarketId(coin: Str): string;