ccxt 4.4.38 → 4.4.40

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 (192) 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/alpaca.js +73 -2
  5. package/dist/cjs/src/ascendex.js +9 -9
  6. package/dist/cjs/src/base/Exchange.js +38 -27
  7. package/dist/cjs/src/binance.js +13 -19
  8. package/dist/cjs/src/bingx.js +1 -2
  9. package/dist/cjs/src/bit2c.js +0 -1
  10. package/dist/cjs/src/bitbank.js +0 -1
  11. package/dist/cjs/src/bitbns.js +0 -1
  12. package/dist/cjs/src/bitfinex.js +17 -18
  13. package/dist/cjs/src/bitfinex1.js +0 -1
  14. package/dist/cjs/src/bitflyer.js +0 -1
  15. package/dist/cjs/src/bitget.js +1 -2
  16. package/dist/cjs/src/bithumb.js +0 -1
  17. package/dist/cjs/src/bitmart.js +3 -4
  18. package/dist/cjs/src/bitmex.js +5 -6
  19. package/dist/cjs/src/bitopro.js +4 -5
  20. package/dist/cjs/src/bitrue.js +5 -7
  21. package/dist/cjs/src/bitso.js +1 -2
  22. package/dist/cjs/src/bitstamp.js +1 -2
  23. package/dist/cjs/src/bitteam.js +1 -3
  24. package/dist/cjs/src/bitvavo.js +2 -4
  25. package/dist/cjs/src/blockchaincom.js +5 -5
  26. package/dist/cjs/src/blofin.js +10 -10
  27. package/dist/cjs/src/btcalpha.js +0 -1
  28. package/dist/cjs/src/btcbox.js +0 -1
  29. package/dist/cjs/src/btcmarkets.js +1 -3
  30. package/dist/cjs/src/bybit.js +2 -3
  31. package/dist/cjs/src/cex.js +1 -1
  32. package/dist/cjs/src/coinbase.js +77 -1
  33. package/dist/cjs/src/coinbaseexchange.js +1 -1
  34. package/dist/cjs/src/coinbaseinternational.js +62 -0
  35. package/dist/cjs/src/coincatch.js +1 -1
  36. package/dist/cjs/src/coinex.js +9 -9
  37. package/dist/cjs/src/coinlist.js +1 -1
  38. package/dist/cjs/src/coinmetro.js +1 -1
  39. package/dist/cjs/src/cryptocom.js +91 -2
  40. package/dist/cjs/src/currencycom.js +1 -1
  41. package/dist/cjs/src/defx.js +1 -2
  42. package/dist/cjs/src/delta.js +1 -1
  43. package/dist/cjs/src/digifinex.js +59 -19
  44. package/dist/cjs/src/exmo.js +2 -2
  45. package/dist/cjs/src/gate.js +1 -1
  46. package/dist/cjs/src/hashkey.js +3 -5
  47. package/dist/cjs/src/htx.js +155 -33
  48. package/dist/cjs/src/hyperliquid.js +1 -1
  49. package/dist/cjs/src/kraken.js +1 -1
  50. package/dist/cjs/src/kucoin.js +25 -24
  51. package/dist/cjs/src/luno.js +1 -1
  52. package/dist/cjs/src/mexc.js +174 -27
  53. package/dist/cjs/src/ndax.js +1 -1
  54. package/dist/cjs/src/okcoin.js +18 -18
  55. package/dist/cjs/src/okx.js +22 -21
  56. package/dist/cjs/src/phemex.js +12 -8
  57. package/dist/cjs/src/poloniex.js +1 -1
  58. package/dist/cjs/src/poloniexfutures.js +6 -6
  59. package/dist/cjs/src/pro/bitget.js +1 -1
  60. package/dist/cjs/src/pro/bybit.js +13 -1
  61. package/dist/cjs/src/pro/coinex.js +2 -2
  62. package/dist/cjs/src/pro/gate.js +6 -6
  63. package/dist/cjs/src/pro/kucoin.js +3 -3
  64. package/dist/cjs/src/pro/okx.js +11 -11
  65. package/dist/cjs/src/pro/upbit.js +3 -3
  66. package/dist/cjs/src/pro/woo.js +1 -1
  67. package/dist/cjs/src/vertex.js +11 -11
  68. package/dist/cjs/src/woo.js +37 -37
  69. package/dist/cjs/src/woofipro.js +24 -24
  70. package/dist/cjs/src/xt.js +26 -26
  71. package/dist/cjs/src/zonda.js +1 -1
  72. package/js/ccxt.d.ts +1 -1
  73. package/js/ccxt.js +1 -1
  74. package/js/src/abstract/digifinex.d.ts +1 -0
  75. package/js/src/abstract/mexc.d.ts +1 -0
  76. package/js/src/alpaca.d.ts +11 -1
  77. package/js/src/alpaca.js +73 -2
  78. package/js/src/ascendex.d.ts +2 -2
  79. package/js/src/ascendex.js +9 -9
  80. package/js/src/base/Exchange.js +38 -27
  81. package/js/src/binance.d.ts +9 -9
  82. package/js/src/binance.js +13 -19
  83. package/js/src/bingx.d.ts +1 -1
  84. package/js/src/bingx.js +1 -2
  85. package/js/src/bit2c.js +0 -1
  86. package/js/src/bitbank.js +0 -1
  87. package/js/src/bitbns.js +0 -1
  88. package/js/src/bitfinex.d.ts +3 -3
  89. package/js/src/bitfinex.js +17 -18
  90. package/js/src/bitfinex1.js +0 -1
  91. package/js/src/bitflyer.js +0 -1
  92. package/js/src/bitget.d.ts +1 -1
  93. package/js/src/bitget.js +1 -2
  94. package/js/src/bithumb.js +0 -1
  95. package/js/src/bitmart.d.ts +1 -1
  96. package/js/src/bitmart.js +3 -4
  97. package/js/src/bitmex.d.ts +1 -1
  98. package/js/src/bitmex.js +5 -6
  99. package/js/src/bitopro.js +4 -5
  100. package/js/src/bitrue.js +5 -7
  101. package/js/src/bitso.d.ts +1 -1
  102. package/js/src/bitso.js +1 -2
  103. package/js/src/bitstamp.d.ts +1 -1
  104. package/js/src/bitstamp.js +1 -2
  105. package/js/src/bitteam.js +1 -3
  106. package/js/src/bitvavo.d.ts +1 -1
  107. package/js/src/bitvavo.js +2 -4
  108. package/js/src/blockchaincom.js +5 -5
  109. package/js/src/blofin.d.ts +3 -3
  110. package/js/src/blofin.js +10 -10
  111. package/js/src/btcalpha.js +0 -1
  112. package/js/src/btcbox.js +0 -1
  113. package/js/src/btcmarkets.js +1 -3
  114. package/js/src/bybit.d.ts +1 -1
  115. package/js/src/bybit.js +2 -3
  116. package/js/src/cex.d.ts +1 -1
  117. package/js/src/cex.js +1 -1
  118. package/js/src/coinbase.d.ts +1 -1
  119. package/js/src/coinbase.js +77 -1
  120. package/js/src/coinbaseexchange.d.ts +1 -1
  121. package/js/src/coinbaseexchange.js +1 -1
  122. package/js/src/coinbaseinternational.js +62 -0
  123. package/js/src/coincatch.d.ts +1 -1
  124. package/js/src/coincatch.js +1 -1
  125. package/js/src/coinex.js +9 -9
  126. package/js/src/coinlist.d.ts +1 -1
  127. package/js/src/coinlist.js +1 -1
  128. package/js/src/coinmetro.d.ts +1 -1
  129. package/js/src/coinmetro.js +1 -1
  130. package/js/src/cryptocom.d.ts +2 -2
  131. package/js/src/cryptocom.js +91 -2
  132. package/js/src/currencycom.d.ts +1 -1
  133. package/js/src/currencycom.js +1 -1
  134. package/js/src/defx.d.ts +1 -2
  135. package/js/src/defx.js +1 -2
  136. package/js/src/delta.d.ts +1 -1
  137. package/js/src/delta.js +1 -1
  138. package/js/src/digifinex.d.ts +5 -3
  139. package/js/src/digifinex.js +59 -19
  140. package/js/src/exmo.js +2 -2
  141. package/js/src/gate.d.ts +1 -1
  142. package/js/src/gate.js +1 -1
  143. package/js/src/hashkey.d.ts +1 -1
  144. package/js/src/hashkey.js +3 -5
  145. package/js/src/htx.d.ts +6 -6
  146. package/js/src/htx.js +155 -33
  147. package/js/src/hyperliquid.d.ts +1 -1
  148. package/js/src/hyperliquid.js +1 -1
  149. package/js/src/kraken.d.ts +1 -1
  150. package/js/src/kraken.js +1 -1
  151. package/js/src/kucoin.d.ts +13 -13
  152. package/js/src/kucoin.js +25 -24
  153. package/js/src/luno.d.ts +1 -1
  154. package/js/src/luno.js +1 -1
  155. package/js/src/mexc.d.ts +8 -9
  156. package/js/src/mexc.js +174 -27
  157. package/js/src/ndax.d.ts +1 -1
  158. package/js/src/ndax.js +1 -1
  159. package/js/src/okcoin.d.ts +4 -4
  160. package/js/src/okcoin.js +18 -18
  161. package/js/src/okx.d.ts +4 -3
  162. package/js/src/okx.js +22 -21
  163. package/js/src/phemex.js +12 -8
  164. package/js/src/poloniex.d.ts +1 -1
  165. package/js/src/poloniex.js +1 -1
  166. package/js/src/poloniexfutures.d.ts +1 -1
  167. package/js/src/poloniexfutures.js +6 -6
  168. package/js/src/pro/bitget.d.ts +1 -1
  169. package/js/src/pro/bitget.js +1 -1
  170. package/js/src/pro/bybit.d.ts +1 -1
  171. package/js/src/pro/bybit.js +13 -1
  172. package/js/src/pro/coinex.js +2 -2
  173. package/js/src/pro/gate.d.ts +2 -2
  174. package/js/src/pro/gate.js +6 -6
  175. package/js/src/pro/kucoin.d.ts +1 -1
  176. package/js/src/pro/kucoin.js +3 -3
  177. package/js/src/pro/okx.d.ts +2 -2
  178. package/js/src/pro/okx.js +11 -11
  179. package/js/src/pro/upbit.d.ts +3 -3
  180. package/js/src/pro/upbit.js +3 -3
  181. package/js/src/pro/woo.js +1 -1
  182. package/js/src/vertex.d.ts +3 -3
  183. package/js/src/vertex.js +11 -11
  184. package/js/src/woo.d.ts +7 -7
  185. package/js/src/woo.js +37 -37
  186. package/js/src/woofipro.d.ts +1 -1
  187. package/js/src/woofipro.js +24 -24
  188. package/js/src/xt.d.ts +7 -7
  189. package/js/src/xt.js +26 -26
  190. package/js/src/zonda.d.ts +1 -1
  191. package/js/src/zonda.js +1 -1
  192. package/package.json +1 -1
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.38';
203
+ const version = '4.4.40';
204
204
  Exchange["default"].ccxtVersion = version;
