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/js/src/coinex.js CHANGED
@@ -93,7 +93,9 @@ export default class coinex extends Exchange {
93
93
  'fetchOrder': true,
94
94
  'fetchOrderBook': true,
95
95
  'fetchPosition': true,
96
+ 'fetchPositionHistory': true,
96
97
  'fetchPositions': true,
98
+ 'fetchPositionsHistory': false,
97
99
  'fetchPositionsRisk': false,
98
100
  'fetchPremiumIndexOHLCV': false,
99
101
  'fetchTicker': true,
@@ -1132,14 +1134,13 @@ export default class coinex extends Exchange {
1132
1134
  //
1133
1135
  // Spot and Swap fetchTrades (public)
1134
1136
  //
1135
- // {
1136
- // "id": 2611511379,
1137
- // "type": "buy",
1138
- // "price": "192.63",
1139
- // "amount": "0.02266931",
1140
- // "date": 1638990110,
1141
- // "date_ms": 1638990110518
1142
- // },
1137
+ // {
1138
+ // "amount": "0.00049432",
1139
+ // "created_at": 1713849825667,
1140
+ // "deal_id": 4137517302,
1141
+ // "price": "66251",
1142
+ // "side": "buy"
1143
+ // }
1143
1144
  //
1144
1145
  // Spot and Margin fetchMyTrades (private)
1145
1146
  //
@@ -1193,9 +1194,9 @@ export default class coinex extends Exchange {
1193
1194
  //
1194
1195
  let timestamp = this.safeTimestamp2(trade, 'create_time', 'time');
1195
1196
  if (timestamp === undefined) {
1196
- timestamp = this.safeInteger(trade, 'date_ms');
1197
+ timestamp = this.safeInteger(trade, 'created_at');
1197
1198
  }
1198
- const tradeId = this.safeString(trade, 'id');
1199
+ const tradeId = this.safeString2(trade, 'id', 'deal_id');
1199
1200
  const orderId = this.safeString(trade, 'order_id');
1200
1201
  const priceString = this.safeString(trade, 'price');
1201
1202
  const amountString = this.safeString(trade, 'amount');
@@ -1232,11 +1233,11 @@ export default class coinex extends Exchange {
1232
1233
  side = 'buy';
1233
1234
  }
1234
1235
  if (side === undefined) {
1235
- side = this.safeString(trade, 'type');
1236
+ side = this.safeString2(trade, 'type', 'side');
1236
1237
  }
1237
1238
  }
1238
1239
  else {
1239
- side = this.safeString(trade, 'type');
1240
+ side = this.safeString2(trade, 'type', 'side');
1240
1241
  }
1241
1242
  return this.safeTrade({
1242
1243
  'info': trade,
@@ -1258,9 +1259,9 @@ export default class coinex extends Exchange {
1258
1259
  /**
1259
1260
  * @method
1260
1261
  * @name coinex#fetchTrades
1261
- * @description get the list of most recent trades for a particular symbol
1262
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market005_market_deals
1263
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http011_market_deals
1262
+ * @description get the list of the most recent trades for a particular symbol
1263
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market-deals
1264
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market-deals
1264
1265
  * @param {string} symbol unified symbol of the market to fetch trades for
1265
1266
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1266
1267
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -1278,28 +1279,27 @@ export default class coinex extends Exchange {
1278
1279
  }
1279
1280
  let response = undefined;
1280
1281
  if (market['swap']) {
1281
- response = await this.v1PerpetualPublicGetMarketDeals(this.extend(request, params));
1282
+ response = await this.v2PublicGetFuturesDeals(this.extend(request, params));
1282
1283
  }
1283
1284
  else {
1284
- response = await this.v1PublicGetMarketDeals(this.extend(request, params));
1285
+ response = await this.v2PublicGetSpotDeals(this.extend(request, params));
1285
1286
  }
1286
1287
  //
1287
1288
  // Spot and Swap
1288
1289
  //
1289
- // {
1290
- // "code": 0,
1291
- // "data": [
1292
- // {
1293
- // "id": 2611511379,
1294
- // "type": "buy",
1295
- // "price": "192.63",
1296
- // "amount": "0.02266931",
1297
- // "date": 1638990110,
1298
- // "date_ms": 1638990110518
1299
- // },
1300
- // ],
1301
- // "message": "OK"
1302
- // }
1290
+ // {
1291
+ // "code": 0,
1292
+ // "data": [
1293
+ // {
1294
+ // "amount": "0.00049432",
1295
+ // "created_at": 1713849825667,
1296
+ // "deal_id": 4137517302,
1297
+ // "price": "66251",
1298
+ // "side": "buy"
1299
+ // },
1300
+ // ],
1301
+ // "message": "OK"
1302
+ // }
1303
1303
  //
1304
1304
  return this.parseTrades(response['data'], market, since, limit);
1305
1305
  }
@@ -1457,24 +1457,24 @@ export default class coinex extends Exchange {
1457
1457
  }
1458
1458
  parseOHLCV(ohlcv, market = undefined) {
1459
1459
  //
1460
- // [
1461
- // 1591484400,
1462
- // "0.02505349",
1463
- // "0.02506988",
1464
- // "0.02507000",
1465
- // "0.02505304",
1466
- // "343.19716223",
1467
- // "8.6021323866383196",
1468
- // "ETHBTC"
1469
- // ]
1460
+ // {
1461
+ // "close": "66999.95",
1462
+ // "created_at": 1713934620000,
1463
+ // "high": "66999.95",
1464
+ // "low": "66988.53",
1465
+ // "market": "BTCUSDT",
1466
+ // "open": "66988.53",
1467
+ // "value": "0.1572393", // base volume
1468
+ // "volume": "10533.2501364336" // quote volume
1469
+ // }
1470
1470
  //
1471
1471
  return [
1472
- this.safeTimestamp(ohlcv, 0),
1473
- this.safeNumber(ohlcv, 1),
1474
- this.safeNumber(ohlcv, 3),
1475
- this.safeNumber(ohlcv, 4),
1476
- this.safeNumber(ohlcv, 2),
1477
- this.safeNumber(ohlcv, 5),
1472
+ this.safeInteger(ohlcv, 'created_at'),
1473
+ this.safeNumber(ohlcv, 'open'),
1474
+ this.safeNumber(ohlcv, 'high'),
1475
+ this.safeNumber(ohlcv, 'low'),
1476
+ this.safeNumber(ohlcv, 'close'),
1477
+ this.safeNumber(ohlcv, 'value'),
1478
1478
  ];
1479
1479
  }
1480
1480
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
@@ -1482,8 +1482,8 @@ export default class coinex extends Exchange {
1482
1482
  * @method
1483
1483
  * @name coinex#fetchOHLCV
1484
1484
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1485
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market006_market_kline
1486
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http012_market_kline
1485
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market-kline
1486
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market-kline
1487
1487
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1488
1488
  * @param {string} timeframe the length of time each candle represents
1489
1489
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -1495,39 +1495,34 @@ export default class coinex extends Exchange {
1495
1495
  const market = this.market(symbol);
1496
1496
  const request = {
1497
1497
  'market': market['id'],
1498
- 'type': this.safeString(this.timeframes, timeframe, timeframe),
1498
+ 'period': this.safeString(this.timeframes, timeframe, timeframe),
1499
1499
  };
1500
1500
  if (limit !== undefined) {
1501
1501
  request['limit'] = limit;
1502
1502
  }
1503
1503
  let response = undefined;
1504
1504
  if (market['swap']) {
1505
- response = await this.v1PerpetualPublicGetMarketKline(this.extend(request, params));
1505
+ response = await this.v2PublicGetFuturesKline(this.extend(request, params));
1506
1506
  }
1507
1507
  else {
1508
- response = await this.v1PublicGetMarketKline(this.extend(request, params));
1508
+ response = await this.v2PublicGetSpotKline(this.extend(request, params));
1509
1509
  }
1510
1510
  //
1511
- // Spot
1512
- //
1513
- // {
1514
- // "code": 0,
1515
- // "data": [
1516
- // [1591484400, "0.02505349", "0.02506988", "0.02507000", "0.02505304", "343.19716223", "8.6021323866383196", "ETHBTC"],
1517
- // [1591484700, "0.02506990", "0.02508109", "0.02508109", "0.02506979", "91.59841581", "2.2972047780447000", "ETHBTC"],
1518
- // [1591485000, "0.02508106", "0.02507996", "0.02508106", "0.02507500", "65.15307697", "1.6340597822306000", "ETHBTC"],
1519
- // ],
1520
- // "message": "OK"
1521
- // }
1522
- //
1523
- // Swap
1511
+ // Spot and Swap
1524
1512
  //
1525
1513
  // {
1526
1514
  // "code": 0,
1527
1515
  // "data": [
1528
- // [1650569400, "41524.64", "41489.31", "41564.61", "41480.58", "29.7060", "1233907.099562"],
1529
- // [1650569700, "41489.31", "41438.29", "41489.31", "41391.87", "42.4115", "1756154.189061"],
1530
- // [1650570000, "41438.29", "41482.21", "41485.05", "41427.31", "22.2892", "924000.317861"]
1516
+ // {
1517
+ // "close": "66999.95",
1518
+ // "created_at": 1713934620000,
1519
+ // "high": "66999.95",
1520
+ // "low": "66988.53",
1521
+ // "market": "BTCUSDT",
1522
+ // "open": "66988.53",
1523
+ // "value": "0.1572393",
1524
+ // "volume": "10533.2501364336"
1525
+ // },
1531
1526
  // ],
1532
1527
  // "message": "OK"
1533
1528
  // }
@@ -3768,7 +3763,7 @@ export default class coinex extends Exchange {
3768
3763
  // "side": 2,
3769
3764
  // "stop_loss_price": "0.00000000000000000000",
3770
3765
  // "stop_loss_type": 0,
3771
- // "sys": 0,
3766
+ // "sy s": 0,
3772
3767
  // "take_profit_price": "0.00000000000000000000",
3773
3768
  // "take_profit_type": 0,
3774
3769
  // "taker_fee": "0.00000000000000000000",
@@ -3850,7 +3845,7 @@ export default class coinex extends Exchange {
3850
3845
  // "side": 2,
3851
3846
  // "stop_loss_price": "0.00000000000000000000",
3852
3847
  // "stop_loss_type": 0,
3853
- // "sys": 0,
3848
+ // "s ys": 0,
3854
3849
  // "take_profit_price": "0.00000000000000000000",
3855
3850
  // "take_profit_type": 0,
3856
3851
  // "taker_fee": "0.00000000000000000000",
@@ -3867,6 +3862,8 @@ export default class coinex extends Exchange {
3867
3862
  return this.parsePosition(data[0], market);
3868
3863
  }
3869
3864
  parsePosition(position, market = undefined) {
3865
+ //
3866
+ // fetchPosition
3870
3867
  //
3871
3868
  // {
3872
3869
  // "adl_sort": 3396,
@@ -3910,7 +3907,7 @@ export default class coinex extends Exchange {
3910
3907
  // "side": 2,
3911
3908
  // "stop_loss_price": "0.00000000000000000000",
3912
3909
  // "stop_loss_type": 0,
3913
- // "sys": 0,
3910
+ // "s ys": 0,
3914
3911
  // "take_profit_price": "0.00000000000000000000",
3915
3912
  // "take_profit_type": 0,
3916
3913
  // "taker_fee": "0.00000000000000000000",
@@ -3920,6 +3917,40 @@ export default class coinex extends Exchange {
3920
3917
  // "user_id": 3620173
3921
3918
  // }
3922
3919
  //
3920
+ //
3921
+ // fetchPositionHistory
3922
+ //
3923
+ // {
3924
+ // amount_max: '10',
3925
+ // amount_max_margin: '2.03466666666666666666',
3926
+ // bkr_price: '0',
3927
+ // create_time: '1711150526.2581',
3928
+ // deal_all: '12.591',
3929
+ // deal_asset_fee: '0',
3930
+ // fee_asset: '',
3931
+ // finish_type: '5',
3932
+ // first_price: '0.6104',
3933
+ // latest_price: '0.6487',
3934
+ // leverage: '3',
3935
+ // liq_amount: '0',
3936
+ // liq_price: '0',
3937
+ // liq_profit: '0',
3938
+ // mainten_margin: '0.01',
3939
+ // market: 'XRPUSDT',
3940
+ // market_type: '1',
3941
+ // open_price: '0.6104',
3942
+ // open_val_max: '6.104',
3943
+ // position_id: '297371462',
3944
+ // profit_real: '0.35702107169',
3945
+ // settle_price: '0.6104',
3946
+ // settle_val: '0',
3947
+ // side: '2',
3948
+ // s ys: "0",
3949
+ // type: '2',
3950
+ // update_time: '1711391446.133233',
3951
+ // user_id: '3685860'
3952
+ // }
3953
+ //
3923
3954
  const marketId = this.safeString(position, 'market');
3924
3955
  market = this.safeMarket(marketId, market, undefined, 'swap');
3925
3956
  const symbol = market['symbol'];
@@ -3935,7 +3966,7 @@ export default class coinex extends Exchange {
3935
3966
  const timestamp = this.safeTimestamp(position, 'update_time');
3936
3967
  const maintenanceMargin = this.safeString(position, 'mainten_margin_amount');
3937
3968
  const maintenanceMarginPercentage = this.safeString(position, 'mainten_margin');
3938
- const collateral = this.safeString(position, 'margin_amount');
3969
+ const collateral = this.safeString2(position, 'margin_amount', 'amount_max_margin');
3939
3970
  const leverage = this.safeString(position, 'leverage');
3940
3971
  const notional = this.safeString(position, 'open_val');
3941
3972
  const initialMargin = Precise.stringDiv(notional, leverage);
@@ -4165,7 +4196,7 @@ export default class coinex extends Exchange {
4165
4196
  // "side": 2,
4166
4197
  // "stop_loss_price": "0.00000000000000000000",
4167
4198
  // "stop_loss_type": 0,
4168
- // "sys": 0,
4199
+ // "s ys": 0,
4169
4200
  // "take_profit_price": "0.00000000000000000000",
4170
4201
  // "take_profit_type": 0,
4171
4202
  // "taker_fee": "0.00000000000000000000",
@@ -4230,7 +4261,7 @@ export default class coinex extends Exchange {
4230
4261
  // "side": 2,
4231
4262
  // "stop_loss_price": "0.00000000000000000000",
4232
4263
  // "stop_loss_type": 0,
4233
- // "sys": 0,
4264
+ // "sy s": 0,
4234
4265
  // "take_profit_price": "0.00000000000000000000",
4235
4266
  // "take_profit_type": 0,
4236
4267
  // "taker_fee": "0.00000000000000000000",
@@ -4487,7 +4518,7 @@ export default class coinex extends Exchange {
4487
4518
  }
4488
4519
  async fetchFundingRates(symbols = undefined, params = {}) {
4489
4520
  /**
4490
- * @method
4521
+ * @method
4491
4522
  * @name coinex#fetchFundingRates
4492
4523
  * @description fetch the current funding rates
4493
4524
  * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http009_market_ticker_all
@@ -5613,6 +5644,80 @@ export default class coinex extends Exchange {
5613
5644
  'shortLeverage': leverageValue,
5614
5645
  };
5615
5646
  }
5647
+ async fetchPositionHistory(symbol, since = undefined, limit = undefined, params = {}) {
5648
+ /**
5649
+ * @method
5650
+ * @name coinex#fetchPositionHistory
5651
+ * @description fetches historical positions
5652
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033-0_finished_position
5653
+ * @param {string} symbol unified contract symbol
5654
+ * @param {int} [since] not used by coinex fetchPositionHistory
5655
+ * @param {int} [limit] the maximum amount of records to fetch, default=1000
5656
+ * @param {object} params extra parameters specific to the exchange api endpoint
5657
+ *
5658
+ * EXCHANGE SPECIFIC PARAMETERS
5659
+ * @param {int} [params.side] 0: all 1: sell, 2: buy
5660
+ * @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
5661
+ */
5662
+ await this.loadMarkets();
5663
+ const market = this.market(symbol);
5664
+ if (limit === undefined) {
5665
+ limit = 1000;
5666
+ }
5667
+ const request = {
5668
+ 'market': market['id'],
5669
+ 'side': 0,
5670
+ 'limit': limit,
5671
+ };
5672
+ const response = await this.v1PerpetualPrivateGetPositionFinished(this.extend(request, params));
5673
+ //
5674
+ // {
5675
+ // code: '0',
5676
+ // data: {
5677
+ // limit: '1000',
5678
+ // offset: '0',
5679
+ // records: [
5680
+ // {
5681
+ // amount_max: '10',
5682
+ // amount_max_margin: '2.03466666666666666666',
5683
+ // bkr_price: '0',
5684
+ // create_time: '1711150526.2581',
5685
+ // deal_all: '12.591',
5686
+ // deal_asset_fee: '0',
5687
+ // fee_asset: '',
5688
+ // finish_type: '5',
5689
+ // first_price: '0.6104',
5690
+ // latest_price: '0.6487',
5691
+ // leverage: '3',
5692
+ // liq_amount: '0',
5693
+ // liq_price: '0',
5694
+ // liq_profit: '0',
5695
+ // mainten_margin: '0.01',
5696
+ // market: 'XRPUSDT',
5697
+ // market_type: '1',
5698
+ // open_price: '0.6104',
5699
+ // open_val_max: '6.104',
5700
+ // position_id: '297371462',
5701
+ // profit_real: '0.35702107169',
5702
+ // settle_price: '0.6104',
5703
+ // settle_val: '0',
5704
+ // side: '2',
5705
+ // sy s: '0',
5706
+ // type: '2',
5707
+ // update_time: '1711391446.133233',
5708
+ // user_id: '3685860'
5709
+ // },
5710
+ // ...
5711
+ // ]
5712
+ // },
5713
+ // message: 'OK'
5714
+ // }
5715
+ //
5716
+ const data = this.safeDict(response, 'data');
5717
+ const records = this.safeList(data, 'records');
5718
+ const positions = this.parsePositions(records);
5719
+ return this.filterBySymbolSinceLimit(positions, symbol, since, limit);
5720
+ }
5616
5721
  handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
5617
5722
  /**
5618
5723
  * @ignore
@@ -63,7 +63,7 @@ export default class coinlist extends Exchange {
63
63
  };
64
64
  parseTransferStatus(status: any): string;
65
65
  fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
66
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
66
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
67
67
  parseTransaction(transaction: any, currency?: Currency): Transaction;
68
68
  parseTransactionType(type: any): string;
69
69
  fetchLedger(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
@@ -90,7 +90,11 @@ export default class coinlist extends Exchange {
90
90
  'fetchOrders': true,
91
91
  'fetchOrderTrades': true,
92
92
  'fetchPosition': false,
93
+ 'fetchPositionHistory': false,
94
+ 'fetchPositionMode': false,
93
95
  'fetchPositions': false,
96
+ 'fetchPositionsForSymbol': false,
97
+ 'fetchPositionsHistory': false,
94
98
  'fetchPositionsRisk': false,
95
99
  'fetchPremiumIndexOHLCV': false,
96
100
  'fetchStatus': false,
@@ -16,7 +16,7 @@ export default class coinmate extends Exchange {
16
16
  fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
17
17
  parseTransactionStatus(status: any): string;
18
18
  parseTransaction(transaction: any, currency?: Currency): Transaction;
19
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
19
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
20
20
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
21
21
  parseTrade(trade: any, market?: Market): Trade;
22
22
  fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
@@ -60,8 +60,11 @@ export default class coinmate extends Exchange {
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,
package/js/src/coinone.js CHANGED
@@ -68,8 +68,11 @@ export default class coinone extends Exchange {
68
68
  'fetchOrder': true,
69
69
  'fetchOrderBook': true,
70
70
  'fetchPosition': false,
71
+ 'fetchPositionHistory': false,
71
72
  'fetchPositionMode': false,
72
73
  'fetchPositions': false,
74
+ 'fetchPositionsForSymbol': false,
75
+ 'fetchPositionsHistory': false,
73
76
  'fetchPositionsRisk': false,
74
77
  'fetchPremiumIndexOHLCV': false,
75
78
  'fetchTicker': true,
@@ -44,7 +44,7 @@ export default class coinsph extends Exchange {
44
44
  fetchTradingFee(symbol: string, params?: {}): Promise<TradingFeeInterface>;
45
45
  fetchTradingFees(params?: {}): Promise<TradingFees>;
46
46
  parseTradingFee(fee: any, market?: Market): TradingFeeInterface;
47
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
47
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
48
48
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
49
49
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
50
50
  parseTransaction(transaction: any, currency?: Currency): Transaction;
package/js/src/coinsph.js CHANGED
@@ -92,7 +92,11 @@ export default class coinsph extends Exchange {
92
92
  'fetchOrders': false,
93
93
  'fetchOrderTrades': true,
94
94
  'fetchPosition': false,
95
+ 'fetchPositionHistory': false,
96
+ 'fetchPositionMode': false,
95
97
  'fetchPositions': false,
98
+ 'fetchPositionsForSymbol': false,
99
+ 'fetchPositionsHistory': false,
96
100
  'fetchPositionsRisk': false,
97
101
  'fetchPremiumIndexOHLCV': false,
98
102
  'fetchStatus': true,
@@ -60,8 +60,11 @@ export default class coinspot extends Exchange {
60
60
  'fetchOpenInterestHistory': false,
61
61
  'fetchOrderBook': 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,
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/cryptocom.js';
2
- import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, Str, Ticker, OrderRequest, Balances, Transaction, OrderBook, Tickers, Strings, Currency, Market, Num, Account } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, Str, Ticker, OrderRequest, Balances, Transaction, OrderBook, Tickers, Strings, Currency, Market, Num, Account, CancellationRequest } from './base/types.js';
3
3
  /**
4
4
  * @class cryptocom
5
5
  * @augments Exchange
@@ -23,10 +23,11 @@ export default class cryptocom extends Exchange {
23
23
  cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
24
24
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
25
25
  cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<Order[]>;
26
+ cancelOrdersForSymbols(orders: CancellationRequest[], params?: {}): Promise<Order[]>;
26
27
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
27
28
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
28
29
  parseAddress(addressString: any): any[];
29
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
30
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
30
31
  fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<{}>;
31
32
  fetchDepositAddress(code: string, params?: {}): Promise<any>;
32
33
  safeNetwork(networkId: any): string;
@@ -35,6 +35,7 @@ export default class cryptocom extends Exchange {
35
35
  'cancelAllOrders': true,
36
36
  'cancelOrder': true,
37
37
  'cancelOrders': true,
38
+ 'cancelOrdersForSymbols': true,
38
39
  'closeAllPositions': false,
39
40
  'closePosition': true,
40
41
  'createMarketBuyOrderWithCost': false,
@@ -82,8 +83,10 @@ export default class cryptocom extends Exchange {
82
83
  'fetchOrderBook': true,
83
84
  'fetchOrders': true,
84
85
  'fetchPosition': true,
86
+ 'fetchPositionHistory': false,
85
87
  'fetchPositionMode': false,
86
88
  'fetchPositions': true,
89
+ 'fetchPositionsHistory': false,
87
90
  'fetchPremiumIndexOHLCV': false,
88
91
  'fetchSettlementHistory': true,
89
92
  'fetchStatus': false,
@@ -1467,6 +1470,37 @@ export default class cryptocom extends Exchange {
1467
1470
  const result = this.safeList(response, 'result', []);
1468
1471
  return this.parseOrders(result, market, undefined, undefined, params);
1469
1472
  }
1473
+ async cancelOrdersForSymbols(orders, params = {}) {
1474
+ /**
1475
+ * @method
1476
+ * @name cryptocom#cancelOrdersForSymbols
1477
+ * @description cancel multiple orders for multiple symbols
1478
+ * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
1479
+ * @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol
1480
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1481
+ * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1482
+ */
1483
+ await this.loadMarkets();
1484
+ const orderRequests = [];
1485
+ for (let i = 0; i < orders.length; i++) {
1486
+ const order = orders[i];
1487
+ const id = this.safeString(order, 'id');
1488
+ const symbol = this.safeString(order, 'symbol');
1489
+ const market = this.market(symbol);
1490
+ const orderItem = {
1491
+ 'instrument_name': market['id'],
1492
+ 'order_id': id.toString(),
1493
+ };
1494
+ orderRequests.push(orderItem);
1495
+ }
1496
+ const request = {
1497
+ 'contingency_type': 'LIST',
1498
+ 'order_list': orderRequests,
1499
+ };
1500
+ const response = await this.v1PrivatePostPrivateCancelOrderList(this.extend(request, params));
1501
+ const result = this.safeList(response, 'result', []);
1502
+ return this.parseOrders(result, undefined, undefined, undefined, params);
1503
+ }
1470
1504
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1471
1505
  /**
1472
1506
  * @method
package/js/src/delta.d.ts CHANGED
@@ -115,8 +115,8 @@ export default class delta extends Exchange {
115
115
  previousFundingTimestamp: any;
116
116
  previousFundingDatetime: any;
117
117
  };
118
- addMargin(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
119
- reduceMargin(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
118
+ addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
119
+ reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
120
120
  modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
121
121
  parseMarginModification(data: any, market?: Market): MarginModification;
122
122
  fetchOpenInterest(symbol: string, params?: {}): Promise<import("./base/types.js").OpenInterest>;
@@ -85,7 +85,7 @@ export default class deribit extends Exchange {
85
85
  datetime: string;
86
86
  };
87
87
  parseTransferStatus(status: any): string;
88
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
88
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
89
89
  parseDepositWithdrawFee(fee: any, currency?: Currency): {
90
90
  info: any;
91
91
  withdraw: {
@@ -85,7 +85,7 @@ export default class digifinex extends Exchange {
85
85
  status: string;
86
86
  };
87
87
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
88
- withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
88
+ withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
89
89
  fetchBorrowInterest(code?: Str, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
90
90
  parseBorrowInterest(info: any, market?: Market): {
91
91
  account: string;
@@ -150,8 +150,8 @@ export default class digifinex extends Exchange {
150
150
  handleMarginModeAndParams(methodName: any, params?: {}, defaultValue?: any): any[];
151
151
  fetchDepositWithdrawFees(codes?: Strings, params?: {}): Promise<{}>;
152
152
  parseDepositWithdrawFees(response: any, codes?: any, currencyIdKey?: any): {};
153
- addMargin(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
154
- reduceMargin(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
153
+ addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
154
+ reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
155
155
  modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
156
156
  parseMarginModification(data: any, market?: Market): MarginModification;
157
157
  fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").FundingHistory[]>;