ccxt 4.1.96 → 4.1.98

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 (187) hide show
  1. package/README.md +3 -3
  2. package/build.sh +1 -1
  3. package/dist/ccxt.browser.js +1275 -1208
  4. package/dist/ccxt.browser.min.js +3 -3
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/ace.js +1 -1
  7. package/dist/cjs/src/ascendex.js +1 -1
  8. package/dist/cjs/src/base/Exchange.js +6 -5
  9. package/dist/cjs/src/base/errors.js +8 -1
  10. package/dist/cjs/src/bigone.js +2 -2
  11. package/dist/cjs/src/binance.js +29 -32
  12. package/dist/cjs/src/bingx.js +76 -3
  13. package/dist/cjs/src/bitfinex.js +1 -1
  14. package/dist/cjs/src/bitfinex2.js +1 -1
  15. package/dist/cjs/src/bitflyer.js +2 -2
  16. package/dist/cjs/src/bitget.js +13 -13
  17. package/dist/cjs/src/bitmart.js +1 -1
  18. package/dist/cjs/src/bitmex.js +2 -2
  19. package/dist/cjs/src/bitopro.js +1 -1
  20. package/dist/cjs/src/bitpanda.js +1 -1
  21. package/dist/cjs/src/bitvavo.js +1 -1
  22. package/dist/cjs/src/blockchaincom.js +1 -1
  23. package/dist/cjs/src/btcalpha.js +2 -2
  24. package/dist/cjs/src/btcbox.js +1 -1
  25. package/dist/cjs/src/btcmarkets.js +2 -2
  26. package/dist/cjs/src/btcturk.js +1 -1
  27. package/dist/cjs/src/bybit.js +2 -2
  28. package/dist/cjs/src/cex.js +1 -1
  29. package/dist/cjs/src/coinbasepro.js +2 -2
  30. package/dist/cjs/src/coinex.js +1 -1
  31. package/dist/cjs/src/coinlist.js +1 -1
  32. package/dist/cjs/src/deribit.js +1 -1
  33. package/dist/cjs/src/digifinex.js +1 -1
  34. package/dist/cjs/src/gate.js +1 -1
  35. package/dist/cjs/src/hitbtc.js +1 -1
  36. package/dist/cjs/src/hollaex.js +2 -2
  37. package/dist/cjs/src/htx.js +1 -1
  38. package/dist/cjs/src/huobijp.js +2 -2
  39. package/dist/cjs/src/idex.js +1 -1
  40. package/dist/cjs/src/independentreserve.js +1 -1
  41. package/dist/cjs/src/kraken.js +1 -1
  42. package/dist/cjs/src/kucoin.js +4 -4
  43. package/dist/cjs/src/kucoinfutures.js +1 -1
  44. package/dist/cjs/src/kuna.js +1 -1
  45. package/dist/cjs/src/latoken.js +1 -1
  46. package/dist/cjs/src/luno.js +2 -2
  47. package/dist/cjs/src/lykke.js +1 -1
  48. package/dist/cjs/src/mexc.js +2 -2
  49. package/dist/cjs/src/ndax.js +1 -1
  50. package/dist/cjs/src/novadax.js +2 -2
  51. package/dist/cjs/src/oceanex.js +1 -1
  52. package/dist/cjs/src/okcoin.js +1 -1
  53. package/dist/cjs/src/okx.js +1 -1
  54. package/dist/cjs/src/phemex.js +3 -3
  55. package/dist/cjs/src/poloniexfutures.js +1 -1
  56. package/dist/cjs/src/pro/alpaca.js +1 -1
  57. package/dist/cjs/src/pro/ascendex.js +1 -1
  58. package/dist/cjs/src/pro/binance.js +2 -2
  59. package/dist/cjs/src/pro/bingx.js +12 -6
  60. package/dist/cjs/src/pro/bitfinex.js +1 -1
  61. package/dist/cjs/src/pro/bitfinex2.js +1 -1
  62. package/dist/cjs/src/pro/bitmart.js +1 -1
  63. package/dist/cjs/src/pro/bitmex.js +1 -1
  64. package/dist/cjs/src/pro/bitpanda.js +1 -1
  65. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  66. package/dist/cjs/src/pro/bybit.js +2 -2
  67. package/dist/cjs/src/pro/coinbase.js +1 -1
  68. package/dist/cjs/src/pro/coinbasepro.js +1 -1
  69. package/dist/cjs/src/pro/deribit.js +1 -1
  70. package/dist/cjs/src/pro/gate.js +1 -1
  71. package/dist/cjs/src/pro/gemini.js +1 -1
  72. package/dist/cjs/src/pro/hollaex.js +1 -1
  73. package/dist/cjs/src/pro/htx.js +1 -1
  74. package/dist/cjs/src/pro/idex.js +1 -1
  75. package/dist/cjs/src/pro/kraken.js +1 -1
  76. package/dist/cjs/src/pro/krakenfutures.js +1 -1
  77. package/dist/cjs/src/pro/kucoinfutures.js +1 -1
  78. package/dist/cjs/src/pro/mexc.js +1 -1
  79. package/dist/cjs/src/pro/okcoin.js +1 -1
  80. package/dist/cjs/src/pro/okx.js +1 -1
  81. package/dist/cjs/src/pro/phemex.js +1 -1
  82. package/dist/cjs/src/pro/poloniexfutures.js +1 -1
  83. package/dist/cjs/src/probit.js +1 -1
  84. package/dist/cjs/src/timex.js +1 -1
  85. package/dist/cjs/src/tokocrypto.js +1 -1
  86. package/dist/cjs/src/upbit.js +1 -1
  87. package/dist/cjs/src/wavesexchange.js +1 -1
  88. package/dist/cjs/src/whitebit.js +1 -1
  89. package/dist/cjs/src/woo.js +1 -1
  90. package/dist/cjs/src/zaif.js +1 -1
  91. package/js/ccxt.d.ts +1 -1
  92. package/js/ccxt.js +1 -1
  93. package/js/src/abstract/bingx.d.ts +2 -0
  94. package/js/src/ace.js +1 -1
  95. package/js/src/ascendex.js +1 -1
  96. package/js/src/base/Exchange.d.ts +1 -1
  97. package/js/src/base/Exchange.js +7 -6
  98. package/js/src/base/errorHierarchy.d.ts +1 -0
  99. package/js/src/base/errorHierarchy.js +1 -0
  100. package/js/src/base/errors.d.ts +5 -1
  101. package/js/src/base/errors.js +8 -2
  102. package/js/src/bigone.js +2 -2
  103. package/js/src/binance.js +29 -32
  104. package/js/src/bingx.d.ts +2 -0
  105. package/js/src/bingx.js +76 -3
  106. package/js/src/bitfinex.js +1 -1
  107. package/js/src/bitfinex2.js +1 -1
  108. package/js/src/bitflyer.js +2 -2
  109. package/js/src/bitget.js +13 -13
  110. package/js/src/bitmart.js +1 -1
  111. package/js/src/bitmex.js +2 -2
  112. package/js/src/bitopro.js +1 -1
  113. package/js/src/bitpanda.js +1 -1
  114. package/js/src/bitso.d.ts +1 -1
  115. package/js/src/bitvavo.js +1 -1
  116. package/js/src/blockchaincom.js +1 -1
  117. package/js/src/btcalpha.js +2 -2
  118. package/js/src/btcbox.js +1 -1
  119. package/js/src/btcmarkets.js +2 -2
  120. package/js/src/btcturk.js +1 -1
  121. package/js/src/bybit.js +2 -2
  122. package/js/src/cex.js +1 -1
  123. package/js/src/coinbasepro.js +2 -2
  124. package/js/src/coinex.js +1 -1
  125. package/js/src/coinlist.js +1 -1
  126. package/js/src/deribit.js +1 -1
  127. package/js/src/digifinex.js +1 -1
  128. package/js/src/gate.js +1 -1
  129. package/js/src/hitbtc.js +1 -1
  130. package/js/src/hollaex.js +2 -2
  131. package/js/src/htx.js +1 -1
  132. package/js/src/huobijp.js +2 -2
  133. package/js/src/idex.js +1 -1
  134. package/js/src/independentreserve.js +1 -1
  135. package/js/src/kraken.js +1 -1
  136. package/js/src/kucoin.js +4 -4
  137. package/js/src/kucoinfutures.js +1 -1
  138. package/js/src/kuna.js +1 -1
  139. package/js/src/latoken.js +1 -1
  140. package/js/src/luno.js +2 -2
  141. package/js/src/lykke.js +1 -1
  142. package/js/src/mexc.js +2 -2
  143. package/js/src/ndax.js +1 -1
  144. package/js/src/novadax.js +2 -2
  145. package/js/src/oceanex.js +1 -1
  146. package/js/src/okcoin.js +1 -1
  147. package/js/src/okx.js +1 -1
  148. package/js/src/phemex.js +3 -3
  149. package/js/src/poloniexfutures.js +1 -1
  150. package/js/src/pro/alpaca.js +1 -1
  151. package/js/src/pro/ascendex.js +1 -1
  152. package/js/src/pro/binance.js +2 -2
  153. package/js/src/pro/bingx.js +12 -6
  154. package/js/src/pro/bitfinex.js +1 -1
  155. package/js/src/pro/bitfinex2.js +1 -1
  156. package/js/src/pro/bitmart.js +1 -1
  157. package/js/src/pro/bitmex.js +1 -1
  158. package/js/src/pro/bitpanda.js +1 -1
  159. package/js/src/pro/blockchaincom.js +1 -1
  160. package/js/src/pro/bybit.js +2 -2
  161. package/js/src/pro/coinbase.js +1 -1
  162. package/js/src/pro/coinbasepro.js +1 -1
  163. package/js/src/pro/deribit.js +1 -1
  164. package/js/src/pro/gate.js +1 -1
  165. package/js/src/pro/gemini.js +1 -1
  166. package/js/src/pro/hollaex.js +1 -1
  167. package/js/src/pro/htx.js +1 -1
  168. package/js/src/pro/idex.js +1 -1
  169. package/js/src/pro/kraken.js +1 -1
  170. package/js/src/pro/krakenfutures.js +1 -1
  171. package/js/src/pro/kucoinfutures.js +1 -1
  172. package/js/src/pro/mexc.js +1 -1
  173. package/js/src/pro/okcoin.js +1 -1
  174. package/js/src/pro/okx.js +1 -1
  175. package/js/src/pro/phemex.js +1 -1
  176. package/js/src/pro/poloniexfutures.js +1 -1
  177. package/js/src/probit.js +1 -1
  178. package/js/src/timex.js +1 -1
  179. package/js/src/tokocrypto.js +1 -1
  180. package/js/src/upbit.js +1 -1
  181. package/js/src/wavesexchange.js +1 -1
  182. package/js/src/whitebit.js +1 -1
  183. package/js/src/woo.js +1 -1
  184. package/js/src/zaif.js +1 -1
  185. package/package.json +13 -13
  186. package/skip-tests.json +120 -71
  187. package/run-tests-ws.js +0 -290