205
205
  const exchanges = {
206
206
  'ace': ace,
@@ -34,7 +34,7 @@ class alpaca extends alpaca$1 {
34
34
  'test': {
35
35
  'broker': 'https://broker-api.sandbox.{hostname}',
36
36
  'trader': 'https://paper-api.{hostname}',
37
- 'market': 'https://data.sandbox.{hostname}',
37
+ 'market': 'https://data.{hostname}',
38
38
  },
39
39
  'doc': 'https://alpaca.markets/docs/',
40
40
  'fees': 'https://docs.alpaca.markets/docs/crypto-fees',
@@ -54,7 +54,7 @@ class alpaca extends alpaca$1 {
54
54
  'createStopOrder': true,
55
55
  'createTriggerOrder': true,
56
56
  'editOrder': true,
57
- 'fetchBalance': false,
57
+ 'fetchBalance': true,
58
58
  'fetchBidsAsks': false,
59
59
  'fetchClosedOrders': true,
60
60
  'fetchCurrencies': false,
@@ -1586,6 +1586,77 @@ class alpaca extends alpaca$1 {
1586
1586
  };
1587
1587
  return this.safeString(types, type, type);
1588
1588
  }
1589
+ /**
1590
+ * @method
1591
+ * @name alpaca#fetchBalance
1592
+ * @description query for balance and get the amount of funds available for trading or funds locked in orders
1593
+ * @see https://docs.alpaca.markets/reference/getaccount-1
1594
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1595
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1596
+ */
1597
+ async fetchBalance(params = {}) {
1598
+ await this.loadMarkets();
1599
+ const response = await this.traderPrivateGetV2Account(params);
1600
+ //
1601
+ // {
1602
+ // "id": "43a01bde-4eb1-64fssc26adb5",
1603
+ // "admin_configurations": {
1604
+ // "allow_instant_ach": true,
1605
+ // "max_margin_multiplier": "4"
1606
+ // },
1607
+ // "user_configurations": {
1608
+ // "fractional_trading": true,
1609
+ // "max_margin_multiplier": "4"
1610
+ // },
1611
+ // "account_number": "744873727",
1612
+ // "status": "ACTIVE",
1613
+ // "crypto_status": "ACTIVE",
1614
+ // "currency": "USD",
1615
+ // "buying_power": "5.92",
1616
+ // "regt_buying_power": "5.92",
1617
+ // "daytrading_buying_power": "0",
1618
+ // "effective_buying_power": "5.92",
1619
+ // "non_marginable_buying_power": "5.92",
1620
+ // "bod_dtbp": "0",
1621
+ // "cash": "5.92",
1622
+ // "accrued_fees": "0",
1623
+ // "portfolio_value": "48.6",
1624
+ // "pattern_day_trader": false,
1625
+ // "trading_blocked": false,
1626
+ // "transfers_blocked": false,
1627
+ // "account_blocked": false,
1628
+ // "created_at": "2022-06-13T14:59:18.318096Z",
1629
+ // "trade_suspended_by_user": false,
1630
+ // "multiplier": "1",
1631
+ // "shorting_enabled": false,
1632
+ // "equity": "48.6",
1633
+ // "last_equity": "48.8014266",
1634
+ // "long_market_value": "42.68",
1635
+ // "short_market_value": "0",
1636
+ // "position_market_value": "42.68",
1637
+ // "initial_margin": "0",
1638
+ // "maintenance_margin": "0",
1639
+ // "last_maintenance_margin": "0",
1640
+ // "sma": "5.92",
1641
+ // "daytrade_count": 0,
1642
+ // "balance_asof": "2024-12-10",
1643
+ // "crypto_tier": 1,
1644
+ // "intraday_adjustments": "0",
1645
+ // "pending_reg_taf_fees": "0"
1646
+ // }
1647
+ //
1648
+ return this.parseBalance(response);
1649
+ }
1650
+ parseBalance(response) {
1651
+ const result = { 'info': response };
1652
+ const account = this.account();
1653
+ const currencyId = this.safeString(response, 'currency');
1654
+ const code = this.safeCurrencyCode(currencyId);
1655
+ account['free'] = this.safeString(response, 'cash');
1656
+ account['total'] = this.safeString(response, 'equity');
1657
+ result[code] = account;
1658
+ return this.safeBalance(result);
1659
+ }
1589
1660
  sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
1590
1661
  let endpoint = '/' + this.implodeParams(path, params);
1591
1662
  let url = this.implodeHostname(this.urls['api'][api[0]]);
@@ -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 = {}) {
@@ -1839,31 +1839,25 @@ class Exchange {
1839
1839
  let wssProxy = undefined;
1840
1840
  let wsSocksProxy = undefined;
1841
1841
  // ws proxy
1842
- if (this.valueIsDefined(this.wsProxy)) {
1842
+ const isWsProxyDefined = this.valueIsDefined(this.wsProxy);
1843
+ const is_ws_proxy_defined = this.valueIsDefined(this.ws_proxy);
1844
+ if (isWsProxyDefined || is_ws_proxy_defined) {
1843
1845
  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;
1846
+ wsProxy = (isWsProxyDefined) ? this.wsProxy : this.ws_proxy;
1849
1847
  }
1850
1848
  // wss proxy
1851
- if (this.valueIsDefined(this.wssProxy)) {
1849
+ const isWssProxyDefined = this.valueIsDefined(this.wssProxy);
1850
+ const is_wss_proxy_defined = this.valueIsDefined(this.wss_proxy);
1851
+ if (isWssProxyDefined || is_wss_proxy_defined) {
1852
1852
  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;
1853
+ wssProxy = (isWssProxyDefined) ? this.wssProxy : this.wss_proxy;
1858
1854
  }
1859
1855
  // ws socks proxy
1860
- if (this.valueIsDefined(this.wsSocksProxy)) {
1856
+ const isWsSocksProxyDefined = this.valueIsDefined(this.wsSocksProxy);
1857
+ const is_ws_socks_proxy_defined = this.valueIsDefined(this.ws_socks_proxy);
1858
+ if (isWsSocksProxyDefined || is_ws_socks_proxy_defined) {
1861
1859
  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;
1860
+ wsSocksProxy = (isWsSocksProxyDefined) ? this.wsSocksProxy : this.ws_socks_proxy;
1867
1861
  }
1868
1862
  // check
1869
1863
  const length = usedProxies.length;
@@ -6813,8 +6807,10 @@ class Exchange {
6813
6807
  const symbolAndTimeFrame = symbolsAndTimeFrames[i];
6814
6808
  const symbol = this.safeString(symbolAndTimeFrame, 0);
6815
6809
  const timeframe = this.safeString(symbolAndTimeFrame, 1);
6816
- if (timeframe in this.ohlcvs[symbol]) {
6817
- delete this.ohlcvs[symbol][timeframe];
6810
+ if (symbol in this.ohlcvs) {
6811
+ if (timeframe in this.ohlcvs[symbol]) {
6812
+ delete this.ohlcvs[symbol][timeframe];
6813
+ }
6818
6814
  }
6819
6815
  }
6820
6816
  }
@@ -6822,35 +6818,50 @@ class Exchange {
6822
6818
  for (let i = 0; i < symbols.length; i++) {
6823
6819
  const symbol = symbols[i];
6824
6820
  if (topic === 'trades') {
6825
- delete this.trades[symbol];
6821
+ if (symbol in this.trades) {
6822
+ delete this.trades[symbol];
6823
+ }
6826
6824
  }
6827
6825
  else if (topic === 'orderbook') {
6828
- delete this.orderbooks[symbol];
6826
+ if (symbol in this.orderbooks) {
6827
+ delete this.orderbooks[symbol];
6828
+ }
6829
6829
  }
6830
6830
  else if (topic === 'ticker') {
6831
- delete this.tickers[symbol];
6831
+ if (symbol in this.tickers) {
6832
+ delete this.tickers[symbol];
6833
+ }
6832
6834
  }
6833
6835
  }
6834
6836
  }
6835
6837
  else {
6836
6838
  if (topic === 'myTrades') {
6837
6839
  // don't reset this.myTrades directly here
6838
- // because in c# we need to use a different object
6840
+ // because in c# we need to use a different object (thread-safe dict)
6839
6841
  const keys = Object.keys(this.myTrades);
6840
6842
  for (let i = 0; i < keys.length; i++) {
6841
- delete this.myTrades[keys[i]];
6843
+ const key = keys[i];
6844
+ if (key in this.myTrades) {
6845
+ delete this.myTrades[key];
6846
+ }
6842
6847
  }
6843
6848
  }
6844
6849
  else if (topic === 'orders') {
6845
6850
  const orderSymbols = Object.keys(this.orders);
6846
6851
  for (let i = 0; i < orderSymbols.length; i++) {
6847
- delete this.orders[orderSymbols[i]];
6852
+ const orderSymbol = orderSymbols[i];
6853
+ if (orderSymbol in this.orders) {
6854
+ delete this.orders[orderSymbol];
6855
+ }
6848
6856
  }
6849
6857
  }
6850
6858
  else if (topic === 'ticker') {
6851
6859
  const tickerSymbols = Object.keys(this.tickers);
6852
6860
  for (let i = 0; i < tickerSymbols.length; i++) {
6853
- delete this.tickers[tickerSymbols[i]];
6861
+ const tickerSymbol = tickerSymbols[i];
6862
+ if (tickerSymbol in this.tickers) {
6863
+ delete this.tickers[tickerSymbol];
6864
+ }
6854
6865
  }
6855
6866
  }
6856
6867
  }
@@ -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');
@@ -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,7 +11630,7 @@ 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();
@@ -3608,7 +3608,6 @@ class bingx extends bingx$1 {
3608
3608
  'postOnly': undefined,
3609
3609
  'side': this.parseOrderSide(side),
3610
3610
  'price': this.safeString2(order, 'price', 'p'),
3611
- 'stopPrice': triggerPrice,
3612
3611
  'triggerPrice': triggerPrice,
3613
3612
  'stopLossPrice': stopLossPrice,
3614
3613
  'takeProfitPrice': takeProfitPrice,
@@ -6154,7 +6153,7 @@ class bingx extends bingx$1 {
6154
6153
  * @param {float} amount how much of the currency you want to trade in units of the base currency
6155
6154
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
6156
6155
  * @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.
6156
+ * @param {string} [params.triggerPrice] Trigger price used for TAKE_STOP_LIMIT, TAKE_STOP_MARKET, TRIGGER_LIMIT, TRIGGER_MARKET order types.
6158
6157
  * @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
6159
6158
  * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
6160
6159
  * @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,
@@ -1509,10 +1509,10 @@ class bitfinex extends bitfinex$1 {
1509
1509
  }
1510
1510
  }
1511
1511
  let price = this.safeString(orderList, 16);
1512
- let stopPrice = undefined;
1512
+ let triggerPrice = undefined;
1513
1513
  if ((orderType === 'EXCHANGE STOP') || (orderType === 'EXCHANGE STOP LIMIT')) {
1514
1514
  price = undefined;
1515
- stopPrice = this.safeString(orderList, 16);
1515
+ triggerPrice = this.safeString(orderList, 16);
1516
1516
  if (orderType === 'EXCHANGE STOP LIMIT') {
1517
1517
  price = this.safeString(orderList, 19);
1518
1518
  }
@@ -1538,8 +1538,7 @@ class bitfinex extends bitfinex$1 {
1538
1538
  'postOnly': postOnly,
1539
1539
  'side': side,
1540
1540
  'price': price,
1541
- 'stopPrice': stopPrice,
1542
- 'triggerPrice': stopPrice,
1541
+ 'triggerPrice': triggerPrice,
1543
1542
  'amount': amount,
1544
1543
  'cost': undefined,
1545
1544
  'average': average,
@@ -1562,7 +1561,7 @@ class bitfinex extends bitfinex$1 {
1562
1561
  * @param {float} amount how much you want to trade in units of the base currency
1563
1562
  * @param {float} [price] the price of the order, in units of the quote currency, ignored in market orders
1564
1563
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1565
- * @param {float} [params.stopPrice] The price at which a trigger order is triggered at
1564
+ * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
1566
1565
  * @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
1567
1566
  * @param {bool} [params.postOnly]
1568
1567
  * @param {bool} [params.reduceOnly] Ensures that the executed order does not flip the opened position.
@@ -1580,7 +1579,7 @@ class bitfinex extends bitfinex$1 {
1580
1579
  'symbol': market['id'],
1581
1580
  'amount': amountString,
1582
1581
  };
1583
- const stopPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
1582
+ const triggerPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
1584
1583
  const trailingAmount = this.safeString(params, 'trailingAmount');
1585
1584
  const timeInForce = this.safeString(params, 'timeInForce');
1586
1585
  const postOnlyParam = this.safeBool(params, 'postOnly', false);
@@ -1591,9 +1590,9 @@ class bitfinex extends bitfinex$1 {
1591
1590
  orderType = 'TRAILING STOP';
1592
1591
  request['price_trailing'] = trailingAmount;
1593
1592
  }
1594
- else if (stopPrice !== undefined) {
1595
- // request['price'] is taken as stopPrice for stop orders
1596
- request['price'] = this.priceToPrecision(symbol, stopPrice);
1593
+ else if (triggerPrice !== undefined) {
1594
+ // request['price'] is taken as triggerPrice for stop orders
1595
+ request['price'] = this.priceToPrecision(symbol, triggerPrice);
1597
1596
  if (type === 'limit') {
1598
1597
  orderType = 'STOP LIMIT';
1599
1598
  request['price_aux_limit'] = this.priceToPrecision(symbol, price);
@@ -1611,7 +1610,7 @@ class bitfinex extends bitfinex$1 {
1611
1610
  if ((ioc || fok) && (type === 'market')) {
1612
1611
  throw new errors.InvalidOrder(this.id + ' createOrder() does not allow market IOC and FOK orders');
1613
1612
  }
1614
- if ((type !== 'market') && (stopPrice === undefined)) {
1613
+ if ((type !== 'market') && (triggerPrice === undefined)) {
1615
1614
  request['price'] = this.priceToPrecision(symbol, price);
1616
1615
  }
1617
1616
  if (ioc) {
@@ -1655,7 +1654,7 @@ class bitfinex extends bitfinex$1 {
1655
1654
  * @param {float} amount the amount of currency to trade
1656
1655
  * @param {float} [price] price of the order
1657
1656
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1658
- * @param {float} [params.stopPrice] the price that triggers a trigger order
1657
+ * @param {float} [params.triggerPrice] the price that triggers a trigger order
1659
1658
  * @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
1660
1659
  * @param {boolean} [params.postOnly] set to true if you want to make a post only order
1661
1660
  * @param {boolean} [params.reduceOnly] indicates that the order is to reduce the size of a position
@@ -2965,7 +2964,7 @@ class bitfinex extends bitfinex$1 {
2965
2964
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2966
2965
  * @param {int} [params.until] timestamp in ms of the latest ledger entry
2967
2966
  * @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)
2968
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2967
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
2969
2968
  */
2970
2969
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
2971
2970
  await this.loadMarkets();
@@ -3657,7 +3656,7 @@ class bitfinex extends bitfinex$1 {
3657
3656
  * @param {float} amount how much you want to trade in units of the base currency
3658
3657
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
3659
3658
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3660
- * @param {float} [params.stopPrice] the price that triggers a trigger order
3659
+ * @param {float} [params.triggerPrice] the price that triggers a trigger order
3661
3660
  * @param {boolean} [params.postOnly] set to true if you want to make a post only order
3662
3661
  * @param {boolean} [params.reduceOnly] indicates that the order is to reduce the size of a position
3663
3662
  * @param {int} [params.flags] additional order parameters: 4096 (Post Only), 1024 (Reduce Only), 16384 (OCO), 64 (Hidden), 512 (Close), 524288 (No Var Rates)
@@ -3677,7 +3676,7 @@ class bitfinex extends bitfinex$1 {
3677
3676
  amountString = (side === 'buy') ? amountString : Precise["default"].stringNeg(amountString);
3678
3677
  request['amount'] = amountString;
3679
3678
  }
3680
- const stopPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
3679
+ const triggerPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
3681
3680
  const trailingAmount = this.safeString(params, 'trailingAmount');
3682
3681
  const timeInForce = this.safeString(params, 'timeInForce');
3683
3682
  const postOnlyParam = this.safeBool(params, 'postOnly', false);
@@ -3686,15 +3685,15 @@ class bitfinex extends bitfinex$1 {
3686
3685
  if (trailingAmount !== undefined) {
3687
3686
  request['price_trailing'] = trailingAmount;
3688
3687
  }
3689
- else if (stopPrice !== undefined) {
3690
- // request['price'] is taken as stopPrice for stop orders
3691
- request['price'] = this.priceToPrecision(symbol, stopPrice);
3688
+ else if (triggerPrice !== undefined) {
3689
+ // request['price'] is taken as triggerPrice for stop orders
3690
+ request['price'] = this.priceToPrecision(symbol, triggerPrice);
3692
3691
  if (type === 'limit') {
3693
3692
  request['price_aux_limit'] = this.priceToPrecision(symbol, price);
3694
3693
  }
3695
3694
  }
3696
3695
  const postOnly = (postOnlyParam || (timeInForce === 'PO'));
3697
- if ((type !== 'market') && (stopPrice === undefined)) {
3696
+ if ((type !== 'market') && (triggerPrice === undefined)) {
3698
3697
  request['price'] = this.priceToPrecision(symbol, price);
3699
3698
  }
3700
3699
  // flag values may be summed to combine flags
@@ -1271,7 +1271,6 @@ class bitfinex1 extends bitfinex1$1 {
1271
1271
  'postOnly': undefined,
1272
1272
  'side': side,
1273
1273
  'price': this.safeString(order, 'price'),
1274
- 'stopPrice': undefined,
1275
1274
  'triggerPrice': undefined,
1276
1275
  'average': this.safeString(order, 'avg_execution_price'),
1277
1276
  'amount': this.safeString(order, 'original_amount'),
@@ -650,7 +650,6 @@ class bitflyer extends bitflyer$1 {
650
650
  'postOnly': undefined,
651
651
  'side': side,
652
652
  'price': price,
653
- 'stopPrice': undefined,
654
653
  'triggerPrice': undefined,
655
654
  'cost': undefined,
656
655
  'amount': amount,
@@ -4242,7 +4242,6 @@ class bitget extends bitget$1 {
4242
4242
  'timeInForce': timeInForce,
4243
4243
  'postOnly': postOnly,
4244
4244
  'reduceOnly': reduceOnly,
4245
- 'stopPrice': this.safeNumber(order, 'triggerPrice'),
4246
4245
  'triggerPrice': this.safeNumber(order, 'triggerPrice'),
4247
4246
  'takeProfitPrice': this.safeNumber2(order, 'presetStopSurplusPrice', 'stopSurplusTriggerPrice'),
4248
4247
  'stopLossPrice': this.safeNumber2(order, 'presetStopLossPrice', 'stopLossTriggerPrice'),
@@ -6065,7 +6064,7 @@ class bitget extends bitget$1 {
6065
6064
  * @param {string} [params.symbol] *contract only* unified market symbol
6066
6065
  * @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
6067
6066
  * @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)
6068
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
6067
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
6069
6068
  */
6070
6069
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
6071
6070
  await this.loadMarkets();
@@ -922,7 +922,6 @@ class bithumb extends bithumb$1 {
922
922
  'postOnly': undefined,
923
923
  'side': side,
924
924
  'price': price,
925
- 'stopPrice': undefined,
926
925
  'triggerPrice': undefined,
927
926
  'amount': amount,
928
927
  'cost': undefined,
@@ -2556,7 +2556,6 @@ class bitmart extends bitmart$1 {
2556
2556
  'postOnly': postOnly,
2557
2557
  'side': this.parseOrderSide(this.safeString(order, 'side')),
2558
2558
  'price': this.omitZero(priceString),
2559
- 'stopPrice': trailingActivationPrice,
2560
2559
  'triggerPrice': trailingActivationPrice,
2561
2560
  'amount': this.omitZero(this.safeString(order, 'size')),
2562
2561
  'cost': this.safeString2(order, 'filled_notional', 'filledNotional'),
@@ -3022,7 +3021,7 @@ class bitmart extends bitmart$1 {
3022
3021
  * @param {string} symbol unified symbol of the market the order was made in
3023
3022
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3024
3023
  * @param {string} [params.clientOrderId] *spot only* the client order id of the order to cancel
3025
- * @param {boolean} [params.stop] *swap only* whether the order is a stop order
3024
+ * @param {boolean} [params.trigger] *swap only* whether the order is a trigger order
3026
3025
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3027
3026
  */
3028
3027
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -3047,9 +3046,9 @@ class bitmart extends bitmart$1 {
3047
3046
  response = await this.privatePostSpotV3CancelOrder(this.extend(request, params));
3048
3047
  }
3049
3048
  else {
3050
- const stop = this.safeBool2(params, 'stop', 'trigger');
3049
+ const trigger = this.safeBool2(params, 'stop', 'trigger');
3051
3050
  params = this.omit(params, ['stop', 'trigger']);
3052
- if (!stop) {
3051
+ if (!trigger) {
3053
3052
  response = await this.privatePostContractPrivateCancelOrder(this.extend(request, params));
3054
3053
  }
3055
3054
  else {