ccxt 4.3.5 → 4.3.7

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 (211) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/ccxt.js +1 -1
  3. package/dist/cjs/src/ace.js +5 -0
  4. package/dist/cjs/src/alpaca.js +6 -0
  5. package/dist/cjs/src/base/Exchange.js +37 -0
  6. package/dist/cjs/src/binance.js +4 -0
  7. package/dist/cjs/src/bingx.js +47 -0
  8. package/dist/cjs/src/bitbank.js +3 -0
  9. package/dist/cjs/src/bitget.js +74 -1
  10. package/dist/cjs/src/bithumb.js +4 -0
  11. package/dist/cjs/src/bitmex.js +26 -0
  12. package/dist/cjs/src/bitopro.js +5 -0
  13. package/dist/cjs/src/bitso.js +3 -0
  14. package/dist/cjs/src/bitstamp.js +3 -0
  15. package/dist/cjs/src/bitteam.js +4 -0
  16. package/dist/cjs/src/bitvavo.js +3 -0
  17. package/dist/cjs/src/bl3p.js +3 -0
  18. package/dist/cjs/src/btcalpha.js +3 -0
  19. package/dist/cjs/src/btcbox.js +3 -0
  20. package/dist/cjs/src/btcmarkets.js +3 -0
  21. package/dist/cjs/src/btcturk.js +3 -0
  22. package/dist/cjs/src/bybit.js +209 -12
  23. package/dist/cjs/src/cex.js +6 -0
  24. package/dist/cjs/src/coinbase.js +100 -21
  25. package/dist/cjs/src/coinbaseinternational.js +2 -0
  26. package/dist/cjs/src/coinbasepro.js +6 -0
  27. package/dist/cjs/src/coincheck.js +3 -0
  28. package/dist/cjs/src/coinex.js +180 -75
  29. package/dist/cjs/src/coinlist.js +4 -0
  30. package/dist/cjs/src/coinmate.js +3 -0
  31. package/dist/cjs/src/coinone.js +3 -0
  32. package/dist/cjs/src/coinsph.js +4 -0
  33. package/dist/cjs/src/coinspot.js +3 -0
  34. package/dist/cjs/src/cryptocom.js +34 -0
  35. package/dist/cjs/src/exmo.js +5 -0
  36. package/dist/cjs/src/gate.js +124 -22
  37. package/dist/cjs/src/hitbtc.js +4 -3
  38. package/dist/cjs/src/htx.js +30 -0
  39. package/dist/cjs/src/hyperliquid.js +40 -0
  40. package/dist/cjs/src/idex.js +3 -0
  41. package/dist/cjs/src/independentreserve.js +3 -0
  42. package/dist/cjs/src/indodax.js +3 -0
  43. package/dist/cjs/src/kraken.js +30 -0
  44. package/dist/cjs/src/krakenfutures.js +28 -0
  45. package/dist/cjs/src/kucoin.js +2 -0
  46. package/dist/cjs/src/kucoinfutures.js +4 -2
  47. package/dist/cjs/src/latoken.js +6 -0
  48. package/dist/cjs/src/luno.js +3 -0
  49. package/dist/cjs/src/lykke.js +5 -0
  50. package/dist/cjs/src/mercado.js +3 -0
  51. package/dist/cjs/src/mexc.js +111 -0
  52. package/dist/cjs/src/ndax.js +4 -0
  53. package/dist/cjs/src/novadax.js +4 -0
  54. package/dist/cjs/src/okx.js +196 -0
  55. package/dist/cjs/src/onetrading.js +3 -0
  56. package/dist/cjs/src/p2b.js +3 -0
  57. package/dist/cjs/src/pro/bitget.js +1 -1
  58. package/dist/cjs/src/pro/bybit.js +1 -1
  59. package/dist/cjs/src/pro/coinbase.js +30 -29
  60. package/dist/cjs/src/probit.js +3 -0
  61. package/dist/cjs/src/timex.js +3 -0
  62. package/dist/cjs/src/tradeogre.js +3 -0
  63. package/dist/cjs/src/wavesexchange.js +3 -0
  64. package/dist/cjs/src/wazirx.js +3 -0
  65. package/dist/cjs/src/whitebit.js +42 -0
  66. package/dist/cjs/src/woo.js +31 -0
  67. package/dist/cjs/src/yobit.js +3 -0
  68. package/js/ccxt.d.ts +1 -1
  69. package/js/ccxt.js +1 -1
  70. package/js/src/abstract/binance.d.ts +1 -0
  71. package/js/src/abstract/binancecoinm.d.ts +1 -0
  72. package/js/src/abstract/binanceus.d.ts +1 -0
  73. package/js/src/abstract/binanceusdm.d.ts +1 -0
  74. package/js/src/abstract/bingx.d.ts +1 -0
  75. package/js/src/abstract/coinbase.d.ts +5 -0
  76. package/js/src/abstract/woo.d.ts +1 -0
  77. package/js/src/ace.js +5 -0
  78. package/js/src/alpaca.js +6 -0
  79. package/js/src/ascendex.d.ts +2 -2
  80. package/js/src/base/Exchange.d.ts +5 -0
  81. package/js/src/base/Exchange.js +37 -0
  82. package/js/src/bigone.d.ts +1 -1
  83. package/js/src/binance.d.ts +3 -3
  84. package/js/src/binance.js +4 -0
  85. package/js/src/bingx.d.ts +2 -1
  86. package/js/src/bingx.js +47 -0
  87. package/js/src/bitbank.d.ts +1 -1
  88. package/js/src/bitbank.js +3 -0
  89. package/js/src/bitfinex.d.ts +1 -1
  90. package/js/src/bitfinex2.d.ts +1 -1
  91. package/js/src/bitflyer.d.ts +1 -1
  92. package/js/src/bitget.d.ts +4 -3
  93. package/js/src/bitget.js +74 -1
  94. package/js/src/bithumb.d.ts +1 -1
  95. package/js/src/bithumb.js +4 -0
  96. package/js/src/bitmart.d.ts +1 -1
  97. package/js/src/bitmex.d.ts +2 -1
  98. package/js/src/bitmex.js +26 -0
  99. package/js/src/bitopro.d.ts +1 -1
  100. package/js/src/bitopro.js +5 -0
  101. package/js/src/bitrue.d.ts +1 -1
  102. package/js/src/bitso.d.ts +1 -1
  103. package/js/src/bitso.js +3 -0
  104. package/js/src/bitstamp.d.ts +1 -1
  105. package/js/src/bitstamp.js +3 -0
  106. package/js/src/bitteam.js +4 -0
  107. package/js/src/bitvavo.d.ts +1 -1
  108. package/js/src/bitvavo.js +3 -0
  109. package/js/src/bl3p.js +3 -0
  110. package/js/src/blockchaincom.d.ts +1 -1
  111. package/js/src/btcalpha.js +3 -0
  112. package/js/src/btcbox.js +3 -0
  113. package/js/src/btcmarkets.d.ts +1 -1
  114. package/js/src/btcmarkets.js +3 -0
  115. package/js/src/btcturk.js +3 -0
  116. package/js/src/bybit.d.ts +8 -6
  117. package/js/src/bybit.js +209 -12
  118. package/js/src/cex.js +6 -0
  119. package/js/src/coinbase.d.ts +1 -1
  120. package/js/src/coinbase.js +100 -21
  121. package/js/src/coinbaseinternational.d.ts +1 -1
  122. package/js/src/coinbaseinternational.js +2 -0
  123. package/js/src/coinbasepro.d.ts +1 -1
  124. package/js/src/coinbasepro.js +6 -0
  125. package/js/src/coincheck.js +3 -0
  126. package/js/src/coinex.d.ts +8 -7
  127. package/js/src/coinex.js +180 -75
  128. package/js/src/coinlist.d.ts +1 -1
  129. package/js/src/coinlist.js +4 -0
  130. package/js/src/coinmate.d.ts +1 -1
  131. package/js/src/coinmate.js +3 -0
  132. package/js/src/coinone.js +3 -0
  133. package/js/src/coinsph.d.ts +1 -1
  134. package/js/src/coinsph.js +4 -0
  135. package/js/src/coinspot.js +3 -0
  136. package/js/src/cryptocom.d.ts +3 -2
  137. package/js/src/cryptocom.js +34 -0
  138. package/js/src/delta.d.ts +2 -2
  139. package/js/src/deribit.d.ts +1 -1
  140. package/js/src/digifinex.d.ts +3 -3
  141. package/js/src/exmo.d.ts +3 -3
  142. package/js/src/exmo.js +5 -0
  143. package/js/src/gate.d.ts +8 -7
  144. package/js/src/gate.js +124 -22
  145. package/js/src/gemini.d.ts +1 -1
  146. package/js/src/hitbtc.d.ts +3 -3
  147. package/js/src/hitbtc.js +4 -3
  148. package/js/src/hollaex.d.ts +1 -1
  149. package/js/src/htx.d.ts +2 -1
  150. package/js/src/htx.js +30 -0
  151. package/js/src/huobijp.d.ts +1 -1
  152. package/js/src/hyperliquid.d.ts +3 -2
  153. package/js/src/hyperliquid.js +40 -0
  154. package/js/src/idex.d.ts +1 -1
  155. package/js/src/idex.js +3 -0
  156. package/js/src/independentreserve.js +3 -0
  157. package/js/src/indodax.d.ts +1 -1
  158. package/js/src/indodax.js +3 -0
  159. package/js/src/kraken.d.ts +2 -1
  160. package/js/src/kraken.js +30 -0
  161. package/js/src/krakenfutures.d.ts +1 -0
  162. package/js/src/krakenfutures.js +28 -0
  163. package/js/src/kucoin.d.ts +1 -1
  164. package/js/src/kucoin.js +2 -0
  165. package/js/src/kucoinfutures.d.ts +1 -1
  166. package/js/src/kucoinfutures.js +4 -2
  167. package/js/src/kuna.d.ts +1 -1
  168. package/js/src/latoken.js +6 -0
  169. package/js/src/lbank.d.ts +1 -1
  170. package/js/src/luno.js +3 -0
  171. package/js/src/lykke.d.ts +1 -1
  172. package/js/src/lykke.js +5 -0
  173. package/js/src/mercado.d.ts +1 -1
  174. package/js/src/mercado.js +3 -0
  175. package/js/src/mexc.d.ts +4 -3
  176. package/js/src/mexc.js +111 -0
  177. package/js/src/ndax.d.ts +1 -1
  178. package/js/src/ndax.js +4 -0
  179. package/js/src/novadax.d.ts +1 -1
  180. package/js/src/novadax.js +4 -0
  181. package/js/src/okcoin.d.ts +1 -1
  182. package/js/src/okx.d.ts +11 -8
  183. package/js/src/okx.js +196 -0
  184. package/js/src/onetrading.d.ts +1 -1
  185. package/js/src/onetrading.js +3 -0
  186. package/js/src/p2b.js +3 -0
  187. package/js/src/phemex.d.ts +1 -1
  188. package/js/src/poloniex.d.ts +1 -1
  189. package/js/src/pro/bitget.d.ts +1 -1
  190. package/js/src/pro/bitget.js +1 -1
  191. package/js/src/pro/bybit.js +1 -1
  192. package/js/src/pro/coinbase.d.ts +2 -2
  193. package/js/src/pro/coinbase.js +30 -29
  194. package/js/src/probit.d.ts +1 -1
  195. package/js/src/probit.js +3 -0
  196. package/js/src/timex.js +3 -0
  197. package/js/src/tokocrypto.d.ts +1 -1
  198. package/js/src/tradeogre.js +3 -0
  199. package/js/src/upbit.d.ts +1 -1
  200. package/js/src/wavesexchange.d.ts +1 -1
  201. package/js/src/wavesexchange.js +3 -0
  202. package/js/src/wazirx.js +3 -0
  203. package/js/src/whitebit.d.ts +2 -1
  204. package/js/src/whitebit.js +42 -0
  205. package/js/src/woo.d.ts +3 -2
  206. package/js/src/woo.js +31 -0
  207. package/js/src/yobit.d.ts +1 -1
  208. package/js/src/yobit.js +3 -0
  209. package/js/src/zaif.d.ts +1 -1
  210. package/js/src/zonda.d.ts +1 -1
  211. package/package.json +1 -1