package/js/src/binance.js CHANGED
@@ -6079,7 +6079,8 @@ export default class binance extends Exchange {
6079
6079
  'amount': this.currencyToPrecision(code, amount),
6080
6080
  };
6081
6081
  request['type'] = this.safeString(params, 'type');
6082
- let method = 'sapiPostAssetTransfer';
6082
+ params = this.omit(params, 'type');
6083
+ let response = undefined;
6083
6084
  if (request['type'] === undefined) {
6084
6085
  const symbol = this.safeString(params, 'symbol');
6085
6086
  if (symbol !== undefined) {
@@ -6119,16 +6120,16 @@ export default class binance extends Exchange {
6119
6120
  throw new BadRequest(this.id + ' transfer () does not allow transfers between ' + fromAccount + ' and ' + toAccount);
6120
6121
  }
6121
6122
  else if (toSpot && fromIsolated) {
6122
- method = 'sapiPostMarginIsolatedTransfer';
6123
6123
  request['transFrom'] = 'ISOLATED_MARGIN';
6124
6124
  request['transTo'] = 'SPOT';
6125
6125
  request['symbol'] = fromId;
6126
+ response = await this.sapiPostMarginIsolatedTransfer(this.extend(request, params));
6126
6127
  }
6127
6128
  else if (fromSpot && toIsolated) {
6128
- method = 'sapiPostMarginIsolatedTransfer';
6129
6129
  request['transFrom'] = 'SPOT';
6130
6130
  request['transTo'] = 'ISOLATED_MARGIN';
6131
6131
  request['symbol'] = toId;
6132
+ response = await this.sapiPostMarginIsolatedTransfer(this.extend(request, params));
6132
6133
  }
6133
6134
  else {
6134
6135
  if (fromIsolated) {
@@ -6146,8 +6147,9 @@ export default class binance extends Exchange {
6146
6147
  request['type'] = fromId + '_' + toId;
6147
6148
  }
6148
6149
  }
6149
- params = this.omit(params, 'type');
6150
- const response = await this[method](this.extend(request, params));
6150
+ if (response === undefined) {
6151
+ response = await this.sapiPostAssetTransfer(this.extend(request, params));
6152
+ }
6151
6153
  //
6152
6154
  // {
6153
6155
  // "tranId":13526853623
@@ -6940,7 +6942,6 @@ export default class binance extends Exchange {
6940
6942
  */
6941
6943
  await this.loadMarkets();
6942
6944
  const request = {};
6943
- let method = undefined;
6944
6945
  let paginate = false;
6945
6946
  [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingRateHistory', 'paginate');
6946
6947
  if (paginate) {
@@ -6957,15 +6958,6 @@ export default class binance extends Exchange {
6957
6958
  let subType = undefined;
6958
6959
  [subType, params] = this.handleSubTypeAndParams('fetchFundingRateHistory', market, params, 'linear');
6959
6960
  params = this.omit(params, 'type');
6960
- if (this.isLinear(type, subType)) {
6961
- method = 'fapiPublicGetFundingRate';
6962
- }
6963
- else if (this.isInverse(type, subType)) {
6964
- method = 'dapiPublicGetFundingRate';
6965
- }
6966
- if (method === undefined) {
6967
- throw new NotSupported(this.id + ' fetchFundingRateHistory() is not supported for ' + type + ' markets');
6968
- }
6969
6961
  if (since !== undefined) {
6970
6962
  request['startTime'] = since;
6971
6963
  }
@@ -6978,7 +6970,16 @@ export default class binance extends Exchange {
6978
6970
  if (limit !== undefined) {
6979
6971
  request['limit'] = limit;
6980
6972
  }
6981
- const response = await this[method](this.extend(request, params));
6973
+ let response = undefined;
6974
+ if (this.isLinear(type, subType)) {
6975
+ response = await this.fapiPublicGetFundingRate(this.extend(request, params));
6976
+ }
6977
+ else if (this.isInverse(type, subType)) {
6978
+ response = await this.dapiPublicGetFundingRate(this.extend(request, params));
6979
+ }
6980
+ else {
6981
+ throw new NotSupported(this.id + ' fetchFundingRateHistory() is not supported for ' + type + ' markets');
6982
+ }
6982
6983
  //
6983
6984
  // {
6984
6985
  // "symbol": "BTCUSDT",
@@ -7014,22 +7015,21 @@ export default class binance extends Exchange {
7014
7015
  */
7015
7016
  await this.loadMarkets();
7016
7017
  symbols = this.marketSymbols(symbols);
7017
- let method = undefined;
7018
7018
  const defaultType = this.safeString2(this.options, 'fetchFundingRates', 'defaultType', 'future');
7019
7019
  const type = this.safeString(params, 'type', defaultType);
7020
7020
  let subType = undefined;
7021
7021
  [subType, params] = this.handleSubTypeAndParams('fetchFundingRates', undefined, params, 'linear');
7022
7022
  const query = this.omit(params, 'type');
7023
+ let response = undefined;
7023
7024
  if (this.isLinear(type, subType)) {
7024
- method = 'fapiPublicGetPremiumIndex';
7025
+ response = await this.fapiPublicGetPremiumIndex(query);
7025
7026
  }
7026
7027
  else if (this.isInverse(type, subType)) {
7027
- method = 'dapiPublicGetPremiumIndex';
7028
+ response = await this.dapiPublicGetPremiumIndex(query);
7028
7029
  }
7029
7030
  else {
7030
7031
  throw new NotSupported(this.id + ' fetchFundingRates() supports linear and inverse contracts only');
7031
7032
  }
7032
- const response = await this[method](query);
7033
7033
  const result = [];
7034
7034
  for (let i = 0; i < response.length; i++) {
7035
7035
  const entry = response[i];
@@ -7497,22 +7497,21 @@ export default class binance extends Exchange {
7497
7497
  // it contains useful stuff like the maintenance margin and initial margin for positions
7498
7498
  const leverageBrackets = this.safeValue(this.options, 'leverageBrackets');
7499
7499
  if ((leverageBrackets === undefined) || (reload)) {
7500
- let method = undefined;
7501
7500
  const defaultType = this.safeString(this.options, 'defaultType', 'future');
7502
7501
  const type = this.safeString(params, 'type', defaultType);
7503
7502
  const query = this.omit(params, 'type');
7504
7503
  let subType = undefined;
7505
7504
  [subType, params] = this.handleSubTypeAndParams('loadLeverageBrackets', undefined, params, 'linear');
7505
+ let response = undefined;
7506
7506
  if (this.isLinear(type, subType)) {
7507
- method = 'fapiPrivateGetLeverageBracket';
7507
+ response = await this.fapiPrivateGetLeverageBracket(query);
7508
7508
  }
7509
7509
  else if (this.isInverse(type, subType)) {
7510
- method = 'dapiPrivateV2GetLeverageBracket';
7510
+ response = await this.dapiPrivateV2GetLeverageBracket(query);
7511
7511
  }
7512
7512
  else {
7513
7513
  throw new NotSupported(this.id + ' loadLeverageBrackets() supports linear and inverse contracts only');
7514
7514
  }
7515
- const response = await this[method](query);
7516
7515
  this.options['leverageBrackets'] = {};
7517
7516
  for (let i = 0; i < response.length; i++) {
7518
7517
  const entry = response[i];
@@ -7974,7 +7973,6 @@ export default class binance extends Exchange {
7974
7973
  */
7975
7974
  await this.loadMarkets();
7976
7975
  let market = undefined;
7977
- let method = undefined;
7978
7976
  const request = {
7979
7977
  'incomeType': 'FUNDING_FEE', // "TRANSFER","WELCOME_BONUS", "REALIZED_PNL","FUNDING_FEE", "COMMISSION" and "INSURANCE_CLEAR"
7980
7978
  };
@@ -7996,16 +7994,16 @@ export default class binance extends Exchange {
7996
7994
  const defaultType = this.safeString2(this.options, 'fetchFundingHistory', 'defaultType', 'future');
7997
7995
  const type = this.safeString(params, 'type', defaultType);
7998
7996
  params = this.omit(params, 'type');
7997
+ let response = undefined;
7999
7998
  if (this.isLinear(type, subType)) {
8000
- method = 'fapiPrivateGetIncome';
7999
+ response = await this.fapiPrivateGetIncome(this.extend(request, params));
8001
8000
  }
8002
8001
  else if (this.isInverse(type, subType)) {
8003
- method = 'dapiPrivateGetIncome';
8002
+ response = await this.dapiPrivateGetIncome(this.extend(request, params));
8004
8003
  }
8005
8004
  else {
8006
8005
  throw new NotSupported(this.id + ' fetchFundingHistory() supports linear and inverse contracts only');
8007
8006
  }
8008
- const response = await this[method](this.extend(request, params));
8009
8007
  return this.parseIncomes(response, market, since, limit);
8010
8008
  }
8011
8009
  async setLeverage(leverage, symbol = undefined, params = {}) {
@@ -8759,17 +8757,16 @@ export default class binance extends Exchange {
8759
8757
  'symbol': market['id'],
8760
8758
  'amount': amount,
8761
8759
  };
8762
- let method = undefined;
8760
+ let response = undefined;
8763
8761
  let code = undefined;
8764
8762
  if (market['linear']) {
8765
- method = 'fapiPrivatePostPositionMargin';
8766
8763
  code = market['quote'];
8764
+ response = await this.fapiPrivatePostPositionMargin(this.extend(request, params));
8767
8765
  }
8768
8766
  else {
8769
- method = 'dapiPrivatePostPositionMargin';
8770
8767
  code = market['base'];
8768
+ response = await this.dapiPrivatePostPositionMargin(this.extend(request, params));
8771
8769
  }
8772
- const response = await this[method](this.extend(request, params));
8773
8770
  //
8774
8771
  // {
8775
8772
  // "code": 200,
package/js/src/bingx.d.ts CHANGED
@@ -133,7 +133,9 @@ export default class bingx extends Exchange {
133
133
  parseParams(params: any): {};
134
134
  fetchMyLiquidations(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Liquidation[]>;
135
135
  parseLiquidation(liquidation: any, market?: Market): import("./base/types.js").Liquidation;
136
+ closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>;
136
137
  closeAllPositions(params?: {}): Promise<Position[]>;
138
+ setPositionMode(hedged: any, symbol?: Str, params?: {}): Promise<any>;
137
139
  sign(path: any, section?: string, method?: string, params?: {}, headers?: any, body?: any): {
138
140
  url: any;
139
141
  method: string;
package/js/src/bingx.js CHANGED
@@ -33,7 +33,7 @@ export default class bingx extends Exchange {
33
33
  'cancelOrder': true,
34
34
  'cancelOrders': true,
35
35
  'closeAllPositions': true,
36
- 'closePosition': false,
36
+ 'closePosition': true,
37
37
  'createMarketBuyOrderWithCost': true,
38
38
  'createMarketOrderWithCost': true,
39
39
  'createMarketSellOrderWithCost': true,
@@ -145,6 +145,16 @@ export default class bingx extends Exchange {
145
145
  },
146
146
  },
147
147
  'swap': {
148
+ 'v1': {
149
+ 'private': {
150
+ 'get': {
151
+ 'positionSide/dual': 1,
152
+ },
153
+ 'post': {
154
+ 'positionSide/dual': 1,
155
+ },
156
+ },
157
+ },
148
158
  'v2': {
149
159
  'public': {
150
160
  'get': {
@@ -2473,7 +2483,7 @@ export default class bingx extends Exchange {
2473
2483
  * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
2474
2484
  * @param {string} [symbol] unified market symbol of the market orders were made in
2475
2485
  * @param {int} [since] the earliest time in ms to fetch orders for
2476
- * @param {int} [limit] the maximum number of orde structures to retrieve
2486
+ * @param {int} [limit] the maximum number of order structures to retrieve
2477
2487
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2478
2488
  * @param {int} [params.until] the latest time in ms to fetch orders for
2479
2489
  * @param {boolean} [params.standard] whether to fetch standard contract orders
@@ -3372,12 +3382,44 @@ export default class bingx extends Exchange {
3372
3382
  'datetime': this.iso8601(timestamp),
3373
3383
  });
3374
3384
  }
3385
+ async closePosition(symbol, side = undefined, params = {}) {
3386
+ /**
3387
+ * @method
3388
+ * @name bingx#closePosition
3389
+ * @description closes open positions for a market
3390
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#One-Click%20Close%20All%20Positions
3391
+ * @param {string} symbol Unified CCXT market symbol
3392
+ * @param {string} [side] not used by bingx
3393
+ * @param {object} [params] extra parameters specific to the bingx api endpoint
3394
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3395
+ */
3396
+ await this.loadMarkets();
3397
+ const market = this.market(symbol);
3398
+ const request = {
3399
+ 'symbol': market['id'],
3400
+ };
3401
+ const response = await this.swapV2PrivatePostTradeCloseAllPositions(this.extend(request, params));
3402
+ //
3403
+ // {
3404
+ // "code": 0,
3405
+ // "msg": "",
3406
+ // "data": {
3407
+ // "success": [
3408
+ // 1727686766700486656,
3409
+ // ],
3410
+ // "failed": null
3411
+ // }
3412
+ // }
3413
+ //
3414
+ const data = this.safeValue(response, 'data');
3415
+ return this.parseOrder(data);
3416
+ }
3375
3417
  async closeAllPositions(params = {}) {
3376
3418
  /**
3377
3419
  * @method
3378
3420
  * @name bitget#closePositions
3379
3421
  * @description closes open positions for a market
3380
- * @see https://bitgetlimited.github.io/apidoc/en/mix/#close-all-position
3422
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#One-Click%20Close%20All%20Positions
3381
3423
  * @param {object} [params] extra parameters specific to the okx api endpoint
3382
3424
  * @param {string} [params.recvWindow] request valid time window value
3383
3425
  * @returns {object[]} [A list of position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -3416,6 +3458,37 @@ export default class bingx extends Exchange {
3416
3458
  }
3417
3459
  return positions;
3418
3460
  }
3461
+ async setPositionMode(hedged, symbol = undefined, params = {}) {
3462
+ /**
3463
+ * @method
3464
+ * @name bingx#setPositionMode
3465
+ * @description set hedged to true or false for a market
3466
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Set%20Position%20Mode
3467
+ * @param {bool} hedged set to true to use dualSidePosition
3468
+ * @param {string} symbol not used by bingx setPositionMode ()
3469
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3470
+ * @returns {object} response from the exchange
3471
+ */
3472
+ let dualSidePosition = undefined;
3473
+ if (hedged) {
3474
+ dualSidePosition = 'true';
3475
+ }
3476
+ else {
3477
+ dualSidePosition = 'false';
3478
+ }
3479
+ const request = {
3480
+ 'dualSidePosition': dualSidePosition,
3481
+ };
3482
+ //
3483
+ // {
3484
+ // code: '0',
3485
+ // msg: '',
3486
+ // timeStamp: '1703327432734',
3487
+ // data: { dualSidePosition: 'false' }
3488
+ // }
3489
+ //
3490
+ return await this.swapV1PrivatePostPositionSideDual(this.extend(request, params));
3491
+ }
3419
3492
  sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
3420
3493
  const type = section[0];
3421
3494
  const version = section[1];
@@ -1241,7 +1241,7 @@ export default class bitfinex extends Exchange {
1241
1241
  * @description fetches information on multiple closed orders made by the user
1242
1242
  * @param {string} symbol unified market symbol of the market orders were made in
1243
1243
  * @param {int} [since] the earliest time in ms to fetch orders for
1244
- * @param {int} [limit] the maximum number of orde structures to retrieve
1244
+ * @param {int} [limit] the maximum number of order structures to retrieve
1245
1245
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1246
1246
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1247
1247
  */
@@ -1816,7 +1816,7 @@ export default class bitfinex2 extends Exchange {
1816
1816
  * @see https://docs.bitfinex.com/reference/rest-auth-retrieve-orders-by-symbol
1817
1817
  * @param {string} symbol unified market symbol of the market orders were made in
1818
1818
  * @param {int} [since] the earliest time in ms to fetch orders for
1819
- * @param {int} [limit] the maximum number of orde structures to retrieve
1819
+ * @param {int} [limit] the maximum number of order structures to retrieve
1820
1820
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1821
1821
  * @param {int} [params.until] the latest time in ms to fetch entries for
1822
1822
  * @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)
@@ -654,7 +654,7 @@ export default class bitflyer extends Exchange {
654
654
  * @see https://lightning.bitflyer.com/docs?lang=en#list-orders
655
655
  * @param {string} symbol unified market symbol of the market orders were made in
656
656
  * @param {int} [since] the earliest time in ms to fetch orders for
657
- * @param {int} [limit] the maximum number of orde structures to retrieve
657
+ * @param {int} [limit] the maximum number of order structures to retrieve
658
658
  * @param {object} [params] extra parameters specific to the exchange API endpoint
659
659
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
660
660
  */
@@ -699,7 +699,7 @@ export default class bitflyer extends Exchange {
699
699
  * @see https://lightning.bitflyer.com/docs?lang=en#list-orders
700
700
  * @param {string} symbol unified market symbol of the market orders were made in
701
701
  * @param {int} [since] the earliest time in ms to fetch orders for
702
- * @param {int} [limit] the maximum number of orde structures to retrieve
702
+ * @param {int} [limit] the maximum number of order structures to retrieve
703
703
  * @param {object} [params] extra parameters specific to the exchange API endpoint
704
704
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
705
705
  */
package/js/src/bitget.js CHANGED
@@ -1281,12 +1281,12 @@ export default class bitget extends Exchange {
1281
1281
  '30m': '30min',
1282
1282
  '1h': '1h',
1283
1283
  '4h': '4h',
1284
- '6h': '6h',
1285
- '12h': '12h',
1286
- '1d': '1day',
1287
- '3d': '3day',
1288
- '1w': '1week',
1289
- '1M': '1M',
1284
+ '6h': '6Hutc',
1285
+ '12h': '12Hutc',
1286
+ '1d': '1Dutc',
1287
+ '3d': '3Dutc',
1288
+ '1w': '1Wutc',
1289
+ '1M': '1Mutc',
1290
1290
  },
1291
1291
  'swap': {
1292
1292
  '1m': '1m',
@@ -1297,12 +1297,12 @@ export default class bitget extends Exchange {
1297
1297
  '1h': '1H',
1298
1298
  '2h': '2H',
1299
1299
  '4h': '4H',
1300
- '6h': '6H',
1301
- '12h': '12H',
1302
- '1d': '1D',
1303
- '3d': '3D',
1304
- '1w': '1W',
1305
- '1M': '1M',
1300
+ '6h': '6Hutc',
1301
+ '12h': '12Hutc',
1302
+ '1d': '1Dutc',
1303
+ '3d': '3Dutc',
1304
+ '1w': '1Wutc',
1305
+ '1M': '1Mutc',
1306
1306
  },
1307
1307
  },
1308
1308
  'fetchMarkets': [
@@ -2904,7 +2904,7 @@ export default class bitget extends Exchange {
2904
2904
  const currencyCode = this.safeCurrencyCode(this.safeString(feeStructure, 'feeCoin'));
2905
2905
  fee = {
2906
2906
  'currency': currencyCode,
2907
- 'cost': Precise.stringNeg(this.safeString(feeStructure, 'totalFee')),
2907
+ 'cost': Precise.stringAbs(this.safeString(feeStructure, 'totalFee')),
2908
2908
  };
2909
2909
  }
2910
2910
  return this.safeTrade({
package/js/src/bitmart.js CHANGED
@@ -2755,7 +2755,7 @@ export default class bitmart extends Exchange {
2755
2755
  * @description fetches information on multiple closed orders made by the user
2756
2756
  * @param {string} symbol unified market symbol of the market orders were made in
2757
2757
  * @param {int} [since] the earliest time in ms to fetch orders for
2758
- * @param {int} [limit] the maximum number of orde structures to retrieve
2758
+ * @param {int} [limit] the maximum number of order structures to retrieve
2759
2759
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2760
2760
  * @param {int} [params.until] timestamp in ms of the latest entry
2761
2761
  * @param {string} [params.marginMode] *spot only* 'cross' or 'isolated', for margin trading
package/js/src/bitmex.js CHANGED
@@ -875,7 +875,7 @@ export default class bitmex extends Exchange {
875
875
  * @description fetches information on multiple orders made by the user
876
876
  * @param {string} symbol unified market symbol of the market orders were made in
877
877
  * @param {int} [since] the earliest time in ms to fetch orders for
878
- * @param {int} [limit] the maximum number of orde structures to retrieve
878
+ * @param {int} [limit] the maximum number of order structures to retrieve
879
879
  * @param {object} [params] extra parameters specific to the exchange API endpoint
880
880
  * @param {int} [params.until] the earliest time in ms to fetch orders for
881
881
  * @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)
@@ -939,7 +939,7 @@ export default class bitmex extends Exchange {
939
939
  * @description fetches information on multiple closed orders made by the user
940
940
  * @param {string} symbol unified market symbol of the market orders were made in
941
941
  * @param {int} [since] the earliest time in ms to fetch orders for
942
- * @param {int} [limit] the maximum number of orde structures to retrieve
942
+ * @param {int} [limit] the maximum number of order structures to retrieve
943
943
  * @param {object} [params] extra parameters specific to the exchange API endpoint
944
944
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
945
945
  */
package/js/src/bitopro.js CHANGED
@@ -1270,7 +1270,7 @@ export default class bitopro extends Exchange {
1270
1270
  * @see https://github.com/bitoex/bitopro-offical-api-docs/blob/master/api/v3/private/get_orders_data.md
1271
1271
  * @param {string} symbol unified market symbol of the market orders were made in
1272
1272
  * @param {int} [since] the earliest time in ms to fetch orders for
1273
- * @param {int} [limit] the maximum number of orde structures to retrieve
1273
+ * @param {int} [limit] the maximum number of order structures to retrieve
1274
1274
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1275
1275
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1276
1276
  */
@@ -1820,7 +1820,7 @@ export default class bitpanda extends Exchange {
1820
1820
  * @description fetches information on multiple closed orders made by the user
1821
1821
  * @param {string} symbol unified market symbol of the market orders were made in
1822
1822
  * @param {int} [since] the earliest time in ms to fetch orders for
1823
- * @param {int} [limit] the maximum number of orde structures to retrieve
1823
+ * @param {int} [limit] the maximum number of order structures to retrieve
1824
1824
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1825
1825
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1826
1826
  */
package/js/src/bitso.d.ts CHANGED
@@ -23,7 +23,7 @@ export default class bitso extends Exchange {
23
23
  after: number;
24
24
  status: string;
25
25
  fee: any;
26
- info: object;
26
+ info: any;
27
27
  };
28
28
  fetchMarkets(params?: {}): Promise<any[]>;
29
29
  parseBalance(response: any): Balances;
package/js/src/bitvavo.js CHANGED
@@ -1261,7 +1261,7 @@ export default class bitvavo extends Exchange {
1261
1261
  * @description fetches information on multiple orders made by the user
1262
1262
  * @param {string} symbol unified market symbol of the market orders were made in
1263
1263
  * @param {int} [since] the earliest time in ms to fetch orders for
1264
- * @param {int} [limit] the maximum number of orde structures to retrieve
1264
+ * @param {int} [limit] the maximum number of order structures to retrieve
1265
1265
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1266
1266
  * @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)
1267
1267
  * @param {int} [params.until] the latest time in ms to fetch entries for
@@ -691,7 +691,7 @@ export default class blockchaincom extends Exchange {
691
691
  * @description fetches information on multiple closed orders made by the user
692
692
  * @param {string} symbol unified market symbol of the market orders were made in
693
693
  * @param {int} [since] the earliest time in ms to fetch orders for
694
- * @param {int} [limit] the maximum number of orde structures to retrieve
694
+ * @param {int} [limit] the maximum number of order structures to retrieve
695
695
  * @param {object} [params] extra parameters specific to the exchange API endpoint
696
696
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
697
697
  */
@@ -798,7 +798,7 @@ export default class btcalpha extends Exchange {
798
798
  * @description fetches information on multiple orders made by the user
799
799
  * @param {string} symbol unified market symbol of the market orders were made in
800
800
  * @param {int} [since] the earliest time in ms to fetch orders for
801
- * @param {int} [limit] the maximum number of orde structures to retrieve
801
+ * @param {int} [limit] the maximum number of order structures to retrieve
802
802
  * @param {object} [params] extra parameters specific to the exchange API endpoint
803
803
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
804
804
  */
@@ -838,7 +838,7 @@ export default class btcalpha extends Exchange {
838
838
  * @description fetches information on multiple closed orders made by the user
839
839
  * @param {string} symbol unified market symbol of the market orders were made in
840
840
  * @param {int} [since] the earliest time in ms to fetch orders for
841
- * @param {int} [limit] the maximum number of orde structures to retrieve
841
+ * @param {int} [limit] the maximum number of order structures to retrieve
842
842
  * @param {object} [params] extra parameters specific to the exchange API endpoint
843
843
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
844
844
  */
package/js/src/btcbox.js CHANGED
@@ -488,7 +488,7 @@ export default class btcbox extends Exchange {
488
488
  * @description fetches information on multiple orders made by the user
489
489
  * @param {string} symbol unified market symbol of the market orders were made in
490
490
  * @param {int} [since] the earliest time in ms to fetch orders for
491
- * @param {int} [limit] the maximum number of orde structures to retrieve
491
+ * @param {int} [limit] the maximum number of order structures to retrieve
492
492
  * @param {object} [params] extra parameters specific to the exchange API endpoint
493
493
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
494
494
  */
@@ -1025,7 +1025,7 @@ export default class btcmarkets extends Exchange {
1025
1025
  * @description fetches information on multiple orders made by the user
1026
1026
  * @param {string} symbol unified market symbol of the market orders were made in
1027
1027
  * @param {int} [since] the earliest time in ms to fetch orders for
1028
- * @param {int} [limit] the maximum number of orde structures to retrieve
1028
+ * @param {int} [limit] the maximum number of order structures to retrieve
1029
1029
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1030
1030
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1031
1031
  */
@@ -1068,7 +1068,7 @@ export default class btcmarkets extends Exchange {
1068
1068
  * @description fetches information on multiple closed orders made by the user
1069
1069
  * @param {string} symbol unified market symbol of the market orders were made in
1070
1070
  * @param {int} [since] the earliest time in ms to fetch orders for
1071
- * @param {int} [limit] the maximum number of orde structures to retrieve
1071
+ * @param {int} [limit] the maximum number of order structures to retrieve
1072
1072
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1073
1073
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1074
1074
  */
package/js/src/btcturk.js CHANGED
@@ -731,7 +731,7 @@ export default class btcturk extends Exchange {
731
731
  * @description fetches information on multiple orders made by the user
732
732
  * @param {string} symbol unified market symbol of the market orders were made in
733
733
  * @param {int} [since] the earliest time in ms to fetch orders for
734
- * @param {int} [limit] the maximum number of orde structures to retrieve
734
+ * @param {int} [limit] the maximum number of order structures to retrieve
735
735
  * @param {object} [params] extra parameters specific to the exchange API endpoint
736
736
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
737
737
  */
package/js/src/bybit.js CHANGED
@@ -4436,7 +4436,7 @@ export default class bybit extends Exchange {
4436
4436
  * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4437
4437
  * @param {string} symbol unified market symbol of the market orders were made in
4438
4438
  * @param {int} [since] the earliest time in ms to fetch orders for
4439
- * @param {int} [limit] the maximum number of orde structures to retrieve
4439
+ * @param {int} [limit] the maximum number of order structures to retrieve
4440
4440
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4441
4441
  * @param {boolean} [params.stop] true if stop order
4442
4442
  * @param {string} [params.type] market type, ['swap', 'option', 'spot']
@@ -4552,7 +4552,7 @@ export default class bybit extends Exchange {
4552
4552
  * @see https://bybit-exchange.github.io/docs/v5/order/order-list
4553
4553
  * @param {string} symbol unified market symbol of the market orders were made in
4554
4554
  * @param {int} [since] the earliest time in ms to fetch orders for
4555
- * @param {int} [limit] the maximum number of orde structures to retrieve
4555
+ * @param {int} [limit] the maximum number of order structures to retrieve
4556
4556
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4557
4557
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4558
4558
  */
package/js/src/cex.js CHANGED
@@ -1332,7 +1332,7 @@ export default class cex extends Exchange {
1332
1332
  * @description fetches information on multiple orders made by the user
1333
1333
  * @param {string} symbol unified market symbol of the market orders were made in
1334
1334
  * @param {int} [since] the earliest time in ms to fetch orders for
1335
- * @param {int} [limit] the maximum number of orde structures to retrieve
1335
+ * @param {int} [limit] the maximum number of order structures to retrieve
1336
1336
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1337
1337
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1338
1338
  */
@@ -1136,7 +1136,7 @@ export default class coinbasepro extends Exchange {
1136
1136
  * @description fetches information on multiple orders made by the user
1137
1137
  * @param {string} symbol unified market symbol of the market orders were made in
1138
1138
  * @param {int} [since] the earliest time in ms to fetch orders for
1139
- * @param {int} [limit] the maximum number of orde structures to retrieve
1139
+ * @param {int} [limit] the maximum number of order structures to retrieve
1140
1140
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1141
1141
  * @param {int} [params.until] the latest time in ms to fetch open orders for
1142
1142
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1194,7 +1194,7 @@ export default class coinbasepro extends Exchange {
1194
1194
  * @description fetches information on multiple closed orders made by the user
1195
1195
  * @param {string} symbol unified market symbol of the market orders were made in
1196
1196
  * @param {int} [since] the earliest time in ms to fetch orders for
1197
- * @param {int} [limit] the maximum number of orde structures to retrieve
1197
+ * @param {int} [limit] the maximum number of order structures to retrieve
1198
1198
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1199
1199
  * @param {int} [params.until] the latest time in ms to fetch open orders for
1200
1200
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
package/js/src/coinex.js CHANGED
@@ -3193,7 +3193,7 @@ export default class coinex extends Exchange {
3193
3193
  * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade012_finished_order
3194
3194
  * @param {string} symbol unified market symbol of the market orders were made in
3195
3195
  * @param {int} [since] the earliest time in ms to fetch orders for
3196
- * @param {int} [limit] the maximum number of orde structures to retrieve
3196
+ * @param {int} [limit] the maximum number of order structures to retrieve
3197
3197
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3198
3198
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
3199
3199
  */
@@ -1220,7 +1220,7 @@ export default class coinlist extends Exchange {
1220
1220
  * @see https://trade-docs.coinlist.co/?javascript--nodejs#list-orders
1221
1221
  * @param {string} symbol unified market symbol of the market orders were made in
1222
1222
  * @param {int} [since] the earliest time in ms to fetch orders for
1223
- * @param {int} [limit] the maximum number of orde structures to retrieve (default 200, max 500)
1223
+ * @param {int} [limit] the maximum number of order structures to retrieve (default 200, max 500)
1224
1224
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1225
1225
  * @param {int} [params.until] the latest time in ms to fetch entries for
1226
1226
  * @param {string|string[]} [params.status] the status of the order - 'accepted', 'done', 'canceled', 'rejected', 'pending' (default [ 'accepted', 'done', 'canceled', 'rejected', 'pending' ])
package/js/src/deribit.js CHANGED
@@ -1990,7 +1990,7 @@ export default class deribit extends Exchange {
1990
1990
  * @description fetches information on multiple closed orders made by the user
1991
1991
  * @param {string} symbol unified market symbol of the market orders were made in
1992
1992
  * @param {int} [since] the earliest time in ms to fetch orders for
1993
- * @param {int} [limit] the maximum number of orde structures to retrieve
1993
+ * @param {int} [limit] the maximum number of order structures to retrieve
1994
1994
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1995
1995
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1996
1996
  */
@@ -2243,7 +2243,7 @@ export default class digifinex extends Exchange {
2243
2243
  * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#historyorder
2244
2244
  * @param {string} symbol unified market symbol of the market orders were made in
2245
2245
  * @param {int} [since] the earliest time in ms to fetch orders for
2246
- * @param {int} [limit] the maximum number of orde structures to retrieve
2246
+ * @param {int} [limit] the maximum number of order structures to retrieve
2247
2247
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2248
2248
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2249
2249
  */