ccxt 4.2.69 → 4.2.71

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.
package/dist/cjs/ccxt.js CHANGED
@@ -152,6 +152,7 @@ var hollaex$1 = require('./src/pro/hollaex.js');
152
152
  var htx$1 = require('./src/pro/htx.js');
153
153
  var huobi$1 = require('./src/pro/huobi.js');
154
154
  var huobijp$1 = require('./src/pro/huobijp.js');
155
+ var hyperliquid$1 = require('./src/pro/hyperliquid.js');
155
156
  var idex$1 = require('./src/pro/idex.js');
156
157
  var independentreserve$1 = require('./src/pro/independentreserve.js');
157
158
  var kraken$1 = require('./src/pro/kraken.js');
@@ -177,7 +178,7 @@ var woo$1 = require('./src/pro/woo.js');
177
178
 
178
179
  //-----------------------------------------------------------------------------
179
180
  // this is updated by vss.js when building
180
- const version = '4.2.69';
181
+ const version = '4.2.71';
181
182
  Exchange["default"].ccxtVersion = version;
182
183
  const exchanges = {
183
184
  'ace': ace,
@@ -322,6 +323,7 @@ const pro = {
322
323
  'htx': htx$1,
323
324
  'huobi': huobi$1,
324
325
  'huobijp': huobijp$1,
326
+ 'hyperliquid': hyperliquid$1,
325
327
  'idex': idex$1,
326
328
  'independentreserve': independentreserve$1,
327
329
  'kraken': kraken$1,
@@ -236,7 +236,7 @@ class Exchange {
236
236
  this.socksProxyAgentModule = undefined;
237
237
  this.socksProxyAgentModuleChecked = false;
238
238
  this.proxyDictionaries = {};
239
- this.proxyModulesLoaded = false;
239
+ this.proxiesModulesLoading = undefined;
240
240
  Object.assign(this, functions);
241
241
  //
242
242
  // if (isNode) {
@@ -731,36 +731,38 @@ class Exchange {
731
731
  console.log(...args);
732
732
  }
733
733
  async loadProxyModules() {
734
- if (this.proxyModulesLoaded) {
735
- return;
736
- }
737
- this.proxyModulesLoaded = true;
738
- // we have to handle it with below nested way, because of dynamic
739
- // import issues (https://github.com/ccxt/ccxt/pull/20687)
740
- try {
741
- // todo: possible sync alternatives: https://stackoverflow.com/questions/51069002/convert-import-to-synchronous
742
- this.httpProxyAgentModule = await Promise.resolve().then(function () { return require(/* webpackIgnore: true */ '../static_dependencies/proxies/http-proxy-agent/index.js'); });
743
- this.httpsProxyAgentModule = await Promise.resolve().then(function () { return require(/* webpackIgnore: true */ '../static_dependencies/proxies/https-proxy-agent/index.js'); });
744
- }
745
- catch (e) {
746
- // if several users are using those frameworks which cause exceptions,
747
- // let them to be able to load modules still, by installing them
748
- try {
749
- // @ts-ignore
750
- this.httpProxyAgentModule = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(/* webpackIgnore: true */ 'http-proxy-agent')); });
751
- // @ts-ignore
752
- this.httpProxyAgentModule = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(/* webpackIgnore: true */ 'https-proxy-agent')); });
753
- }
754
- catch (e) { }
755
- }
756
- if (this.socksProxyAgentModuleChecked === false) {
757
- this.socksProxyAgentModuleChecked = true;
758
- try {
759
- // @ts-ignore
760
- this.socksProxyAgentModule = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(/* webpackIgnore: true */ 'socks-proxy-agent')); });
761
- }
762
- catch (e) { }
734
+ // when loading markets, multiple parallel calls are made, so need one promise
735
+ if (this.proxiesModulesLoading === undefined) {
736
+ this.proxiesModulesLoading = (async () => {
737
+ // we have to handle it with below nested way, because of dynamic
738
+ // import issues (https://github.com/ccxt/ccxt/pull/20687)
739
+ try {
740
+ // todo: possible sync alternatives: https://stackoverflow.com/questions/51069002/convert-import-to-synchronous
741
+ this.httpProxyAgentModule = await Promise.resolve().then(function () { return require(/* webpackIgnore: true */ '../static_dependencies/proxies/http-proxy-agent/index.js'); });
742
+ this.httpsProxyAgentModule = await Promise.resolve().then(function () { return require(/* webpackIgnore: true */ '../static_dependencies/proxies/https-proxy-agent/index.js'); });
743
+ }
744
+ catch (e) {
745
+ // if several users are using those frameworks which cause exceptions,
746
+ // let them to be able to load modules still, by installing them
747
+ try {
748
+ // @ts-ignore
749
+ this.httpProxyAgentModule = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(/* webpackIgnore: true */ 'http-proxy-agent')); });
750
+ // @ts-ignore
751
+ this.httpProxyAgentModule = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(/* webpackIgnore: true */ 'https-proxy-agent')); });
752
+ }
753
+ catch (e) { }
754
+ }
755
+ if (this.socksProxyAgentModuleChecked === false) {
756
+ try {
757
+ // @ts-ignore
758
+ this.socksProxyAgentModule = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(/* webpackIgnore: true */ 'socks-proxy-agent')); });
759
+ }
760
+ catch (e) { }
761
+ this.socksProxyAgentModuleChecked = true;
762
+ }
763
+ })();
763
764
  }
