ccxt 4.4.39 → 4.4.41

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 (190) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/ascendex.js +9 -9
  5. package/dist/cjs/src/base/Exchange.js +32 -21
  6. package/dist/cjs/src/binance.js +37 -43
  7. package/dist/cjs/src/bingx.js +4 -3
  8. package/dist/cjs/src/bit2c.js +0 -1
  9. package/dist/cjs/src/bitbank.js +0 -1
  10. package/dist/cjs/src/bitbns.js +0 -1
  11. package/dist/cjs/src/bitfinex.js +18 -19
  12. package/dist/cjs/src/bitfinex1.js +0 -1
  13. package/dist/cjs/src/bitflyer.js +0 -1
  14. package/dist/cjs/src/bitget.js +2 -2
  15. package/dist/cjs/src/bithumb.js +0 -1
  16. package/dist/cjs/src/bitmart.js +257 -5
  17. package/dist/cjs/src/bitmex.js +5 -6
  18. package/dist/cjs/src/bitopro.js +4 -5
  19. package/dist/cjs/src/bitrue.js +5 -7
  20. package/dist/cjs/src/bitso.js +1 -2
  21. package/dist/cjs/src/bitstamp.js +1 -2
  22. package/dist/cjs/src/bitteam.js +1 -3
  23. package/dist/cjs/src/bitvavo.js +2 -4
  24. package/dist/cjs/src/blockchaincom.js +5 -5
  25. package/dist/cjs/src/blofin.js +10 -10
  26. package/dist/cjs/src/btcalpha.js +0 -1
  27. package/dist/cjs/src/btcbox.js +0 -1
  28. package/dist/cjs/src/btcmarkets.js +1 -3
  29. package/dist/cjs/src/bybit.js +10 -11
  30. package/dist/cjs/src/cex.js +1 -1
  31. package/dist/cjs/src/coinbase.js +77 -1
  32. package/dist/cjs/src/coinbaseexchange.js +1 -1
  33. package/dist/cjs/src/coinbaseinternational.js +62 -0
  34. package/dist/cjs/src/coincatch.js +1 -1
  35. package/dist/cjs/src/coinex.js +9 -9
  36. package/dist/cjs/src/coinlist.js +1 -1
  37. package/dist/cjs/src/coinmetro.js +1 -1
  38. package/dist/cjs/src/cryptocom.js +91 -2
  39. package/dist/cjs/src/currencycom.js +1 -1
  40. package/dist/cjs/src/defx.js +1 -2
  41. package/dist/cjs/src/delta.js +1 -1
  42. package/dist/cjs/src/digifinex.js +1 -1
  43. package/dist/cjs/src/exmo.js +64 -6
  44. package/dist/cjs/src/gate.js +2 -2
  45. package/dist/cjs/src/hashkey.js +3 -5
  46. package/dist/cjs/src/htx.js +2 -2
  47. package/dist/cjs/src/hyperliquid.js +66 -2
  48. package/dist/cjs/src/kraken.js +130 -27
  49. package/dist/cjs/src/kucoin.js +30 -25
  50. package/dist/cjs/src/luno.js +1 -1
  51. package/dist/cjs/src/mexc.js +138 -2
  52. package/dist/cjs/src/ndax.js +1 -1
  53. package/dist/cjs/src/okcoin.js +18 -18
  54. package/dist/cjs/src/okx.js +27 -22
  55. package/dist/cjs/src/phemex.js +12 -8
  56. package/dist/cjs/src/poloniex.js +1 -1
  57. package/dist/cjs/src/poloniexfutures.js +6 -6
  58. package/dist/cjs/src/pro/bitget.js +1 -1
  59. package/dist/cjs/src/pro/bybit.js +13 -1
  60. package/dist/cjs/src/pro/coinex.js +2 -2
  61. package/dist/cjs/src/pro/gate.js +6 -6
  62. package/dist/cjs/src/pro/kucoin.js +3 -3
  63. package/dist/cjs/src/pro/okx.js +11 -11
  64. package/dist/cjs/src/pro/upbit.js +3 -3
  65. package/dist/cjs/src/vertex.js +11 -11
  66. package/dist/cjs/src/woo.js +33 -33
  67. package/dist/cjs/src/woofipro.js +24 -24
  68. package/dist/cjs/src/xt.js +31 -28
  69. package/dist/cjs/src/zonda.js +1 -1
  70. package/js/ccxt.d.ts +3 -3
  71. package/js/ccxt.js +1 -1
  72. package/js/src/abstract/bitmart.d.ts +2 -0
  73. package/js/src/abstract/okx.d.ts +5 -0
  74. package/js/src/ascendex.d.ts +2 -2
  75. package/js/src/ascendex.js +9 -9
  76. package/js/src/base/Exchange.d.ts +6 -3
  77. package/js/src/base/Exchange.js +32 -21
  78. package/js/src/base/types.d.ts +2 -0
  79. package/js/src/binance.d.ts +9 -9
  80. package/js/src/binance.js +37 -43
  81. package/js/src/bingx.d.ts +1 -1
  82. package/js/src/bingx.js +4 -3
  83. package/js/src/bit2c.js +0 -1
  84. package/js/src/bitbank.js +0 -1
  85. package/js/src/bitbns.js +0 -1
  86. package/js/src/bitfinex.d.ts +3 -3
  87. package/js/src/bitfinex.js +18 -19
  88. package/js/src/bitfinex1.js +0 -1
  89. package/js/src/bitflyer.js +0 -1
  90. package/js/src/bitget.d.ts +1 -1
  91. package/js/src/bitget.js +2 -2
  92. package/js/src/bithumb.js +0 -1
  93. package/js/src/bitmart.d.ts +53 -2
  94. package/js/src/bitmart.js +257 -5
  95. package/js/src/bitmex.d.ts +1 -1
  96. package/js/src/bitmex.js +5 -6
  97. package/js/src/bitopro.js +4 -5
  98. package/js/src/bitrue.js +5 -7
  99. package/js/src/bitso.d.ts +1 -1
  100. package/js/src/bitso.js +1 -2
  101. package/js/src/bitstamp.d.ts +1 -1
  102. package/js/src/bitstamp.js +1 -2
  103. package/js/src/bitteam.js +1 -3
  104. package/js/src/bitvavo.d.ts +1 -1
  105. package/js/src/bitvavo.js +2 -4
  106. package/js/src/blockchaincom.js +5 -5
  107. package/js/src/blofin.d.ts +3 -3
  108. package/js/src/blofin.js +10 -10
  109. package/js/src/btcalpha.js +0 -1
  110. package/js/src/btcbox.js +0 -1
  111. package/js/src/btcmarkets.js +1 -3
  112. package/js/src/bybit.d.ts +1 -1
  113. package/js/src/bybit.js +10 -11
  114. package/js/src/cex.d.ts +1 -1
  115. package/js/src/cex.js +1 -1
  116. package/js/src/coinbase.d.ts +1 -1
  117. package/js/src/coinbase.js +77 -1
  118. package/js/src/coinbaseexchange.d.ts +1 -1
  119. package/js/src/coinbaseexchange.js +1 -1
  120. package/js/src/coinbaseinternational.js +62 -0
  121. package/js/src/coincatch.d.ts +1 -1
  122. package/js/src/coincatch.js +1 -1
  123. package/js/src/coinex.js +9 -9
  124. package/js/src/coinlist.d.ts +1 -1
  125. package/js/src/coinlist.js +1 -1
  126. package/js/src/coinmetro.d.ts +1 -1
  127. package/js/src/coinmetro.js +1 -1
  128. package/js/src/cryptocom.d.ts +2 -2
  129. package/js/src/cryptocom.js +91 -2
  130. package/js/src/currencycom.d.ts +1 -1
  131. package/js/src/currencycom.js +1 -1
  132. package/js/src/defx.d.ts +1 -2
  133. package/js/src/defx.js +1 -2
  134. package/js/src/delta.d.ts +1 -1
  135. package/js/src/delta.js +1 -1
  136. package/js/src/digifinex.d.ts +1 -1
  137. package/js/src/digifinex.js +1 -1
  138. package/js/src/exmo.d.ts +35 -0
  139. package/js/src/exmo.js +64 -6
  140. package/js/src/gate.d.ts +1 -1
  141. package/js/src/gate.js +2 -2
  142. package/js/src/hashkey.d.ts +1 -1
  143. package/js/src/hashkey.js +3 -5
  144. package/js/src/htx.d.ts +1 -1
  145. package/js/src/htx.js +2 -2
  146. package/js/src/hyperliquid.d.ts +21 -2
  147. package/js/src/hyperliquid.js +66 -2
  148. package/js/src/kraken.d.ts +14 -8
  149. package/js/src/kraken.js +130 -27
  150. package/js/src/kucoin.d.ts +13 -13
  151. package/js/src/kucoin.js +30 -25
  152. package/js/src/luno.d.ts +1 -1
  153. package/js/src/luno.js +1 -1
  154. package/js/src/mexc.d.ts +1 -2
  155. package/js/src/mexc.js +138 -2
  156. package/js/src/ndax.d.ts +1 -1
  157. package/js/src/ndax.js +1 -1
  158. package/js/src/okcoin.d.ts +4 -4
  159. package/js/src/okcoin.js +18 -18
  160. package/js/src/okx.d.ts +3 -3
  161. package/js/src/okx.js +27 -22
  162. package/js/src/phemex.js +12 -8
  163. package/js/src/poloniex.d.ts +1 -1
  164. package/js/src/poloniex.js +1 -1
  165. package/js/src/poloniexfutures.d.ts +1 -1
  166. package/js/src/poloniexfutures.js +6 -6
  167. package/js/src/pro/bitget.d.ts +1 -1
  168. package/js/src/pro/bitget.js +1 -1
  169. package/js/src/pro/bybit.d.ts +1 -1
  170. package/js/src/pro/bybit.js +13 -1
  171. package/js/src/pro/coinex.js +2 -2
  172. package/js/src/pro/gate.d.ts +2 -2
  173. package/js/src/pro/gate.js +6 -6
  174. package/js/src/pro/kucoin.d.ts +1 -1
  175. package/js/src/pro/kucoin.js +3 -3
  176. package/js/src/pro/okx.d.ts +2 -2
  177. package/js/src/pro/okx.js +11 -11
  178. package/js/src/pro/upbit.d.ts +3 -3
  179. package/js/src/pro/upbit.js +3 -3
  180. package/js/src/vertex.d.ts +3 -3
  181. package/js/src/vertex.js +11 -11
  182. package/js/src/woo.d.ts +7 -7
  183. package/js/src/woo.js +33 -33
  184. package/js/src/woofipro.d.ts +1 -1
  185. package/js/src/woofipro.js +24 -24
  186. package/js/src/xt.d.ts +7 -7
  187. package/js/src/xt.js +31 -28
  188. package/js/src/zonda.d.ts +1 -1
  189. package/js/src/zonda.js +1 -1
  190. package/package.json +2 -2
