ccxt 4.5.53 → 4.5.54

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 (69) hide show
  1. package/README.md +144 -145
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -4
  4. package/dist/cjs/src/base/Exchange.js +29 -0
  5. package/dist/cjs/src/bydfi.js +1 -1
  6. package/dist/cjs/src/coinbase.js +1 -1
  7. package/dist/cjs/src/coinbaseinternational.js +0 -38
  8. package/dist/cjs/src/coinex.js +1 -1
  9. package/dist/cjs/src/deepcoin.js +1 -1
  10. package/dist/cjs/src/dydx.js +1 -1
  11. package/dist/cjs/src/hollaex.js +2 -6
  12. package/dist/cjs/src/modetrade.js +1 -1
  13. package/dist/cjs/src/pacifica.js +42 -44
  14. package/dist/cjs/src/paradex.js +1 -1
  15. package/dist/cjs/src/pro/backpack.js +12 -3
  16. package/dist/cjs/src/pro/binance.js +7 -2
  17. package/dist/cjs/src/pro/hashkey.js +7 -4
  18. package/dist/cjs/src/pro/krakenfutures.js +27 -12
  19. package/dist/cjs/src/pro/kucoin.js +3 -3
  20. package/dist/cjs/src/pro/modetrade.js +1 -1
  21. package/dist/cjs/src/pro/weex.js +7 -5
  22. package/dist/cjs/src/pro/woo.js +1 -1
  23. package/dist/cjs/src/pro/woofipro.js +1 -1
  24. package/dist/cjs/src/weex.js +9 -6
  25. package/dist/cjs/src/woo.js +1 -1
  26. package/dist/cjs/src/woofipro.js +1 -1
  27. package/dist/cjs/src/xt.js +2 -2
  28. package/js/ccxt.d.ts +2 -5
  29. package/js/ccxt.js +2 -4
  30. package/js/src/base/Exchange.d.ts +23 -2
  31. package/js/src/base/Exchange.js +29 -0
  32. package/js/src/bydfi.js +1 -1
  33. package/js/src/coinbase.js +1 -1
  34. package/js/src/coinbaseexchange.d.ts +1 -1
  35. package/js/src/coinbaseinternational.d.ts +0 -21
  36. package/js/src/coinbaseinternational.js +0 -38
  37. package/js/src/coinex.js +1 -1
  38. package/js/src/deepcoin.js +1 -1
  39. package/js/src/dydx.js +1 -1
  40. package/js/src/hollaex.js +2 -6
  41. package/js/src/modetrade.js +1 -1
  42. package/js/src/pacifica.js +42 -44
  43. package/js/src/paradex.js +1 -1
  44. package/js/src/pro/backpack.js +12 -3
  45. package/js/src/pro/binance.d.ts +1 -1
  46. package/js/src/pro/binance.js +7 -2
  47. package/js/src/pro/hashkey.js +7 -4
  48. package/js/src/pro/krakenfutures.js +27 -12
  49. package/js/src/pro/kucoin.js +3 -3
  50. package/js/src/pro/modetrade.js +1 -1
  51. package/js/src/pro/weex.d.ts +1 -0
  52. package/js/src/pro/weex.js +7 -5
  53. package/js/src/pro/woo.js +1 -1
  54. package/js/src/pro/woofipro.js +1 -1
  55. package/js/src/protobuf/mexc/compiled.d.cts +0 -6
  56. package/js/src/static_dependencies/dydx-v4-client/long/index.d.cts +0 -6
  57. package/js/src/static_dependencies/fflake/browser.d.ts +5 -5
  58. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +0 -1
  59. package/js/src/weex.js +9 -6
  60. package/js/src/woo.js +1 -1
  61. package/js/src/woofipro.js +1 -1
  62. package/js/src/xt.js +2 -2
  63. package/package.json +3 -3
  64. package/dist/cjs/src/abstract/zonda.js +0 -11
  65. package/dist/cjs/src/zonda.js +0 -1998
  66. package/js/src/abstract/zonda.d.ts +0 -56
  67. package/js/src/abstract/zonda.js +0 -11
  68. package/js/src/zonda.d.ts +0 -214
  69. package/js/src/zonda.js +0 -1997
package/dist/cjs/ccxt.js CHANGED
@@ -118,7 +118,6 @@ var xt = require('./src/xt.js');
118
118
  var yobit = require('./src/yobit.js');