765
+ return await this.proxiesModulesLoading;
764
766
  }
765
767
  setProxyAgents(httpProxy, httpsProxy, socksProxy) {
766
768
  let chosenAgent = undefined;
@@ -6308,11 +6308,13 @@ class bitget extends bitget$1 {
6308
6308
  * @description fetch all open positions
6309
6309
  * @see https://www.bitget.com/api-doc/contract/position/get-all-position
6310
6310
  * @see https://www.bitget.com/api-doc/contract/position/Get-History-Position
6311
- * @param {string[]|undefined} symbols list of unified market symbols
6311
+ * @param {string[]} [symbols] list of unified market symbols
6312
6312
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6313
6313
  * @param {string} [params.marginCoin] the settle currency of the positions, needs to match the productType
6314
6314
  * @param {string} [params.productType] 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
6315
6315
  * @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)
6316
+ * @param {boolean} [params.useHistoryEndpoint] default false, when true will use the historic endpoint to fetch positions
6317
+ * @param {string} [params.method] either (default) 'privateMixGetV2MixPositionAllPosition' or 'privateMixGetV2MixPositionHistoryPosition'
6316
6318
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
6317
6319
  */
6318
6320
  await this.loadMarkets();
@@ -6321,8 +6323,14 @@ class bitget extends bitget$1 {
6321
6323
  if (paginate) {
6322
6324
  return await this.fetchPaginatedCallCursor('fetchPositions', undefined, undefined, undefined, params, 'endId', 'idLessThan');
6323
6325
  }
6324
- const fetchPositionsOptions = this.safeValue(this.options, 'fetchPositions', {});
6325
- const method = this.safeString(fetchPositionsOptions, 'method', 'privateMixGetV2MixPositionAllPosition');
6326
+ let method = undefined;
6327
+ const useHistoryEndpoint = this.safeBool(params, 'useHistoryEndpoint', false);
6328
+ if (useHistoryEndpoint) {
6329
+ method = 'privateMixGetV2MixPositionHistoryPosition';
6330
+ }
6331
+ else {
6332
+ [method, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', 'privateMixGetV2MixPositionAllPosition');
6333
+ }
6326
6334
  let market = undefined;
6327
6335
  if (symbols !== undefined) {
6328
6336
  const first = this.safeString(symbols, 0);
@@ -6438,11 +6446,11 @@ class bitget extends bitget$1 {
6438
6446
  //
6439
6447
  let position = [];
6440
6448
  if (!isHistory) {
6441
- position = this.safeValue(response, 'data', []);
6449
+ position = this.safeList(response, 'data', []);
6442
6450
  }
6443
6451
  else {
6444
- const data = this.safeValue(response, 'data', {});
6445
- position = this.safeValue(data, 'list', []);
6452
+ const data = this.safeDict(response, 'data', {});
6453
+ position = this.safeList(data, 'list', []);
6446
6454
  }
6447
6455
  const result = [];
6448
6456
  for (let i = 0; i < position.length; i++) {