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
@@ -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();
@@ -3357,7 +3356,7 @@ class bitfinex extends bitfinex$1 {
3357
3356
  // ],
3358
3357
  // ]
3359
3358
  //
3360
- return this.parseOpenInterests(response, market, since, limit);
3359
+ return this.parseOpenInterestsHistory(response, market, since, limit);
3361
3360
  }
3362
3361
  parseOpenInterest(interest, market = undefined) {
3363
3362
  //
@@ -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,
@@ -1243,6 +1243,7 @@ class bitget extends bitget$1 {
1243
1243
  '41103': errors.InvalidOrder,
1244
1244
  '41114': errors.OnMaintenance,
1245
1245
  '43011': errors.InvalidOrder,
1246
+ '43001': errors.OrderNotFound,
1246
1247
  '43012': errors.InsufficientFunds,
1247
1248
  '43025': errors.InvalidOrder,
1248
1249
  '43115': errors.OnMaintenance,
@@ -4242,7 +4243,6 @@ class bitget extends bitget$1 {
4242
4243
  'timeInForce': timeInForce,
4243
4244
  'postOnly': postOnly,
4244
4245
  'reduceOnly': reduceOnly,
4245
- 'stopPrice': this.safeNumber(order, 'triggerPrice'),
4246
4246
  'triggerPrice': this.safeNumber(order, 'triggerPrice'),
4247
4247
  'takeProfitPrice': this.safeNumber2(order, 'presetStopSurplusPrice', 'stopSurplusTriggerPrice'),
4248
4248
  'stopLossPrice': this.safeNumber2(order, 'presetStopLossPrice', 'stopLossTriggerPrice'),
@@ -6065,7 +6065,7 @@ class bitget extends bitget$1 {
6065
6065
  * @param {string} [params.symbol] *contract only* unified market symbol
6066
6066
  * @param {string} [params.productType] *contract only* 'USDT-FUTURES', 'USDC-FUTURES', 'COIN-FUTURES', 'SUSDT-FUTURES', 'SUSDC-FUTURES' or 'SCOIN-FUTURES'
6067
6067
  * @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}
6068
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
6069
6069
  */
6070
6070
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
6071
6071
  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,
@@ -62,12 +62,13 @@ class bitmart extends bitmart$1 {
62
62
  'fetchDeposits': true,
63
63
  'fetchDepositWithdrawFee': true,
64
64
  'fetchDepositWithdrawFees': false,
65
- 'fetchFundingHistory': undefined,
65
+ 'fetchFundingHistory': true,
66
66
  'fetchFundingRate': true,
67
67
  'fetchFundingRateHistory': false,
68
68
  'fetchFundingRates': false,
69
69
  'fetchIsolatedBorrowRate': true,
70
70
  'fetchIsolatedBorrowRates': true,
71
+ 'fetchLedger': true,
71
72
  'fetchLiquidations': false,
72
73
  'fetchMarginMode': false,
73
74
  'fetchMarkets': true,
@@ -154,6 +155,7 @@ class bitmart extends bitmart$1 {
154
155
  'contract/public/depth': 5,
155
156
  'contract/public/open-interest': 30,
156
157
  'contract/public/funding-rate': 30,
158
+ 'contract/public/funding-rate-history': 30,
157
159
  'contract/public/kline': 6,
158
160
  'account/v1/currencies': 30,
159
161
  },
@@ -204,6 +206,7 @@ class bitmart extends bitmart$1 {
204
206
  'contract/private/position-risk': 10,
205
207
  'contract/private/affilate/rebate-list': 10,
206
208
  'contract/private/affilate/trade-list': 10,
209
+ 'contract/private/transaction-history': 10,
207
210
  },
208
211
  'post': {
209
212
  // sub-account endpoints
@@ -2556,7 +2559,6 @@ class bitmart extends bitmart$1 {
2556
2559
  'postOnly': postOnly,
2557
2560
  'side': this.parseOrderSide(this.safeString(order, 'side')),
2558
2561
  'price': this.omitZero(priceString),
2559
- 'stopPrice': trailingActivationPrice,
2560
2562
  'triggerPrice': trailingActivationPrice,
2561
2563
  'amount': this.omitZero(this.safeString(order, 'size')),
2562
2564
  'cost': this.safeString2(order, 'filled_notional', 'filledNotional'),
@@ -3022,7 +3024,7 @@ class bitmart extends bitmart$1 {
3022
3024
  * @param {string} symbol unified symbol of the market the order was made in
3023
3025
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3024
3026
  * @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
3027
+ * @param {boolean} [params.trigger] *swap only* whether the order is a trigger order
3026
3028
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3027
3029
  */
3028
3030
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -3047,9 +3049,9 @@ class bitmart extends bitmart$1 {
3047
3049
  response = await this.privatePostSpotV3CancelOrder(this.extend(request, params));
3048
3050
  }
3049
3051
  else {
3050
- const stop = this.safeBool2(params, 'stop', 'trigger');
3052
+ const trigger = this.safeBool2(params, 'stop', 'trigger');
3051
3053
  params = this.omit(params, ['stop', 'trigger']);
3052
- if (!stop) {
3054
+ if (!trigger) {
3053
3055
  response = await this.privatePostContractPrivateCancelOrder(this.extend(request, params));
3054
3056
  }
3055
3057
  else {
@@ -4616,6 +4618,65 @@ class bitmart extends bitmart$1 {
4616
4618
  const data = this.safeDict(response, 'data', {});
4617
4619
  return this.parseFundingRate(data, market);
4618
4620
  }
4621
+ /**
4622
+ * @method
4623
+ * @name bitmart#fetchFundingRateHistory
4624
+ * @description fetches historical funding rate prices
4625
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-funding-rate-history
4626
+ * @param {string} symbol unified symbol of the market to fetch the funding rate history for
4627
+ * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
4628
+ * @param {int} [limit] the maximum amount of funding rate structures to fetch
4629
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4630
+ * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
4631
+ */
4632
+ async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4633
+ if (symbol === undefined) {
4634
+ throw new errors.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
4635
+ }
4636
+ await this.loadMarkets();
4637
+ const market = this.market(symbol);
4638
+ const request = {
4639
+ 'symbol': market['id'],
4640
+ };
4641
+ if (limit !== undefined) {
4642
+ request['limit'] = limit;
4643
+ }
4644
+ const response = await this.publicGetContractPublicFundingRateHistory(this.extend(request, params));
4645
+ //
4646
+ // {
4647
+ // "code": 1000,
4648
+ // "message": "Ok",
4649
+ // "data": {
4650
+ // "list": [
4651
+ // {
4652
+ // "symbol": "BTCUSDT",
4653
+ // "funding_rate": "0.000091412174",
4654
+ // "funding_time": "1734336000000"
4655
+ // },
4656
+ // ]
4657
+ // },
4658
+ // "trace": "fg73d949fgfdf6a40c8fc7f5ae6738.54.345345345345"
4659
+ // }
4660
+ //
4661
+ const data = this.safeDict(response, 'data', {});
4662
+ const result = this.safeList(data, 'list', []);
4663
+ const rates = [];
4664
+ for (let i = 0; i < result.length; i++) {
4665
+ const entry = result[i];
4666
+ const marketId = this.safeString(entry, 'symbol');
4667
+ const symbolInner = this.safeSymbol(marketId, market, '-', 'swap');
4668
+ const timestamp = this.safeInteger(entry, 'funding_time');
4669
+ rates.push({
4670
+ 'info': entry,
4671
+ 'symbol': symbolInner,
4672
+ 'fundingRate': this.safeNumber(entry, 'funding_rate'),
4673
+ 'timestamp': timestamp,
4674
+ 'datetime': this.iso8601(timestamp),
4675
+ });
4676
+ }
4677
+ const sorted = this.sortBy(rates, 'timestamp');
4678
+ return this.filterBySymbolSinceLimit(sorted, market['symbol'], since, limit);
4679
+ }
4619
4680
  parseFundingRate(contract, market = undefined) {
4620
4681
  //
4621
4682
  // {
@@ -5050,6 +5111,197 @@ class bitmart extends bitmart$1 {
5050
5111
  const data = this.safeDict(response, 'data', {});
5051
5112
  return this.parseOrder(data, market);
5052
5113
  }
5114
+ /**
5115
+ * @method
5116
+ * @name bitmart#fetchLedger
5117
+ * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
5118
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-transaction-history-keyed
5119
+ * @param {string} [code] unified currency code
5120
+ * @param {int} [since] timestamp in ms of the earliest ledger entry
5121
+ * @param {int} [limit] max number of ledger entries to return
5122
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
5123
+ * @param {int} [params.until] timestamp in ms of the latest ledger entry
5124
+ * @returns {object[]} a list of [ledger structures]{@link https://docs.ccxt.com/#/?id=ledger}
5125
+ */
5126
+ async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
5127
+ await this.loadMarkets();
5128
+ let currency = undefined;
5129
+ if (code !== undefined) {
5130
+ currency = this.currency(code);
5131
+ }
5132
+ let request = {};
5133
+ [request, params] = this.handleUntilOption('end_time', request, params);
5134
+ const transactionsRequest = this.fetchTransactionsRequest(0, undefined, since, limit, params);
5135
+ const response = await this.privateGetContractPrivateTransactionHistory(transactionsRequest);
5136
+ //
5137
+ // {
5138
+ // "code": 1000,
5139
+ // "message": "Ok",
5140
+ // "data": [
5141
+ // {
5142
+ // "time": "1734422402121",
5143
+ // "type": "Funding Fee",
5144
+ // "amount": "-0.00008253",
5145
+ // "asset": "USDT",
5146
+ // "symbol": "LTCUSDT",
5147
+ // "tran_id": "1734422402121",
5148
+ // "flow_type": 3
5149
+ // },
5150
+ // ],
5151
+ // "trace": "4cd11f83c71egfhfgh842790f07241e.23.173442343427772866"
5152
+ // }
5153
+ //
5154
+ const data = this.safeList(response, 'data', []);
5155
+ return this.parseLedger(data, currency, since, limit);
5156
+ }
5157
+ parseLedgerEntry(item, currency = undefined) {
5158
+ //
5159
+ // {
5160
+ // "time": "1734422402121",
5161
+ // "type": "Funding Fee",
5162
+ // "amount": "-0.00008253",
5163
+ // "asset": "USDT",
5164
+ // "symbol": "LTCUSDT",
5165
+ // "tran_id": "1734422402121",
5166
+ // "flow_type": 3
5167
+ // }
5168
+ //
5169
+ let amount = this.safeString(item, 'amount');
5170
+ let direction = undefined;
5171
+ if (Precise["default"].stringLe(amount, '0')) {
5172
+ direction = 'out';
5173
+ amount = Precise["default"].stringMul('-1', amount);
5174
+ }
5175
+ else {
5176
+ direction = 'in';
5177
+ }
5178
+ const currencyId = this.safeString(item, 'asset');
5179
+ const timestamp = this.safeInteger(item, 'time');
5180
+ const type = this.safeString(item, 'type');
5181
+ return this.safeLedgerEntry({
5182
+ 'info': item,
5183
+ 'id': this.safeString(item, 'tran_id'),
5184
+ 'direction': direction,
5185
+ 'account': undefined,
5186
+ 'referenceAccount': undefined,
5187
+ 'referenceId': this.safeString(item, 'tradeId'),
5188
+ 'type': this.parseLedgerEntryType(type),
5189
+ 'currency': this.safeCurrencyCode(currencyId, currency),
5190
+ 'amount': this.parseNumber(amount),
5191
+ 'timestamp': timestamp,
5192
+ 'datetime': this.iso8601(timestamp),
5193
+ 'before': undefined,
5194
+ 'after': undefined,
5195
+ 'status': undefined,
5196
+ 'fee': undefined,
5197
+ }, currency);
5198
+ }
5199
+ parseLedgerEntryType(type) {
5200
+ const ledgerType = {
5201
+ 'Commission Fee': 'fee',
5202
+ 'Funding Fee': 'fee',
5203
+ 'Realized PNL': 'trade',
5204
+ 'Transfer': 'transfer',
5205
+ 'Liquidation Clearance': 'settlement',
5206
+ };
5207
+ return this.safeString(ledgerType, type, type);
5208
+ }
5209
+ fetchTransactionsRequest(flowType = undefined, symbol = undefined, since = undefined, limit = undefined, params = {}) {
5210
+ let request = {};
5211
+ if (flowType !== undefined) {
5212
+ request['flow_type'] = flowType;
5213
+ }
5214
+ let market = undefined;
5215
+ if (symbol !== undefined) {
5216
+ market = this.market(symbol);
5217
+ request['symbol'] = market['id'];
5218
+ }
5219
+ if (since !== undefined) {
5220
+ request['start_time'] = since;
5221
+ }
5222
+ if (limit !== undefined) {
5223
+ request['page_size'] = limit;
5224
+ }
5225
+ [request, params] = this.handleUntilOption('end_time', request, params);
5226
+ return this.extend(request, params);
5227
+ }
5228
+ /**
5229
+ * @method
5230
+ * @name bitmart#fetchFundingHistory
5231
+ * @description fetch the history of funding payments paid and received on this account
5232
+ * @see https://developer-pro.bitmart.com/en/futuresv2/#get-transaction-history-keyed
5233
+ * @param {string} [symbol] unified market symbol
5234
+ * @param {int} [since] the starting timestamp in milliseconds
5235
+ * @param {int} [limit] the number of entries to return
5236
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
5237
+ * @param {int} [params.until] the latest time in ms to fetch funding history for
5238
+ * @returns {object[]} a list of [funding history structures]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
5239
+ */
5240
+ async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
5241
+ await this.loadMarkets();
5242
+ let market = undefined;
5243
+ if (symbol !== undefined) {
5244
+ market = this.market(symbol);
5245
+ }
5246
+ let request = {};
5247
+ [request, params] = this.handleUntilOption('end_time', request, params);
5248
+ const transactionsRequest = this.fetchTransactionsRequest(3, symbol, since, limit, params);
5249
+ const response = await this.privateGetContractPrivateTransactionHistory(transactionsRequest);
5250
+ //
5251
+ // {
5252
+ // "code": 1000,
5253
+ // "message": "Ok",
5254
+ // "data": [
5255
+ // {
5256
+ // "time": "1734422402121",
5257
+ // "type": "Funding Fee",
5258
+ // "amount": "-0.00008253",
5259
+ // "asset": "USDT",
5260
+ // "symbol": "LTCUSDT",
5261
+ // "tran_id": "1734422402121",
5262
+ // "flow_type": 3
5263
+ // },
5264
+ // ],
5265
+ // "trace": "4cd11f83c71egfhfgh842790f07241e.23.173442343427772866"
5266
+ // }
5267
+ //
5268
+ const data = this.safeList(response, 'data', []);
5269
+ return this.parseFundingHistories(data, market, since, limit);
5270
+ }
5271
+ parseFundingHistory(contract, market = undefined) {
5272
+ //
5273
+ // {
5274
+ // "time": "1734422402121",
5275
+ // "type": "Funding Fee",
5276
+ // "amount": "-0.00008253",
5277
+ // "asset": "USDT",
5278
+ // "symbol": "LTCUSDT",
5279
+ // "tran_id": "1734422402121",
5280
+ // "flow_type": 3
5281
+ // }
5282
+ //
5283
+ const marketId = this.safeString(contract, 'symbol');
5284
+ const currencyId = this.safeString(contract, 'asset');
5285
+ const timestamp = this.safeInteger(contract, 'time');
5286
+ return {
5287
+ 'info': contract,
5288
+ 'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
5289
+ 'code': this.safeCurrencyCode(currencyId),
5290
+ 'timestamp': timestamp,
5291
+ 'datetime': this.iso8601(timestamp),
5292
+ 'id': this.safeString(contract, 'tran_id'),
5293
+ 'amount': this.safeNumber(contract, 'amount'),
5294
+ };
5295
+ }
5296
+ parseFundingHistories(contracts, market = undefined, since = undefined, limit = undefined) {
5297
+ const result = [];
5298
+ for (let i = 0; i < contracts.length; i++) {
5299
+ const contract = contracts[i];
5300
+ result.push(this.parseFundingHistory(contract, market));
5301
+ }
5302
+ const sorted = this.sortBy(result, 'timestamp');
5303
+ return this.filterBySinceLimit(sorted, since, limit);
5304
+ }
5053
5305
  nonce() {
5054
5306
  return this.milliseconds();
5055
5307
  }
@@ -1307,7 +1307,7 @@ class bitmex extends bitmex$1 {
1307
1307
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1308
1308
  * @param {int} [limit] max number of ledger entries to return, default is undefined
1309
1309
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1310
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1310
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
1311
1311
  */
1312
1312
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
1313
1313
  await this.loadMarkets();
@@ -1865,7 +1865,7 @@ class bitmex extends bitmex$1 {
1865
1865
  postOnly = (execInst === 'ParticipateDoNotInitiate');
1866
1866
  }
1867
1867
  const timestamp = this.parse8601(this.safeString(order, 'timestamp'));
1868
- const stopPrice = this.safeNumber(order, 'stopPx');
1868
+ const triggerPrice = this.safeNumber(order, 'stopPx');
1869
1869
  const remaining = this.safeString(order, 'leavesQty');
1870
1870
  return this.safeOrder({
1871
1871
  'info': order,
@@ -1880,8 +1880,7 @@ class bitmex extends bitmex$1 {
1880
1880
  'postOnly': postOnly,
1881
1881
  'side': this.safeStringLower(order, 'side'),
1882
1882
  'price': this.safeString(order, 'price'),
1883
- 'stopPrice': stopPrice,
1884
- 'triggerPrice': stopPrice,
1883
+ 'triggerPrice': triggerPrice,
1885
1884
  'amount': amount,
1886
1885
  'cost': cost,
1887
1886
  'average': average,
@@ -2035,7 +2034,7 @@ class bitmex extends bitmex$1 {
2035
2034
  else {
2036
2035
  if (triggerPrice === undefined) {
2037
2036
  // if exchange specific trigger types were provided
2038
- throw new errors.ArgumentsRequired(this.id + ' createOrder() requires a triggerPrice (stopPx|stopPrice) parameter for the ' + orderType + ' order type');
2037
+ throw new errors.ArgumentsRequired(this.id + ' createOrder() requires a triggerPrice parameter for the ' + orderType + ' order type');
2039
2038
  }
2040
2039
  request['stopPx'] = this.parseToNumeric(this.priceToPrecision(symbol, triggerPrice));
2041
2040
  }
@@ -2629,7 +2628,7 @@ class bitmex extends bitmex$1 {
2629
2628
  'timestamp': this.parse8601(datetime),
2630
2629
  'datetime': datetime,
2631
2630
  'fundingRate': this.safeNumber(contract, 'fundingRate'),
2632
- 'fundingTimestamp': this.parseToNumeric(this.iso8601(fundingDatetime)),
2631
+ 'fundingTimestamp': this.parse8601(fundingDatetime),
2633
2632
  'fundingDatetime': fundingDatetime,
2634
2633
  'nextFundingRate': this.safeNumber(contract, 'indicativeFundingRate'),
2635
2634
  'nextFundingTimestamp': undefined,
@@ -981,7 +981,6 @@ class bitopro extends bitopro$1 {
981
981
  'postOnly': postOnly,
982
982
  'side': side,
983
983
  'price': price,
984
- 'stopPrice': undefined,
985
984
  'triggerPrice': undefined,
986
985
  'amount': amount,
987
986
  'cost': undefined,
@@ -1024,13 +1023,13 @@ class bitopro extends bitopro$1 {
1024
1023
  }
1025
1024
  if (orderType === 'STOP_LIMIT') {
1026
1025
  request['price'] = this.priceToPrecision(symbol, price);
1027
- const stopPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
1026
+ const triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
1028
1027
  params = this.omit(params, ['triggerPrice', 'stopPrice']);
1029
- if (stopPrice === undefined) {
1030
- throw new errors.InvalidOrder(this.id + ' createOrder() requires a stopPrice parameter for ' + orderType + ' orders');
1028
+ if (triggerPrice === undefined) {
1029
+ throw new errors.InvalidOrder(this.id + ' createOrder() requires a triggerPrice parameter for ' + orderType + ' orders');
1031
1030
  }
1032
1031
  else {
1033
- request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
1032
+ request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
1034
1033
  }
1035
1034
  const condition = this.safeString(params, 'condition');
1036
1035
  if (condition === undefined) {
@@ -1834,8 +1834,7 @@ class bitrue extends bitrue$1 {
1834
1834
  if (type === 'limit_maker') {
1835
1835
  type = 'limit';
1836
1836
  }
1837
- const stopPriceString = this.safeString(order, 'stopPrice');
1838
- const stopPrice = this.parseNumber(this.omitZero(stopPriceString));
1837
+ const triggerPrice = this.parseNumber(this.omitZero(this.safeString(order, 'stopPrice')));
1839
1838
  return this.safeOrder({
1840
1839
  'info': order,
1841
1840
  'id': id,
@@ -1849,8 +1848,7 @@ class bitrue extends bitrue$1 {
1849
1848
  'postOnly': postOnly,
1850
1849
  'side': side,
1851
1850
  'price': price,
1852
- 'stopPrice': stopPrice,
1853
- 'triggerPrice': stopPrice,
1851
+ 'triggerPrice': triggerPrice,
1854
1852
  'amount': amount,
1855
1853
  'cost': cost,
1856
1854
  'average': average,
@@ -1988,10 +1986,10 @@ class bitrue extends bitrue$1 {
1988
1986
  params = this.omit(params, ['newClientOrderId', 'clientOrderId']);
1989
1987
  request['newClientOrderId'] = clientOrderId;
1990
1988
  }
1991
- const stopPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
1992
- if (stopPrice !== undefined) {
1989
+ const triggerPrice = this.safeValue2(params, 'triggerPrice', 'stopPrice');
1990
+ if (triggerPrice !== undefined) {
1993
1991
  params = this.omit(params, ['triggerPrice', 'stopPrice']);
1994
- request['stopPrice'] = this.priceToPrecision(symbol, stopPrice);
1992
+ request['stopPrice'] = this.priceToPrecision(symbol, triggerPrice);
1995
1993
  }
1996
1994
  response = await this.spotV1PrivatePostOrder(this.extend(request, params));
1997
1995
  data = response;
@@ -202,7 +202,7 @@ class bitso extends bitso$1 {
202
202
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
203
203
  * @param {int} [limit] max number of ledger entries to return, default is undefined
204
204
  * @param {object} [params] extra parameters specific to the exchange API endpoint
205
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
205
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
206
206
  */
207
207
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
208
208
  const request = {};
@@ -1137,7 +1137,6 @@ class bitso extends bitso$1 {
1137
1137
  'postOnly': undefined,
1138
1138
  'side': side,
1139
1139
  'price': price,
1140
- 'stopPrice': undefined,
1141
1140
  'triggerPrice': undefined,
1142
1141
  'amount': amount,
1143
1142
  'cost': undefined,
@@ -1915,7 +1915,6 @@ class bitstamp extends bitstamp$1 {
1915
1915
  'postOnly': undefined,
1916
1916
  'side': side,
1917
1917
  'price': price,
1918
- 'stopPrice': undefined,
1919
1918
  'triggerPrice': undefined,
1920
1919
  'cost': undefined,
1921
1920
  'amount': amount,
@@ -2039,7 +2038,7 @@ class bitstamp extends bitstamp$1 {
2039
2038
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2040
2039
  * @param {int} [limit] max number of ledger entries to return, default is undefined
2041
2040
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2042
- * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
2041
+ * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
2043
2042
  */
2044
2043
  async fetchLedger(code = undefined, since = undefined, limit = undefined, params = {}) {
2045
2044
  await this.loadMarkets();