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
@@ -90,7 +90,9 @@ class coinex extends coinex$1 {
90
90
  'fetchOrder': true,
91
91
  'fetchOrderBook': true,
92
92
  'fetchPosition': true,
93
+ 'fetchPositionHistory': true,
93
94
  'fetchPositions': true,
95
+ 'fetchPositionsHistory': false,
94
96
  'fetchPositionsRisk': false,
95
97
  'fetchPremiumIndexOHLCV': false,
96
98
  'fetchTicker': true,
@@ -1129,14 +1131,13 @@ class coinex extends coinex$1 {
1129
1131
  //
1130
1132
  // Spot and Swap fetchTrades (public)
1131
1133
  //
1132
- // {
1133
- // "id": 2611511379,
1134
- // "type": "buy",
1135
- // "price": "192.63",
1136
- // "amount": "0.02266931",
1137
- // "date": 1638990110,
1138
- // "date_ms": 1638990110518
1139
- // },
1134
+ // {
1135
+ // "amount": "0.00049432",
1136
+ // "created_at": 1713849825667,
1137
+ // "deal_id": 4137517302,
1138
+ // "price": "66251",
1139
+ // "side": "buy"
1140
+ // }
1140
1141
  //
1141
1142
  // Spot and Margin fetchMyTrades (private)
1142
1143
  //
@@ -1190,9 +1191,9 @@ class coinex extends coinex$1 {
1190
1191
  //
1191
1192
  let timestamp = this.safeTimestamp2(trade, 'create_time', 'time');
1192
1193
  if (timestamp === undefined) {
1193
- timestamp = this.safeInteger(trade, 'date_ms');
1194
+ timestamp = this.safeInteger(trade, 'created_at');
1194
1195
  }
1195
- const tradeId = this.safeString(trade, 'id');
1196
+ const tradeId = this.safeString2(trade, 'id', 'deal_id');
1196
1197
  const orderId = this.safeString(trade, 'order_id');
1197
1198
  const priceString = this.safeString(trade, 'price');
1198
1199
  const amountString = this.safeString(trade, 'amount');
@@ -1229,11 +1230,11 @@ class coinex extends coinex$1 {
1229
1230
  side = 'buy';
1230
1231
  }
1231
1232
  if (side === undefined) {
1232
- side = this.safeString(trade, 'type');
1233
+ side = this.safeString2(trade, 'type', 'side');
1233
1234
  }
1234
1235
  }
1235
1236
  else {
1236
- side = this.safeString(trade, 'type');
1237
+ side = this.safeString2(trade, 'type', 'side');
1237
1238
  }
1238
1239
  return this.safeTrade({
1239
1240
  'info': trade,
@@ -1255,9 +1256,9 @@ class coinex extends coinex$1 {
1255
1256
  /**
1256
1257
  * @method
1257
1258
  * @name coinex#fetchTrades
1258
- * @description get the list of most recent trades for a particular symbol
1259
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market005_market_deals
1260
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http011_market_deals
1259
+ * @description get the list of the most recent trades for a particular symbol
1260
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market-deals
1261
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market-deals
1261
1262
  * @param {string} symbol unified symbol of the market to fetch trades for
1262
1263
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1263
1264
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -1275,28 +1276,27 @@ class coinex extends coinex$1 {
1275
1276
  }
1276
1277
  let response = undefined;
1277
1278
  if (market['swap']) {
1278
- response = await this.v1PerpetualPublicGetMarketDeals(this.extend(request, params));
1279
+ response = await this.v2PublicGetFuturesDeals(this.extend(request, params));
1279
1280
  }
1280
1281
  else {
1281
- response = await this.v1PublicGetMarketDeals(this.extend(request, params));
1282
+ response = await this.v2PublicGetSpotDeals(this.extend(request, params));
1282
1283
  }
1283
1284
  //
1284
1285
  // Spot and Swap
1285
1286
  //
1286
- // {
1287
- // "code": 0,
1288
- // "data": [
1289
- // {
1290
- // "id": 2611511379,
1291
- // "type": "buy",
1292
- // "price": "192.63",
1293
- // "amount": "0.02266931",
1294
- // "date": 1638990110,
1295
- // "date_ms": 1638990110518
1296
- // },
1297
- // ],
1298
- // "message": "OK"
1299
- // }
1287
+ // {
1288
+ // "code": 0,
1289
+ // "data": [
1290
+ // {
1291
+ // "amount": "0.00049432",
1292
+ // "created_at": 1713849825667,
1293
+ // "deal_id": 4137517302,
1294
+ // "price": "66251",
1295
+ // "side": "buy"
1296
+ // },
1297
+ // ],
1298
+ // "message": "OK"
1299
+ // }
1300
1300
  //
1301
1301
  return this.parseTrades(response['data'], market, since, limit);
1302
1302
  }
@@ -1454,24 +1454,24 @@ class coinex extends coinex$1 {
1454
1454
  }
1455
1455
  parseOHLCV(ohlcv, market = undefined) {
1456
1456
  //
1457
- // [
1458
- // 1591484400,
1459
- // "0.02505349",
1460
- // "0.02506988",
1461
- // "0.02507000",
1462
- // "0.02505304",
1463
- // "343.19716223",
1464
- // "8.6021323866383196",
1465
- // "ETHBTC"
1466
- // ]
1457
+ // {
1458
+ // "close": "66999.95",
1459
+ // "created_at": 1713934620000,
1460
+ // "high": "66999.95",
1461
+ // "low": "66988.53",
1462
+ // "market": "BTCUSDT",
1463
+ // "open": "66988.53",
1464
+ // "value": "0.1572393", // base volume
1465
+ // "volume": "10533.2501364336" // quote volume
1466
+ // }
1467
1467
  //
1468
1468
  return [
1469
- this.safeTimestamp(ohlcv, 0),
1470
- this.safeNumber(ohlcv, 1),
1471
- this.safeNumber(ohlcv, 3),
1472
- this.safeNumber(ohlcv, 4),
1473
- this.safeNumber(ohlcv, 2),
1474
- this.safeNumber(ohlcv, 5),
1469
+ this.safeInteger(ohlcv, 'created_at'),
1470
+ this.safeNumber(ohlcv, 'open'),
1471
+ this.safeNumber(ohlcv, 'high'),
1472
+ this.safeNumber(ohlcv, 'low'),
1473
+ this.safeNumber(ohlcv, 'close'),
1474
+ this.safeNumber(ohlcv, 'value'),
1475
1475
  ];
1476
1476
  }
1477
1477
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
@@ -1479,8 +1479,8 @@ class coinex extends coinex$1 {
1479
1479
  * @method
1480
1480
  * @name coinex#fetchOHLCV
1481
1481
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1482
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market006_market_kline
1483
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http012_market_kline
1482
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market-kline
1483
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market-kline
1484
1484
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1485
1485
  * @param {string} timeframe the length of time each candle represents
1486
1486
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -1492,39 +1492,34 @@ class coinex extends coinex$1 {
1492
1492
  const market = this.market(symbol);
1493
1493
  const request = {
1494
1494
  'market': market['id'],
1495
- 'type': this.safeString(this.timeframes, timeframe, timeframe),
1495
+ 'period': this.safeString(this.timeframes, timeframe, timeframe),
1496
1496
  };
1497
1497
  if (limit !== undefined) {
1498
1498
  request['limit'] = limit;
1499
1499
  }
1500
1500
  let response = undefined;
1501
1501
  if (market['swap']) {
1502
- response = await this.v1PerpetualPublicGetMarketKline(this.extend(request, params));
1502
+ response = await this.v2PublicGetFuturesKline(this.extend(request, params));
1503
1503
  }
1504
1504
  else {
1505
- response = await this.v1PublicGetMarketKline(this.extend(request, params));
1505
+ response = await this.v2PublicGetSpotKline(this.extend(request, params));
1506
1506
  }
1507
1507
  //
1508
- // Spot
1509
- //
1510
- // {
1511
- // "code": 0,
1512
- // "data": [
1513
- // [1591484400, "0.02505349", "0.02506988", "0.02507000", "0.02505304", "343.19716223", "8.6021323866383196", "ETHBTC"],
1514
- // [1591484700, "0.02506990", "0.02508109", "0.02508109", "0.02506979", "91.59841581", "2.2972047780447000", "ETHBTC"],
1515
- // [1591485000, "0.02508106", "0.02507996", "0.02508106", "0.02507500", "65.15307697", "1.6340597822306000", "ETHBTC"],
1516
- // ],
1517
- // "message": "OK"
1518
- // }
1519
- //
1520
- // Swap
1508
+ // Spot and Swap
1521
1509
  //
1522
1510
  // {
1523
1511
  // "code": 0,
1524
1512
  // "data": [
1525
- // [1650569400, "41524.64", "41489.31", "41564.61", "41480.58", "29.7060", "1233907.099562"],
1526
- // [1650569700, "41489.31", "41438.29", "41489.31", "41391.87", "42.4115", "1756154.189061"],
1527
- // [1650570000, "41438.29", "41482.21", "41485.05", "41427.31", "22.2892", "924000.317861"]
1513
+ // {
1514
+ // "close": "66999.95",
1515
+ // "created_at": 1713934620000,
1516
+ // "high": "66999.95",
1517
+ // "low": "66988.53",
1518
+ // "market": "BTCUSDT",
1519
+ // "open": "66988.53",
1520
+ // "value": "0.1572393",
1521
+ // "volume": "10533.2501364336"
1522
+ // },
1528
1523
  // ],
1529
1524
  // "message": "OK"
1530
1525
  // }
@@ -3765,7 +3760,7 @@ class coinex extends coinex$1 {
3765
3760
  // "side": 2,
3766
3761
  // "stop_loss_price": "0.00000000000000000000",
3767
3762
  // "stop_loss_type": 0,
3768
- // "sys": 0,
3763
+ // "sy s": 0,
3769
3764
  // "take_profit_price": "0.00000000000000000000",
3770
3765
  // "take_profit_type": 0,
3771
3766
  // "taker_fee": "0.00000000000000000000",
@@ -3847,7 +3842,7 @@ class coinex extends coinex$1 {
3847
3842
  // "side": 2,
3848
3843
  // "stop_loss_price": "0.00000000000000000000",
3849
3844
  // "stop_loss_type": 0,
3850
- // "sys": 0,
3845
+ // "s ys": 0,
3851
3846
  // "take_profit_price": "0.00000000000000000000",
3852
3847
  // "take_profit_type": 0,
3853
3848
  // "taker_fee": "0.00000000000000000000",
@@ -3864,6 +3859,8 @@ class coinex extends coinex$1 {
3864
3859
  return this.parsePosition(data[0], market);
3865
3860
  }
3866
3861
  parsePosition(position, market = undefined) {
3862
+ //
3863
+ // fetchPosition
3867
3864
  //
3868
3865
  // {
3869
3866
  // "adl_sort": 3396,
@@ -3907,7 +3904,7 @@ class coinex extends coinex$1 {
3907
3904
  // "side": 2,
3908
3905
  // "stop_loss_price": "0.00000000000000000000",
3909
3906
  // "stop_loss_type": 0,
3910
- // "sys": 0,
3907
+ // "s ys": 0,
3911
3908
  // "take_profit_price": "0.00000000000000000000",
3912
3909
  // "take_profit_type": 0,
3913
3910
  // "taker_fee": "0.00000000000000000000",
@@ -3917,6 +3914,40 @@ class coinex extends coinex$1 {
3917
3914
  // "user_id": 3620173
3918
3915
  // }
3919
3916
  //
3917
+ //
3918
+ // fetchPositionHistory
3919
+ //
3920
+ // {
3921
+ // amount_max: '10',
3922
+ // amount_max_margin: '2.03466666666666666666',
3923
+ // bkr_price: '0',
3924
+ // create_time: '1711150526.2581',
3925
+ // deal_all: '12.591',
3926
+ // deal_asset_fee: '0',
3927
+ // fee_asset: '',
3928
+ // finish_type: '5',
3929
+ // first_price: '0.6104',
3930
+ // latest_price: '0.6487',
3931
+ // leverage: '3',
3932
+ // liq_amount: '0',
3933
+ // liq_price: '0',
3934
+ // liq_profit: '0',
3935
+ // mainten_margin: '0.01',
3936
+ // market: 'XRPUSDT',
3937
+ // market_type: '1',
3938
+ // open_price: '0.6104',
3939
+ // open_val_max: '6.104',
3940
+ // position_id: '297371462',
3941
+ // profit_real: '0.35702107169',
3942
+ // settle_price: '0.6104',
3943
+ // settle_val: '0',
3944
+ // side: '2',
3945
+ // s ys: "0",
3946
+ // type: '2',
3947
+ // update_time: '1711391446.133233',
3948
+ // user_id: '3685860'
3949
+ // }
3950
+ //
3920
3951
  const marketId = this.safeString(position, 'market');
3921
3952
  market = this.safeMarket(marketId, market, undefined, 'swap');
3922
3953
  const symbol = market['symbol'];
@@ -3932,7 +3963,7 @@ class coinex extends coinex$1 {
3932
3963
  const timestamp = this.safeTimestamp(position, 'update_time');
3933
3964
  const maintenanceMargin = this.safeString(position, 'mainten_margin_amount');
3934
3965
  const maintenanceMarginPercentage = this.safeString(position, 'mainten_margin');
3935
- const collateral = this.safeString(position, 'margin_amount');
3966
+ const collateral = this.safeString2(position, 'margin_amount', 'amount_max_margin');
3936
3967
  const leverage = this.safeString(position, 'leverage');
3937
3968
  const notional = this.safeString(position, 'open_val');
3938
3969
  const initialMargin = Precise["default"].stringDiv(notional, leverage);
@@ -4162,7 +4193,7 @@ class coinex extends coinex$1 {
4162
4193
  // "side": 2,
4163
4194
  // "stop_loss_price": "0.00000000000000000000",
4164
4195
  // "stop_loss_type": 0,
4165
- // "sys": 0,
4196
+ // "s ys": 0,
4166
4197
  // "take_profit_price": "0.00000000000000000000",
4167
4198
  // "take_profit_type": 0,
4168
4199
  // "taker_fee": "0.00000000000000000000",
@@ -4227,7 +4258,7 @@ class coinex extends coinex$1 {
4227
4258
  // "side": 2,
4228
4259
  // "stop_loss_price": "0.00000000000000000000",
4229
4260
  // "stop_loss_type": 0,
4230
- // "sys": 0,
4261
+ // "sy s": 0,
4231
4262
  // "take_profit_price": "0.00000000000000000000",
4232
4263
  // "take_profit_type": 0,
4233
4264
  // "taker_fee": "0.00000000000000000000",
@@ -4484,7 +4515,7 @@ class coinex extends coinex$1 {
4484
4515
  }
4485
4516
  async fetchFundingRates(symbols = undefined, params = {}) {
4486
4517
  /**
4487
- * @method
4518
+ * @method
4488
4519
  * @name coinex#fetchFundingRates
4489
4520
  * @description fetch the current funding rates
4490
4521
  * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http009_market_ticker_all
@@ -5610,6 +5641,80 @@ class coinex extends coinex$1 {
5610
5641
  'shortLeverage': leverageValue,
5611
5642
  };
5612
5643
  }
5644
+ async fetchPositionHistory(symbol, since = undefined, limit = undefined, params = {}) {
5645
+ /**
5646
+ * @method
5647
+ * @name coinex#fetchPositionHistory
5648
+ * @description fetches historical positions
5649
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033-0_finished_position
5650
+ * @param {string} symbol unified contract symbol
5651
+ * @param {int} [since] not used by coinex fetchPositionHistory
5652
+ * @param {int} [limit] the maximum amount of records to fetch, default=1000
5653
+ * @param {object} params extra parameters specific to the exchange api endpoint
5654
+ *
5655
+ * EXCHANGE SPECIFIC PARAMETERS
5656
+ * @param {int} [params.side] 0: all 1: sell, 2: buy
5657
+ * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
5658
+ */
5659
+ await this.loadMarkets();
5660
+ const market = this.market(symbol);
5661
+ if (limit === undefined) {
5662
+ limit = 1000;
5663
+ }
5664
+ const request = {
5665
+ 'market': market['id'],
5666
+ 'side': 0,
5667
+ 'limit': limit,
5668
+ };
5669
+ const response = await this.v1PerpetualPrivateGetPositionFinished(this.extend(request, params));
5670
+ //
5671
+ // {
5672
+ // code: '0',
5673
+ // data: {
5674
+ // limit: '1000',
5675
+ // offset: '0',
5676
+ // records: [
5677
+ // {
5678
+ // amount_max: '10',
5679
+ // amount_max_margin: '2.03466666666666666666',
5680
+ // bkr_price: '0',
5681
+ // create_time: '1711150526.2581',
5682
+ // deal_all: '12.591',
5683
+ // deal_asset_fee: '0',
5684
+ // fee_asset: '',
5685
+ // finish_type: '5',
5686
+ // first_price: '0.6104',
5687
+ // latest_price: '0.6487',
5688
+ // leverage: '3',
5689
+ // liq_amount: '0',
5690
+ // liq_price: '0',
5691
+ // liq_profit: '0',
5692
+ // mainten_margin: '0.01',
5693
+ // market: 'XRPUSDT',
5694
+ // market_type: '1',
5695
+ // open_price: '0.6104',
5696
+ // open_val_max: '6.104',
5697
+ // position_id: '297371462',
5698
+ // profit_real: '0.35702107169',
5699
+ // settle_price: '0.6104',
5700
+ // settle_val: '0',
5701
+ // side: '2',
5702
+ // sy s: '0',
5703
+ // type: '2',
5704
+ // update_time: '1711391446.133233',
5705
+ // user_id: '3685860'
5706
+ // },
5707
+ // ...
5708
+ // ]
5709
+ // },
5710
+ // message: 'OK'
5711
+ // }
5712
+ //
5713
+ const data = this.safeDict(response, 'data');
5714
+ const records = this.safeList(data, 'records');
5715
+ const positions = this.parsePositions(records);
5716
+ return this.filterBySymbolSinceLimit(positions, symbol, since, limit);
5717
+ }
5613
5718
  handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
5614
5719
  /**
5615
5720
  * @ignore
@@ -87,7 +87,11 @@ class coinlist extends coinlist$1 {
87
87
  'fetchOrders': true,
88
88
  'fetchOrderTrades': true,
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,
@@ -57,8 +57,11 @@ class coinmate extends coinmate$1 {
57
57
  'fetchOrderBook': true,
58
58
  'fetchOrders': true,
59
59
  'fetchPosition': false,
60
+ 'fetchPositionHistory': false,
60
61
  'fetchPositionMode': false,
61
62
  'fetchPositions': false,
63
+ 'fetchPositionsForSymbol': false,
64
+ 'fetchPositionsHistory': false,
62
65
  'fetchPositionsRisk': false,
63
66
  'fetchPremiumIndexOHLCV': false,
64
67
  'fetchTicker': true,
@@ -65,8 +65,11 @@ class coinone extends coinone$1 {
65
65
  'fetchOrder': true,
66
66
  'fetchOrderBook': 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,
@@ -89,7 +89,11 @@ class coinsph extends coinsph$1 {
89
89
  'fetchOrders': false,
90
90
  'fetchOrderTrades': true,
91
91
  'fetchPosition': false,
92
+ 'fetchPositionHistory': false,
93
+ 'fetchPositionMode': false,
92
94
  'fetchPositions': false,
95
+ 'fetchPositionsForSymbol': false,
96
+ 'fetchPositionsHistory': false,
93
97
  'fetchPositionsRisk': false,
94
98
  'fetchPremiumIndexOHLCV': false,
95
99
  'fetchStatus': true,
@@ -57,8 +57,11 @@ class coinspot extends coinspot$1 {
57
57
  'fetchOpenInterestHistory': false,
58
58
  'fetchOrderBook': true,
59
59
  'fetchPosition': false,
60
+ 'fetchPositionHistory': false,
60
61
  'fetchPositionMode': false,
61
62
  'fetchPositions': false,
63
+ 'fetchPositionsForSymbol': false,
64
+ 'fetchPositionsHistory': false,
62
65
  'fetchPositionsRisk': false,
63
66
  'fetchPremiumIndexOHLCV': false,
64
67
  'fetchTicker': true,
@@ -32,6 +32,7 @@ class cryptocom extends cryptocom$1 {
32
32
  'cancelAllOrders': true,
33
33
  'cancelOrder': true,
34
34
  'cancelOrders': true,
35
+ 'cancelOrdersForSymbols': true,
35
36
  'closeAllPositions': false,
36
37
  'closePosition': true,
37
38
  'createMarketBuyOrderWithCost': false,
@@ -79,8 +80,10 @@ class cryptocom extends cryptocom$1 {
79
80
  'fetchOrderBook': true,
80
81
  'fetchOrders': true,
81
82
  'fetchPosition': true,
83
+ 'fetchPositionHistory': false,
82
84
  'fetchPositionMode': false,
83
85
  'fetchPositions': true,
86
+ 'fetchPositionsHistory': false,
84
87
  'fetchPremiumIndexOHLCV': false,
85
88
  'fetchSettlementHistory': true,
86
89
  'fetchStatus': false,
@@ -1464,6 +1467,37 @@ class cryptocom extends cryptocom$1 {
1464
1467
  const result = this.safeList(response, 'result', []);
1465
1468
  return this.parseOrders(result, market, undefined, undefined, params);
1466
1469
  }
1470
+ async cancelOrdersForSymbols(orders, params = {}) {
1471
+ /**
1472
+ * @method
1473
+ * @name cryptocom#cancelOrdersForSymbols
1474
+ * @description cancel multiple orders for multiple symbols
1475
+ * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
1476
+ * @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol
1477
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1478
+ * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1479
+ */
1480
+ await this.loadMarkets();
1481
+ const orderRequests = [];
1482
+ for (let i = 0; i < orders.length; i++) {
1483
+ const order = orders[i];
1484
+ const id = this.safeString(order, 'id');
1485
+ const symbol = this.safeString(order, 'symbol');
1486
+ const market = this.market(symbol);
1487
+ const orderItem = {
1488
+ 'instrument_name': market['id'],
1489
+ 'order_id': id.toString(),
1490
+ };
1491
+ orderRequests.push(orderItem);
1492
+ }
1493
+ const request = {
1494
+ 'contingency_type': 'LIST',
1495
+ 'order_list': orderRequests,
1496
+ };
1497
+ const response = await this.v1PrivatePostPrivateCancelOrderList(this.extend(request, params));
1498
+ const result = this.safeList(response, 'result', []);
1499
+ return this.parseOrders(result, undefined, undefined, undefined, params);
1500
+ }
1467
1501
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1468
1502
  /**
1469
1503
  * @method
@@ -62,7 +62,12 @@ class exmo extends exmo$1 {
62
62
  'fetchOrderBook': true,
63
63
  'fetchOrderBooks': true,
64
64
  'fetchOrderTrades': true,
65
+ 'fetchPosition': false,
66
+ 'fetchPositionHistory': false,
65
67
  'fetchPositionMode': false,
68
+ 'fetchPositions': false,
69
+ 'fetchPositionsHistory': false,
70
+ 'fetchPositionsRisk': false,
66
71
  'fetchPremiumIndexOHLCV': false,
67
72
  'fetchTicker': true,
68
73
  'fetchTickers': true,