package/README.md CHANGED
@@ -213,13 +213,13 @@ console.log(version, Object.keys(exchanges));
213
213
 
214
214
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
215
215
 
216
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.5/dist/ccxt.browser.js
217
- * unpkg: https://unpkg.com/ccxt@4.3.5/dist/ccxt.browser.js
216
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.7/dist/ccxt.browser.js
217
+ * unpkg: https://unpkg.com/ccxt@4.3.7/dist/ccxt.browser.js
218
218
 
219
219
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
220
220
 
221
221
  ```HTML
222
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.5/dist/ccxt.browser.js"></script>
222
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.7/dist/ccxt.browser.js"></script>
223
223
  ```
224
224
 
225
225
  Creates a global `ccxt` object:
package/dist/cjs/ccxt.js CHANGED
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
182
182
 
183
183
  //-----------------------------------------------------------------------------
184
184
  // this is updated by vss.js when building
185
- const version = '4.3.5';
185
+ const version = '4.3.7';
186
186
  Exchange["default"].ccxtVersion = version;
187
187
  const exchanges = {
188
188
  'ace': ace,
@@ -62,8 +62,13 @@ class ace extends ace$1 {
62
62
  'fetchOrderBook': true,
63
63
  'fetchOrders': false,
64
64
  'fetchOrderTrades': true,
65
+ 'fetchPosition': false,
66
+ 'fetchPositionHistory': false,
65
67
  'fetchPositionMode': false,
66
68
  'fetchPositions': false,
69
+ 'fetchPositionsForSymbol': false,
70
+ 'fetchPositionsHistory': false,
71
+ 'fetchPositionsRisk': false,
67
72
  'fetchPremiumIndexOHLCV': false,
68
73
  'fetchTicker': true,
69
74
  'fetchTickers': true,
@@ -71,7 +71,13 @@ class alpaca extends alpaca$1 {
71
71
  'fetchOrder': true,
72
72
  'fetchOrderBook': true,
73
73
  'fetchOrders': true,
74
+ 'fetchPosition': false,
75
+ 'fetchPositionHistory': false,
76
+ 'fetchPositionMode': false,
74
77
  'fetchPositions': false,
78
+ 'fetchPositionsForSymbol': false,
79
+ 'fetchPositionsHistory': false,
80
+ 'fetchPositionsRisk': false,
75
81
  'fetchStatus': false,
76
82
  'fetchTicker': false,
77
83
  'fetchTickers': false,
@@ -505,6 +505,8 @@ class Exchange {
505
505
  'fetchOrderWs': undefined,
506
506
  'fetchPermissions': undefined,
507
507
  'fetchPosition': undefined,
508
+ 'fetchPositionHistory': undefined,
509
+ 'fetchPositionsHistory': undefined,
508
510
  'fetchPositionWs': undefined,
509
511
  'fetchPositionMode': undefined,
510
512
  'fetchPositions': undefined,
@@ -4711,6 +4713,9 @@ class Exchange {
4711
4713
  async cancelAllOrders(symbol = undefined, params = {}) {
4712
4714
  throw new errors.NotSupported(this.id + ' cancelAllOrders() is not supported yet');
4713
4715
  }
4716
+ async cancelAllOrdersAfter(timeout, params = {}) {
4717
+ throw new errors.NotSupported(this.id + ' cancelAllOrdersAfter() is not supported yet');
4718
+ }
4714
4719
  async cancelOrdersForSymbols(orders, params = {}) {
4715
4720
  throw new errors.NotSupported(this.id + ' cancelOrdersForSymbols() is not supported yet');
4716
4721
  }
@@ -6204,6 +6209,38 @@ class Exchange {
6204
6209
  const reconstructedDate = day + month + year;
6205
6210
  return reconstructedDate;
6206
6211
  }
6212
+ async fetchPositionHistory(symbol, since = undefined, limit = undefined, params = {}) {
6213
+ /**
6214
+ * @method
6215
+ * @name exchange#fetchPositionHistory
6216
+ * @description fetches the history of margin added or reduced from contract isolated positions
6217
+ * @param {string} [symbol] unified market symbol
6218
+ * @param {int} [since] timestamp in ms of the position
6219
+ * @param {int} [limit] the maximum amount of candles to fetch, default=1000
6220
+ * @param {object} params extra parameters specific to the exchange api endpoint
6221
+ * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
6222
+ */
6223
+ if (this.has['fetchPositionsHistory']) {
6224
+ const positions = await this.fetchPositionsHistory([symbol], since, limit, params);
6225
+ return this.safeDict(positions, 0);
6226
+ }
6227
+ else {
6228
+ throw new errors.NotSupported(this.id + ' fetchPositionHistory () is not supported yet');
6229
+ }
6230
+ }
6231
+ async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
6232
+ /**
6233
+ * @method
6234
+ * @name exchange#fetchPositionsHistory
6235
+ * @description fetches the history of margin added or reduced from contract isolated positions
6236
+ * @param {string} [symbol] unified market symbol
6237
+ * @param {int} [since] timestamp in ms of the position
6238
+ * @param {int} [limit] the maximum amount of candles to fetch, default=1000
6239
+ * @param {object} params extra parameters specific to the exchange api endpoint
6240
+ * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
6241
+ */
6242
+ throw new errors.NotSupported(this.id + ' fetchPositionsHistory () is not supported yet');
6243
+ }
6207
6244
  parseMarginModification(data, market = undefined) {
6208
6245
  throw new errors.NotSupported(this.id + ' parseMarginModification() is not supported yet');
6209
6246
  }
@@ -125,8 +125,10 @@ class binance extends binance$1 {
125
125
  'fetchOrders': true,
126
126
  'fetchOrderTrades': true,
127
127
  'fetchPosition': true,
128
+ 'fetchPositionHistory': false,
128
129
  'fetchPositionMode': true,
129
130
  'fetchPositions': true,
131
+ 'fetchPositionsHistory': false,
130
132
  'fetchPositionsRisk': true,
131
133
  'fetchPremiumIndexOHLCV': false,
132
134
  'fetchSettlementHistory': true,
@@ -321,6 +323,7 @@ class binance extends binance$1 {
321
323
  'capital/deposit/subAddress': 0.1,
322
324
  'capital/deposit/subHisrec': 0.1,
323
325
  'capital/withdraw/history': 1800,
326
+ 'capital/withdraw/address/list': 10,
324
327
  'capital/contract/convertible-coins': 4.0002,
325
328
  'convert/tradeFlow': 20.001,
326
329
  'convert/exchangeInfo': 50,
@@ -4107,6 +4110,7 @@ class binance extends binance$1 {
4107
4110
  * @param {string[]} [symbols] unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
4108
4111
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4109
4112
  * @param {string} [params.subType] "linear" or "inverse"
4113
+ * @param {string} [params.type] 'spot', 'option', use params["subType"] for swap and future markets
4110
4114
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
4111
4115
  */
4112
4116
  await this.loadMarkets();
@@ -32,6 +32,7 @@ class bingx extends bingx$1 {
32
32
  'option': false,
33
33
  'addMargin': true,
34
34
  'cancelAllOrders': true,
35
+ 'cancelAllOrdersAfter': true,
35
36
  'cancelOrder': true,
36
37
  'cancelOrders': true,
37
38
  'closeAllPositions': true,
@@ -71,8 +72,10 @@ class bingx extends bingx$1 {
71
72
  'fetchOrder': true,
72
73
  'fetchOrderBook': true,
73
74
  'fetchOrders': true,
75
+ 'fetchPositionHistory': false,
74
76
  'fetchPositionMode': true,
75
77
  'fetchPositions': true,
78
+ 'fetchPositionsHistory': false,
76
79
  'fetchTicker': true,
77
80
  'fetchTickers': true,
78
81
  'fetchTime': true,
@@ -228,6 +231,7 @@ class bingx extends bingx$1 {
228
231
  'trade/order': 3,
229
232
  'trade/batchOrders': 3,
230
233
  'trade/closeAllPositions': 3,
234
+ 'trade/cancelAllAfter': 3,
231
235
  'trade/marginType': 3,
232
236
  'trade/leverage': 3,
233
237
  'trade/positionMargin': 3,
@@ -2749,6 +2753,49 @@ class bingx extends bingx$1 {
2749
2753
  //
2750
2754
  return response;
2751
2755
  }
2756
+ async cancelAllOrdersAfter(timeout, params = {}) {
2757
+ /**
2758
+ * @method
2759
+ * @name bingx#cancelAllOrdersAfter
2760
+ * @description dead man's switch, cancel all orders after the given timeout
2761
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20all%20orders%20in%20countdown
2762
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20all%20orders%20in%20countdown
2763
+ * @param {number} timeout time in milliseconds, 0 represents cancel the timer
2764
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2765
+ * @param {string} [params.type] spot or swap market
2766
+ * @returns {object} the api result
2767
+ */
2768
+ await this.loadMarkets();
2769
+ const isActive = (timeout > 0);
2770
+ const request = {
2771
+ 'type': (isActive) ? 'ACTIVATE' : 'CLOSE',
2772
+ 'timeOut': (isActive) ? (this.parseToInt(timeout / 1000)) : 0,
2773
+ };
2774
+ let response = undefined;
2775
+ let type = undefined;
2776
+ [type, params] = this.handleMarketTypeAndParams('cancelAllOrdersAfter', undefined, params);
2777
+ if (type === 'spot') {
2778
+ response = await this.spotV1PrivatePostTradeCancelAllAfter(this.extend(request, params));
2779
+ }
2780
+ else if (type === 'swap') {
2781
+ response = await this.swapV2PrivatePostTradeCancelAllAfter(this.extend(request, params));
2782
+ }
2783
+ else {
2784
+ throw new errors.NotSupported(this.id + ' cancelAllOrdersAfter() is not supported for ' + type + ' markets');
2785
+ }
2786
+ //
2787
+ // {
2788
+ // code: '0',
2789
+ // msg: '',
2790
+ // data: {
2791
+ // triggerTime: '1712645434',
2792
+ // status: 'ACTIVATED',
2793
+ // note: 'All your perpetual pending orders will be closed automatically at 2024-04-09 06:50:34 UTC(+0),before that you can cancel the timer, or extend triggerTime time by this request'
2794
+ // }
2795
+ // }
2796
+ //
2797
+ return response;
2798
+ }
2752
2799
  async fetchOrder(id, symbol = undefined, params = {}) {
2753
2800
  /**
2754
2801
  * @method
@@ -56,8 +56,11 @@ class bitbank extends bitbank$1 {
56
56
  'fetchOrder': true,
57
57
  'fetchOrderBook': true,
58
58
  'fetchPosition': false,
59
+ 'fetchPositionHistory': false,
59
60
  'fetchPositionMode': false,
60
61
  'fetchPositions': false,
62
+ 'fetchPositionsForSymbol': false,
63
+ 'fetchPositionsHistory': false,
61
64
  'fetchPositionsRisk': false,
62
65
  'fetchPremiumIndexOHLCV': false,
63
66
  'fetchTicker': true,
@@ -106,8 +106,10 @@ class bitget extends bitget$1 {
106
106
  'fetchOrders': false,
107
107
  'fetchOrderTrades': false,
108
108
  'fetchPosition': true,
109
+ 'fetchPositionHistory': 'emulated',
109
110
  'fetchPositionMode': false,
110
111
  'fetchPositions': true,
112
+ 'fetchPositionsHistory': true,
111
113
  'fetchPositionsRisk': false,
112
114
  'fetchPremiumIndexOHLCV': false,
113
115
  'fetchStatus': false,
@@ -6548,7 +6550,7 @@ class bitget extends bitget$1 {
6548
6550
  // "cTime": "1700807507275"
6549
6551
  // }
6550
6552
  //
6551
- // fetchPositions: privateMixGetV2MixPositionHistoryPosition
6553
+ // fetchPositionsHistory: privateMixGetV2MixPositionHistoryPosition
6552
6554
  //
6553
6555
  // {
6554
6556
  // "symbol": "BTCUSDT",
@@ -8447,6 +8449,77 @@ class bitget extends bitget$1 {
8447
8449
  'marginMode': marginType,
8448
8450
  };
8449
8451
  }
8452
+ async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
8453
+ /**
8454
+ * @method
8455
+ * @name bitget#fetchPositionsHistory
8456
+ * @description fetches historical positions
8457
+ * @see https://www.bitget.com/api-doc/contract/position/Get-History-Position
8458
+ * @param {string} [symbol] unified contract symbols
8459
+ * @param {int} [since] timestamp in ms of the earliest position to fetch, default=3 months ago, max range for params["until"] - since is 3 months
8460
+ * @param {int} [limit] the maximum amount of records to fetch, default=20, max=100
8461
+ * @param {object} params extra parameters specific to the exchange api endpoint
8462
+ * @param {int} [params.until] timestamp in ms of the latest position to fetch, max range for params["until"] - since is 3 months
8463
+ *
8464
+ * EXCHANGE SPECIFIC PARAMETERS
8465
+ * @param {string} [params.productType] USDT-FUTURES (default), COIN-FUTURES, USDC-FUTURES, SUSDT-FUTURES, SCOIN-FUTURES, or SUSDC-FUTURES
8466
+ * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
8467
+ */
8468
+ await this.loadMarkets();
8469
+ const until = this.safeInteger(params, 'until');
8470
+ params = this.omit(params, 'until');
8471
+ const request = {};
8472
+ if (symbols !== undefined) {
8473
+ const symbolsLength = symbols.length;
8474
+ if (symbolsLength > 0) {
8475
+ const market = this.market(symbols[0]);
8476
+ request['symbol'] = market['id'];
8477
+ }
8478
+ }
8479
+ if (since !== undefined) {
8480
+ request['startTime'] = since;
8481
+ }
8482
+ if (limit !== undefined) {
8483
+ request['limit'] = limit;
8484
+ }
8485
+ if (until !== undefined) {
8486
+ request['endTime'] = until;
8487
+ }
8488
+ const response = await this.privateMixGetV2MixPositionHistoryPosition(this.extend(request, params));
8489
+ //
8490
+ // {
8491
+ // code: '00000',
8492
+ // msg: 'success',
8493
+ // requestTime: '1712794148791',
8494
+ // data: {
8495
+ // list: [
8496
+ // {
8497
+ // symbol: 'XRPUSDT',
8498
+ // marginCoin: 'USDT',
8499
+ // holdSide: 'long',
8500
+ // openAvgPrice: '0.64967',
8501
+ // closeAvgPrice: '0.58799',
8502
+ // marginMode: 'isolated',
8503
+ // openTotalPos: '10',
8504
+ // closeTotalPos: '10',
8505
+ // pnl: '-0.62976205',
8506
+ // netProfit: '-0.65356802',
8507
+ // totalFunding: '-0.01638',
8508
+ // openFee: '-0.00389802',
8509
+ // closeFee: '-0.00352794',
8510
+ // ctime: '1709590322199',
8511
+ // utime: '1709667583395'
8512
+ // },
8513
+ // ...
8514
+ // ]
8515
+ // }
8516
+ // }
8517
+ //
8518
+ const data = this.safeDict(response, 'data');
8519
+ const responseList = this.safeList(data, 'list');
8520
+ const positions = this.parsePositions(responseList, symbols, params);
8521
+ return this.filterBySinceLimit(positions, since, limit);
8522
+ }
8450
8523
  async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
8451
8524
  /**
8452
8525
  * @method
@@ -55,7 +55,11 @@ class bithumb extends bithumb$1 {
55
55
  'fetchOrder': true,
56
56
  'fetchOrderBook': true,
57
57
  'fetchPosition': false,
58
+ 'fetchPositionHistory': false,
59
+ 'fetchPositionMode': false,
58
60
  'fetchPositions': false,
61
+ 'fetchPositionsForSymbol': false,
62
+ 'fetchPositionsHistory': false,
59
63
  'fetchPositionsRisk': false,
60
64
  'fetchPremiumIndexOHLCV': false,
61
65
  'fetchTicker': true,
@@ -36,6 +36,7 @@ class bitmex extends bitmex$1 {
36
36
  'option': false,
37
37
  'addMargin': undefined,
38
38
  'cancelAllOrders': true,
39
+ 'cancelAllOrdersAfter': true,
39
40
  'cancelOrder': true,
40
41
  'cancelOrders': true,
41
42
  'closeAllPositions': false,
@@ -75,7 +76,9 @@ class bitmex extends bitmex$1 {
75
76
  'fetchOrderBook': true,
76
77
  'fetchOrders': true,
77
78
  'fetchPosition': false,
79
+ 'fetchPositionHistory': false,
78
80
  'fetchPositions': true,
81
+ 'fetchPositionsHistory': false,
79
82
  'fetchPositionsRisk': false,
80
83
  'fetchPremiumIndexOHLCV': false,
81
84
  'fetchTicker': true,
@@ -2116,6 +2119,29 @@ class bitmex extends bitmex$1 {
2116
2119
  //
2117
2120
  return this.parseOrders(response, market);
2118
2121
  }
2122
+ async cancelAllOrdersAfter(timeout, params = {}) {
2123
+ /**
2124
+ * @method
2125
+ * @name bitmex#cancelAllOrdersAfter
2126
+ * @description dead man's switch, cancel all orders after the given timeout
2127
+ * @see https://www.bitmex.com/api/explorer/#!/Order/Order_cancelAllAfter
2128
+ * @param {number} timeout time in milliseconds, 0 represents cancel the timer
2129
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2130
+ * @returns {object} the api result
2131
+ */
2132
+ await this.loadMarkets();
2133
+ const request = {
2134
+ 'timeout': (timeout > 0) ? this.parseToInt(timeout / 1000) : 0,
2135
+ };
2136
+ const response = await this.privatePostOrderCancelAllAfter(this.extend(request, params));
2137
+ //
2138
+ // {
2139
+ // now: '2024-04-09T09:01:56.560Z',
2140
+ // cancelTime: '2024-04-09T09:01:56.660Z'
2141
+ // }
2142
+ //
2143
+ return response;
2144
+ }
2119
2145
  async fetchLeverages(symbols = undefined, params = {}) {
2120
2146
  /**
2121
2147
  * @method
@@ -65,8 +65,13 @@ class bitopro extends bitopro$1 {
65
65
  'fetchOrderBook': true,
66
66
  'fetchOrders': false,
67
67
  'fetchOrderTrades': false,
68
+ 'fetchPosition': false,
69
+ 'fetchPositionHistory': false,
68
70
  'fetchPositionMode': false,
69
71
  'fetchPositions': false,
72
+ 'fetchPositionsForSymbol': false,
73
+ 'fetchPositionsHistory': false,
74
+ 'fetchPositionsRisk': false,
70
75
  'fetchPremiumIndexOHLCV': false,
71
76
  'fetchTicker': true,
72
77
  'fetchTickers': true,
@@ -69,8 +69,11 @@ class bitso extends bitso$1 {
69
69
  'fetchOrderBook': true,
70
70
  'fetchOrderTrades': true,
71
71
  'fetchPosition': false,
72
+ 'fetchPositionHistory': false,
72
73
  'fetchPositionMode': false,
73
74
  'fetchPositions': false,
75
+ 'fetchPositionsForSymbol': false,
76
+ 'fetchPositionsHistory': false,
74
77
  'fetchPositionsRisk': false,
75
78
  'fetchPremiumIndexOHLCV': false,
76
79
  'fetchTicker': true,
@@ -69,8 +69,11 @@ class bitstamp extends bitstamp$1 {
69
69
  'fetchOrder': true,
70
70
  'fetchOrderBook': true,
71
71
  'fetchPosition': false,
72
+ 'fetchPositionHistory': false,
72
73
  'fetchPositionMode': false,
73
74
  'fetchPositions': false,
75
+ 'fetchPositionsForSymbol': false,
76
+ 'fetchPositionsHistory': false,
74
77
  'fetchPositionsRisk': false,
75
78
  'fetchPremiumIndexOHLCV': false,
76
79
  'fetchTicker': true,
@@ -87,7 +87,11 @@ class bitteam extends bitteam$1 {
87
87
  'fetchOrders': true,
88
88
  'fetchOrderTrades': false,
89
89
  'fetchPosition': false,
90
+ 'fetchPositionHistory': false,
91
+ 'fetchPositionMode': false,
90
92
  'fetchPositions': false,
93
+ 'fetchPositionsForSymbol': false,
94
+ 'fetchPositionsHistory': false,
91
95
  'fetchPositionsRisk': false,
92
96
  'fetchPremiumIndexOHLCV': false,
93
97
  'fetchStatus': false,
@@ -70,8 +70,11 @@ class bitvavo extends bitvavo$1 {
70
70
  'fetchOrderBook': true,
71
71
  'fetchOrders': true,
72
72
  'fetchPosition': false,
73
+ 'fetchPositionHistory': false,
73
74
  'fetchPositionMode': false,
74
75
  'fetchPositions': false,
76
+ 'fetchPositionsForSymbol': false,
77
+ 'fetchPositionsHistory': false,
75
78
  'fetchPositionsRisk': false,
76
79
  'fetchPremiumIndexOHLCV': false,
77
80
  'fetchTicker': true,
@@ -59,8 +59,11 @@ class bl3p extends bl3p$1 {
59
59
  'fetchOpenInterestHistory': false,
60
60
  'fetchOrderBook': true,
61
61
  'fetchPosition': false,
62
+ 'fetchPositionHistory': false,
62
63
  'fetchPositionMode': false,
63
64
  'fetchPositions': false,
65
+ 'fetchPositionsForSymbol': false,
66
+ 'fetchPositionsHistory': false,
64
67
  'fetchPositionsRisk': false,
65
68
  'fetchPremiumIndexOHLCV': false,
66
69
  'fetchTicker': true,
@@ -67,8 +67,11 @@ class btcalpha extends btcalpha$1 {
67
67
  'fetchOrderBook': true,
68
68
  'fetchOrders': true,
69
69
  'fetchPosition': false,
70
+ 'fetchPositionHistory': false,
70
71
  'fetchPositionMode': false,
71
72
  'fetchPositions': false,
73
+ 'fetchPositionsForSymbol': false,
74
+ 'fetchPositionsHistory': false,
72
75
  'fetchPositionsRisk': false,
73
76
  'fetchPremiumIndexOHLCV': false,
74
77
  'fetchTicker': true,
@@ -55,8 +55,11 @@ class btcbox extends btcbox$1 {
55
55
  'fetchOrderBook': true,
56
56
  'fetchOrders': true,
57
57
  'fetchPosition': false,
58
+ 'fetchPositionHistory': false,
58
59
  'fetchPositionMode': false,
59
60
  'fetchPositions': false,
61
+ 'fetchPositionsForSymbol': false,
62
+ 'fetchPositionsHistory': false,
60
63
  'fetchPositionsRisk': false,
61
64
  'fetchPremiumIndexOHLCV': false,
62
65
  'fetchTicker': true,
@@ -65,8 +65,11 @@ class btcmarkets extends btcmarkets$1 {
65
65
  'fetchOrderBook': true,
66
66
  'fetchOrders': true,
67
67
  'fetchPosition': false,
68
+ 'fetchPositionHistory': false,
68
69
  'fetchPositionMode': false,
69
70
  'fetchPositions': false,
71
+ 'fetchPositionsForSymbol': false,
72
+ 'fetchPositionsHistory': false,
70
73
  'fetchPositionsRisk': false,
71
74
  'fetchPremiumIndexOHLCV': false,
72
75
  'fetchTicker': true,
@@ -60,8 +60,11 @@ class btcturk extends btcturk$1 {
60
60
  'fetchOrderBook': true,
61
61
  'fetchOrders': true,
62
62
  'fetchPosition': false,
63
+ 'fetchPositionHistory': false,
63
64
  'fetchPositionMode': false,
64
65
  'fetchPositions': false,
66
+ 'fetchPositionsForSymbol': false,
67
+ 'fetchPositionsHistory': false,
65
68
  'fetchPositionsRisk': false,
66
69
  'fetchPremiumIndexOHLCV': false,
67
70
  'fetchTicker': true,