package/dist/cjs/ccxt.js CHANGED
@@ -200,7 +200,7 @@ var xt$1 = require('./src/pro/xt.js');
200
200
 
201
201
  //-----------------------------------------------------------------------------
202
202
  // this is updated by vss.js when building
203
- const version = '4.4.39';
203
+ const version = '4.4.41';
204
204
  Exchange["default"].ccxtVersion = version;
205
205
  const exchanges = {
206
206
  'ace': ace,
@@ -1394,7 +1394,7 @@ class ascendex extends ascendex$1 {
1394
1394
  'currency': feeCurrencyCode,
1395
1395
  };
1396
1396
  }
1397
- const stopPrice = this.omitZero(this.safeString(order, 'stopPrice'));
1397
+ const triggerPrice = this.omitZero(this.safeString(order, 'stopPrice'));
1398
1398
  let reduceOnly = undefined;
1399
1399
  const execInst = this.safeString(order, 'execInst');
1400
1400
  if (execInst === 'reduceOnly') {
@@ -1418,8 +1418,8 @@ class ascendex extends ascendex$1 {
1418
1418
  'reduceOnly': reduceOnly,
1419
1419
  'side': side,
1420
1420
  'price': price,
1421
- 'stopPrice': stopPrice,
1422
- 'triggerPrice': stopPrice,
1421
+ 'stopPrice': triggerPrice,
1422
+ 'triggerPrice': triggerPrice,
1423
1423
  'amount': amount,
1424
1424
  'cost': undefined,
1425
1425
  'average': average,
@@ -1495,7 +1495,7 @@ class ascendex extends ascendex$1 {
1495
1495
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1496
1496
  * @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
1497
1497
  * @param {bool} [params.postOnly] true or false
1498
- * @param {float} [params.stopPrice] the price at which a trigger order is triggered at
1498
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
1499
1499
  * @returns {object} request to be sent to the exchange
1500
1500
  */
1501
1501
  const market = this.market(symbol);
@@ -1527,7 +1527,7 @@ class ascendex extends ascendex$1 {
1527
1527
  const timeInForce = this.safeString(params, 'timeInForce');
1528
1528
  const postOnly = this.isPostOnly(isMarketOrder, false, params);
1529
1529
  const reduceOnly = this.safeBool(params, 'reduceOnly', false);
1530
- const stopPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
1530
+ const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
1531
1531
  if (isLimitOrder) {
1532
1532
  request['orderPrice'] = this.priceToPrecision(symbol, price);
1533
1533
  }
@@ -1540,8 +1540,8 @@ class ascendex extends ascendex$1 {
1540
1540
  if (postOnly) {
1541
1541
  request['postOnly'] = true;
1542
1542
  }
1543
- if (stopPrice !== undefined) {
1544
- request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
1543
+ if (triggerPrice !== undefined) {
1544
+ request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
1545
1545
  if (isLimitOrder) {
1546
1546
  request['orderType'] = 'stop_limit';
1547
1547
  }
@@ -1583,7 +1583,7 @@ class ascendex extends ascendex$1 {
1583
1583
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1584
1584
  * @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
1585
1585
  * @param {bool} [params.postOnly] true or false
1586
- * @param {float} [params.stopPrice] the price at which a trigger order is triggered at
1586
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
1587
1587
  * @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice that the attached take profit order will be triggered (perpetual swap markets only)
1588
1588
  * @param {float} [params.takeProfit.triggerPrice] *swap only* take profit trigger price
1589
1589
  * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice that the attached stop loss order will be triggered (perpetual swap markets only)
@@ -1679,7 +1679,7 @@ class ascendex extends ascendex$1 {
1679
1679
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1680
1680
  * @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
1681
1681
  * @param {bool} [params.postOnly] true or false
1682
- * @param {float} [params.stopPrice] the price at which a trigger order is triggered at
1682
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
1683
1683
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1684
1684
  */
1685
1685
  async createOrders(orders, params = {}) {
@@ -1444,6 +1444,7 @@ class Exchange {
1444
1444
  'fetchOHLCV': undefined,
1445
1445
  'fetchOHLCVWs': undefined,
1446
1446
  'fetchOpenInterest': undefined,
1447
+ 'fetchOpenInterests': undefined,
1447
1448
  'fetchOpenInterestHistory': undefined,
1448
1449
  'fetchOpenOrder': undefined,
1449
1450
  'fetchOpenOrders': undefined,
@@ -1839,31 +1840,25 @@ class Exchange {
1839
1840
  let wssProxy = undefined;
1840
1841
  let wsSocksProxy = undefined;
1841
1842
  // ws proxy
1842
- if (this.valueIsDefined(this.wsProxy)) {
1843
+ const isWsProxyDefined = this.valueIsDefined(this.wsProxy);
1844
+ const is_ws_proxy_defined = this.valueIsDefined(this.ws_proxy);
1845
+ if (isWsProxyDefined || is_ws_proxy_defined) {
1843
1846
  usedProxies.push('wsProxy');
1844
- wsProxy = this.wsProxy;
1845
- }
1846
- if (this.valueIsDefined(this.ws_proxy)) {
1847
- usedProxies.push('ws_proxy');
1848
- wsProxy = this.ws_proxy;
1847
+ wsProxy = (isWsProxyDefined) ? this.wsProxy : this.ws_proxy;
1849
1848
  }
1850
1849
  // wss proxy
1851
- if (this.valueIsDefined(this.wssProxy)) {
1850
+ const isWssProxyDefined = this.valueIsDefined(this.wssProxy);
1851
+ const is_wss_proxy_defined = this.valueIsDefined(this.wss_proxy);
1852
+ if (isWssProxyDefined || is_wss_proxy_defined) {
1852
1853
  usedProxies.push('wssProxy');
1853
- wssProxy = this.wssProxy;
1854
- }
1855
- if (this.valueIsDefined(this.wss_proxy)) {
1856
- usedProxies.push('wss_proxy');
1857
- wssProxy = this.wss_proxy;
1854
+ wssProxy = (isWssProxyDefined) ? this.wssProxy : this.wss_proxy;
1858
1855
  }
1859
1856
  // ws socks proxy
1860
- if (this.valueIsDefined(this.wsSocksProxy)) {
1857
+ const isWsSocksProxyDefined = this.valueIsDefined(this.wsSocksProxy);
1858
+ const is_ws_socks_proxy_defined = this.valueIsDefined(this.ws_socks_proxy);
1859
+ if (isWsSocksProxyDefined || is_ws_socks_proxy_defined) {
1861
1860
  usedProxies.push('wsSocksProxy');
1862
- wsSocksProxy = this.wsSocksProxy;
1863
- }
1864
- if (this.valueIsDefined(this.ws_socks_proxy)) {
1865
- usedProxies.push('ws_socks_proxy');
1866
- wsSocksProxy = this.ws_socks_proxy;
1861
+ wsSocksProxy = (isWsSocksProxyDefined) ? this.wsSocksProxy : this.ws_socks_proxy;
1867
1862
  }
1868
1863
  // check
1869
1864
  const length = usedProxies.length;
@@ -2284,6 +2279,9 @@ class Exchange {
2284
2279
  async fetchOpenInterest(symbol, params = {}) {
2285
2280
  throw new errors.NotSupported(this.id + ' fetchOpenInterest() is not supported yet');
2286
2281
  }
2282
+ async fetchOpenInterests(symbols = undefined, params = {}) {
2283
+ throw new errors.NotSupported(this.id + ' fetchOpenInterests() is not supported yet');
2284
+ }
2287
2285
  async signIn(params = {}) {
2288
2286
  throw new errors.NotSupported(this.id + ' signIn() is not supported yet');
2289
2287
  }
@@ -5739,6 +5737,14 @@ class Exchange {
5739
5737
  }
5740
5738
  return result;
5741
5739
  }
5740
+ parseOpenInterests(response, market = undefined) {
5741
+ const result = {};
5742
+ for (let i = 0; i < response.length; i++) {
5743
+ const parsed = this.parseOpenInterest(response[i], market);
5744
+ result[parsed['symbol']] = parsed;
5745
+ }
5746
+ return result;
5747
+ }
5742
5748
  parseLongShortRatio(info, market = undefined) {
5743
5749
  throw new errors.NotSupported(this.id + ' parseLongShortRatio() is not supported yet');
5744
5750
  }
@@ -5848,7 +5854,7 @@ class Exchange {
5848
5854
  parseOpenInterest(interest, market = undefined) {
5849
5855
  throw new errors.NotSupported(this.id + ' parseOpenInterest () is not supported yet');
5850
5856
  }
5851
- parseOpenInterests(response, market = undefined, since = undefined, limit = undefined) {
5857
+ parseOpenInterestsHistory(response, market = undefined, since = undefined, limit = undefined) {
5852
5858
  const interests = [];
5853
5859
  for (let i = 0; i < response.length; i++) {
5854
5860
  const entry = response[i];
@@ -6200,7 +6206,7 @@ class Exchange {
6200
6206
  }
6201
6207
  return [maxEntriesPerRequest, params];
6202
6208
  }
6203
- async fetchPaginatedCallDynamic(method, symbol = undefined, since = undefined, limit = undefined, params = {}, maxEntriesPerRequest = undefined) {
6209
+ async fetchPaginatedCallDynamic(method, symbol = undefined, since = undefined, limit = undefined, params = {}, maxEntriesPerRequest = undefined, removeRepeated = true) {
6204
6210
  let maxCalls = undefined;
6205
6211
  [maxCalls, params] = this.handleOptionAndParams(params, method, 'paginationCalls', 10);
6206
6212
  let maxRetries = undefined;
@@ -6208,6 +6214,8 @@ class Exchange {
6208
6214
  let paginationDirection = undefined;
6209
6215
  [paginationDirection, params] = this.handleOptionAndParams(params, method, 'paginationDirection', 'backward');
6210
6216
  let paginationTimestamp = undefined;
6217
+ let removeRepeatedOption = removeRepeated;
6218
+ [removeRepeatedOption, params] = this.handleOptionAndParams(params, method, 'removeRepeated', removeRepeated);
6211
6219
  let calls = 0;
6212
6220
  let result = [];
6213
6221
  let errors$1 = 0;
@@ -6278,7 +6286,10 @@ class Exchange {
6278
6286
  }
6279
6287
  }
6280
6288
  }
6281
- const uniqueResults = this.removeRepeatedElementsFromArray(result);
6289
+ let uniqueResults = result;
6290
+ if (removeRepeatedOption) {
6291
+ uniqueResults = this.removeRepeatedElementsFromArray(result);
6292
+ }
6282
6293
  const key = (method === 'fetchOHLCV') ? 0 : 'timestamp';
6283
6294
  return this.filterBySinceLimit(uniqueResults, since, limit, key);
6284
6295
  }
@@ -5229,8 +5229,8 @@ class binance extends binance$1 {
5229
5229
  uppercaseType = 'LIMIT_MAKER';
5230
5230
  }
5231
5231
  request['type'] = uppercaseType;
5232
- const stopPrice = this.safeNumber2(params, 'stopPrice', 'triggerPrice');
5233
- if (stopPrice !== undefined) {
5232
+ const triggerPrice = this.safeNumber2(params, 'stopPrice', 'triggerPrice');
5233
+ if (triggerPrice !== undefined) {
5234
5234
  if (uppercaseType === 'MARKET') {
5235
5235
  uppercaseType = 'STOP_LOSS';
5236
5236
  }
@@ -5241,7 +5241,7 @@ class binance extends binance$1 {
5241
5241
  const validOrderTypes = this.safeList(market['info'], 'orderTypes');
5242
5242
  if (!this.inArray(uppercaseType, validOrderTypes)) {
5243
5243
  if (initialUppercaseType !== uppercaseType) {
5244
- throw new errors.InvalidOrder(this.id + ' stopPrice parameter is not allowed for ' + symbol + ' ' + type + ' orders');
5244
+ throw new errors.InvalidOrder(this.id + ' triggerPrice parameter is not allowed for ' + symbol + ' ' + type + ' orders');
5245
5245
  }
5246
5246
  else {
5247
5247
  throw new errors.InvalidOrder(this.id + ' ' + type + ' is not a valid order type for the ' + symbol + ' market');
@@ -5262,7 +5262,7 @@ class binance extends binance$1 {
5262
5262
  request['newOrderRespType'] = this.safeValue(this.options['newOrderRespType'], type, 'RESULT'); // 'ACK' for order id, 'RESULT' for full order or 'FULL' for order with fills
5263
5263
  let timeInForceIsRequired = false;
5264
5264
  let priceIsRequired = false;
5265
- let stopPriceIsRequired = false;
5265
+ let triggerPriceIsRequired = false;
5266
5266
  let quantityIsRequired = false;
5267
5267
  if (uppercaseType === 'MARKET') {
5268
5268
  const quoteOrderQty = this.safeBool(this.options, 'quoteOrderQty', true);
@@ -5292,12 +5292,12 @@ class binance extends binance$1 {
5292
5292
  quantityIsRequired = true;
5293
5293
  }
5294
5294
  else if ((uppercaseType === 'STOP_LOSS') || (uppercaseType === 'TAKE_PROFIT')) {
5295
- stopPriceIsRequired = true;
5295
+ triggerPriceIsRequired = true;
5296
5296
  quantityIsRequired = true;
5297
5297
  }
5298
5298
  else if ((uppercaseType === 'STOP_LOSS_LIMIT') || (uppercaseType === 'TAKE_PROFIT_LIMIT')) {
5299
5299
  quantityIsRequired = true;
5300
- stopPriceIsRequired = true;
5300
+ triggerPriceIsRequired = true;
5301
5301
  priceIsRequired = true;
5302
5302
  timeInForceIsRequired = true;
5303
5303
  }
@@ -5317,12 +5317,12 @@ class binance extends binance$1 {
5317
5317
  if (timeInForceIsRequired && (this.safeString(params, 'timeInForce') === undefined)) {
5318
5318
  request['timeInForce'] = this.options['defaultTimeInForce']; // 'GTC' = Good To Cancel (default), 'IOC' = Immediate Or Cancel
5319
5319
  }
5320
- if (stopPriceIsRequired) {
5321
- if (stopPrice === undefined) {
5322
- throw new errors.InvalidOrder(this.id + ' editOrder() requires a stopPrice extra param for a ' + type + ' order');
5320
+ if (triggerPriceIsRequired) {
5321
+ if (triggerPrice === undefined) {
5322
+ throw new errors.InvalidOrder(this.id + ' editOrder() requires a triggerPrice extra param for a ' + type + ' order');
5323
5323
  }
5324
5324
  else {
5325
- request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
5325
+ request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
5326
5326
  }
5327
5327
  }
5328
5328
  request['cancelReplaceMode'] = 'STOP_ON_FAILURE'; // If the cancel request fails, the new order placement will not be attempted.
@@ -5986,7 +5986,7 @@ class binance extends binance$1 {
5986
5986
  type = 'limit';
5987
5987
  }
5988
5988
  const stopPriceString = this.safeString(order, 'stopPrice');
5989
- const stopPrice = this.parseNumber(this.omitZero(stopPriceString));
5989
+ const triggerPrice = this.parseNumber(this.omitZero(stopPriceString));
5990
5990
  const feeCost = this.safeNumber(order, 'fee');
5991
5991
  let fee = undefined;
5992
5992
  if (feeCost !== undefined) {
@@ -6011,7 +6011,7 @@ class binance extends binance$1 {
6011
6011
  'reduceOnly': this.safeBool(order, 'reduceOnly'),
6012
6012
  'side': side,
6013
6013
  'price': price,
6014
- 'triggerPrice': stopPrice,
6014
+ 'triggerPrice': triggerPrice,
6015
6015
  'amount': amount,
6016
6016
  'cost': cost,
6017
6017
  'average': average,
@@ -6249,16 +6249,10 @@ class binance extends binance$1 {
6249
6249
  let marginMode = undefined;
6250
6250
  [marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
6251
6251
  const reduceOnly = this.safeBool(params, 'reduceOnly', false);
6252
- if ((marketType === 'margin') || (marginMode !== undefined) || market['option']) {
6253
- // for swap and future reduceOnly is a string that cant be sent with close position set to true or in hedge mode
6254
- params = this.omit(params, 'reduceOnly');
6255
- if (market['option']) {
6256
- request['reduceOnly'] = reduceOnly;
6257
- }
6258
- else {
6259
- if (reduceOnly) {
6260
- request['sideEffectType'] = 'AUTO_REPAY';
6261
- }
6252
+ if (reduceOnly) {
6253
+ if (marketType === 'margin' || (!market['contract'] && (marginMode !== undefined))) {
6254
+ params = this.omit(params, 'reduceOnly');
6255
+ request['sideEffectType'] = 'AUTO_REPAY';
6262
6256
  }
6263
6257
  }
6264
6258
  const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
@@ -6336,7 +6330,7 @@ class binance extends binance$1 {
6336
6330
  const validOrderTypes = this.safeList(market['info'], 'orderTypes');
6337
6331
  if (!this.inArray(uppercaseType, validOrderTypes)) {
6338
6332
  if (initialUppercaseType !== uppercaseType) {
6339
- throw new errors.InvalidOrder(this.id + ' stopPrice parameter is not allowed for ' + symbol + ' ' + type + ' orders');
6333
+ throw new errors.InvalidOrder(this.id + ' triggerPrice parameter is not allowed for ' + symbol + ' ' + type + ' orders');
6340
6334
  }
6341
6335
  else {
6342
6336
  throw new errors.InvalidOrder(this.id + ' ' + type + ' is not a valid order type for the ' + symbol + ' market');
@@ -6391,7 +6385,7 @@ class binance extends binance$1 {
6391
6385
  const closePosition = this.safeBool(params, 'closePosition', false);
6392
6386
  let timeInForceIsRequired = false;
6393
6387
  let priceIsRequired = false;
6394
- let stopPriceIsRequired = false;
6388
+ let triggerPriceIsRequired = false;
6395
6389
  let quantityIsRequired = false;
6396
6390
  //
6397
6391
  // spot/margin
@@ -6446,7 +6440,7 @@ class binance extends binance$1 {
6446
6440
  quantityIsRequired = true;
6447
6441
  }
6448
6442
  else if ((uppercaseType === 'STOP_LOSS') || (uppercaseType === 'TAKE_PROFIT')) {
6449
- stopPriceIsRequired = true;
6443
+ triggerPriceIsRequired = true;
6450
6444
  quantityIsRequired = true;
6451
6445
  if (market['linear'] || market['inverse']) {
6452
6446
  priceIsRequired = true;
@@ -6454,7 +6448,7 @@ class binance extends binance$1 {
6454
6448
  }
6455
6449
  else if ((uppercaseType === 'STOP_LOSS_LIMIT') || (uppercaseType === 'TAKE_PROFIT_LIMIT')) {
6456
6450
  quantityIsRequired = true;
6457
- stopPriceIsRequired = true;
6451
+ triggerPriceIsRequired = true;
6458
6452
  priceIsRequired = true;
6459
6453
  timeInForceIsRequired = true;
6460
6454
  }
@@ -6464,14 +6458,14 @@ class binance extends binance$1 {
6464
6458
  }
6465
6459
  else if (uppercaseType === 'STOP') {
6466
6460
  quantityIsRequired = true;
6467
- stopPriceIsRequired = true;
6461
+ triggerPriceIsRequired = true;
6468
6462
  priceIsRequired = true;
6469
6463
  }
6470
6464
  else if ((uppercaseType === 'STOP_MARKET') || (uppercaseType === 'TAKE_PROFIT_MARKET')) {
6471
6465
  if (!closePosition) {
6472
6466
  quantityIsRequired = true;
6473
6467
  }
6474
- stopPriceIsRequired = true;
6468
+ triggerPriceIsRequired = true;
6475
6469
  }
6476
6470
  else if (uppercaseType === 'TRAILING_STOP_MARKET') {
6477
6471
  if (!closePosition) {
@@ -6510,16 +6504,16 @@ class binance extends binance$1 {
6510
6504
  request['price'] = this.parseToNumeric(price); // some options don't have the precision available
6511
6505
  }
6512
6506
  }
6513
- if (stopPriceIsRequired) {
6507
+ if (triggerPriceIsRequired) {
6514
6508
  if (market['contract']) {
6515
6509
  if (stopPrice === undefined) {
6516
- throw new errors.InvalidOrder(this.id + ' createOrder() requires a stopPrice extra param for a ' + type + ' order');
6510
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires a triggerPrice extra param for a ' + type + ' order');
6517
6511
  }
6518
6512
  }
6519
6513
  else {
6520
6514
  // check for delta price as well
6521
6515
  if (trailingDelta === undefined && stopPrice === undefined && trailingPercent === undefined) {
6522
- throw new errors.InvalidOrder(this.id + ' createOrder() requires a stopPrice, trailingDelta or trailingPercent param for a ' + type + ' order');
6516
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires a triggerPrice, trailingDelta or trailingPercent param for a ' + type + ' order');
6523
6517
  }
6524
6518
  }
6525
6519
  if (stopPrice !== undefined) {
@@ -6708,7 +6702,7 @@ class binance extends binance$1 {
6708
6702
  * @param {int} [params.until] the latest time in ms to fetch orders for
6709
6703
  * @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)
6710
6704
  * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
6711
- * @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
6705
+ * @param {boolean} [params.trigger] set to true if you would like to fetch portfolio margin account trigger or conditional orders
6712
6706
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
6713
6707
  */
6714
6708
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -6985,7 +6979,7 @@ class binance extends binance$1 {
6985
6979
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6986
6980
  * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
6987
6981
  * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch open orders in the portfolio margin account
6988
- * @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account conditional orders
6982
+ * @param {boolean} [params.trigger] set to true if you would like to fetch portfolio margin account conditional orders
6989
6983
  * @param {string} [params.subType] "linear" or "inverse"
6990
6984
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
6991
6985
  */
@@ -7307,7 +7301,7 @@ class binance extends binance$1 {
7307
7301
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7308
7302
  * @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)
7309
7303
  * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
7310
- * @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
7304
+ * @param {boolean} [params.trigger] set to true if you would like to fetch portfolio margin account trigger or conditional orders
7311
7305
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
7312
7306
  */
7313
7307
  async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -7337,7 +7331,7 @@ class binance extends binance$1 {
7337
7331
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7338
7332
  * @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)
7339
7333
  * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
7340
- * @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
7334
+ * @param {boolean} [params.trigger] set to true if you would like to fetch portfolio margin account trigger or conditional orders
7341
7335
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
7342
7336
  */
7343
7337
  async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -7367,7 +7361,7 @@ class binance extends binance$1 {
7367
7361
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7368
7362
  * @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)
7369
7363
  * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
7370
- * @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
7364
+ * @param {boolean} [params.trigger] set to true if you would like to fetch portfolio margin account trigger or conditional orders
7371
7365
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
7372
7366
  */
7373
7367
  async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -7399,7 +7393,7 @@ class binance extends binance$1 {
7399
7393
  * @param {string} symbol unified symbol of the market the order was made in
7400
7394
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7401
7395
  * @param {boolean} [params.portfolioMargin] set to true if you would like to cancel an order in a portfolio margin account
7402
- * @param {boolean} [params.stop] set to true if you would like to cancel a portfolio margin account conditional order
7396
+ * @param {boolean} [params.trigger] set to true if you would like to cancel a portfolio margin account conditional order
7403
7397
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
7404
7398
  */
7405
7399
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -7504,7 +7498,7 @@ class binance extends binance$1 {
7504
7498
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7505
7499
  * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
7506
7500
  * @param {boolean} [params.portfolioMargin] set to true if you would like to cancel orders in a portfolio margin account
7507
- * @param {boolean} [params.stop] set to true if you would like to cancel portfolio margin account conditional orders
7501
+ * @param {boolean} [params.trigger] set to true if you would like to cancel portfolio margin account conditional orders
7508
7502
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
7509
7503
  */
7510
7504
  async cancelAllOrders(symbol = undefined, params = {}) {
@@ -11589,7 +11583,7 @@ class binance extends binance$1 {
11589
11583
  * @param {string} id the identification number of the ledger entry
11590
11584
  * @param {string} code unified currency code
11591
11585
  * @param {object} [params] extra parameters specific to the exchange API endpoint
11592
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
11586
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
11593
11587
  */
11594
11588
  async fetchLedgerEntry(id, code = undefined, params = {}) {
11595
11589
  await this.loadMarkets();
@@ -11636,14 +11630,14 @@ class binance extends binance$1 {
11636
11630
  * @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)
11637
11631
  * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch the ledger for a portfolio margin account
11638
11632
  * @param {string} [params.subType] "linear" or "inverse"
11639
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
11633
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
11640
11634
  */
11641
11635
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
11642
11636
  await this.loadMarkets();
11643
11637
  let paginate = false;
11644
11638
  [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
11645
11639
  if (paginate) {
11646
- return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params);
11640
+ return await this.fetchPaginatedCallDynamic('fetchLedger', code, since, limit, params, undefined, false);
11647
11641
  }
11648
11642
  let type = undefined;
11649
11643
  let subType = undefined;
@@ -12825,7 +12819,7 @@ class binance extends binance$1 {
12825
12819
  // ...
12826
12820
  // ]
12827
12821
  //
12828
- return this.parseOpenInterests(response, market, since, limit);
12822
+ return this.parseOpenInterestsHistory(response, market, since, limit);
12829
12823
  }
12830
12824
  /**
12831
12825
  * @method
@@ -12894,7 +12888,7 @@ class binance extends binance$1 {
12894
12888
  //
12895
12889
  if (market['option']) {
12896
12890
  symbol = market['symbol'];
12897
- const result = this.parseOpenInterests(response, market);
12891
+ const result = this.parseOpenInterestsHistory(response, market);
12898
12892
  for (let i = 0; i < result.length; i++) {
12899
12893
  const item = result[i];
12900
12894
  if (item['symbol'] === symbol) {
@@ -48,6 +48,7 @@ class bingx extends bingx$1 {
48
48
  'createTrailingAmountOrder': true,
49
49
  'createTrailingPercentOrder': true,
50
50
  'createTriggerOrder': true,
51
+ 'editOrder': true,
51
52
  'fetchBalance': true,
52
53
  'fetchCanceledOrders': true,
53
54
  'fetchClosedOrders': true,
@@ -70,6 +71,7 @@ class bingx extends bingx$1 {
70
71
  'fetchMarkPrice': true,
71
72
  'fetchMarkPrices': true,
72
73
  'fetchMyLiquidations': true,
74
+ 'fetchMyTrades': true,
73
75
  'fetchOHLCV': true,
74
76
  'fetchOpenInterest': true,
75
77
  'fetchOpenOrders': true,
@@ -1037,7 +1039,7 @@ class bingx extends bingx$1 {
1037
1039
  };
1038
1040
  request['interval'] = this.safeString(this.timeframes, timeframe, timeframe);
1039
1041
  if (since !== undefined) {
1040
- request['startTime'] = since;
1042
+ request['startTime'] = Math.max(since - 1, 0);
1041
1043
  }
1042
1044
  if (limit !== undefined) {
1043
1045
  request['limit'] = limit;
@@ -3608,7 +3610,6 @@ class bingx extends bingx$1 {
3608
3610
  'postOnly': undefined,
3609
3611
  'side': this.parseOrderSide(side),
3610
3612
  'price': this.safeString2(order, 'price', 'p'),
3611
- 'stopPrice': triggerPrice,
3612
3613
  'triggerPrice': triggerPrice,
3613
3614
  'stopLossPrice': stopLossPrice,
3614
3615
  'takeProfitPrice': takeProfitPrice,
@@ -6154,7 +6155,7 @@ class bingx extends bingx$1 {
6154
6155
  * @param {float} amount how much of the currency you want to trade in units of the base currency
6155
6156
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
6156
6157
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6157
- * @param {string} [params.stopPrice] Trigger price used for TAKE_STOP_LIMIT, TAKE_STOP_MARKET, TRIGGER_LIMIT, TRIGGER_MARKET order types.
6158
+ * @param {string} [params.triggerPrice] Trigger price used for TAKE_STOP_LIMIT, TAKE_STOP_MARKET, TRIGGER_LIMIT, TRIGGER_MARKET order types.
6158
6159
  * @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
6159
6160
  * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
6160
6161
  * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
@@ -637,7 +637,6 @@ class bit2c extends bit2c$1 {
637
637
  'postOnly': undefined,
638
638
  'side': side,
639
639
  'price': price,
640
- 'stopPrice': undefined,
641
640
  'triggerPrice': undefined,
642
641
  'amount': amount,
643
642
  'filled': undefined,
@@ -633,7 +633,6 @@ class bitbank extends bitbank$1 {
633
633
  'postOnly': undefined,
634
634
  'side': side,
635
635
  'price': price,
636
- 'stopPrice': undefined,
637
636
  'triggerPrice': undefined,
638
637
  'cost': undefined,
639
638
  'average': average,
@@ -564,7 +564,6 @@ class bitbns extends bitbns$1 {
564
564
  'postOnly': undefined,
565
565
  'side': side,
566
566
  'price': this.safeString(order, 'rate'),
567
- 'stopPrice': triggerPrice,
568
567
  'triggerPrice': triggerPrice,
569
568
  'amount': this.safeString(order, 'btc'),
570
569
  'cost': undefined,