119
119
  var zaif = require('./src/zaif.js');
120
120
  var zebpay = require('./src/zebpay.js');
121
- var zonda = require('./src/zonda.js');
122
121
  var aftermath$1 = require('./src/pro/aftermath.js');
123
122
  var alpaca$1 = require('./src/pro/alpaca.js');
124
123
  var apex$1 = require('./src/pro/apex.js');
@@ -202,7 +201,7 @@ var xt$1 = require('./src/pro/xt.js');
202
201
 
203
202
  //-----------------------------------------------------------------------------
204
203
  // this is updated by vss.js when building
205
- const version = '4.5.53';
204
+ const version = '4.5.54';
206
205
  Exchange["default"].ccxtVersion = version;
207
206
  const exchanges = {
208
207
  'aftermath': aftermath["default"],
@@ -315,7 +314,6 @@ const exchanges = {
315
314
  'yobit': yobit["default"],
316
315
  'zaif': zaif["default"],
317
316
  'zebpay': zebpay["default"],
318
- 'zonda': zonda["default"],
319
317
  };
320
318
  const pro = {
321
319
  'aftermath': aftermath$1["default"],
@@ -560,7 +558,6 @@ exports.xt = xt["default"];
560
558
  exports.yobit = yobit["default"];
561
559
  exports.zaif = zaif["default"];
562
560
  exports.zebpay = zebpay["default"];
563
- exports.zonda = zonda["default"];
564
561
  exports["default"] = ccxt;
565
562
  exports.exchanges = exchanges;
566
563
  exports.pro = pro;
@@ -4575,6 +4575,35 @@ class Exchange {
4575
4575
  }
4576
4576
  return ohlcv;
4577
4577
  }
4578
+ safeNetwork(network) {
4579
+ const withdrawEnabled = this.safeBool(network, 'withdraw');
4580
+ const depositEnabled = this.safeBool(network, 'deposit');
4581
+ const limits = this.safeDict(network, 'limits');
4582
+ const withdraw = this.safeDict(limits, 'withdraw');
4583
+ const deposit = this.safeDict(limits, 'deposit');
4584
+ const isEnabled = (withdrawEnabled && depositEnabled);
4585
+ return {
4586
+ 'info': network['info'],
4587
+ 'id': this.safeString(network, 'id'),
4588
+ 'name': this.safeString(network, 'name'),
4589
+ 'network': this.safeString(network, 'network'),
4590
+ 'active': this.safeBool(network, 'active', isEnabled),
4591
+ 'deposit': depositEnabled,
4592
+ 'withdraw': withdrawEnabled,
4593
+ 'fee': this.safeNumber(network, 'fee'),
4594
+ 'precision': this.safeNumber(network, 'precision'),
4595
+ 'limits': {
4596
+ 'withdraw': {
4597
+ 'min': this.safeNumber(withdraw, 'min'),
4598
+ 'max': this.safeNumber(withdraw, 'max'),
4599
+ },
4600
+ 'deposit': {
4601
+ 'min': this.safeNumber(deposit, 'min'),
4602
+ 'max': this.safeNumber(deposit, 'max'),
4603
+ },
4604
+ },
4605
+ };
4606
+ }
4578
4607
  networkCodeToId(networkCode, currencyCode = undefined) {
4579
4608
  /**
4580
4609
  * @ignore
@@ -636,7 +636,7 @@ class bydfi extends bydfi$1["default"] {
636
636
  'symbol': market['id'],
637
637
  };
638
638
  if (limit !== undefined) {
639
- request['limit'] = limit;
639
+ request['limit'] = Math.min(limit, 1000);
640
640
  }
641
641
  const response = await this.publicGetV1FapiMarketTrades(this.extend(request, params));
642
642
  //
@@ -1487,6 +1487,7 @@ class coinbase extends coinbase$1["default"] {
1487
1487
  // has_promo_fee: false
1488
1488
  // }
1489
1489
  //
1490
+ const promises = await Promise.all(spotUnresolvedPromises);
1490
1491
  let unresolvedContractPromises = [];
1491
1492
  try {
1492
1493
  unresolvedContractPromises = [
@@ -1497,7 +1498,6 @@ class coinbase extends coinbase$1["default"] {
1497
1498
  catch (e) {
1498
1499
  unresolvedContractPromises = []; // the sync version of ccxt won't have the promise.all line so the request is made here. Some users can't access perpetual products
1499
1500
  }
1500
- const promises = await Promise.all(spotUnresolvedPromises);
1501
1501
  let contractPromises = undefined;
1502
1502
  try {
1503
1503
  contractPromises = await Promise.all(unresolvedContractPromises); // some users don't have access to contracts
@@ -2243,44 +2243,6 @@ class coinbaseinternational extends coinbaseinternational$1["default"] {
2243
2243
  //
2244
2244
  return this.parseTransaction(response, currency);
2245
2245
  }
2246
- safeNetwork(network) {
2247
- let withdrawEnabled = this.safeBool(network, 'withdraw');
2248
- let depositEnabled = this.safeBool(network, 'deposit');
2249
- const limits = this.safeDict(network, 'limits');
2250
- const withdraw = this.safeDict(limits, 'withdraw');
2251
- const withdrawMax = this.safeNumber(withdraw, 'max');
2252
- const deposit = this.safeDict(limits, 'deposit');
2253
- const depositMax = this.safeNumber(deposit, 'max');
2254
- if (withdrawEnabled === undefined && withdrawMax !== undefined) {
2255
- withdrawEnabled = (withdrawMax > 0);
2256
- }
2257
- if (depositEnabled === undefined && depositMax !== undefined) {
2258
- depositEnabled = (depositMax > 0);
2259
- }
2260
- const networkId = this.safeString(network, 'id');
2261
- const isEnabled = (withdrawEnabled && depositEnabled);
2262
- return {
2263
- 'info': network['info'],
2264
- 'id': networkId,
2265
- 'name': this.safeString(network, 'name'),
2266
- 'network': this.safeString(network, 'network'),
2267
- 'active': this.safeBool(network, 'active', isEnabled),
2268
- 'deposit': depositEnabled,
2269
- 'withdraw': withdrawEnabled,
2270
- 'fee': this.safeNumber(network, 'fee'),
2271
- 'precision': this.safeNumber(network, 'precision'),
2272
- 'limits': {
2273
- 'withdraw': {
2274
- 'min': this.safeNumber(withdraw, 'min'),
2275
- 'max': withdrawMax,
2276
- },
2277
- 'deposit': {
2278
- 'min': this.safeNumber(deposit, 'min'),
2279
- 'max': depositMax,
2280
- },
2281
- },
2282
- };
2283
- }
2284
2246
  sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
2285
2247
  const version = api[0];
2286
2248
  const signed = api[1] === 'private';
@@ -1430,7 +1430,7 @@ class coinex extends coinex$1["default"] {
1430
1430
  // 'last_id': 0,
1431
1431
  };
1432
1432
  if (limit !== undefined) {
1433
- request['limit'] = limit;
1433
+ request['limit'] = Math.min(limit, 1000);
1434
1434
  }
1435
1435
  let response = undefined;
1436
1436
  if (market['swap']) {
@@ -814,7 +814,7 @@ class deepcoin extends deepcoin$1["default"] {
814
814
  'instId': market['id'],
815
815
  };
816
816
  if (limit !== undefined) {
817
- request['limit'] = limit; // default 100, max 500
817
+ request['limit'] = Math.min(limit, 2000);
818
818
  }
819
819
  const productGroup = this.getProductGroupFromMarket(market);
820
820
  request['productGroup'] = productGroup;
@@ -672,7 +672,7 @@ class dydx extends dydx$1["default"] {
672
672
  'market': market['id'],
673
673
  };
674
674
  if (limit !== undefined) {
675
- request['limit'] = limit;
675
+ request['limit'] = Math.min(limit, 1000);
676
676
  }
677
677
  const response = await this.indexerGetTradesPerpetualMarketMarket(this.extend(request, params));
678
678
  //
@@ -924,14 +924,10 @@ class hollaex extends hollaex$1["default"] {
924
924
  const timeDelta = this.parseTimeframe(timeframe) * maxLimit * 1000;
925
925
  let start = since;
926
926
  const now = this.milliseconds();
927
- if (until === undefined && start === undefined) {
928
- until = now;
929
- start = until - timeDelta;
930
- }
931
- else if (until === undefined) {
927
+ if (until === undefined) {
932
928
  until = now; // the exchange has not a lot of trades, so if we count until by limit and limit is small, it may return empty result
933
929
  }
934
- else if (start === undefined) {
930
+ if (start === undefined) {
935
931
  start = until - timeDelta;
936
932
  }
937
933
  request['from'] = this.parseToInt(start / 1000); // convert to seconds
@@ -1643,7 +1643,7 @@ class modetrade extends modetrade$1["default"] {
1643
1643
  //
1644
1644
  // {
1645
1645
  // "success": true,
1646
- // "timestamp": 1702989203989,
1646
+ // "timestamp": 1702989203988,
1647
1647
  // "data": {
1648
1648
  // "rows": [{
1649
1649
  // "order_id": 13,
@@ -1000,53 +1000,51 @@ class pacifica extends pacifica$1["default"] {
1000
1000
  if (paginate) {
1001
1001
  return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, defaultMaxLimit);
1002
1002
  }
1003
- else {
1004
- const tf = this.safeString(this.timeframes, timeframe, timeframe);
1005
- let request = {
1006
- 'symbol': market['id'],
1007
- 'interval': tf,
1008
- 'start_time': since,
1009
- };
1010
- [request, params] = this.handleUntilOption('end_time', request, params);
1011
- const nowMillis = this.milliseconds();
1012
- let until = this.safeInteger(request, 'end_time');
1003
+ const tf = this.safeString(this.timeframes, timeframe, timeframe);
1004
+ let request = {
1005
+ 'symbol': market['id'],
1006
+ 'interval': tf,
1007
+ 'start_time': since,
1008
+ };
1009
+ [request, params] = this.handleUntilOption('end_time', request, params);
1010
+ const nowMillis = this.milliseconds();
1011
+ let until = this.safeInteger(request, 'end_time');
1012
+ if (until === undefined) {
1013
+ if (limit !== undefined) {
1014
+ until = since + (limit * (this.parseTimeframe(tf) * 1000)) - 1;
1015
+ }
1013
1016
  if (until === undefined) {
1014
- if (limit !== undefined) {
1015
- until = since + (limit * (this.parseTimeframe(tf) * 1000)) - 1;
1016
- }
1017
- if (until === undefined) {
1018
- until = since + (defaultMaxLimit * (this.parseTimeframe(tf) * 1000)) - 1;
1019
- }
1020
- if (until > nowMillis) {
1021
- until = nowMillis;
1022
- }
1023
- request['end_time'] = until;
1017
+ until = since + (defaultMaxLimit * (this.parseTimeframe(tf) * 1000)) - 1;
1024
1018
  }
1025
- const response = await this.publicGetKline(this.extend(request, params));
1026
- //
1027
- // {
1028
- // "success": true,
1029
- // "data": [
1030
- // {
1031
- // "t": 1748954160000,
1032
- // "T": 1748954220000,
1033
- // "s": "BTC",
1034
- // "i": "1m",
1035
- // "o": "105376",
1036
- // "c": "105376",
1037
- // "h": "105376",
1038
- // "l": "105376",
1039
- // "v": "0.00022",
1040
- // "n": 2
1041
- // }
1042
- // ],
1043
- // "error": null,
1044
- // "code": null
1045
- // }
1046
- //
1047
- const candles = this.safeList(response, 'data', []);
1048
- return this.parseOHLCVs(candles, market, timeframe, since, limit);
1019
+ if (until > nowMillis) {
1020
+ until = nowMillis;
1021
+ }
1022
+ request['end_time'] = until;
1049
1023
  }
1024
+ const response = await this.publicGetKline(this.extend(request, params));
1025
+ //
1026
+ // {
1027
+ // "success": true,
1028
+ // "data": [
1029
+ // {
1030
+ // "t": 1748954160000,
1031
+ // "T": 1748954220000,
1032
+ // "s": "BTC",
1033
+ // "i": "1m",
1034
+ // "o": "105376",
1035
+ // "c": "105376",
1036
+ // "h": "105376",
1037
+ // "l": "105376",
1038
+ // "v": "0.00022",
1039
+ // "n": 2
1040
+ // }
1041
+ // ],
1042
+ // "error": null,
1043
+ // "code": null
1044
+ // }
1045
+ //
1046
+ const candles = this.safeList(response, 'data', []);
1047
+ return this.parseOHLCVs(candles, market, timeframe, since, limit);
1050
1048
  }
1051
1049
  parseOHLCV(ohlcv, market = undefined) {
1052
1050
  //
@@ -907,7 +907,7 @@ class paradex extends paradex$1["default"] {
907
907
  'market': market['id'],
908
908
  };
909
909
  if (limit !== undefined) {
910
- request['page_size'] = limit;
910
+ request['page_size'] = Math.min(limit, 1000);
911
911
  }
912
912
  if (since !== undefined) {
913
913
  request['start_at'] = since;
@@ -719,9 +719,18 @@ class backpack extends backpack$1["default"] {
719
719
  const id = this.safeString(trade, 't');
720
720
  const marketId = this.safeString(trade, 's');
721
721
  market = this.safeMarket(marketId, market);
722
- const isMaker = this.safeBool(trade, 'm');
723
- const side = isMaker ? 'sell' : 'buy';
724
- const takerOrMaker = isMaker ? 'maker' : 'taker';
722
+ const isBuyerMaker = this.safeBool(trade, 'm');
723
+ let side = undefined;
724
+ let takerOrMaker = undefined;
725
+ if (isBuyerMaker !== undefined) {
726
+ takerOrMaker = 'taker';
727
+ if (isBuyerMaker) {
728
+ side = 'sell';
729
+ }
730
+ else {
731
+ side = 'buy';
732
+ }
733
+ }
725
734
  const price = this.safeString(trade, 'p');
726
735
  const amount = this.safeString(trade, 'q');
727
736
  let orderId = undefined;
@@ -234,8 +234,13 @@ class binance extends binance$1["default"] {
234
234
  const baseUrl = this.urls['api']['ws'][type];
235
235
  if (type === 'future') {
236
236
  // skip URL manipulation for proxied/bridge URLs (contain an embedded protocol)
237
- const firstProtocol = baseUrl.indexOf('://');
238
- if (firstProtocol !== -1 && baseUrl.indexOf('://', firstProtocol + 3) !== -1) {
237
+ // const firstProtocol = baseUrl.indexOf ('://');
238
+ // if (firstProtocol !== -1 && baseUrl.indexOf ('://', firstProtocol + 3) !== -1) {
239
+ // return baseUrl;
240
+ // }
241
+ const baseUrlSplit = baseUrl.split('://');
242
+ const baseUrlSplitLength = baseUrlSplit.length;
243
+ if (baseUrlSplitLength > 2) {
239
244
  return baseUrl;
240
245
  }
241
246
  // only rewrite when the URL ends with exactly "/ws"
@@ -556,13 +556,16 @@ class hashkey extends hashkey$1["default"] {
556
556
  const marketId = this.safeString(trade, 's');
557
557
  market = this.safeMarket(marketId, market);
558
558
  const timestamp = this.safeInteger(trade, 't');
559
- const isMaker = this.safeBool(trade, 'm');
559
+ const isBuyerMaker = this.safeBool(trade, 'm');
560
+ let side = undefined;
560
561
  let takerOrMaker = undefined;
561
- if (isMaker !== undefined) {
562
- if (isMaker) {
562
+ if (isBuyerMaker !== undefined) {
563
+ if (isBuyerMaker) {
564
+ side = 'sell';
563
565
  takerOrMaker = 'maker';
564
566
  }
565
567
  else {
568
+ side = 'buy';
566
569
  takerOrMaker = 'taker';
567
570
  }
568
571
  }
@@ -571,7 +574,7 @@ class hashkey extends hashkey$1["default"] {
571
574
  'timestamp': timestamp,
572
575
  'datetime': this.iso8601(timestamp),
573
576
  'symbol': market['symbol'],
574
- 'side': this.safeStringLower(trade, 'S'),
577
+ 'side': this.safeStringLower(trade, 'S', side),
575
578
  'price': this.safeString(trade, 'p'),
576
579
  'amount': this.safeString(trade, 'q'),
577
580
  'cost': undefined,
@@ -549,6 +549,21 @@ class krakenfutures extends krakenfutures$1["default"] {
549
549
  // "price": 34893
550
550
  // }
551
551
  //
552
+ // order update
553
+ // {
554
+ // "instrument": "PF_DOGEUSD",
555
+ // "time": 1778610421471,
556
+ // "last_update_time": 1778610444402,
557
+ // "qty": 0,
558
+ // "filled": 10,
559
+ // "limit_price": 0.10912,
560
+ // "stop_price": 0,
561
+ // "type": "limit",
562
+ // "order_id": "a1c3803c-8f3d-4317-a085-8d06e11b1d36",
563
+ // "direction": 0,
564
+ // "reduce_only": false
565
+ // }
566
+ //
552
567
  const marketId = this.safeString(trade, 'product_id');
553
568
  market = this.safeMarket(marketId, market);
554
569
  const timestamp = this.safeInteger(trade, 'time');
@@ -562,8 +577,8 @@ class krakenfutures extends krakenfutures$1["default"] {
562
577
  'type': this.safeString(trade, 'type'),
563
578
  'side': this.safeString(trade, 'side'),
564
579
  'takerOrMaker': 'taker',
565
- 'price': this.safeString(trade, 'price'),
566
- 'amount': this.safeString(trade, 'qty'),
580
+ 'price': this.safeString2(trade, 'price', 'limit_price'),
581
+ 'amount': this.safeString2(trade, 'filled', 'qty'),
567
582
  'cost': undefined,
568
583
  'fee': {
569
584
  'rate': undefined,
@@ -613,7 +628,7 @@ class krakenfutures extends krakenfutures$1["default"] {
613
628
  'type': this.safeStringLower(trade, 'type'),
614
629
  'side': this.safeString(trade, 'side'),
615
630
  'takerOrMaker': this.safeString(trade, 'matchRole'),
616
- 'price': this.safeString(trade, 'price'),
631
+ 'price': this.safeString2(trade, 'price', 'limit_price'),
617
632
  'amount': this.safeString(trade, 'tradeAmount'),
618
633
  'cost': undefined,
619
634
  'fee': {
@@ -732,13 +747,13 @@ class krakenfutures extends krakenfutures$1["default"] {
732
747
  previousOrder['average'] = Precise["default"].stringDiv(totalCost, totalAmount);
733
748
  }
734
749
  previousOrder['cost'] = totalCost;
735
- if (previousOrder['filled'] !== undefined) {
736
- const stringOrderFilled = this.numberToString(previousOrder['filled']);
737
- previousOrder['filled'] = Precise["default"].stringAdd(stringOrderFilled, this.numberToString(trade['amount']));
738
- if (previousOrder['amount'] !== undefined) {
739
- previousOrder['remaining'] = Precise["default"].stringSub(this.numberToString(previousOrder['amount']), stringOrderFilled);
740
- }
741
- }
750
+ const filledString = this.numberToString(trade['amount']);
751
+ const stringOrderFilled = this.safeString(previousOrder, 'filled', '0');
752
+ const totalFilled = Precise["default"].stringAdd(stringOrderFilled, filledString);
753
+ previousOrder['filled'] = totalFilled;
754
+ const prevAmountString = this.safeString(previousOrder, 'amount');
755
+ const remaining = Precise["default"].stringSub(prevAmountString, totalFilled);
756
+ previousOrder['remaining'] = remaining;
742
757
  if (previousOrder['fee'] === undefined) {
743
758
  previousOrder['fee'] = {
744
759
  'rate': undefined,
@@ -913,11 +928,11 @@ class krakenfutures extends krakenfutures$1["default"] {
913
928
  'price': this.safeString(unparsedOrder, 'limit_price'),
914
929
  'stopPrice': this.safeString(unparsedOrder, 'stop_price'),
915
930
  'triggerPrice': this.safeString(unparsedOrder, 'stop_price'),
916
- 'amount': this.safeString(unparsedOrder, 'qty'),
931
+ 'amount': undefined,
917
932
  'cost': undefined,
918
933
  'average': undefined,
919
934
  'filled': this.safeString(unparsedOrder, 'filled'),
920
- 'remaining': undefined,
935
+ 'remaining': this.safeString(unparsedOrder, 'qty'),
921
936
  'status': status,
922
937
  'fee': {
923
938
  'rate': undefined,
@@ -1697,14 +1697,14 @@ class kucoin extends kucoin$1["default"] {
1697
1697
  getCacheIndex(orderbook, cache) {
1698
1698
  const firstDelta = this.safeValue(cache, 0);
1699
1699
  const nonce = this.safeInteger(orderbook, 'nonce');
1700
- const firstDeltaStart = this.safeInteger2(firstDelta, 'sequenceStart', 'sequence');
1700
+ const firstDeltaStart = this.safeIntegerN(firstDelta, ['sequenceStart', 'sequence', 'O']);
1701
1701
  if (nonce < firstDeltaStart - 1) {
1702
1702
  return -1;
1703
1703
  }
1704
1704
  for (let i = 0; i < cache.length; i++) {
1705
1705
  const delta = cache[i];
1706
- const deltaStart = this.safeInteger2(delta, 'sequenceStart', 'sequence');
1707
- const deltaEnd = this.safeInteger2(delta, 'sequenceEnd', 'timestamp'); // todo check
1706
+ const deltaStart = this.safeIntegerN(delta, ['sequenceStart', 'sequence', 'O']);
1707
+ const deltaEnd = this.safeIntegerN(delta, ['sequenceEnd', 'sequence', 'C']); // todo check
1708
1708
  if ((nonce >= deltaStart - 1) && (nonce < deltaEnd)) {
1709
1709
  return i;
1710
1710
  }
@@ -729,7 +729,7 @@ class modetrade extends modetrade$1["default"] {
729
729
  // "orderTag": "default",
730
730
  // "totalFee": 0,
731
731
  // "visible": 0.01,
732
- // "timestamp": 1657515556799,
732
+ // "timestamp": 1657515556798,
733
733
  // "reduceOnly": false,
734
734
  // "maker": false
735
735
  // }
@@ -1309,12 +1309,10 @@ class weex extends weex$1["default"] {
1309
1309
  this.orders = new Cache.ArrayCacheBySymbolById(limit);
1310
1310
  }
1311
1311
  const orders = this.orders;
1312
- const newOrders = [];
1313
1312
  for (let i = 0; i < data.length; i++) {
1314
1313
  const rawOrder = this.safeDict(data, i, {});
1315
1314
  const parsed = this.parseWsOrder(rawOrder);
1316
1315
  orders.append(parsed);
1317
- newOrders.push(parsed);
1318
1316
  const symbol = parsed['symbol'];
1319
1317
  symbols[symbol] = true;
1320
1318
  }
@@ -1327,9 +1325,9 @@ class weex extends weex$1["default"] {
1327
1325
  for (let i = 0; i < symbolKeys.length; i++) {
1328
1326
  const symbol = symbolKeys[i];
1329
1327
  const symbolMessageHash = messageHash + '::' + symbol;
1330
- client.resolve(newOrders, symbolMessageHash);
1328
+ client.resolve(orders, symbolMessageHash);
1331
1329
  }
1332
- client.resolve(newOrders, messageHash);
1330
+ client.resolve(this.orders, messageHash);
1333
1331
  }
1334
1332
  parseWsOrder(order, market = undefined) {
1335
1333
  //
@@ -1762,7 +1760,7 @@ class weex extends weex$1["default"] {
1762
1760
  const data = this.safeList(message, 'd', []);
1763
1761
  for (let i = 0; i < data.length; i++) {
1764
1762
  const rawPosition = this.safeDict(data, i, {});
1765
- const position = this.parsePosition(rawPosition);
1763
+ const position = this.parseWsPosition(rawPosition);
1766
1764
  cache.append(position);
1767
1765
  newPositions.push(position);
1768
1766
  }
@@ -1779,6 +1777,10 @@ class weex extends weex$1["default"] {
1779
1777
  }
1780
1778
  client.resolve(newPositions, 'positions');
1781
1779
  }
1780
+ parseWsPosition(position, market = undefined) {
1781
+ // same as REST api
1782
+ return this.parsePosition(position, market);
1783
+ }
1782
1784
  getMarketFromClientAndMessage(client, message) {
1783
1785
  const url = client.url;
1784
1786
  let marketType = 'spot';
@@ -974,7 +974,7 @@ class woo extends woo$1["default"] {
974
974
  // "orderTag": "default",
975
975
  // "totalFee": 0,
976
976
  // "visible": 0.01,
977
- // "timestamp": 1657515556799,
977
+ // "timestamp": 1657515556798,
978
978
  // "reduceOnly": false,
979
979
  // "maker": false
980
980
  // }
@@ -729,7 +729,7 @@ class woofipro extends woofipro$1["default"] {
729
729
  // "orderTag": "default",
730
730
  // "totalFee": 0,
731
731
  // "visible": 0.01,
732
- // "timestamp": 1657515556799,
732
+ // "timestamp": 1657515556798,
733
733
  // "reduceOnly": false,
734
734
  // "maker": false
735
735
  // }
@@ -1486,7 +1486,7 @@ class weex extends weex$1["default"] {
1486
1486
  'symbol': market['id'],
1487
1487
  };
1488
1488
  if (limit !== undefined) {
1489
- request['limit'] = limit;
1489
+ request['limit'] = Math.min(limit, 1000);
1490
1490
  }
1491
1491
  let response = undefined;
1492
1492
  if (market['spot']) {
@@ -3309,7 +3309,7 @@ class weex extends weex$1["default"] {
3309
3309
  if (errorMessage !== undefined) {
3310
3310
  this.handleOrderOrPositionError(errorCode, errorMessage, position);
3311
3311
  }
3312
- const marketId = this.safeString(position, 'symbol');
3312
+ const marketId = this.safeString2(position, 'symbol', 'coinId'); // coinId might be used in testnet: https://github.com/ccxt/ccxt/issues/28576#issuecomment-4439400273
3313
3313
  market = this.safeMarket(marketId, market, undefined, 'contract');
3314
3314
  const timestamp = this.safeInteger(position, 'createdTime');
3315
3315
  const marginType = this.safeString2(position, 'marginType', 'marginMode');
@@ -3325,20 +3325,23 @@ class weex extends weex$1["default"] {
3325
3325
  else if (separatedMode === 'SEPARATED') {
3326
3326
  hedged = true;
3327
3327
  }
3328
+ const notional = this.safeString(position, 'openValue');
3329
+ const size = this.safeString(position, 'size');
3330
+ const entryPrice = Precise["default"].stringDiv(notional, size);
3328
3331
  return this.safePosition({
3329
3332
  'symbol': market['symbol'],
3330
3333
  'id': this.safeString2(position, 'id', 'positionId'),
3331
3334
  'timestamp': timestamp,
3332
3335
  'datetime': this.iso8601(timestamp),
3333
- 'contracts': this.safeNumber(position, 'size'),
3336
+ 'contracts': this.parseNumber(size),
3334
3337
  'contractSize': undefined,
3335
3338
  'side': this.safeStringLower(position, 'side'),
3336
- 'notional': this.safeNumber(position, 'openValue'),
3339
+ 'notional': this.parseNumber(notional),
3337
3340
  'leverage': this.safeNumber(position, 'leverage'),
3338
3341
  'unrealizedPnl': this.safeNumber(position, 'unrealizePnl'),
3339
3342
  'realizedPnl': undefined,
3340
3343
  'collateral': undefined,
3341
- 'entryPrice': undefined,
3344
+ 'entryPrice': this.parseNumber(entryPrice),
3342
3345
  'markPrice': undefined,
3343
3346
  'liquidationPrice': this.safeNumber(position, 'liquidatePrice'),
3344
3347
  'marginMode': marginMode,
@@ -3353,7 +3356,7 @@ class weex extends weex$1["default"] {
3353
3356
  'stopLossPrice': undefined,
3354
3357
  'takeProfitPrice': undefined,
3355
3358
  'percentage': undefined,
3356
- 'info': undefined,
3359
+ 'info': position,
3357
3360
  });
3358
3361
  }
3359
3362
  /**
@@ -2554,7 +2554,7 @@ class woo extends woo$1["default"] {
2554
2554
  // {
2555
2555
  // "createdTime": "1734964440.523",
2556
2556
  // "updatedTime": "1734964614.081",
2557
- // "id": "24122314340000585",
2557
+ // "id": "24122314340000586",
2558
2558
  // "externalId": "241223143600621",
2559
2559
  // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2560
2560
  // "token": "ARB_USDCNATIVE",
@@ -2075,7 +2075,7 @@ class woofipro extends woofipro$1["default"] {
2075
2075
  //
2076
2076
  // {
2077
2077
  // "success": true,
2078
- // "timestamp": 1702989203989,
2078
+ // "timestamp": 1702989203988,
2079
2079
  // "data": {
2080
2080
  // "meta": {
2081
2081
  // "total": 9,
@@ -1934,13 +1934,13 @@ class xt extends xt$1["default"] {
1934
1934
  let response = undefined;
1935
1935
  if (market['spot']) {
1936
1936
  if (limit !== undefined) {
1937
- request['limit'] = limit;
1937
+ request['limit'] = Math.min(limit, 1000);
1938
1938
  }
1939
1939
  response = await this.publicSpotGetTradeRecent(this.extend(request, params));
1940
1940
  }
1941
1941
  else {
1942
1942
  if (limit !== undefined) {
1943
- request['num'] = limit;
1943
+ request['num'] = Math.min(limit, 1000);
1944
1944
  }
1945
1945
  if (market['linear']) {
1946
1946
  response = await this.publicLinearGetFutureMarketV1PublicQDeal(this.extend(request, params));