ccxt 4.4.94 → 4.4.96

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 (125) hide show
  1. package/README.md +7 -7
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +4 -1
  4. package/dist/cjs/src/abstract/foxbit.js +9 -0
  5. package/dist/cjs/src/apex.js +2 -2
  6. package/dist/cjs/src/ascendex.js +3 -3
  7. package/dist/cjs/src/base/Exchange.js +8 -4
  8. package/dist/cjs/src/base/ws/Future.js +2 -2
  9. package/dist/cjs/src/bingx.js +148 -94
  10. package/dist/cjs/src/bitget.js +32 -144
  11. package/dist/cjs/src/bitmart.js +2 -2
  12. package/dist/cjs/src/bitrue.js +15 -8
  13. package/dist/cjs/src/bitstamp.js +1 -0
  14. package/dist/cjs/src/blofin.js +7 -1
  15. package/dist/cjs/src/bybit.js +17 -6
  16. package/dist/cjs/src/coinbase.js +36 -0
  17. package/dist/cjs/src/coinbaseexchange.js +4 -2
  18. package/dist/cjs/src/coinmate.js +34 -0
  19. package/dist/cjs/src/coinone.js +34 -0
  20. package/dist/cjs/src/coinsph.js +29 -0
  21. package/dist/cjs/src/coinspot.js +36 -1
  22. package/dist/cjs/src/cryptocom.js +2 -1
  23. package/dist/cjs/src/cryptomus.js +41 -1
  24. package/dist/cjs/src/defx.js +1 -1
  25. package/dist/cjs/src/derive.js +1 -1
  26. package/dist/cjs/src/ellipx.js +40 -0
  27. package/dist/cjs/src/foxbit.js +2016 -0
  28. package/dist/cjs/src/gate.js +1 -1
  29. package/dist/cjs/src/hyperliquid.js +3 -2
  30. package/dist/cjs/src/kucoin.js +1 -1
  31. package/dist/cjs/src/kucoinfutures.js +3 -2
  32. package/dist/cjs/src/mexc.js +28 -13
  33. package/dist/cjs/src/modetrade.js +3 -3
  34. package/dist/cjs/src/okcoin.js +1 -1
  35. package/dist/cjs/src/okx.js +12 -3
  36. package/dist/cjs/src/onetrading.js +1 -1
  37. package/dist/cjs/src/oxfun.js +2 -1
  38. package/dist/cjs/src/paradex.js +2 -2
  39. package/dist/cjs/src/pro/hyperliquid.js +6 -6
  40. package/dist/cjs/src/pro/kraken.js +18 -18
  41. package/dist/cjs/src/pro/mexc.js +10 -10
  42. package/dist/cjs/src/vertex.js +3 -2
  43. package/dist/cjs/src/woo.js +1281 -894
  44. package/dist/cjs/src/woofipro.js +2 -2
  45. package/js/ccxt.d.ts +5 -2
  46. package/js/ccxt.js +4 -2
  47. package/js/src/abstract/bingx.d.ts +3 -0
  48. package/js/src/abstract/foxbit.d.ts +29 -0
  49. package/js/src/abstract/foxbit.js +11 -0
  50. package/js/src/abstract/woo.d.ts +58 -3
  51. package/js/src/apex.d.ts +2 -2
  52. package/js/src/apex.js +2 -2
  53. package/js/src/ascendex.d.ts +1 -1
  54. package/js/src/ascendex.js +3 -3
  55. package/js/src/base/Exchange.d.ts +7 -6
  56. package/js/src/base/Exchange.js +8 -4
  57. package/js/src/base/ws/Future.js +2 -2
  58. package/js/src/bingx.d.ts +6 -6
  59. package/js/src/bingx.js +148 -94
  60. package/js/src/bitget.js +32 -144
  61. package/js/src/bitmart.d.ts +2 -2
  62. package/js/src/bitmart.js +2 -2
  63. package/js/src/bitrue.js +15 -8
  64. package/js/src/bitstamp.js +2 -1
  65. package/js/src/bittrade.d.ts +1 -1
  66. package/js/src/blofin.d.ts +2 -1
  67. package/js/src/blofin.js +7 -1
  68. package/js/src/bybit.d.ts +1 -1
  69. package/js/src/bybit.js +17 -6
  70. package/js/src/coinbase.js +36 -0
  71. package/js/src/coinbaseexchange.d.ts +2 -2
  72. package/js/src/coinbaseexchange.js +4 -2
  73. package/js/src/coinbaseinternational.d.ts +2 -2
  74. package/js/src/coinmate.js +34 -0
  75. package/js/src/coinone.js +34 -0
  76. package/js/src/coinsph.js +29 -0
  77. package/js/src/coinspot.d.ts +1 -1
  78. package/js/src/coinspot.js +36 -1
  79. package/js/src/cryptocom.d.ts +1 -1
  80. package/js/src/cryptocom.js +2 -1
  81. package/js/src/cryptomus.d.ts +1 -1
  82. package/js/src/cryptomus.js +41 -1
  83. package/js/src/defx.d.ts +2 -2
  84. package/js/src/defx.js +1 -1
  85. package/js/src/derive.d.ts +2 -2
  86. package/js/src/derive.js +1 -1
  87. package/js/src/digifinex.d.ts +1 -1
  88. package/js/src/ellipx.js +40 -0
  89. package/js/src/foxbit.d.ts +352 -0
  90. package/js/src/foxbit.js +2016 -0
  91. package/js/src/gate.js +1 -1
  92. package/js/src/htx.d.ts +2 -2
  93. package/js/src/hyperliquid.d.ts +2 -2
  94. package/js/src/hyperliquid.js +3 -2
  95. package/js/src/krakenfutures.d.ts +1 -1
  96. package/js/src/kucoin.d.ts +1 -1
  97. package/js/src/kucoin.js +1 -1
  98. package/js/src/kucoinfutures.d.ts +3 -3
  99. package/js/src/kucoinfutures.js +3 -2
  100. package/js/src/mexc.d.ts +1 -1
  101. package/js/src/mexc.js +28 -13
  102. package/js/src/modetrade.d.ts +2 -4
  103. package/js/src/modetrade.js +3 -3
  104. package/js/src/ndax.d.ts +1 -1
  105. package/js/src/okcoin.d.ts +1 -1
  106. package/js/src/okcoin.js +1 -1
  107. package/js/src/okx.d.ts +1 -1
  108. package/js/src/okx.js +12 -3
  109. package/js/src/onetrading.d.ts +1 -1
  110. package/js/src/onetrading.js +1 -1
  111. package/js/src/oxfun.d.ts +1 -1
  112. package/js/src/oxfun.js +2 -1
  113. package/js/src/paradex.d.ts +1 -1
  114. package/js/src/paradex.js +2 -2
  115. package/js/src/pro/hyperliquid.js +6 -6
  116. package/js/src/pro/kraken.js +18 -18
  117. package/js/src/pro/mexc.js +10 -10
  118. package/js/src/timex.d.ts +1 -1
  119. package/js/src/vertex.d.ts +2 -2
  120. package/js/src/vertex.js +3 -2
  121. package/js/src/woo.d.ts +80 -50
  122. package/js/src/woo.js +1281 -894
  123. package/js/src/woofipro.d.ts +2 -4
  124. package/js/src/woofipro.js +2 -2
  125. package/package.json +7 -7
@@ -102,7 +102,7 @@ class woo extends woo$1 {
102
102
  'fetchTickers': false,
103
103
  'fetchTime': true,
104
104
  'fetchTrades': true,
105
- 'fetchTradingFee': false,
105
+ 'fetchTradingFee': true,
106
106
  'fetchTradingFees': true,
107
107
  'fetchTransactions': 'emulated',
108
108
  'fetchTransfers': true,
@@ -238,19 +238,56 @@ class woo extends woo$1 {
238
238
  'v3': {
239
239
  'public': {
240
240
  'get': {
241
- 'insuranceFund': 3,
241
+ 'systemInfo': 1,
242
+ 'instruments': 1,
243
+ 'token': 1,
244
+ 'tokenNetwork': 1,
245
+ 'tokenInfo': 1,
246
+ 'marketTrades': 1,
247
+ 'marketTradesHistory': 1,
248
+ 'orderbook': 1,
249
+ 'kline': 1,
250
+ 'klineHistory': 1,
251
+ 'futures': 1,
252
+ 'fundingRate': 1,
253
+ 'fundingRateHistory': 1,
254
+ 'insuranceFund': 1, // 10/1s
242
255
  },
243
256
  },
244
257
  'private': {
245
258
  'get': {
259
+ 'trade/order': 2,
260
+ 'trade/orders': 1,
261
+ 'trade/algoOrder': 1,
262
+ 'trade/algoOrders': 1,
263
+ 'trade/transaction': 1,
264
+ 'trade/transactionHistory': 5,
265
+ 'trade/tradingFee': 5,
266
+ 'account/info': 60,
267
+ 'account/tokenConfig': 1,
268
+ 'account/symbolConfig': 1,
269
+ 'account/subAccounts/all': 60,
270
+ 'account/referral/summary': 60,
271
+ 'account/referral/rewardHistory': 60,
272
+ 'account/credentials': 60,
273
+ 'asset/balances': 1,
274
+ 'asset/token/history': 60,
275
+ 'asset/transfer/history': 30,
276
+ 'asset/wallet/history': 60,
277
+ 'asset/wallet/deposit': 60,
278
+ 'asset/staking/yieldHistory': 60,
279
+ 'futures/positions': 3.33,
280
+ 'futures/leverage': 60,
281
+ 'futures/defaultMarginMode': 60,
282
+ 'futures/fundingFee/history': 30,
283
+ 'spotMargin/interestRate': 60,
284
+ 'spotMargin/interestHistory': 60,
285
+ 'spotMargin/maxMargin': 60,
246
286
  'algo/order/{oid}': 1,
247
287
  'algo/orders': 1,
248
288
  'balances': 1,
249
- 'accountinfo': 60,
250
289
  'positions': 3.33,
251
290
  'buypower': 1,
252
- 'referrals': 60,
253
- 'referral_rewards': 60,
254
291
  'convert/exchangeInfo': 1,
255
292
  'convert/assetInfo': 1,
256
293
  'convert/rfq': 60,
@@ -258,16 +295,34 @@ class woo extends woo$1 {
258
295
  'convert/trades': 1,
259
296
  },
260
297
  'post': {
298
+ 'trade/order': 2,
299
+ 'trade/algoOrder': 5,
300
+ 'trade/cancelAllAfter': 1,
301
+ 'account/tradingMode': 120,
302
+ 'account/listenKey': 20,
303
+ 'asset/transfer': 30,
304
+ 'asset/wallet/withdraw': 60,
305
+ 'spotMargin/leverage': 120,
306
+ 'spotMargin/interestRepay': 60,
261
307
  'algo/order': 5,
262
308
  'convert/rft': 60,
263
309
  },
264
310
  'put': {
311
+ 'trade/order': 2,
312
+ 'trade/algoOrder': 2,
313
+ 'futures/leverage': 60,
314
+ 'futures/positionMode': 120,
265
315
  'order/{oid}': 2,
266
316
  'order/client/{client_order_id}': 2,
267
317
  'algo/order/{oid}': 2,
268
318
  'algo/order/client/{client_order_id}': 2,
269
319
  },
270
320
  'delete': {
321
+ 'trade/order': 1,
322
+ 'trade/orders': 1,
323
+ 'trade/algoOrder': 1,
324
+ 'trade/algoOrders': 1,
325
+ 'trade/allOrders': 1,
271
326
  'algo/order/{order_id}': 1,
272
327
  'algo/orders/pending': 1,
273
328
  'algo/orders/pending/{symbol}': 1,
@@ -446,20 +501,21 @@ class woo extends woo$1 {
446
501
  * @method
447
502
  * @name woo#fetchStatus
448
503
  * @description the latest known information on the availability of the exchange API
449
- * @see https://docs.woox.io/#get-system-maintenance-status-public
504
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/systemInfo
450
505
  * @param {object} [params] extra parameters specific to the exchange API endpoint
451
506
  * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
452
507
  */
453
508
  async fetchStatus(params = {}) {
454
- const response = await this.v1PublicGetSystemInfo(params);
509
+ const response = await this.v3PublicGetSystemInfo(params);
455
510
  //
456
511
  // {
457
512
  // "success": true,
458
513
  // "data": {
459
- // "status": "0",
460
- // "msg": "System is functioning properly."
514
+ // "status": 0,
515
+ // "msg": "System is functioning properly.",
516
+ // "estimatedEndTime": 1749963600362
461
517
  // },
462
- // "timestamp": "1709274106602"
518
+ // "timestamp": 1751442989564
463
519
  // }
464
520
  //
465
521
  const data = this.safeDict(response, 'data', {});
@@ -485,20 +541,21 @@ class woo extends woo$1 {
485
541
  * @method
486
542
  * @name woo#fetchTime
487
543
  * @description fetches the current integer timestamp in milliseconds from the exchange server
488
- * @see https://docs.woox.io/#get-system-maintenance-status-public
544
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/systemInfo
489
545
  * @param {object} [params] extra parameters specific to the exchange API endpoint
490
546
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
491
547
  */
492
548
  async fetchTime(params = {}) {
493
- const response = await this.v1PublicGetSystemInfo(params);
549
+ const response = await this.v3PublicGetSystemInfo(params);
494
550
  //
495
551
  // {
496
552
  // "success": true,
497
553
  // "data": {
498
- // "status": "0",
499
- // "msg": "System is functioning properly."
554
+ // "status": 0,
555
+ // "msg": "System is functioning properly.",
556
+ // "estimatedEndTime": 1749963600362
500
557
  // },
501
- // "timestamp": "1709274106602"
558
+ // "timestamp": 1751442989564
502
559
  // }
503
560
  //
504
561
  return this.safeInteger(response, 'timestamp');
@@ -507,7 +564,7 @@ class woo extends woo$1 {
507
564
  * @method
508
565
  * @name woo#fetchMarkets
509
566
  * @description retrieves data on all markets for woo
510
- * @see https://docs.woox.io/#exchange-information
567
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/instruments
511
568
  * @param {object} [params] extra parameters specific to the exchange API endpoint
512
569
  * @returns {object[]} an array of objects representing market data
513
570
  */
@@ -515,30 +572,42 @@ class woo extends woo$1 {
515
572
  if (this.options['adjustForTimeDifference']) {
516
573
  await this.loadTimeDifference();
517
574
  }
518
- const response = await this.v1PublicGetInfo(params);
575
+ const response = await this.v3PublicGetInstruments(params);
519
576
  //
520
- // {
521
- // "rows": [
522
- // {
523
- // "symbol": "SPOT_AAVE_USDT",
524
- // "quote_min": 0,
525
- // "quote_max": 100000,
526
- // "quote_tick": 0.01,
527
- // "base_min": 0.01,
528
- // "base_max": 7284,
529
- // "base_tick": 0.0001,
530
- // "min_notional": 10,
531
- // "price_range": 0.1,
532
- // "created_time": "0",
533
- // "updated_time": "1639107647.988",
534
- // "is_stable": 0
577
+ // {
578
+ // "success": true,
579
+ // "data": {
580
+ // "rows": [
581
+ // {
582
+ // "symbol": "SPOT_AAVE_USDT",
583
+ // "status": "TRADING",
584
+ // "baseAsset": "AAVE",
585
+ // "baseAssetMultiplier": 1,
586
+ // "quoteAsset": "USDT",
587
+ // "quoteMin": "0",
588
+ // "quoteMax": "100000",
589
+ // "quoteTick": "0.01",
590
+ // "baseMin": "0.005",
591
+ // "baseMax": "5000",
592
+ // "baseTick": "0.0001",
593
+ // "minNotional": "1",
594
+ // "bidCapRatio": "1.1",
595
+ // "bidFloorRatio": null,
596
+ // "askCapRatio": null,
597
+ // "askFloorRatio": "0.9",
598
+ // "orderMode": "NORMAL",
599
+ // "impactNotional": null,
600
+ // "isAllowedRpi": false,
601
+ // "tickGranularity": null
602
+ // }
603
+ // ]
535
604
  // },
536
- // ...
537
- // "success": true
538
- // }
605
+ // "timestamp": 1751512951338
606
+ // }
539
607
  //
540
- const data = this.safeList(response, 'rows', []);
541
- return this.parseMarkets(data);
608
+ const data = this.safeDict(response, 'data', {});
609
+ const rows = this.safeList(data, 'rows', []);
610
+ return this.parseMarkets(rows);
542
611
  }
543
612
  parseMarket(market) {
544
613
  const marketId = this.safeString(market, 'symbol');
@@ -576,7 +645,7 @@ class woo extends woo$1 {
576
645
  linear = true;
577
646
  inverse = false;
578
647
  }
579
- const active = this.safeString(market, 'is_trading') === '1';
648
+ const active = this.safeString(market, 'status') === 'TRADING';
580
649
  return {
581
650
  'id': marketId,
582
651
  'symbol': symbol,
@@ -602,8 +671,8 @@ class woo extends woo$1 {
602
671
  'strike': undefined,
603
672
  'optionType': undefined,
604
673
  'precision': {
605
- 'amount': this.safeNumber(market, 'base_tick'),
606
- 'price': this.safeNumber(market, 'quote_tick'),
674
+ 'amount': this.safeNumber(market, 'baseTick'),
675
+ 'price': this.safeNumber(market, 'quoteTick'),
607
676
  },
608
677
  'limits': {
609
678
  'leverage': {
@@ -611,19 +680,19 @@ class woo extends woo$1 {
611
680
  'max': undefined,
612
681
  },
613
682
  'amount': {
614
- 'min': this.safeNumber(market, 'base_min'),
615
- 'max': this.safeNumber(market, 'base_max'),
683
+ 'min': this.safeNumber(market, 'baseMin'),
684
+ 'max': this.safeNumber(market, 'baseMax'),
616
685
  },
617
686
  'price': {
618
- 'min': this.safeNumber(market, 'quote_min'),
619
- 'max': this.safeNumber(market, 'quote_max'),
687
+ 'min': this.safeNumber(market, 'quoteMin'),
688
+ 'max': this.safeNumber(market, 'quoteMax'),
620
689
  },
621
690
  'cost': {
622
- 'min': this.safeNumber(market, 'min_notional'),
691
+ 'min': this.safeNumber(market, 'minNotional'),
623
692
  'max': undefined,
624
693
  },
625
694
  },
626
- 'created': this.safeTimestamp(market, 'created_time'),
695
+ 'created': undefined,
627
696
  'info': market,
628
697
  };
629
698
  }
@@ -631,7 +700,7 @@ class woo extends woo$1 {
631
700
  * @method
632
701
  * @name woo#fetchTrades
633
702
  * @description get the list of most recent trades for a particular symbol
634
- * @see https://docs.woox.io/#market-trades-public
703
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/marketTrades
635
704
  * @param {string} symbol unified symbol of the market to fetch trades for
636
705
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
637
706
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -647,38 +716,28 @@ class woo extends woo$1 {
647
716
  if (limit !== undefined) {
648
717
  request['limit'] = limit;
649
718
  }
650
- const response = await this.v1PublicGetMarketTrades(this.extend(request, params));
719
+ const response = await this.v3PublicGetMarketTrades(this.extend(request, params));
651
720
  //
652
- // {
653
- // "success": true,
654
- // "rows": [
655
- // {
656
- // "symbol": "SPOT_BTC_USDT",
657
- // "side": "SELL",
658
- // "executed_price": 46222.35,
659
- // "executed_quantity": 0.0012,
660
- // "executed_timestamp": "1641241162.329"
661
- // },
662
- // {
663
- // "symbol": "SPOT_BTC_USDT",
664
- // "side": "SELL",
665
- // "executed_price": 46222.35,
666
- // "executed_quantity": 0.0012,
667
- // "executed_timestamp": "1641241162.329"
668
- // },
669
- // {
670
- // "symbol": "SPOT_BTC_USDT",
671
- // "side": "BUY",
672
- // "executed_price": 46224.32,
673
- // "executed_quantity": 0.00039,
674
- // "executed_timestamp": "1641241162.287"
721
+ // {
722
+ // "success": true,
723
+ // "data": {
724
+ // "rows": [
725
+ // {
726
+ // "symbol": "SPOT_BTC_USDT",
727
+ // "side": "SELL",
728
+ // "source": 0,
729
+ // "executedPrice": "108741.01",
730
+ // "executedQuantity": "0.02477",
731
+ // "executedTimestamp": 1751513940144
732
+ // }
733
+ // ]
675
734
  // },
676
- // ...
677
- // ]
678
- // }
735
+ // "timestamp": 1751513988543
736
+ // }
679
737
  //
680
- const resultResponse = this.safeList(response, 'rows', []);
681
- return this.parseTrades(resultResponse, market, since, limit);
738
+ const data = this.safeDict(response, 'data', {});
739
+ const rows = this.safeList(data, 'rows', []);
740
+ return this.parseTrades(rows, market, since, limit);
682
741
  }
683
742
  parseTrade(trade, market = undefined) {
684
743
  //
@@ -687,36 +746,47 @@ class woo extends woo$1 {
687
746
  // {
688
747
  // "symbol": "SPOT_BTC_USDT",
689
748
  // "side": "SELL",
690
- // "executed_price": 46222.35,
691
- // "executed_quantity": 0.0012,
692
- // "executed_timestamp": "1641241162.329"
749
+ // "source": 0,
750
+ // "executedPrice": "108741.01",
751
+ // "executedQuantity": "0.02477",
752
+ // "executedTimestamp": 1751513940144
693
753
  // }
694
754
  //
695
755
  // fetchOrderTrades, fetchOrder
696
756
  //
697
757
  // {
698
- // "id": "99119876",
699
- // "symbol": "SPOT_WOO_USDT",
700
- // "fee": "0.0024",
758
+ // "id": 1734947821,
759
+ // "symbol": "SPOT_LTC_USDT",
760
+ // "orderId": 60780383217,
761
+ // "executedPrice": 87.86,
762
+ // "executedQuantity": 0.1,
763
+ // "fee": 0.0001,
764
+ // "realizedPnl": null,
765
+ // "feeAsset": "LTC",
766
+ // "orderTag": "default",
701
767
  // "side": "BUY",
702
- // "executed_timestamp": "1641481113.084",
703
- // "order_id": "87001234",
704
- // "order_tag": "default", <-- this param only in "fetchOrderTrades"
705
- // "executed_price": "1",
706
- // "executed_quantity": "12",
707
- // "fee_asset": "WOO",
708
- // "is_maker": "1"
768
+ // "executedTimestamp": "1752055173.630",
769
+ // "isMaker": 0
709
770
  // }
710
771
  //
711
772
  const isFromFetchOrder = ('id' in trade);
712
- const timestamp = this.safeTimestamp(trade, 'executed_timestamp');
773
+ const timestampString = this.safeString2(trade, 'executed_timestamp', 'executedTimestamp');
774
+ let timestamp = undefined;
775
+ if (timestampString !== undefined) {
776
+ if (timestampString.indexOf('.') > -1) {
777
+ timestamp = this.safeTimestamp2(trade, 'executed_timestamp', 'executedTimestamp');
778
+ }
779
+ else {
780
+ timestamp = this.safeInteger(trade, 'executedTimestamp');
781
+ }
782
+ }
713
783
  const marketId = this.safeString(trade, 'symbol');
714
784
  market = this.safeMarket(marketId, market);
715
785
  const symbol = market['symbol'];
716
- const price = this.safeString(trade, 'executed_price');
717
- const amount = this.safeString(trade, 'executed_quantity');
718
- const order_id = this.safeString(trade, 'order_id');
719
- const fee = this.parseTokenAndFeeTemp(trade, 'fee_asset', 'fee');
786
+ const price = this.safeString2(trade, 'executed_price', 'executedPrice');
787
+ const amount = this.safeString2(trade, 'executed_quantity', 'executedQuantity');
788
+ const order_id = this.safeString2(trade, 'order_id', 'orderId');
789
+ const fee = this.parseTokenAndFeeTemp(trade, ['fee_asset', 'feeAsset'], ['fee']);
720
790
  const feeCost = this.safeString(fee, 'cost');
721
791
  if (feeCost !== undefined) {
722
792
  fee['cost'] = feeCost;
@@ -726,7 +796,7 @@ class woo extends woo$1 {
726
796
  const id = this.safeString(trade, 'id');
727
797
  let takerOrMaker = undefined;
728
798
  if (isFromFetchOrder) {
729
- const isMaker = this.safeString(trade, 'is_maker') === '1';
799
+ const isMaker = this.safeString2(trade, 'is_maker', 'isMaker') === '1';
730
800
  takerOrMaker = isMaker ? 'maker' : 'taker';
731
801
  }
732
802
  return this.safeTrade({
@@ -745,11 +815,11 @@ class woo extends woo$1 {
745
815
  'info': trade,
746
816
  }, market);
747
817
  }
748
- parseTokenAndFeeTemp(item, feeTokenKey, feeAmountKey) {
749
- const feeCost = this.safeString(item, feeAmountKey);
818
+ parseTokenAndFeeTemp(item, feeTokenKeys, feeAmountKeys) {
819
+ const feeCost = this.safeStringN(item, feeAmountKeys);
750
820
  let fee = undefined;
751
821
  if (feeCost !== undefined) {
752
- const feeCurrencyId = this.safeString(item, feeTokenKey);
822
+ const feeCurrencyId = this.safeStringN(item, feeTokenKeys);
753
823
  const feeCurrencyCode = this.safeCurrencyCode(feeCurrencyId);
754
824
  fee = {
755
825
  'cost': feeCost,
@@ -758,43 +828,90 @@ class woo extends woo$1 {
758
828
  }
759
829
  return fee;
760
830
  }
831
+ parseTradingFee(fee, market = undefined) {
832
+ const marketId = this.safeString(fee, 'symbol');
833
+ const symbol = this.safeSymbol(marketId, market);
834
+ return {
835
+ 'info': fee,
836
+ 'symbol': symbol,
837
+ 'maker': this.parseNumber(Precise["default"].stringDiv(this.safeString(fee, 'makerFee'), '100')),
838
+ 'taker': this.parseNumber(Precise["default"].stringDiv(this.safeString(fee, 'takerFee'), '100')),
839
+ 'percentage': undefined,
840
+ 'tierBased': undefined,
841
+ };
842
+ }
843
+ /**
844
+ * @method
845
+ * @name woo#fetchTradingFee
846
+ * @description fetch the trading fees for a market
847
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_tradingFee
848
+ * @param {string} symbol unified market symbol
849
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
850
+ * @param {boolean} [params.portfolioMargin] set to true if you would like to fetch trading fees in a portfolio margin account
851
+ * @param {string} [params.subType] "linear" or "inverse"
852
+ * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
853
+ */
854
+ async fetchTradingFee(symbol, params = {}) {
855
+ await this.loadMarkets();
856
+ const market = this.market(symbol);
857
+ const request = {
858
+ 'symbol': market['id'],
859
+ };
860
+ const response = await this.v3PrivateGetTradeTradingFee(this.extend(request, params));
861
+ //
862
+ // {
863
+ // "success": true,
864
+ // "data": {
865
+ // "symbol": "SPOT_BTC_USDT",
866
+ // "takerFee": "10",
867
+ // "makerFee": "8"
868
+ // },
869
+ // "timestamp": 1751858977368
870
+ // }
871
+ //
872
+ const data = this.safeDict(response, 'data', {});
873
+ return this.parseTradingFee(data, market);
874
+ }
761
875
  /**
762
876
  * @method
763
877
  * @name woo#fetchTradingFees
764
878
  * @description fetch the trading fees for multiple markets
765
- * @see https://docs.woox.io/#get-account-information-new
879
+ * @see https://developer.woox.io/api-reference/endpoint/account/get_account_info
766
880
  * @param {object} [params] extra parameters specific to the exchange API endpoint
767
881
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
768
882
  */
769
883
  async fetchTradingFees(params = {}) {
770
884
  await this.loadMarkets();
771
- const response = await this.v3PrivateGetAccountinfo(params);
885
+ const response = await this.v3PrivateGetAccountInfo(params);
772
886
  //
773
887
  // {
774
888
  // "success": true,
775
889
  // "data": {
776
- // "applicationId": "dsa",
777
- // "account": "dsa",
778
- // "alias": "haha",
779
- // "accountMode": "MARGIN",
780
- // "leverage": 1,
781
- // "takerFeeRate": 1,
782
- // "makerFeeRate": 1,
783
- // "interestRate": 1,
784
- // "futuresTakerFeeRate": 1,
785
- // "futuresMakerFeeRate": 1,
890
+ // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
891
+ // "account": "carlos_jose_lima@yahoo.com",
892
+ // "alias": "carlos_jose_lima@yahoo.com",
786
893
  // "otpauth": true,
787
- // "marginRatio": 1,
788
- // "openMarginRatio": 1,
789
- // "initialMarginRatio": 1,
790
- // "maintenanceMarginRatio": 1,
791
- // "totalCollateral": 1,
792
- // "freeCollateral": 1,
793
- // "totalAccountValue": 1,
794
- // "totalVaultValue": 1,
795
- // "totalStakingValue": 1
894
+ // "accountMode": "FUTURES",
895
+ // "positionMode": "ONE_WAY",
896
+ // "leverage": 0,
897
+ // "makerFeeRate": 0,
898
+ // "takerFeeRate": 0,
899
+ // "marginRatio": "10",
900
+ // "openMarginRatio": "10",
901
+ // "initialMarginRatio": "10",
902
+ // "maintenanceMarginRatio": "0.03",
903
+ // "totalCollateral": "165.55629469",
904
+ // "freeCollateral": "165.55629469",
905
+ // "totalAccountValue": "167.32418611",
906
+ // "totalTradingValue": "167.32418611",
907
+ // "totalVaultValue": "0",
908
+ // "totalStakingValue": "0",
909
+ // "totalLaunchpadValue": "0",
910
+ // "totalEarnValue": "0",
911
+ // "referrerID": null,
912
+ // "accountType": "Main"
796
913
  // },
797
- // "timestamp": 1673323685109
914
+ // "timestamp": 1752062807915
798
915
  // }
799
916
  //
800
917
  const data = this.safeDict(response, 'data', {});
@@ -1058,8 +1175,8 @@ class woo extends woo$1 {
1058
1175
  * @method
1059
1176
  * @name woo#createOrder
1060
1177
  * @description create a trade order
1061
- * @see https://docs.woox.io/#send-order
1062
- * @see https://docs.woox.io/#send-algo-order
1178
+ * @see https://developer.woox.io/api-reference/endpoint/trading/post_order
1179
+ * @see https://developer.woox.io/api-reference/endpoint/trading/post_algo_order
1063
1180
  * @param {string} symbol unified symbol of the market to create an order in
1064
1181
  * @param {string} type 'market' or 'limit'
1065
1182
  * @param {string} side 'buy' or 'sell'
@@ -1094,7 +1211,7 @@ class woo extends woo$1 {
1094
1211
  let marginMode = undefined;
1095
1212
  [marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
1096
1213
  if (marginMode !== undefined) {
1097
- request['margin_mode'] = this.encodeMarginMode(marginMode);
1214
+ request['marginMode'] = this.encodeMarginMode(marginMode);
1098
1215
  }
1099
1216
  const triggerPrice = this.safeString2(params, 'triggerPrice', 'stopPrice');
1100
1217
  const stopLoss = this.safeValue(params, 'stopLoss');
@@ -1110,33 +1227,29 @@ class woo extends woo$1 {
1110
1227
  const isMarket = orderType === 'MARKET';
1111
1228
  const timeInForce = this.safeStringLower(params, 'timeInForce');
1112
1229
  const postOnly = this.isPostOnly(isMarket, undefined, params);
1113
- const reduceOnlyKey = isConditional ? 'reduceOnly' : 'reduce_only';
1114
- const clientOrderIdKey = isConditional ? 'clientOrderId' : 'client_order_id';
1115
- const orderQtyKey = isConditional ? 'quantity' : 'order_quantity';
1116
- const priceKey = isConditional ? 'price' : 'order_price';
1117
- const typeKey = isConditional ? 'type' : 'order_type';
1118
- request[typeKey] = orderType; // LIMIT/MARKET/IOC/FOK/POST_ONLY/ASK/BID
1230
+ const clientOrderIdKey = isConditional ? 'clientAlgoOrderId' : 'clientOrderId';
1231
+ request['type'] = orderType; // LIMIT/MARKET/IOC/FOK/POST_ONLY/ASK/BID
1119
1232
  if (!isConditional) {
1120
1233
  if (postOnly) {
1121
- request['order_type'] = 'POST_ONLY';
1234
+ request['type'] = 'POST_ONLY';
1122
1235
  }
1123
1236
  else if (timeInForce === 'fok') {
1124
- request['order_type'] = 'FOK';
1237
+ request['type'] = 'FOK';
1125
1238
  }
1126
1239
  else if (timeInForce === 'ioc') {
1127
- request['order_type'] = 'IOC';
1240
+ request['type'] = 'IOC';
1128
1241
  }
1129
1242
  }
1130
1243
  if (reduceOnly) {
1131
- request[reduceOnlyKey] = reduceOnly;
1244
+ request['reduceOnly'] = reduceOnly;
1132
1245
  }
1133
1246
  if (!isMarket && price !== undefined) {
1134
- request[priceKey] = this.priceToPrecision(symbol, price);
1247
+ request['price'] = this.priceToPrecision(symbol, price);
1135
1248
  }
1136
1249
  if (isMarket && !isConditional) {
1137
1250
  // for market buy it requires the amount of quote currency to spend
1138
- const cost = this.safeString2(params, 'cost', 'order_amount');
1139
- params = this.omit(params, ['cost', 'order_amount']);
1251
+ const cost = this.safeStringN(params, ['cost', 'order_amount', 'orderAmount']);
1252
+ params = this.omit(params, ['cost', 'order_amount', 'orderAmount']);
1140
1253
  const isPriceProvided = price !== undefined;
1141
1254
  if (market['spot'] && (isPriceProvided || (cost !== undefined))) {
1142
1255
  let quoteAmount = undefined;
@@ -1149,14 +1262,14 @@ class woo extends woo$1 {
1149
1262
  const costRequest = Precise["default"].stringMul(amountString, priceString);
1150
1263
  quoteAmount = this.costToPrecision(symbol, costRequest);
1151
1264
  }
1152
- request['order_amount'] = quoteAmount;
1265
+ request['amount'] = quoteAmount;
1153
1266
  }
1154
1267
  else {
1155
- request['order_quantity'] = this.amountToPrecision(symbol, amount);
1268
+ request['quantity'] = this.amountToPrecision(symbol, amount);
1156
1269
  }
1157
1270
  }
1158
1271
  else if (algoType !== 'POSITIONAL_TP_SL') {
1159
- request[orderQtyKey] = this.amountToPrecision(symbol, amount);
1272
+ request['quantity'] = this.amountToPrecision(symbol, amount);
1160
1273
  }
1161
1274
  const clientOrderId = this.safeStringN(params, ['clOrdID', 'clientOrderId', 'client_order_id']);
1162
1275
  if (clientOrderId !== undefined) {
@@ -1219,44 +1332,46 @@ class woo extends woo$1 {
1219
1332
  params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id', 'postOnly', 'timeInForce', 'stopPrice', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingPercent', 'trailingAmount', 'trailingTriggerPrice']);
1220
1333
  let response = undefined;
1221
1334
  if (isConditional) {
1222
- response = await this.v3PrivatePostAlgoOrder(this.extend(request, params));
1335
+ response = await this.v3PrivatePostTradeAlgoOrder(this.extend(request, params));
1336
+ //
1337
+ // {
1338
+ // "success": true,
1339
+ // "data": {
1340
+ // "rows": [
1341
+ // {
1342
+ // "orderId": "1578938",
1343
+ // "clientOrderId": "0",
1344
+ // "algoType": "STOP_LOSS",
1345
+ // "quantity": "0.1"
1346
+ // }
1347
+ // ]
1348
+ // },
1349
+ // "timestamp": "1686149372216"
1350
+ // }
1351
+ //
1223
1352
  }
1224
1353
  else {
1225
- response = await this.v1PrivatePostOrder(this.extend(request, params));
1226
- }
1227
- // {
1228
- // "success": true,
1229
- // "timestamp": "1641383206.489",
1230
- // "order_id": "86980774",
1231
- // "order_type": "LIMIT",
1232
- // "order_price": "1", // null for "MARKET" order
1233
- // "order_quantity": "12", // null for "MARKET" order
1234
- // "order_amount": null, // NOT-null for "MARKET" order
1235
- // "client_order_id": "0"
1236
- // }
1237
- // stop orders
1238
- // {
1239
- // "success": true,
1240
- // "data": {
1241
- // "rows": [
1242
- // {
1243
- // "orderId": "1578938",
1244
- // "clientOrderId": "0",
1245
- // "algoType": "STOP_LOSS",
1246
- // "quantity": "0.1"
1247
- // }
1248
- // ]
1249
- // },
1250
- // "timestamp": "1686149372216"
1251
- // }
1252
- const data = this.safeDict(response, 'data');
1253
- if (data !== undefined) {
1254
- const rows = this.safeList(data, 'rows', []);
1255
- return this.parseOrder(rows[0], market);
1354
+ response = await this.v3PrivatePostTradeOrder(this.extend(request, params));
1355
+ //
1356
+ // {
1357
+ // "success": true,
1358
+ // "data": {
1359
+ // "orderId": 60667653330,
1360
+ // "clientOrderId": 0,
1361
+ // "type": "LIMIT",
1362
+ // "price": 60,
1363
+ // "quantity": 0.1,
1364
+ // "amount": null,
1365
+ // "bidAskLevel": null
1366
+ // },
1367
+ // "timestamp": 1751871779855
1368
+ // }
1369
+ //
1256
1370
  }
1257
- const order = this.parseOrder(response, market);
1258
- order['type'] = type;
1259
- return order;
1371
+ let data = this.safeDict(response, 'data', {});
1372
+ data = this.safeDict(this.safeList(data, 'rows'), 0, data);
1373
+ data['timestamp'] = this.safeString(response, 'timestamp');
1374
+ return this.parseOrder(data, market);
1260
1375
  }
1261
1376
  encodeMarginMode(mode) {
1262
1377
  const modes = {
@@ -1365,9 +1480,8 @@ class woo extends woo$1 {
1365
1480
  /**
1366
1481
  * @method
1367
1482
  * @name woo#cancelOrder
1368
- * @see https://docs.woox.io/#cancel-algo-order
1369
- * @see https://docs.woox.io/#cancel-order
1370
- * @see https://docs.woox.io/#cancel-order-by-client_order_id
1483
+ * @see https://developer.woox.io/api-reference/endpoint/trading/cancel_order
1484
+ * @see https://developer.woox.io/api-reference/endpoint/trading/cancel_algo_order
1371
1485
  * @description cancels an open order
1372
1486
  * @param {string} id order id
1373
1487
  * @param {string} symbol unified symbol of the market the order was made in
@@ -1389,42 +1503,52 @@ class woo extends woo$1 {
1389
1503
  const request = {};
1390
1504
  const clientOrderIdUnified = this.safeString2(params, 'clOrdID', 'clientOrderId');
1391
1505
  const clientOrderIdExchangeSpecific = this.safeString(params, 'client_order_id', clientOrderIdUnified);
1506
+ params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id']);
1392
1507
  const isByClientOrder = clientOrderIdExchangeSpecific !== undefined;
1393
1508
  let response = undefined;
1394
1509
  if (isTrigger) {
1395
- request['order_id'] = id;
1396
- response = await this.v3PrivateDeleteAlgoOrderOrderId(this.extend(request, params));
1510
+ if (isByClientOrder) {
1511
+ request['clientAlgoOrderId'] = clientOrderIdExchangeSpecific;
1512
+ }
1513
+ else {
1514
+ request['algoOrderId'] = id;
1515
+ }
1516
+ response = await this.v3PrivateDeleteTradeAlgoOrder(this.extend(request, params));
1397
1517
  }
1398
1518
  else {
1399
1519
  request['symbol'] = market['id'];
1400
1520
  if (isByClientOrder) {
1401
- request['client_order_id'] = clientOrderIdExchangeSpecific;
1402
- params = this.omit(params, ['clOrdID', 'clientOrderId', 'client_order_id']);
1403
- response = await this.v1PrivateDeleteClientOrder(this.extend(request, params));
1521
+ request['clientOrderId'] = clientOrderIdExchangeSpecific;
1404
1522
  }
1405
1523
  else {
1406
- request['order_id'] = id;
1407
- response = await this.v1PrivateDeleteOrder(this.extend(request, params));
1524
+ request['orderId'] = id;
1408
1525
  }
1526
+ response = await this.v3PrivateDeleteTradeOrder(this.extend(request, params));
1409
1527
  }
1410
1528
  //
1411
- // { success: true, status: "CANCEL_SENT" }
1529
+ // {
1530
+ // "success": true,
1531
+ // "data": {
1532
+ // "status": "CANCEL_SENT"
1533
+ // },
1534
+ // "timestamp": 1751940315838
1535
+ // }
1412
1536
  //
1413
- const extendParams = { 'symbol': symbol };
1537
+ const data = this.safeDict(response, 'data', {});
1538
+ data['timestamp'] = this.safeString(response, 'timestamp');
1414
1539
  if (isByClientOrder) {
1415
- extendParams['client_order_id'] = clientOrderIdExchangeSpecific;
1540
+ data['clientOrderId'] = clientOrderIdExchangeSpecific;
1416
1541
  }
1417
1542
  else {
1418
- extendParams['id'] = id;
1543
+ data['orderId'] = id;
1419
1544
  }
1420
- return this.extend(this.parseOrder(response), extendParams);
1545
+ return this.parseOrder(data, market);
1421
1546
  }
1422
1547
  /**
1423
1548
  * @method
1424
1549
  * @name woo#cancelAllOrders
1425
- * @see https://docs.woox.io/#cancel-all-pending-orders
1426
- * @see https://docs.woox.io/#cancel-orders
1427
- * @see https://docs.woox.io/#cancel-all-pending-algo-orders
1550
+ * @see https://developer.woox.io/api-reference/endpoint/trading/cancel_all_order
1551
+ * @see https://developer.woox.io/api-reference/endpoint/trading/cancel_algo_orders
1428
1552
  * @description cancel all open orders in a market
1429
1553
  * @param {string} symbol unified market symbol
1430
1554
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1435,32 +1559,35 @@ class woo extends woo$1 {
1435
1559
  await this.loadMarkets();
1436
1560
  const trigger = this.safeBool2(params, 'stop', 'trigger');
1437
1561
  params = this.omit(params, ['stop', 'trigger']);
1562
+ const request = {};
1563
+ if (symbol !== undefined) {
1564
+ const market = this.market(symbol);
1565
+ request['symbol'] = market['id'];
1566
+ }
1567
+ let response = undefined;
1438
1568
  if (trigger) {
1439
- return await this.v3PrivateDeleteAlgoOrdersPending(params);
1569
+ response = await this.v3PrivateDeleteTradeAlgoOrders(params);
1440
1570
  }
1441
- if (symbol === undefined) {
1442
- throw new errors.ArgumentsRequired(this.id + ' cancelOrders() requires a symbol argument');
1571
+ else {
1572
+ response = await this.v3PrivateDeleteTradeOrders(this.extend(request, params));
1443
1573
  }
1444
- const market = this.market(symbol);
1445
- const request = {
1446
- 'symbol': market['id'],
1447
- };
1448
- const response = await this.v1PrivateDeleteOrders(this.extend(request, params));
1449
1574
  //
1450
1575
  // {
1451
- // "success":true,
1452
- // "status":"CANCEL_ALL_SENT"
1576
+ // "success": true,
1577
+ // "data": {
1578
+ // "status": "CANCEL_ALL_SENT"
1579
+ // },
1580
+ // "timestamp": 1751941988134
1453
1581
  // }
1454
1582
  //
1455
- return [
1456
- this.safeOrder(response),
1457
- ];
1583
+ const data = this.safeDict(response, 'data', {});
1584
+ return [this.safeOrder({ 'info': data })];
1458
1585
  }
1459
1586
  /**
1460
1587
  * @method
1461
1588
  * @name woo#cancelAllOrdersAfter
1462
1589
  * @description dead man's switch, cancel all orders after the given timeout
1463
- * @see https://docs.woox.io/#cancel-all-after
1590
+ * @see https://developer.woox.io/api-reference/endpoint/trading/cancel_all_after
1464
1591
  * @param {number} timeout time in milliseconds, 0 represents cancel the timer
1465
1592
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1466
1593
  * @returns {object} the api result
@@ -1468,27 +1595,25 @@ class woo extends woo$1 {
1468
1595
  async cancelAllOrdersAfter(timeout, params = {}) {
1469
1596
  await this.loadMarkets();
1470
1597
  const request = {
1471
- 'trigger_after': (timeout > 0) ? timeout : 0,
1598
+ 'triggerAfter': (timeout > 0) ? Math.min(timeout, 900000) : 0,
1472
1599
  };
1473
- const response = await this.v1PrivatePostOrderCancelAllAfter(this.extend(request, params));
1600
+ const response = await this.v3PrivatePostTradeCancelAllAfter(this.extend(request, params));
1474
1601
  //
1475
- // {
1476
- // "success": true,
1477
- // "data": {
1478
- // "expected_trigger_time": 1711534302938
1479
- // },
1480
- // "timestamp": 1711534302943
1602
+ // {
1603
+ // "success": true,
1604
+ // "timestamp": 123,
1605
+ // "data": {
1606
+ // "expectedTriggerTime": 123
1481
1607
  // }
1608
+ // }
1482
1609
  //
1483
- return [
1484
- this.safeOrder(response),
1485
- ];
1610
+ return response;
1486
1611
  }
1487
1612
  /**
1488
1613
  * @method
1489
1614
  * @name woo#fetchOrder
1490
- * @see https://docs.woox.io/#get-algo-order
1491
- * @see https://docs.woox.io/#get-order
1615
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_order
1616
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_algo_order
1492
1617
  * @description fetches information on an order made by the user
1493
1618
  * @param {string} id the order id
1494
1619
  * @param {string} symbol unified symbol of the market the order was made in
@@ -1498,68 +1623,109 @@ class woo extends woo$1 {
1498
1623
  */
1499
1624
  async fetchOrder(id, symbol = undefined, params = {}) {
1500
1625
  await this.loadMarkets();
1501
- const market = (symbol !== undefined) ? this.market(symbol) : undefined;
1626
+ let market = undefined;
1627
+ if (symbol !== undefined) {
1628
+ market = this.market(symbol);
1629
+ }
1502
1630
  const trigger = this.safeBool2(params, 'stop', 'trigger');
1503
1631
  params = this.omit(params, ['stop', 'trigger']);
1504
1632
  const request = {};
1505
1633
  const clientOrderId = this.safeString2(params, 'clOrdID', 'clientOrderId');
1506
1634
  let response = undefined;
1507
1635
  if (trigger) {
1508
- request['oid'] = id;
1509
- response = await this.v3PrivateGetAlgoOrderOid(this.extend(request, params));
1510
- }
1511
- else if (clientOrderId) {
1512
- request['client_order_id'] = clientOrderId;
1513
- response = await this.v1PrivateGetClientOrderClientOrderId(this.extend(request, params));
1636
+ if (clientOrderId !== undefined) {
1637
+ request['clientAlgoOrderId'] = id;
1638
+ }
1639
+ else {
1640
+ request['algoOrderId'] = id;
1641
+ }
1642
+ response = await this.v3PrivateGetTradeAlgoOrder(this.extend(request, params));
1643
+ //
1644
+ // {
1645
+ // "success": true,
1646
+ // "data": {
1647
+ // "algoOrderId": 10399260,
1648
+ // "clientAlgoOrderId": 0,
1649
+ // "rootAlgoOrderId": 10399260,
1650
+ // "parentAlgoOrderId": 0,
1651
+ // "symbol": "SPOT_LTC_USDT",
1652
+ // "algoOrderTag": "default",
1653
+ // "algoType": "TAKE_PROFIT",
1654
+ // "side": "BUY",
1655
+ // "quantity": 0.1,
1656
+ // "isTriggered": false,
1657
+ // "triggerPrice": 65,
1658
+ // "triggerStatus": "USELESS",
1659
+ // "type": "LIMIT",
1660
+ // "rootAlgoStatus": "NEW",
1661
+ // "algoStatus": "NEW",
1662
+ // "triggerPriceType": "MARKET_PRICE",
1663
+ // "price": 60,
1664
+ // "triggerTime": "0",
1665
+ // "totalExecutedQuantity": 0,
1666
+ // "visibleQuantity": 0.1,
1667
+ // "averageExecutedPrice": 0,
1668
+ // "totalFee": 0,
1669
+ // "feeAsset": "",
1670
+ // "totalRebate": 0,
1671
+ // "rebateAsset": "",
1672
+ // "reduceOnly": false,
1673
+ // "createdTime": "1752049747.732",
1674
+ // "updatedTime": "1752049747.732",
1675
+ // "positionSide": "BOTH"
1676
+ // },
1677
+ // "timestamp": 1752049767550
1678
+ // }
1679
+ //
1514
1680
  }
1515
1681
  else {
1516
- request['oid'] = id;
1517
- response = await this.v1PrivateGetOrderOid(this.extend(request, params));
1682
+ if (clientOrderId !== undefined) {
1683
+ request['clientOrderId'] = clientOrderId;
1684
+ }
1685
+ else {
1686
+ request['orderId'] = id;
1687
+ }
1688
+ response = await this.v3PrivateGetTradeOrder(this.extend(request, params));
1689
+ //
1690
+ // {
1691
+ // "success": true,
1692
+ // "data": {
1693
+ // "orderId": 60780315704,
1694
+ // "clientOrderId": 0,
1695
+ // "symbol": "SPOT_LTC_USDT",
1696
+ // "orderTag": "default",
1697
+ // "side": "BUY",
1698
+ // "quantity": 0.1,
1699
+ // "amount": null,
1700
+ // "type": "LIMIT",
1701
+ // "status": "NEW",
1702
+ // "price": 60,
1703
+ // "executed": 0,
1704
+ // "visible": 0.1,
1705
+ // "averageExecutedPrice": 0,
1706
+ // "totalFee": 0,
1707
+ // "feeAsset": "LTC",
1708
+ // "totalRebate": 0,
1709
+ // "rebateAsset": "USDT",
1710
+ // "reduceOnly": false,
1711
+ // "createdTime": "1752049062.496",
1712
+ // "realizedPnl": null,
1713
+ // "positionSide": "BOTH",
1714
+ // "bidAskLevel": null
1715
+ // },
1716
+ // "timestamp": 1752049393466
1717
+ // }
1718
+ //
1518
1719
  }
1519
- //
1520
- // {
1521
- // "success": true,
1522
- // "symbol": "SPOT_WOO_USDT",
1523
- // "status": "FILLED", // FILLED, NEW
1524
- // "side": "BUY",
1525
- // "created_time": "1641480933.000",
1526
- // "order_id": "87541111",
1527
- // "order_tag": "default",
1528
- // "price": "1",
1529
- // "type": "LIMIT",
1530
- // "quantity": "12",
1531
- // "amount": null,
1532
- // "visible": "12",
1533
- // "executed": "12", // or any partial amount
1534
- // "total_fee": "0.0024",
1535
- // "fee_asset": "WOO",
1536
- // "client_order_id": null,
1537
- // "average_executed_price": "1",
1538
- // "Transactions": [
1539
- // {
1540
- // "id": "99111647",
1541
- // "symbol": "SPOT_WOO_USDT",
1542
- // "fee": "0.0024",
1543
- // "side": "BUY",
1544
- // "executed_timestamp": "1641482113.084",
1545
- // "order_id": "87541111",
1546
- // "executed_price": "1",
1547
- // "executed_quantity": "12",
1548
- // "fee_asset": "WOO",
1549
- // "is_maker": "1"
1550
- // }
1551
- // ]
1552
- // }
1553
- //
1554
- const orders = this.safeDict(response, 'data', response);
1555
- return this.parseOrder(orders, market);
1720
+ const data = this.safeDict(response, 'data', {});
1721
+ return this.parseOrder(data, market);
1556
1722
  }
1557
1723
  /**
1558
1724
  * @method
1559
1725
  * @name woo#fetchOrders
1560
1726
  * @description fetches information on multiple orders made by the user
1561
- * @see https://docs.woox.io/#get-orders
1562
- * @see https://docs.woox.io/#get-algo-orders
1727
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_orders
1728
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_algo_orders
1563
1729
  * @param {string} symbol unified market symbol of the market orders were made in
1564
1730
  * @param {int} [since] the earliest time in ms to fetch orders for
1565
1731
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1567,7 +1733,6 @@ class woo extends woo$1 {
1567
1733
  * @param {boolean} [params.trigger] whether the order is a trigger/algo order
1568
1734
  * @param {boolean} [params.isTriggered] whether the order has been triggered (false by default)
1569
1735
  * @param {string} [params.side] 'buy' or 'sell'
1570
- * @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
1571
1736
  * @param {boolean} [params.paginate] set to true if you want to fetch orders with pagination
1572
1737
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1573
1738
  */
@@ -1581,80 +1746,124 @@ class woo extends woo$1 {
1581
1746
  const request = {};
1582
1747
  let market = undefined;
1583
1748
  const trigger = this.safeBool2(params, 'stop', 'trigger');
1584
- const trailing = this.safeBool(params, 'trailing', false);
1585
- params = this.omit(params, ['stop', 'trailing', 'trigger']);
1749
+ params = this.omit(params, ['stop', 'trigger']);
1586
1750
  if (symbol !== undefined) {
1587
1751
  market = this.market(symbol);
1588
1752
  request['symbol'] = market['id'];
1589
1753
  }
1590
1754
  if (since !== undefined) {
1591
- if (trigger || trailing) {
1592
- request['createdTimeStart'] = since;
1593
- }
1594
- else {
1595
- request['start_t'] = since;
1596
- }
1597
- }
1598
- if (limit !== undefined) {
1599
- request['size'] = limit;
1600
- }
1601
- else {
1602
- request['size'] = trailing ? 50 : 500;
1755
+ request['startTime'] = since;
1603
1756
  }
1604
- if (trigger) {
1605
- request['algoType'] = 'stop';
1757
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
1758
+ params = this.omit(params, ['until']);
1759
+ if (until !== undefined) {
1760
+ request['endTime'] = until;
1606
1761
  }
1607
- else if (trailing) {
1608
- request['algoType'] = 'TRAILING_STOP';
1762
+ if (limit !== undefined) {
1763
+ request['size'] = Math.min(limit, 500);
1609
1764
  }
1610
1765
  let response = undefined;
1611
- if (trigger || trailing) {
1612
- response = await this.v3PrivateGetAlgoOrders(this.extend(request, params));
1766
+ if (trigger) {
1767
+ response = await this.v3PrivateGetTradeAlgoOrders(this.extend(request, params));
1768
+ //
1769
+ // {
1770
+ // "success": true,
1771
+ // "data": {
1772
+ // "rows": [
1773
+ // {
1774
+ // "algoOrderId": 10399260,
1775
+ // "clientAlgoOrderId": 0,
1776
+ // "rootAlgoOrderId": 10399260,
1777
+ // "parentAlgoOrderId": 0,
1778
+ // "symbol": "SPOT_LTC_USDT",
1779
+ // "algoOrderTag": "default",
1780
+ // "algoType": "TAKE_PROFIT",
1781
+ // "side": "BUY",
1782
+ // "quantity": 0.1,
1783
+ // "isTriggered": false,
1784
+ // "triggerPrice": 65,
1785
+ // "triggerStatus": "USELESS",
1786
+ // "type": "LIMIT",
1787
+ // "rootAlgoStatus": "NEW",
1788
+ // "algoStatus": "NEW",
1789
+ // "triggerPriceType": "MARKET_PRICE",
1790
+ // "price": 60,
1791
+ // "triggerTime": "0",
1792
+ // "totalExecutedQuantity": 0,
1793
+ // "visibleQuantity": 0.1,
1794
+ // "averageExecutedPrice": 0,
1795
+ // "totalFee": 0,
1796
+ // "feeAsset": "",
1797
+ // "totalRebate": 0,
1798
+ // "rebateAsset": "",
1799
+ // "reduceOnly": false,
1800
+ // "createdTime": "1752049747.730",
1801
+ // "updatedTime": "1752049747.730",
1802
+ // "positionSide": "BOTH"
1803
+ // }
1804
+ // ],
1805
+ // "meta": {
1806
+ // "total": 7,
1807
+ // "recordsPerPage": 1,
1808
+ // "currentPage": 1
1809
+ // }
1810
+ // },
1811
+ // "timestamp": 1752053127448
1812
+ // }
1813
+ //
1613
1814
  }
1614
1815
  else {
1615
- response = await this.v1PrivateGetOrders(this.extend(request, params));
1816
+ response = await this.v3PrivateGetTradeOrders(this.extend(request, params));
1817
+ //
1818
+ // {
1819
+ // "success": true,
1820
+ // "data": {
1821
+ // "rows": [
1822
+ // {
1823
+ // "orderId": 60780315704,
1824
+ // "clientOrderId": 0,
1825
+ // "symbol": "SPOT_LTC_USDT",
1826
+ // "orderTag": "default",
1827
+ // "side": "BUY",
1828
+ // "quantity": 0.1,
1829
+ // "amount": null,
1830
+ // "type": "LIMIT",
1831
+ // "status": "NEW",
1832
+ // "price": 60,
1833
+ // "executed": 0,
1834
+ // "visible": 0.1,
1835
+ // "averageExecutedPrice": 0,
1836
+ // "totalFee": 0,
1837
+ // "feeAsset": "LTC",
1838
+ // "totalRebate": 0,
1839
+ // "rebateAsset": "USDT",
1840
+ // "reduceOnly": false,
1841
+ // "createdTime": "1752049062.496",
1842
+ // "realizedPnl": null,
1843
+ // "positionSide": "BOTH",
1844
+ // "bidAskLevel": null
1845
+ // }
1846
+ // ],
1847
+ // "meta": {
1848
+ // "total": 11,
1849
+ // "recordsPerPage": 1,
1850
+ // "currentPage": 1
1851
+ // }
1852
+ // },
1853
+ // "timestamp": 1752053061236
1854
+ // }
1855
+ //
1616
1856
  }
1617
- //
1618
- // {
1619
- // "success":true,
1620
- // "meta":{
1621
- // "total":1,
1622
- // "records_per_page":100,
1623
- // "current_page":1
1624
- // },
1625
- // "rows":[
1626
- // {
1627
- // "symbol":"PERP_BTC_USDT",
1628
- // "status":"FILLED",
1629
- // "side":"SELL",
1630
- // "created_time":"1611617776.000",
1631
- // "updated_time":"1611617776.000",
1632
- // "order_id":52121167,
1633
- // "order_tag":"default",
1634
- // "price":null,
1635
- // "type":"MARKET",
1636
- // "quantity":0.002,
1637
- // "amount":null,
1638
- // "visible":0,
1639
- // "executed":0.002,
1640
- // "total_fee":0.01732885,
1641
- // "fee_asset":"USDT",
1642
- // "client_order_id":null,
1643
- // "average_executed_price":28881.41
1644
- // }
1645
- // ]
1646
- // }
1647
- //
1648
- const data = this.safeValue(response, 'data', response);
1649
- const orders = this.safeList(data, 'rows');
1857
+ const data = this.safeValue(response, 'data', {});
1858
+ const orders = this.safeList(data, 'rows', []);
1650
1859
  return this.parseOrders(orders, market, since, limit);
1651
1860
  }
1652
1861
  /**
1653
1862
  * @method
1654
1863
  * @name woo#fetchOpenOrders
1655
1864
  * @description fetches information on multiple orders made by the user
1656
- * @see https://docs.woox.io/#get-orders
1657
- * @see https://docs.woox.io/#get-algo-orders
1865
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_orders
1866
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_algo_orders
1658
1867
  * @param {string} symbol unified market symbol of the market orders were made in
1659
1868
  * @param {int} [since] the earliest time in ms to fetch orders for
1660
1869
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1675,8 +1884,8 @@ class woo extends woo$1 {
1675
1884
  * @method
1676
1885
  * @name woo#fetchClosedOrders
1677
1886
  * @description fetches information on multiple orders made by the user
1678
- * @see https://docs.woox.io/#get-orders
1679
- * @see https://docs.woox.io/#get-algo-orders
1887
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_orders
1888
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_algo_orders
1680
1889
  * @param {string} symbol unified market symbol of the market orders were made in
1681
1890
  * @param {int} [since] the earliest time in ms to fetch orders for
1682
1891
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -1703,83 +1912,108 @@ class woo extends woo$1 {
1703
1912
  }
1704
1913
  parseOrder(order, market = undefined) {
1705
1914
  //
1706
- // Possible input functions:
1707
- // * createOrder
1708
- // * cancelOrder
1709
- // * fetchOrder
1710
- // * fetchOrders
1711
- // const isFromFetchOrder = ('order_tag' in order); TO_DO
1712
- //
1713
- // stop order after creating it:
1714
- // {
1715
- // "orderId": "1578938",
1716
- // "clientOrderId": "0",
1717
- // "algoType": "STOP_LOSS",
1718
- // "quantity": "0.1"
1719
- // }
1720
- // stop order after fetching it:
1721
- // {
1722
- // "algoOrderId": "1578958",
1723
- // "clientOrderId": "0",
1724
- // "rootAlgoOrderId": "1578958",
1725
- // "parentAlgoOrderId": "0",
1726
- // "symbol": "SPOT_LTC_USDT",
1727
- // "orderTag": "default",
1728
- // "algoType": "STOP_LOSS",
1729
- // "side": "BUY",
1730
- // "quantity": "0.1",
1731
- // "isTriggered": false,
1732
- // "triggerPrice": "100",
1733
- // "triggerStatus": "USELESS",
1734
- // "type": "LIMIT",
1735
- // "rootAlgoStatus": "CANCELLED",
1736
- // "algoStatus": "CANCELLED",
1737
- // "triggerPriceType": "MARKET_PRICE",
1738
- // "price": "75",
1739
- // "triggerTime": "0",
1740
- // "totalExecutedQuantity": "0",
1741
- // "averageExecutedPrice": "0",
1742
- // "totalFee": "0",
1743
- // "feeAsset": '',
1744
- // "reduceOnly": false,
1745
- // "createdTime": "1686149609.744",
1746
- // "updatedTime": "1686149903.362"
1747
- // }
1748
- //
1749
- const timestamp = this.safeTimestampN(order, ['timestamp', 'created_time', 'createdTime']);
1750
- const orderId = this.safeStringN(order, ['order_id', 'orderId', 'algoOrderId']);
1751
- const clientOrderId = this.omitZero(this.safeString2(order, 'client_order_id', 'clientOrderId')); // Somehow, this always returns 0 for limit order
1915
+ // createOrder
1916
+ // {
1917
+ // "orderId": 60667653330,
1918
+ // "clientOrderId": 0,
1919
+ // "type": "LIMIT",
1920
+ // "price": 60,
1921
+ // "quantity": 0.1,
1922
+ // "amount": null,
1923
+ // "bidAskLevel": null,
1924
+ // "timestamp": 1751871779855
1925
+ // }
1926
+ //
1927
+ // createOrder - algo
1928
+ // {
1929
+ // "orderId": "1578938",
1930
+ // "clientOrderId": "0",
1931
+ // "algoType": "STOP_LOSS",
1932
+ // "quantity": "0.1",
1933
+ // "timestamp": "1686149372216"
1934
+ // }
1935
+ //
1936
+ // fetchOrder
1937
+ // {
1938
+ // "orderId": 60780315704,
1939
+ // "clientOrderId": 0,
1940
+ // "symbol": "SPOT_LTC_USDT",
1941
+ // "orderTag": "default",
1942
+ // "side": "BUY",
1943
+ // "quantity": 0.1,
1944
+ // "amount": null,
1945
+ // "type": "LIMIT",
1946
+ // "status": "NEW",
1947
+ // "price": 60,
1948
+ // "executed": 0,
1949
+ // "visible": 0.1,
1950
+ // "averageExecutedPrice": 0,
1951
+ // "totalFee": 0,
1952
+ // "feeAsset": "LTC",
1953
+ // "totalRebate": 0,
1954
+ // "rebateAsset": "USDT",
1955
+ // "reduceOnly": false,
1956
+ // "createdTime": "1752049062.496",
1957
+ // "realizedPnl": null,
1958
+ // "positionSide": "BOTH",
1959
+ // "bidAskLevel": null
1960
+ // }
1961
+ //
1962
+ // fetchOrder - algo
1963
+ // {
1964
+ // "algoOrderId": 10399260,
1965
+ // "clientAlgoOrderId": 0,
1966
+ // "rootAlgoOrderId": 10399260,
1967
+ // "parentAlgoOrderId": 0,
1968
+ // "symbol": "SPOT_LTC_USDT",
1969
+ // "algoOrderTag": "default",
1970
+ // "algoType": "TAKE_PROFIT",
1971
+ // "side": "BUY",
1972
+ // "quantity": 0.1,
1973
+ // "isTriggered": false,
1974
+ // "triggerPrice": 65,
1975
+ // "triggerStatus": "USELESS",
1976
+ // "type": "LIMIT",
1977
+ // "rootAlgoStatus": "NEW",
1978
+ // "algoStatus": "NEW",
1979
+ // "triggerPriceType": "MARKET_PRICE",
1980
+ // "price": 60,
1981
+ // "triggerTime": "0",
1982
+ // "totalExecutedQuantity": 0,
1983
+ // "visibleQuantity": 0.1,
1984
+ // "averageExecutedPrice": 0,
1985
+ // "totalFee": 0,
1986
+ // "feeAsset": "",
1987
+ // "totalRebate": 0,
1988
+ // "rebateAsset": "",
1989
+ // "reduceOnly": false,
1990
+ // "createdTime": "1752049747.732",
1991
+ // "updatedTime": "1752049747.732",
1992
+ // "positionSide": "BOTH"
1993
+ // }
1994
+ //
1995
+ let timestamp = this.safeTimestamp(order, 'createdTime');
1996
+ if (timestamp === undefined) {
1997
+ timestamp = this.safeInteger(order, 'timestamp');
1998
+ }
1999
+ const orderId = this.safeString2(order, 'orderId', 'algoOrderId');
2000
+ const clientOrderId = this.omitZero(this.safeString2(order, 'clientOrderId', 'clientAlgoOrderId')); // Somehow, this always returns 0 for limit order
1752
2001
  const marketId = this.safeString(order, 'symbol');
1753
2002
  market = this.safeMarket(marketId, market);
1754
2003
  const symbol = market['symbol'];
1755
- const price = this.safeString2(order, 'order_price', 'price');
1756
- const amount = this.safeString2(order, 'order_quantity', 'quantity'); // This is base amount
1757
- const cost = this.safeString2(order, 'order_amount', 'amount'); // This is quote amount
1758
- const orderType = this.safeStringLower2(order, 'order_type', 'type');
2004
+ const price = this.safeString(order, 'price');
2005
+ const amount = this.safeString(order, 'quantity'); // This is base amount
2006
+ const cost = this.safeString(order, 'amount'); // This is quote amount
2007
+ const orderType = this.safeStringLower(order, 'type');
1759
2008
  const status = this.safeValue2(order, 'status', 'algoStatus');
1760
2009
  const side = this.safeStringLower(order, 'side');
1761
2010
  const filled = this.omitZero(this.safeValue2(order, 'executed', 'totalExecutedQuantity'));
1762
- const average = this.omitZero(this.safeString2(order, 'average_executed_price', 'averageExecutedPrice'));
2011
+ const average = this.omitZero(this.safeString(order, 'averageExecutedPrice'));
1763
2012
  // const remaining = Precise.stringSub (cost, filled);
1764
- const fee = this.safeNumber2(order, 'total_fee', 'totalFee');
1765
- const feeCurrency = this.safeString2(order, 'fee_asset', 'feeAsset');
1766
- const transactions = this.safeValue(order, 'Transactions');
2013
+ const fee = this.safeNumber(order, 'totalFee');
2014
+ const feeCurrency = this.safeString(order, 'feeAsset');
1767
2015
  const triggerPrice = this.safeNumber(order, 'triggerPrice');
1768
- let takeProfitPrice = undefined;
1769
- let stopLossPrice = undefined;
1770
- const childOrders = this.safeValue(order, 'childOrders');
1771
- if (childOrders !== undefined) {
1772
- const first = this.safeValue(childOrders, 0);
1773
- const innerChildOrders = this.safeValue(first, 'childOrders', []);
1774
- const innerChildOrdersLength = innerChildOrders.length;
1775
- if (innerChildOrdersLength > 0) {
1776
- const takeProfitOrder = this.safeValue(innerChildOrders, 0);
1777
- const stopLossOrder = this.safeValue(innerChildOrders, 1);
1778
- takeProfitPrice = this.safeNumber(takeProfitOrder, 'triggerPrice');
1779
- stopLossPrice = this.safeNumber(stopLossOrder, 'triggerPrice');
1780
- }
1781
- }
1782
- const lastUpdateTimestamp = this.safeTimestamp2(order, 'updatedTime', 'updated_time');
2016
+ const lastUpdateTimestamp = this.safeTimestamp(order, 'updatedTime');
1783
2017
  return this.safeOrder({
1784
2018
  'id': orderId,
1785
2019
  'clientOrderId': clientOrderId,
@@ -1792,18 +2026,18 @@ class woo extends woo$1 {
1792
2026
  'type': orderType,
1793
2027
  'timeInForce': this.parseTimeInForce(orderType),
1794
2028
  'postOnly': undefined,
1795
- 'reduceOnly': this.safeBool(order, 'reduce_only'),
2029
+ 'reduceOnly': this.safeBool(order, 'reduceOnly'),
1796
2030
  'side': side,
1797
2031
  'price': price,
1798
2032
  'triggerPrice': triggerPrice,
1799
- 'takeProfitPrice': takeProfitPrice,
1800
- 'stopLossPrice': stopLossPrice,
2033
+ 'takeProfitPrice': undefined,
2034
+ 'stopLossPrice': undefined,
1801
2035
  'average': average,
1802
2036
  'amount': amount,
1803
2037
  'filled': filled,
1804
2038
  'remaining': undefined,
1805
2039
  'cost': cost,
1806
- 'trades': transactions,
2040
+ 'trades': undefined,
1807
2041
  'fee': {
1808
2042
  'cost': fee,
1809
2043
  'currency': feeCurrency,
@@ -1832,7 +2066,7 @@ class woo extends woo$1 {
1832
2066
  * @method
1833
2067
  * @name woo#fetchOrderBook
1834
2068
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
1835
- * @see https://docs.woox.io/#orderbook-snapshot-public
2069
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/orderbook
1836
2070
  * @param {string} symbol unified symbol of the market to fetch the order book for
1837
2071
  * @param {int} [limit] the maximum amount of order book entries to return
1838
2072
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1845,40 +2079,45 @@ class woo extends woo$1 {
1845
2079
  'symbol': market['id'],
1846
2080
  };
1847
2081
  if (limit !== undefined) {
1848
- limit = Math.min(limit, 1000);
1849
- request['max_level'] = limit;
2082
+ request['maxLevel'] = limit;
1850
2083
  }
1851
- const response = await this.v1PublicGetOrderbookSymbol(this.extend(request, params));
2084
+ const response = await this.v3PublicGetOrderbook(this.extend(request, params));
1852
2085
  //
1853
- // {
1854
- // "success": true,
1855
- // "timestamp": "1641562961192",
1856
- // "asks": [
1857
- // { price: '0.921', quantity: "76.01" },
1858
- // { price: '0.933', quantity: "477.10" },
1859
- // ...
1860
- // ],
1861
- // "bids": [
1862
- // { price: '0.940', quantity: "13502.47" },
1863
- // { price: '0.932', quantity: "43.91" },
1864
- // ...
1865
- // ]
1866
2086
  // }
1867
- //
1868
- const timestamp = this.safeInteger(response, 'timestamp');
1869
- return this.parseOrderBook(response, symbol, timestamp, 'bids', 'asks', 'price', 'quantity');
1870
- }
1871
- /**
2087
+ // {
2088
+ // "success": true,
2089
+ // "timestamp": 1751620923344,
2090
+ // "data": {
2091
+ // "asks": [
2092
+ // {
2093
+ // "price": "108924.86",
2094
+ // "quantity": "0.032126"
2095
+ // }
2096
+ // ],
2097
+ // "bids": [
2098
+ // {
2099
+ // "price": "108924.85",
2100
+ // "quantity": "1.714147"
2101
+ // }
2102
+ // ]
2103
+ // }
2104
+ // }
2105
+ //
2106
+ const data = this.safeDict(response, 'data', {});
2107
+ const timestamp = this.safeInteger(response, 'timestamp');
2108
+ return this.parseOrderBook(data, symbol, timestamp, 'bids', 'asks', 'price', 'quantity');
2109
+ }
2110
+ /**
1872
2111
  * @method
1873
2112
  * @name woo#fetchOHLCV
1874
- * @see https://docs.woox.io/#kline-public
1875
- * @see https://docs.woox.io/#kline-historical-data-public
2113
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/klineHistory
1876
2114
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1877
2115
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1878
2116
  * @param {string} timeframe the length of time each candle represents
1879
2117
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
1880
2118
  * @param {int} [limit] max=1000, max=100 when since is defined and is less than (now - (999 * (timeframe in ms)))
1881
2119
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2120
+ * @param {int} [params.until] the latest time in ms to fetch entries for
1882
2121
  * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
1883
2122
  */
1884
2123
  async fetchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
@@ -1888,75 +2127,47 @@ class woo extends woo$1 {
1888
2127
  'symbol': market['id'],
1889
2128
  'type': this.safeString(this.timeframes, timeframe, timeframe),
1890
2129
  };
1891
- let useHistEndpoint = since !== undefined;
1892
- if ((limit !== undefined) && (since !== undefined)) {
1893
- const oneThousandCandles = this.parseTimeframe(timeframe) * 1000 * 999; // 999 because there will be delay between this and the request, causing the latest candle to be excluded sometimes
1894
- const startWithLimit = this.milliseconds() - oneThousandCandles;
1895
- useHistEndpoint = since < startWithLimit;
1896
- }
1897
- if (useHistEndpoint) {
1898
- request['start_time'] = since;
1899
- }
1900
- else if (limit !== undefined) { // the hist endpoint does not accept limit
2130
+ if (limit !== undefined) {
1901
2131
  request['limit'] = Math.min(limit, 1000);
1902
2132
  }
1903
- let response = undefined;
1904
- if (!useHistEndpoint) {
1905
- response = await this.v1PublicGetKline(this.extend(request, params));
1906
- //
1907
- // {
1908
- // "success": true,
1909
- // "rows": [
1910
- // {
1911
- // "open": "0.94238",
1912
- // "close": "0.94271",
1913
- // "low": "0.94238",
1914
- // "high": "0.94296",
1915
- // "volume": "73.55",
1916
- // "amount": "69.32040520",
1917
- // "symbol": "SPOT_WOO_USDT",
1918
- // "type": "1m",
1919
- // "start_timestamp": "1641584700000",
1920
- // "end_timestamp": "1641584760000"
1921
- // },
1922
- // ...
1923
- // ]
1924
- // }
1925
- //
2133
+ if (since !== undefined) {
2134
+ request['after'] = since;
1926
2135
  }
1927
- else {
1928
- response = await this.v1PubGetHistKline(this.extend(request, params));
1929
- response = this.safeDict(response, 'data');
1930
- //
1931
- // {
1932
- // "success": true,
1933
- // "data": {
1934
- // "rows": [
1935
- // {
1936
- // "symbol": "SPOT_BTC_USDT",
1937
- // "open": 44181.40000000,
1938
- // "close": 44174.29000000,
1939
- // "high": 44193.44000000,
1940
- // "low": 44148.34000000,
1941
- // "volume": 110.11930100,
1942
- // "amount": 4863796.24318878,
1943
- // "type": "1m",
1944
- // "start_timestamp": 1704153600000,
1945
- // "end_timestamp": 1704153660000
1946
- // },
1947
- // ...
1948
- // ]
1949
- // }
1950
- // }
1951
- //
2136
+ const until = this.safeInteger(params, 'until');
2137
+ params = this.omit(params, 'until');
2138
+ if (until !== undefined) {
2139
+ request['before'] = until;
1952
2140
  }
1953
- const rows = this.safeList(response, 'rows', []);
2141
+ const response = await this.v3PublicGetKlineHistory(this.extend(request, params));
2142
+ //
2143
+ // {
2144
+ // "success": true,
2145
+ // "data": {
2146
+ // "rows": [
2147
+ // {
2148
+ // "symbol": "SPOT_BTC_USDT",
2149
+ // "open": "108994.16",
2150
+ // "close": "108994.16",
2151
+ // "high": "108994.16",
2152
+ // "low": "108994.16",
2153
+ // "volume": "0",
2154
+ // "amount": "0",
2155
+ // "type": "1m",
2156
+ // "startTimestamp": 1751622120000,
2157
+ // "endTimestamp": 1751622180000
2158
+ // }
2159
+ // ]
2160
+ // },
2161
+ // "timestamp": 1751622205410
2162
+ // }
2163
+ //
2164
+ const data = this.safeDict(response, 'data', {});
2165
+ const rows = this.safeList(data, 'rows', []);
1954
2166
  return this.parseOHLCVs(rows, market, timeframe, since, limit);
1955
2167
  }
1956
2168
  parseOHLCV(ohlcv, market = undefined) {
1957
- // example response in fetchOHLCV
1958
2169
  return [
1959
- this.safeInteger(ohlcv, 'start_timestamp'),
2170
+ this.safeInteger(ohlcv, 'startTimestamp'),
1960
2171
  this.safeNumber(ohlcv, 'open'),
1961
2172
  this.safeNumber(ohlcv, 'high'),
1962
2173
  this.safeNumber(ohlcv, 'low'),
@@ -2011,7 +2222,7 @@ class woo extends woo$1 {
2011
2222
  * @method
2012
2223
  * @name woo#fetchMyTrades
2013
2224
  * @description fetch all trades made by the user
2014
- * @see https://docs.woox.io/#get-trade-history
2225
+ * @see https://developer.woox.io/api-reference/endpoint/trading/get_transactions
2015
2226
  * @param {string} symbol unified market symbol
2016
2227
  * @param {int} [since] the earliest time in ms to fetch trades for
2017
2228
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -2026,93 +2237,159 @@ class woo extends woo$1 {
2026
2237
  if (paginate) {
2027
2238
  return await this.fetchPaginatedCallIncremental('fetchMyTrades', symbol, since, limit, params, 'page', 500);
2028
2239
  }
2029
- let request = {};
2240
+ const request = {};
2030
2241
  let market = undefined;
2031
2242
  if (symbol !== undefined) {
2032
2243
  market = this.market(symbol);
2033
2244
  request['symbol'] = market['id'];
2034
2245
  }
2035
2246
  if (since !== undefined) {
2036
- request['start_t'] = since;
2247
+ request['startTime'] = since;
2037
2248
  }
2038
- [request, params] = this.handleUntilOption('end_t', request, params);
2039
- if (limit !== undefined) {
2040
- request['size'] = limit;
2249
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
2250
+ params = this.omit(params, ['until']);
2251
+ if (until !== undefined) {
2252
+ request['endTime'] = until;
2041
2253
  }
2042
- else {
2043
- request['size'] = 500;
2254
+ if (limit !== undefined) {
2255
+ request['limit'] = limit;
2044
2256
  }
2045
- const response = await this.v1PrivateGetClientTrades(this.extend(request, params));
2046
- // {
2047
- // "success": true,
2048
- // "meta": {
2049
- // "records_per_page": 25,
2050
- // "current_page": 1
2051
- // },
2052
- // "rows": [
2053
- // {
2054
- // "id": 5,
2055
- // "symbol": "SPOT_BTC_USDT",
2056
- // "order_id": 211,
2057
- // "order_tag": "default",
2058
- // "executed_price": 10892.84,
2059
- // "executed_quantity": 0.002,
2060
- // "is_maker": 0,
2061
- // "side": "SELL",
2062
- // "fee": 0,
2063
- // "fee_asset": "USDT",
2064
- // "executed_timestamp": "1566264290.250"
2257
+ const response = await this.v3PrivateGetTradeTransactionHistory(this.extend(request, params));
2258
+ //
2259
+ // {
2260
+ // "success": true,
2261
+ // "data": {
2262
+ // "rows": [
2263
+ // {
2264
+ // "id": 1734947821,
2265
+ // "symbol": "SPOT_LTC_USDT",
2266
+ // "orderId": 60780383217,
2267
+ // "executedPrice": 87.86,
2268
+ // "executedQuantity": 0.1,
2269
+ // "fee": 0.0001,
2270
+ // "realizedPnl": null,
2271
+ // "feeAsset": "LTC",
2272
+ // "orderTag": "default",
2273
+ // "side": "BUY",
2274
+ // "executedTimestamp": "1752055173.630",
2275
+ // "isMaker": 0
2276
+ // }
2277
+ // ],
2278
+ // "meta": {
2279
+ // "total": 1,
2280
+ // "recordsPerPage": 100,
2281
+ // "currentPage": 1
2282
+ // }
2065
2283
  // },
2066
- // ...
2067
- // ]
2068
- // }
2069
- const trades = this.safeList(response, 'rows', []);
2284
+ // "timestamp": 1752055545121
2285
+ // }
2286
+ //
2287
+ const data = this.safeDict(response, 'data', {});
2288
+ const trades = this.safeList(data, 'rows', []);
2070
2289
  return this.parseTrades(trades, market, since, limit, params);
2071
2290
  }
2072
2291
  /**
2073
2292
  * @method
2074
2293
  * @name woo#fetchAccounts
2075
2294
  * @description fetch all the accounts associated with a profile
2076
- * @see https://docs.woox.io/#get-assets-of-subaccounts
2295
+ * @see https://developer.woox.io/api-reference/endpoint/account/get_account_info
2296
+ * @see https://developer.woox.io/api-reference/endpoint/account/sub_accounts
2077
2297
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2078
2298
  * @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
2079
2299
  */
2080
2300
  async fetchAccounts(params = {}) {
2081
- const response = await this.v1PrivateGetSubAccountAssets(params);
2301
+ const mainAccountPromise = this.v3PrivateGetAccountInfo(params);
2082
2302
  //
2083
2303
  // {
2084
- // "rows": [{
2085
- // "application_id": "13e4fc34-e2ff-4cb7-b1e4-4c22fee7d365",
2086
- // "account": "Main",
2087
- // "usdt_balance": "4.0"
2088
- // },
2089
- // {
2090
- // "application_id": "432952aa-a401-4e26-aff6-972920aebba3",
2091
- // "account": "subaccount",
2092
- // "usdt_balance": "1.0"
2093
- // }
2094
- // ],
2095
- // "success": true
2304
+ // "success": true,
2305
+ // "data": {
2306
+ // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2307
+ // "account": "carlos_jose_lima@yahoo.com",
2308
+ // "alias": "carlos_jose_lima@yahoo.com",
2309
+ // "otpauth": true,
2310
+ // "accountMode": "FUTURES",
2311
+ // "positionMode": "ONE_WAY",
2312
+ // "leverage": 0,
2313
+ // "marginRatio": "10",
2314
+ // "openMarginRatio": "10",
2315
+ // "initialMarginRatio": "10",
2316
+ // "maintenanceMarginRatio": "0.03",
2317
+ // "totalCollateral": "165.55629469",
2318
+ // "freeCollateral": "165.55629469",
2319
+ // "totalAccountValue": "167.32418611",
2320
+ // "totalTradingValue": "167.32418611",
2321
+ // "totalVaultValue": "0",
2322
+ // "totalStakingValue": "0",
2323
+ // "totalLaunchpadValue": "0",
2324
+ // "totalEarnValue": "0",
2325
+ // "referrerID": null,
2326
+ // "accountType": "Main"
2327
+ // },
2328
+ // "timestamp": 1752062807915
2329
+ // }
2330
+ //
2331
+ const subAccountPromise = this.v3PrivateGetAccountSubAccountsAll(params);
2332
+ //
2333
+ // {
2334
+ // "success": true,
2335
+ // "data": {
2336
+ // "rows": [
2337
+ // {
2338
+ // "applicationId": "6b43de5c-0955-4887-9862-d84e4689f9fe",
2339
+ // "name": "sub_account_2",
2340
+ // "createdTime": "1606897264.994"
2341
+ // },
2342
+ // ]
2343
+ // },
2344
+ // "timestamp": 1721295317627
2096
2345
  // }
2097
2346
  //
2098
- const rows = this.safeList(response, 'rows', []);
2347
+ const [mainAccountResponse, subAccountResponse] = await Promise.all([mainAccountPromise, subAccountPromise]);
2348
+ const mainData = this.safeDict(mainAccountResponse, 'data', {});
2349
+ const mainRows = [mainData];
2350
+ const subData = this.safeDict(subAccountResponse, 'data', {});
2351
+ const subRows = this.safeList(subData, 'rows', []);
2352
+ const rows = this.arrayConcat(mainRows, subRows);
2099
2353
  return this.parseAccounts(rows, params);
2100
2354
  }
2101
2355
  parseAccount(account) {
2102
2356
  //
2103
2357
  // {
2104
- // "application_id": "336952aa-a401-4e26-aff6-972920aebba3",
2105
- // "account": "subaccount",
2106
- // "usdt_balance": "1.0",
2358
+ // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2359
+ // "account": "carlos_jose_lima@yahoo.com",
2360
+ // "alias": "carlos_jose_lima@yahoo.com",
2361
+ // "otpauth": true,
2362
+ // "accountMode": "FUTURES",
2363
+ // "positionMode": "ONE_WAY",
2364
+ // "leverage": 0,
2365
+ // "marginRatio": "10",
2366
+ // "openMarginRatio": "10",
2367
+ // "initialMarginRatio": "10",
2368
+ // "maintenanceMarginRatio": "0.03",
2369
+ // "totalCollateral": "165.55629469",
2370
+ // "freeCollateral": "165.55629469",
2371
+ // "totalAccountValue": "167.32418611",
2372
+ // "totalTradingValue": "167.32418611",
2373
+ // "totalVaultValue": "0",
2374
+ // "totalStakingValue": "0",
2375
+ // "totalLaunchpadValue": "0",
2376
+ // "totalEarnValue": "0",
2377
+ // "referrerID": null,
2378
+ // "accountType": "Main"
2379
+ // }
2380
+ //
2381
+ // {
2382
+ // "applicationId": "6b43de5c-0955-4887-9862-d84e4689f9fe",
2383
+ // "name": "sub_account_2",
2384
+ // "createdTime": "1606897264.994"
2107
2385
  // }
2108
2386
  //
2109
- const accountId = this.safeString(account, 'account');
2110
2387
  return {
2111
2388
  'info': account,
2112
- 'id': this.safeString(account, 'application_id'),
2113
- 'name': accountId,
2389
+ 'id': this.safeString(account, 'applicationId'),
2390
+ 'name': this.safeStringN(account, ['name', 'account', 'alias']),
2114
2391
  'code': undefined,
2115
- 'type': accountId === 'Main' ? 'main' : 'subaccount',
2392
+ 'type': this.safeStringLower(account, 'accountType', 'subaccount'),
2116
2393
  };
2117
2394
  }
2118
2395
  /**
@@ -2171,7 +2448,7 @@ class woo extends woo$1 {
2171
2448
  * @method
2172
2449
  * @name woo#fetchDepositAddress
2173
2450
  * @description fetch the deposit address for a currency associated with this account
2174
- * @see https://docs.woox.io/#get-token-deposit-address
2451
+ * @see https://developer.woox.io/api-reference/endpoint/assets/get_wallet_deposit
2175
2452
  * @param {string} code unified currency code
2176
2453
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2177
2454
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -2180,18 +2457,25 @@ class woo extends woo$1 {
2180
2457
  // this method is TODO because of networks unification
2181
2458
  await this.loadMarkets();
2182
2459
  const currency = this.currency(code);
2183
- let specialNetworkId = undefined;
2184
- [specialNetworkId, params] = this.getDedicatedNetworkId(currency, params);
2460
+ let networkCode = undefined;
2461
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
2185
2462
  const request = {
2186
- 'token': specialNetworkId,
2463
+ 'token': currency['id'],
2464
+ 'network': this.networkCodeToId(networkCode),
2187
2465
  };
2188
- const response = await this.v1PrivateGetAssetDeposit(this.extend(request, params));
2189
- // {
2190
- // "success": true,
2191
- // "address": "3Jmtjx5544T4smrit9Eroe4PCrRkpDeKjP",
2192
- // "extra": ''
2193
- // }
2194
- return this.parseDepositAddress(response, currency);
2466
+ const response = await this.v3PrivateGetAssetWalletDeposit(this.extend(request, params));
2467
+ //
2468
+ // {
2469
+ // "success": true,
2470
+ // "data": {
2471
+ // "address": "0x31d64B3230f8baDD91dE1710A65DF536aF8f7cDa",
2472
+ // "extra": ""
2473
+ // },
2474
+ // "timestamp": 1721300689532
2475
+ // }
2476
+ //
2477
+ const data = this.safeDict(response, 'data', {});
2478
+ return this.parseDepositAddress(data, currency);
2195
2479
  }
2196
2480
  getDedicatedNetworkId(currency, params) {
2197
2481
  let networkCode = undefined;
@@ -2222,61 +2506,68 @@ class woo extends woo$1 {
2222
2506
  let currency = undefined;
2223
2507
  if (code !== undefined) {
2224
2508
  currency = this.currency(code);
2225
- request['balance_token'] = currency['id'];
2509
+ request['token'] = currency['id'];
2510
+ }
2511
+ let networkCode = undefined;
2512
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
2513
+ if (networkCode !== undefined) {
2514
+ request['network'] = this.networkCodeToId(networkCode);
2226
2515
  }
2227
2516
  if (since !== undefined) {
2228
- request['start_t'] = since;
2517
+ request['startTime'] = since;
2229
2518
  }
2230
2519
  if (limit !== undefined) {
2231
- request['pageSize'] = limit;
2520
+ request['size'] = Math.min(limit, 1000);
2232
2521
  }
2233
2522
  const transactionType = this.safeString(params, 'type');
2234
2523
  params = this.omit(params, 'type');
2235
2524
  if (transactionType !== undefined) {
2236
2525
  request['type'] = transactionType;
2237
2526
  }
2238
- const response = await this.v1PrivateGetAssetHistory(this.extend(request, params));
2239
- // {
2240
- // "rows": [
2241
- // {
2242
- // "id": "22010508193900165",
2243
- // "token": "TRON_USDT",
2244
- // "extra": '',
2245
- // "amount": "13.75848500",
2246
- // "status": "COMPLETED",
2247
- // "account": null,
2248
- // "description": null,
2249
- // "user_id": "42222",
2250
- // "application_id": "6ad2b303-f354-45c0-8105-9f5f19d0e335",
2251
- // "external_id": "220105081900134",
2252
- // "target_address": "TXnyFSnAYad3YCaqtwMw9jvXKkeU39NLnK",
2253
- // "source_address": "TYDzsYUEpvnYmQk4zGP9sWWcTEd2MiAtW6",
2254
- // "type": "BALANCE",
2255
- // "token_side": "DEPOSIT",
2256
- // "tx_id": "35b0004022f6b3ad07f39a0b7af199f6b258c2c3e2c7cdc93c67efa74fd625ee",
2257
- // "fee_token": '',
2258
- // "fee_amount": "0.00000000",
2259
- // "created_time": "1641370779.442",
2260
- // "updated_time": "1641370779.465",
2261
- // "is_new_target_address": null,
2262
- // "confirmed_number": "29",
2263
- // "confirming_threshold": "27",
2264
- // "audit_tag": "1",
2265
- // "audit_result": "0",
2266
- // "balance_token": null, // TODO -write to support, that this seems broken. here should be the token id
2267
- // "network_name": null // TODO -write to support, that this seems broken. here should be the network id
2268
- // }
2269
- // ],
2270
- // "meta": { total: '1', records_per_page: "25", current_page: "1" },
2271
- // "success": true
2272
- // }
2273
- return [currency, this.safeList(response, 'rows', [])];
2527
+ const response = await this.v3PrivateGetAssetWalletHistory(this.extend(request, params));
2528
+ //
2529
+ // {
2530
+ // "success": true,
2531
+ // "data": {
2532
+ // "rows": [
2533
+ // {
2534
+ // "createdTime": "1734964440.523",
2535
+ // "updatedTime": "1734964614.081",
2536
+ // "id": "24122314340000585",
2537
+ // "externalId": "241223143600621",
2538
+ // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2539
+ // "token": "ARB_USDCNATIVE",
2540
+ // "targetAddress": "0x4d6802d2736daa85e6242ef0dc0f00aa0e68f635",
2541
+ // "sourceAddress": "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4",
2542
+ // "extra": "",
2543
+ // "type": "BALANCE",
2544
+ // "tokenSide": "WITHDRAW",
2545
+ // "amount": "10.00000000",
2546
+ // "txId": "0x891ade0a47fd55466bb9d06702bea4edcb75ed9367d9afbc47b93a84f496d2e6",
2547
+ // "feeToken": "USDC",
2548
+ // "feeAmount": "2",
2549
+ // "status": "COMPLETED",
2550
+ // "confirmingThreshold": null,
2551
+ // "confirmedNumber": null
2552
+ // }
2553
+ // ],
2554
+ // "meta": {
2555
+ // "total": 1,
2556
+ // "records_per_page": 25,
2557
+ // "current_page": 1
2558
+ // }
2559
+ // },
2560
+ // "timestamp": 1752485344719
2561
+ // }
2562
+ //
2563
+ const data = this.safeDict(response, 'data', {});
2564
+ return [currency, this.safeList(data, 'rows', [])];
2274
2565
  }
2275
2566
  /**
2276
2567
  * @method
2277
2568
  * @name woo#fetchLedger
2278
2569
  * @description fetch the history of changes, actions done by the user or operations that altered balance of the user
2279
- * @see https://docs.woox.io/#get-asset-history
2570
+ * @see https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history
2280
2571
  * @param {string} [code] unified currency code, default is undefined
2281
2572
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
2282
2573
  * @param {int} [limit] max number of ledger entries to return, default is undefined
@@ -2290,22 +2581,43 @@ class woo extends woo$1 {
2290
2581
  return this.parseLedger(rows, currency, since, limit, params);
2291
2582
  }
2292
2583
  parseLedgerEntry(item, currency = undefined) {
2584
+ //
2585
+ // {
2586
+ // "createdTime": "1734964440.523",
2587
+ // "updatedTime": "1734964614.081",
2588
+ // "id": "24122314340000585",
2589
+ // "externalId": "241223143600621",
2590
+ // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2591
+ // "token": "ARB_USDCNATIVE",
2592
+ // "targetAddress": "0x4d6802d2736daa85e6242ef0dc0f00aa0e68f635",
2593
+ // "sourceAddress": "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4",
2594
+ // "extra": "",
2595
+ // "type": "BALANCE",
2596
+ // "tokenSide": "WITHDRAW",
2597
+ // "amount": "10.00000000",
2598
+ // "txId": "0x891ade0a47fd55466bb9d06702bea4edcb75ed9367d9afbc47b93a84f496d2e6",
2599
+ // "feeToken": "USDC",
2600
+ // "feeAmount": "2",
2601
+ // "status": "COMPLETED",
2602
+ // "confirmingThreshold": null,
2603
+ // "confirmedNumber": null
2604
+ // }
2605
+ //
2293
2606
  const networkizedCode = this.safeString(item, 'token');
2294
- const currencyDefined = this.getCurrencyFromChaincode(networkizedCode, currency);
2295
- const code = currencyDefined['code'];
2607
+ const code = this.safeCurrencyCode(networkizedCode, currency);
2296
2608
  currency = this.safeCurrency(code, currency);
2297
2609
  const amount = this.safeNumber(item, 'amount');
2298
- const side = this.safeString(item, 'token_side');
2610
+ const side = this.safeString(item, 'tokenSide');
2299
2611
  const direction = (side === 'DEPOSIT') ? 'in' : 'out';
2300
- const timestamp = this.safeTimestamp(item, 'created_time');
2301
- const fee = this.parseTokenAndFeeTemp(item, 'fee_token', 'fee_amount');
2612
+ const timestamp = this.safeTimestamp(item, 'createdTime');
2613
+ const fee = this.parseTokenAndFeeTemp(item, ['feeToken'], ['feeAmount']);
2302
2614
  return this.safeLedgerEntry({
2303
2615
  'info': item,
2304
2616
  'id': this.safeString(item, 'id'),
2305
2617
  'currency': code,
2306
2618
  'account': this.safeString(item, 'account'),
2307
2619
  'referenceAccount': undefined,
2308
- 'referenceId': this.safeString(item, 'tx_id'),
2620
+ 'referenceId': this.safeString(item, 'txId'),
2309
2621
  'status': this.parseTransactionStatus(this.safeString(item, 'status')),
2310
2622
  'amount': amount,
2311
2623
  'before': undefined,
@@ -2344,7 +2656,7 @@ class woo extends woo$1 {
2344
2656
  * @method
2345
2657
  * @name woo#fetchDeposits
2346
2658
  * @description fetch all deposits made to an account
2347
- * @see https://docs.woox.io/#get-asset-history
2659
+ * @see https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history
2348
2660
  * @param {string} code unified currency code
2349
2661
  * @param {int} [since] the earliest time in ms to fetch deposits for
2350
2662
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -2353,7 +2665,7 @@ class woo extends woo$1 {
2353
2665
  */
2354
2666
  async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
2355
2667
  const request = {
2356
- 'token_side': 'DEPOSIT',
2668
+ 'tokenSide': 'DEPOSIT',
2357
2669
  };
2358
2670
  return await this.fetchDepositsWithdrawals(code, since, limit, this.extend(request, params));
2359
2671
  }
@@ -2361,7 +2673,7 @@ class woo extends woo$1 {
2361
2673
  * @method
2362
2674
  * @name woo#fetchWithdrawals
2363
2675
  * @description fetch all withdrawals made from an account
2364
- * @see https://docs.woox.io/#get-asset-history
2676
+ * @see https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history
2365
2677
  * @param {string} code unified currency code
2366
2678
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
2367
2679
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -2370,7 +2682,7 @@ class woo extends woo$1 {
2370
2682
  */
2371
2683
  async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
2372
2684
  const request = {
2373
- 'token_side': 'WITHDRAW',
2685
+ 'tokenSide': 'WITHDRAW',
2374
2686
  };
2375
2687
  return await this.fetchDepositsWithdrawals(code, since, limit, this.extend(request, params));
2376
2688
  }
@@ -2378,7 +2690,7 @@ class woo extends woo$1 {
2378
2690
  * @method
2379
2691
  * @name woo#fetchDepositsWithdrawals
2380
2692
  * @description fetch history of deposits and withdrawals
2381
- * @see https://docs.woox.io/#get-asset-history
2693
+ * @see https://developer.woox.io/api-reference/endpoint/assets/get_wallet_history
2382
2694
  * @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
2383
2695
  * @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
2384
2696
  * @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
@@ -2392,36 +2704,46 @@ class woo extends woo$1 {
2392
2704
  const currencyRows = await this.getAssetHistoryRows(code, since, limit, this.extend(request, params));
2393
2705
  const currency = this.safeValue(currencyRows, 0);
2394
2706
  const rows = this.safeList(currencyRows, 1);
2707
+ return this.parseTransactions(rows, currency, since, limit, params);
2708
+ }
2709
+ parseTransaction(transaction, currency = undefined) {
2395
2710
  //
2396
2711
  // {
2397
- // "rows":[],
2398
- // "meta":{
2399
- // "total":0,
2400
- // "records_per_page":25,
2401
- // "current_page":1
2402
- // },
2403
- // "success":true
2712
+ // "createdTime": "1734964440.523",
2713
+ // "updatedTime": "1734964614.081",
2714
+ // "id": "24122314340000585",
2715
+ // "externalId": "241223143600621",
2716
+ // "applicationId": "251bf5c4-f3c8-4544-bb8b-80001007c3c0",
2717
+ // "token": "ARB_USDCNATIVE",
2718
+ // "targetAddress": "0x4d6802d2736daa85e6242ef0dc0f00aa0e68f635",
2719
+ // "sourceAddress": "0x63DFE4e34A3bFC00eB0220786238a7C6cEF8Ffc4",
2720
+ // "extra": "",
2721
+ // "type": "BALANCE",
2722
+ // "tokenSide": "WITHDRAW",
2723
+ // "amount": "10.00000000",
2724
+ // "txId": "0x891ade0a47fd55466bb9d06702bea4edcb75ed9367d9afbc47b93a84f496d2e6",
2725
+ // "feeToken": "USDC",
2726
+ // "feeAmount": "2",
2727
+ // "status": "COMPLETED",
2728
+ // "confirmingThreshold": null,
2729
+ // "confirmedNumber": null
2404
2730
  // }
2405
2731
  //
2406
- return this.parseTransactions(rows, currency, since, limit, params);
2407
- }
2408
- parseTransaction(transaction, currency = undefined) {
2409
- // example in fetchLedger
2410
2732
  const networkizedCode = this.safeString(transaction, 'token');
2411
2733
  const currencyDefined = this.getCurrencyFromChaincode(networkizedCode, currency);
2412
2734
  const code = currencyDefined['code'];
2413
- let movementDirection = this.safeStringLower(transaction, 'token_side');
2735
+ let movementDirection = this.safeStringLower2(transaction, 'token_side', 'tokenSide');
2414
2736
  if (movementDirection === 'withdraw') {
2415
2737
  movementDirection = 'withdrawal';
2416
2738
  }
2417
- const fee = this.parseTokenAndFeeTemp(transaction, 'fee_token', 'fee_amount');
2418
- const addressTo = this.safeString(transaction, 'target_address');
2419
- const addressFrom = this.safeString(transaction, 'source_address');
2420
- const timestamp = this.safeTimestamp(transaction, 'created_time');
2739
+ const fee = this.parseTokenAndFeeTemp(transaction, ['fee_token', 'feeToken'], ['fee_amount', 'feeAmount']);
2740
+ const addressTo = this.safeString2(transaction, 'target_address', 'targetAddress');
2741
+ const addressFrom = this.safeString2(transaction, 'source_address', 'sourceAddress');
2742
+ const timestamp = this.safeTimestamp2(transaction, 'created_time', 'createdTime');
2421
2743
  return {
2422
2744
  'info': transaction,
2423
- 'id': this.safeString2(transaction, 'id', 'withdraw_id'),
2424
- 'txid': this.safeString(transaction, 'tx_id'),
2745
+ 'id': this.safeStringN(transaction, ['id', 'withdraw_id', 'withdrawId']),
2746
+ 'txid': this.safeString2(transaction, 'tx_id', 'txId'),
2425
2747
  'timestamp': timestamp,
2426
2748
  'datetime': this.iso8601(timestamp),
2427
2749
  'address': undefined,
@@ -2434,7 +2756,7 @@ class woo extends woo$1 {
2434
2756
  'amount': this.safeNumber(transaction, 'amount'),
2435
2757
  'currency': code,
2436
2758
  'status': this.parseTransactionStatus(this.safeString(transaction, 'status')),
2437
- 'updated': this.safeTimestamp(transaction, 'updated_time'),
2759
+ 'updated': this.safeTimestamp2(transaction, 'updated_time', 'updatedTime'),
2438
2760
  'comment': undefined,
2439
2761
  'internal': undefined,
2440
2762
  'fee': fee,
@@ -2493,7 +2815,7 @@ class woo extends woo$1 {
2493
2815
  * @method
2494
2816
  * @name woo#fetchTransfers
2495
2817
  * @description fetch a history of internal transfers made on an account
2496
- * @see https://docs.woox.io/#get-transfer-history
2818
+ * @see https://developer.woox.io/api-reference/endpoint/assets/get_transfer_history
2497
2819
  * @param {string} code unified currency code of the currency transferred
2498
2820
  * @param {int} [since] the earliest time in ms to fetch transfers for
2499
2821
  * @param {int} [limit] the maximum number of transfers structures to retrieve
@@ -2503,44 +2825,56 @@ class woo extends woo$1 {
2503
2825
  */
2504
2826
  async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
2505
2827
  const request = {};
2828
+ let currency = undefined;
2829
+ if (code !== undefined) {
2830
+ currency = this.currency(code);
2831
+ }
2506
2832
  if (limit !== undefined) {
2507
2833
  request['size'] = limit;
2508
2834
  }
2509
2835
  if (since !== undefined) {
2510
- request['start_t'] = since;
2836
+ request['startTime'] = since;
2511
2837
  }
2512
2838
  const until = this.safeInteger(params, 'until'); // unified in milliseconds
2513
2839
  params = this.omit(params, ['until']);
2514
2840
  if (until !== undefined) {
2515
- request['end_t'] = until;
2841
+ request['endTime'] = until;
2516
2842
  }
2517
- const response = await this.v1PrivateGetAssetMainSubTransferHistory(this.extend(request, params));
2843
+ const response = await this.v3PrivateGetAssetTransferHistory(this.extend(request, params));
2518
2844
  //
2519
2845
  // {
2520
- // "rows": [
2521
- // {
2522
- // "id": 46704,
2523
- // "token": "USDT",
2524
- // "amount": 30000.00000000,
2525
- // "status": "COMPLETED",
2526
- // "from_application_id": "0f1bd3cd-dba2-4563-b8bb-0adb1bfb83a3",
2527
- // "to_application_id": "c01e6940-a735-4022-9b6c-9d3971cdfdfa",
2528
- // "from_user": "LeverageLow",
2529
- // "to_user": "dev",
2530
- // "created_time": "1709022325.427",
2531
- // "updated_time": "1709022325.542"
2846
+ // "success": true,
2847
+ // "data": {
2848
+ // "rows": [
2849
+ // {
2850
+ // "id": 225,
2851
+ // "token": "USDT",
2852
+ // "amount": "1000000",
2853
+ // "status": "COMPLETED",
2854
+ // "from": {
2855
+ // "applicationId": "046b5c5c-5b44-4d27-9593-ddc32c0a08ae",
2856
+ // "accountName": "Main"
2857
+ // },
2858
+ // "to": {
2859
+ // "applicationId": "082ae5ae-e26a-4fb1-be5b-03e5b4867663",
2860
+ // "accountName": "sub001"
2861
+ // },
2862
+ // "createdTime": "1642660941.534",
2863
+ // "updatedTime": "1642660941.950"
2864
+ // }
2865
+ // ],
2866
+ // "meta": {
2867
+ // "total": 46,
2868
+ // "recordsPerPage": 1,
2869
+ // "currentPage": 1
2532
2870
  // }
2533
- // ],
2534
- // "meta": {
2535
- // "total": 50,
2536
- // "records_per_page": 25,
2537
- // "current_page": 1
2538
2871
  // },
2539
- // "success": true
2872
+ // "timestamp": 1721295317627
2540
2873
  // }
2541
2874
  //
2542
- const data = this.safeList(response, 'rows', []);
2543
- return this.parseTransfers(data, undefined, since, limit, params);
2875
+ const data = this.safeDict(response, 'data', {});
2876
+ const rows = this.safeList(data, 'rows', []);
2877
+ return this.parseTransfers(rows, currency, since, limit, params);
2544
2878
  }
2545
2879
  parseTransfer(transfer, currency = undefined) {
2546
2880
  //
@@ -2557,6 +2891,22 @@ class woo extends woo$1 {
2557
2891
  // "created_time": "1709022325.427",
2558
2892
  // "updated_time": "1709022325.542"
2559
2893
  // }
2894
+ // {
2895
+ // "id": 225,
2896
+ // "token": "USDT",
2897
+ // "amount": "1000000",
2898
+ // "status": "COMPLETED",
2899
+ // "from": {
2900
+ // "applicationId": "046b5c5c-5b44-4d27-9593-ddc32c0a08ae",
2901
+ // "accountName": "Main"
2902
+ // },
2903
+ // "to": {
2904
+ // "applicationId": "082ae5ae-e26a-4fb1-be5b-03e5b4867663",
2905
+ // "accountName": "sub001"
2906
+ // },
2907
+ // "createdTime": "1642660941.534",
2908
+ // "updatedTime": "1642660941.950"
2909
+ // }
2560
2910
  //
2561
2911
  // transfer
2562
2912
  // {
@@ -2564,23 +2914,23 @@ class woo extends woo$1 {
2564
2914
  // "id": 200
2565
2915
  // }
2566
2916
  //
2567
- const networkizedCode = this.safeString(transfer, 'token');
2568
- const currencyDefined = this.getCurrencyFromChaincode(networkizedCode, currency);
2569
- const code = currencyDefined['code'];
2570
- const timestamp = this.safeTimestamp(transfer, 'created_time');
2917
+ const code = this.safeCurrencyCode(this.safeString(transfer, 'token'), currency);
2918
+ const timestamp = this.safeTimestamp(transfer, 'createdTime');
2571
2919
  const success = this.safeBool(transfer, 'success');
2572
2920
  let status = undefined;
2573
2921
  if (success !== undefined) {
2574
2922
  status = success ? 'ok' : 'failed';
2575
2923
  }
2924
+ const fromAccount = this.safeDict(transfer, 'from', {});
2925
+ const toAccount = this.safeDict(transfer, 'to', {});
2576
2926
  return {
2577
2927
  'id': this.safeString(transfer, 'id'),
2578
2928
  'timestamp': timestamp,
2579
2929
  'datetime': this.iso8601(timestamp),
2580
2930
  'currency': code,
2581
2931
  'amount': this.safeNumber(transfer, 'amount'),
2582
- 'fromAccount': this.safeString(transfer, 'from_application_id'),
2583
- 'toAccount': this.safeString(transfer, 'to_application_id'),
2932
+ 'fromAccount': this.safeString(fromAccount, 'applicationId'),
2933
+ 'toAccount': this.safeString(toAccount, 'applicationId'),
2584
2934
  'status': this.parseTransferStatus(this.safeString(transfer, 'status', status)),
2585
2935
  'info': transfer,
2586
2936
  };
@@ -2707,7 +3057,7 @@ class woo extends woo$1 {
2707
3057
  }
2708
3058
  else {
2709
3059
  this.checkRequiredCredentials();
2710
- if (method === 'POST' && (path === 'algo/order' || path === 'order')) {
3060
+ if (method === 'POST' && (path === 'trade/algoOrder' || path === 'trade/order')) {
2711
3061
  const isSandboxMode = this.safeBool(this.options, 'sandboxMode', false);
2712
3062
  if (!isSandboxMode) {
2713
3063
  const applicationId = 'bc830de7-50f3-460b-9ee0-f430f83f9dad';
@@ -2731,9 +3081,10 @@ class woo extends woo$1 {
2731
3081
  };
2732
3082
  if (version === 'v3') {
2733
3083
  auth = ts + method + '/' + version + '/' + pathWithParams;
2734
- if (method === 'POST' || method === 'PUT' || method === 'DELETE') {
3084
+ if (method === 'POST' || method === 'PUT') {
2735
3085
  body = this.json(params);
2736
3086
  auth += body;
3087
+ headers['content-type'] = 'application/json';
2737
3088
  }
2738
3089
  else {
2739
3090
  if (Object.keys(params).length) {
@@ -2742,7 +3093,6 @@ class woo extends woo$1 {
2742
3093
  auth += '?' + query;
2743
3094
  }
2744
3095
  }
2745
- headers['content-type'] = 'application/json';
2746
3096
  }
2747
3097
  else {
2748
3098
  auth = this.urlencode(params);
@@ -2781,25 +3131,26 @@ class woo extends woo$1 {
2781
3131
  parseIncome(income, market = undefined) {
2782
3132
  //
2783
3133
  // {
2784
- // "id":666666,
2785
- // "symbol":"PERP_BTC_USDT",
2786
- // "funding_rate":0.00001198,
2787
- // "mark_price":28941.04000000,
2788
- // "funding_fee":0.00069343,
2789
- // "payment_type":"Pay",
2790
- // "status":"COMPLETED",
2791
- // "created_time":"1653616000.666",
2792
- // "updated_time":"1653616000.605"
3134
+ // "id": 1286360,
3135
+ // "symbol": "PERP_BTC_USDT",
3136
+ // "fundingRate": -0.00001445,
3137
+ // "markPrice": "26930.60000000",
3138
+ // "fundingFee": "9.56021744",
3139
+ // "fundingIntervalHours": 8,
3140
+ // "paymentType": "Pay",
3141
+ // "status": "COMPLETED",
3142
+ // "createdTime": 1696060873259,
3143
+ // "updatedTime": 1696060873286
2793
3144
  // }
2794
3145
  //
2795
3146
  const marketId = this.safeString(income, 'symbol');
2796
3147
  const symbol = this.safeSymbol(marketId, market);
2797
- let amount = this.safeString(income, 'funding_fee');
3148
+ let amount = this.safeString(income, 'fundingFee');
2798
3149
  const code = this.safeCurrencyCode('USD');
2799
3150
  const id = this.safeString(income, 'id');
2800
- const timestamp = this.safeTimestamp(income, 'updated_time');
2801
- const rate = this.safeNumber(income, 'funding_rate');
2802
- const paymentType = this.safeString(income, 'payment_type');
3151
+ const timestamp = this.safeInteger(income, 'updatedTime');
3152
+ const rate = this.safeNumber(income, 'fundingRate');
3153
+ const paymentType = this.safeString(income, 'paymentType');
2803
3154
  amount = (paymentType === 'Pay') ? Precise["default"].stringNeg(amount) : amount;
2804
3155
  return {
2805
3156
  'info': income,
@@ -2816,7 +3167,7 @@ class woo extends woo$1 {
2816
3167
  * @method
2817
3168
  * @name woo#fetchFundingHistory
2818
3169
  * @description fetch the history of funding payments paid and received on this account
2819
- * @see https://docs.woox.io/#get-funding-fee-history
3170
+ * @see https://developer.woox.io/api-reference/endpoint/futures/get_fundingFee_history
2820
3171
  * @param {string} [symbol] unified market symbol
2821
3172
  * @param {int} [since] the earliest time in ms to fetch funding history for
2822
3173
  * @param {int} [limit] the maximum number of funding history structures to retrieve
@@ -2829,7 +3180,7 @@ class woo extends woo$1 {
2829
3180
  let paginate = false;
2830
3181
  [paginate, params] = this.handleOptionAndParams(params, 'fetchFundingHistory', 'paginate');
2831
3182
  if (paginate) {
2832
- return await this.fetchPaginatedCallCursor('fetchFundingHistory', symbol, since, limit, params, 'page', 'page', 1, 500);
3183
+ return await this.fetchPaginatedCallIncremental('fetchFundingHistory', symbol, since, limit, params, 'page', 500);
2833
3184
  }
2834
3185
  const request = {};
2835
3186
  let market = undefined;
@@ -2838,70 +3189,67 @@ class woo extends woo$1 {
2838
3189
  request['symbol'] = market['id'];
2839
3190
  }
2840
3191
  if (since !== undefined) {
2841
- request['start_t'] = since;
3192
+ request['startTime'] = since;
2842
3193
  }
2843
- if (limit !== undefined) {
2844
- request['size'] = limit;
3194
+ const until = this.safeInteger(params, 'until'); // unified in milliseconds
3195
+ params = this.omit(params, ['until']);
3196
+ if (until !== undefined) {
3197
+ request['endTime'] = until;
2845
3198
  }
2846
- else {
2847
- request['size'] = 5000;
3199
+ if (limit !== undefined) {
3200
+ request['size'] = Math.min(limit, 500);
2848
3201
  }
2849
- const response = await this.v1PrivateGetFundingFeeHistory(this.extend(request, params));
3202
+ const response = await this.v3PrivateGetFuturesFundingFeeHistory(this.extend(request, params));
2850
3203
  //
2851
3204
  // {
2852
- // "rows":[
2853
- // {
2854
- // "id":666666,
2855
- // "symbol":"PERP_BTC_USDT",
2856
- // "funding_rate":0.00001198,
2857
- // "mark_price":28941.04000000,
2858
- // "funding_fee":0.00069343,
2859
- // "payment_type":"Pay",
2860
- // "status":"COMPLETED",
2861
- // "created_time":"1653616000.666",
2862
- // "updated_time":"1653616000.605"
2863
- // }
2864
- // ],
2865
- // "meta":{
2866
- // "total":235,
2867
- // "records_per_page":25,
2868
- // "current_page":1
3205
+ // "success": true,
3206
+ // "data": {
3207
+ // "meta": {
3208
+ // "total": 670,
3209
+ // "recordsPerPage": 25,
3210
+ // "currentPage": 1
3211
+ // },
3212
+ // "rows": [
3213
+ // {
3214
+ // "id": 1286360,
3215
+ // "symbol": "PERP_BTC_USDT",
3216
+ // "fundingRate": -0.00001445,
3217
+ // "markPrice": "26930.60000000",
3218
+ // "fundingFee": "9.56021744",
3219
+ // "fundingIntervalHours": 8,
3220
+ // "paymentType": "Pay",
3221
+ // "status": "COMPLETED",
3222
+ // "createdTime": 1696060873259,
3223
+ // "updatedTime": 1696060873286
3224
+ // }
3225
+ // ]
2869
3226
  // },
2870
- // "success":true
3227
+ // "timestamp": 1721351502594
2871
3228
  // }
2872
3229
  //
2873
- const meta = this.safeDict(response, 'meta', {});
2874
- const cursor = this.safeInteger(meta, 'current_page');
2875
- const result = this.safeList(response, 'rows', []);
2876
- const resultLength = result.length;
2877
- if (resultLength > 0) {
2878
- const lastItem = result[resultLength - 1];
2879
- lastItem['page'] = cursor;
2880
- result[resultLength - 1] = lastItem;
2881
- }
2882
- return this.parseIncomes(result, market, since, limit);
3230
+ const data = this.safeDict(response, 'data', {});
3231
+ const rows = this.safeList(data, 'rows', []);
3232
+ return this.parseIncomes(rows, market, since, limit);
2883
3233
  }
2884
3234
  parseFundingRate(fundingRate, market = undefined) {
2885
3235
  //
2886
3236
  // {
2887
- // "success": true,
2888
- // "timestamp": 1727427915529,
2889
3237
  // "symbol": "PERP_BTC_USDT",
2890
- // "est_funding_rate": -0.00092719,
2891
- // "est_funding_rate_timestamp": 1727427899060,
2892
- // "last_funding_rate": -0.00092610,
2893
- // "last_funding_rate_timestamp": 1727424000000,
2894
- // "next_funding_time": 1727452800000,
2895
- // "last_funding_rate_interval": 8,
2896
- // "est_funding_rate_interval": 8
3238
+ // "estFundingRate": "-0.00000441",
3239
+ // "estFundingRateTimestamp": 1751623979022,
3240
+ // "lastFundingRate": "-0.00004953",
3241
+ // "lastFundingRateTimestamp": 1751616000000,
3242
+ // "nextFundingTime": 1751644800000,
3243
+ // "lastFundingIntervalHours": 8,
3244
+ // "estFundingIntervalHours": 8
2897
3245
  // }
2898
3246
  //
2899
3247
  const symbol = this.safeString(fundingRate, 'symbol');
2900
3248
  market = this.market(symbol);
2901
- const nextFundingTimestamp = this.safeInteger(fundingRate, 'next_funding_time');
2902
- const estFundingRateTimestamp = this.safeInteger(fundingRate, 'est_funding_rate_timestamp');
2903
- const lastFundingRateTimestamp = this.safeInteger(fundingRate, 'last_funding_rate_timestamp');
2904
- const intervalString = this.safeString(fundingRate, 'est_funding_rate_interval');
3249
+ const nextFundingTimestamp = this.safeInteger(fundingRate, 'nextFundingTime');
3250
+ const estFundingRateTimestamp = this.safeInteger(fundingRate, 'estFundingRateTimestamp');
3251
+ const lastFundingRateTimestamp = this.safeInteger(fundingRate, 'lastFundingRateTimestamp');
3252
+ const intervalString = this.safeString(fundingRate, 'estFundingIntervalHours');
2905
3253
  return {
2906
3254
  'info': fundingRate,
2907
3255
  'symbol': market['symbol'],
@@ -2911,13 +3259,13 @@ class woo extends woo$1 {
2911
3259
  'estimatedSettlePrice': undefined,
2912
3260
  'timestamp': estFundingRateTimestamp,
2913
3261
  'datetime': this.iso8601(estFundingRateTimestamp),
2914
- 'fundingRate': this.safeNumber(fundingRate, 'est_funding_rate'),
3262
+ 'fundingRate': this.safeNumber(fundingRate, 'estFundingRate'),
2915
3263
  'fundingTimestamp': nextFundingTimestamp,
2916
3264
  'fundingDatetime': this.iso8601(nextFundingTimestamp),
2917
3265
  'nextFundingRate': undefined,
2918
3266
  'nextFundingTimestamp': undefined,
2919
3267
  'nextFundingDatetime': undefined,
2920
- 'previousFundingRate': this.safeNumber(fundingRate, 'last_funding_rate'),
3268
+ 'previousFundingRate': this.safeNumber(fundingRate, 'lastFundingRate'),
2921
3269
  'previousFundingTimestamp': lastFundingRateTimestamp,
2922
3270
  'previousFundingDatetime': this.iso8601(lastFundingRateTimestamp),
2923
3271
  'interval': intervalString + 'h',
@@ -2927,7 +3275,7 @@ class woo extends woo$1 {
2927
3275
  * @method
2928
3276
  * @name woo#fetchFundingInterval
2929
3277
  * @description fetch the current funding rate interval
2930
- * @see https://docs.woox.io/#get-predicted-funding-rate-for-one-market-public
3278
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/fundingRate
2931
3279
  * @param {string} symbol unified market symbol
2932
3280
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2933
3281
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -2939,7 +3287,7 @@ class woo extends woo$1 {
2939
3287
  * @method
2940
3288
  * @name woo#fetchFundingRate
2941
3289
  * @description fetch the current funding rate
2942
- * @see https://docs.woox.io/#get-predicted-funding-rate-for-one-market-public
3290
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/fundingRate
2943
3291
  * @param {string} symbol unified market symbol
2944
3292
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2945
3293
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -2950,28 +3298,37 @@ class woo extends woo$1 {
2950
3298
  const request = {
2951
3299
  'symbol': market['id'],
2952
3300
  };
2953
- const response = await this.v1PublicGetFundingRateSymbol(this.extend(request, params));
3301
+ const response = await this.v3PublicGetFundingRate(this.extend(request, params));
2954
3302
  //
2955
3303
  // {
2956
3304
  // "success": true,
2957
- // "timestamp": 1727428037877,
2958
- // "symbol": "PERP_BTC_USDT",
2959
- // "est_funding_rate": -0.00092674,
2960
- // "est_funding_rate_timestamp": 1727428019064,
2961
- // "last_funding_rate": -0.00092610,
2962
- // "last_funding_rate_timestamp": 1727424000000,
2963
- // "next_funding_time": 1727452800000,
2964
- // "last_funding_rate_interval": 8,
2965
- // "est_funding_rate_interval": 8
3305
+ // "data": {
3306
+ // "rows": [
3307
+ // {
3308
+ // "symbol": "PERP_BTC_USDT",
3309
+ // "estFundingRate": "-0.00000441",
3310
+ // "estFundingRateTimestamp": 1751623979022,
3311
+ // "lastFundingRate": "-0.00004953",
3312
+ // "lastFundingRateTimestamp": 1751616000000,
3313
+ // "nextFundingTime": 1751644800000,
3314
+ // "lastFundingIntervalHours": 8,
3315
+ // "estFundingIntervalHours": 8
3316
+ // }
3317
+ // ]
3318
+ // },
3319
+ // "timestamp": 1751624037798
2966
3320
  // }
2967
3321
  //
2968
- return this.parseFundingRate(response, market);
3322
+ const data = this.safeDict(response, 'data', {});
3323
+ const rows = this.safeList(data, 'rows', []);
3324
+ const first = this.safeDict(rows, 0, {});
3325
+ return this.parseFundingRate(first, market);
2969
3326
  }
2970
3327
  /**
2971
3328
  * @method
2972
3329
  * @name woo#fetchFundingRates
2973
3330
  * @description fetch the funding rate for multiple markets
2974
- * @see https://docs.woox.io/#get-predicted-funding-rate-for-all-markets-public
3331
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/fundingRate
2975
3332
  * @param {string[]|undefined} symbols list of unified market symbols
2976
3333
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2977
3334
  * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
@@ -2979,31 +3336,36 @@ class woo extends woo$1 {
2979
3336
  async fetchFundingRates(symbols = undefined, params = {}) {
2980
3337
  await this.loadMarkets();
2981
3338
  symbols = this.marketSymbols(symbols);
2982
- const response = await this.v1PublicGetFundingRates(params);
3339
+ const response = await this.v3PublicGetFundingRate(params);
2983
3340
  //
2984
3341
  // {
2985
- // "success":true,
2986
- // "rows":[
2987
- // {
2988
- // "symbol":"PERP_AAVE_USDT",
2989
- // "est_funding_rate":-0.00003447,
2990
- // "est_funding_rate_timestamp":1653633959001,
2991
- // "last_funding_rate":-0.00002094,
2992
- // "last_funding_rate_timestamp":1653631200000,
2993
- // "next_funding_time":1653634800000
2994
- // }
2995
- // ],
2996
- // "timestamp":1653633985646
3342
+ // "success": true,
3343
+ // "data": {
3344
+ // "rows": [
3345
+ // {
3346
+ // "symbol": "PERP_BTC_USDT",
3347
+ // "estFundingRate": "-0.00000441",
3348
+ // "estFundingRateTimestamp": 1751623979022,
3349
+ // "lastFundingRate": "-0.00004953",
3350
+ // "lastFundingRateTimestamp": 1751616000000,
3351
+ // "nextFundingTime": 1751644800000,
3352
+ // "lastFundingIntervalHours": 8,
3353
+ // "estFundingIntervalHours": 8
3354
+ // }
3355
+ // ]
3356
+ // },
3357
+ // "timestamp": 1751624037798
2997
3358
  // }
2998
3359
  //
2999
- const rows = this.safeList(response, 'rows', []);
3360
+ const data = this.safeDict(response, 'data', {});
3361
+ const rows = this.safeList(data, 'rows', []);
3000
3362
  return this.parseFundingRates(rows, symbols);
3001
3363
  }
3002
3364
  /**
3003
3365
  * @method
3004
3366
  * @name woo#fetchFundingRateHistory
3005
3367
  * @description fetches historical funding rate prices
3006
- * @see https://docs.woox.io/#get-funding-rate-history-for-one-market-public
3368
+ * @see https://developer.woox.io/api-reference/endpoint/public_data/fundingRateHistory
3007
3369
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
3008
3370
  * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
3009
3371
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
@@ -3019,46 +3381,52 @@ class woo extends woo$1 {
3019
3381
  if (paginate) {
3020
3382
  return await this.fetchPaginatedCallIncremental('fetchFundingRateHistory', symbol, since, limit, params, 'page', 25);
3021
3383
  }
3022
- let request = {};
3023
- if (symbol !== undefined) {
3024
- const market = this.market(symbol);
3025
- symbol = market['symbol'];
3026
- request['symbol'] = market['id'];
3384
+ if (symbol === undefined) {
3385
+ throw new errors.ArgumentsRequired(this.id + ' fetchFundingRateHistory() requires a symbol argument');
3027
3386
  }
3387
+ const market = this.market(symbol);
3388
+ symbol = market['symbol'];
3389
+ let request = {
3390
+ 'symbol': market['id'],
3391
+ };
3028
3392
  if (since !== undefined) {
3029
- request['start_t'] = this.parseToInt(since / 1000);
3393
+ request['startTime'] = since;
3030
3394
  }
3031
- [request, params] = this.handleUntilOption('end_t', request, params, 0.001);
3032
- const response = await this.v1PublicGetFundingRateHistory(this.extend(request, params));
3395
+ [request, params] = this.handleUntilOption('endTime', request, params);
3396
+ const response = await this.v3PublicGetFundingRateHistory(this.extend(request, params));
3033
3397
  //
3034
3398
  // {
3035
- // "success":true,
3036
- // "meta":{
3037
- // "total":2464,
3038
- // "records_per_page":25,
3039
- // "current_page":1
3040
- // },
3041
- // "rows":[
3042
- // {
3043
- // "symbol":"PERP_BTC_USDT",
3044
- // "funding_rate":0.00000629,
3045
- // "funding_rate_timestamp":1653638400000,
3046
- // "next_funding_time":1653642000000
3399
+ // "success": true,
3400
+ // "data": {
3401
+ // "rows": [
3402
+ // {
3403
+ // "symbol": "PERP_BTC_USDT",
3404
+ // "fundingRate": "-0.00004953",
3405
+ // "fundingRateTimestamp": 1751616000000,
3406
+ // "nextFundingTime": 1751644800000,
3407
+ // "markPrice": "108708"
3408
+ // }
3409
+ // ],
3410
+ // "meta": {
3411
+ // "total": 11690,
3412
+ // "recordsPerPage": 25,
3413
+ // "currentPage": 1
3047
3414
  // }
3048
- // ],
3049
- // "timestamp":1653640814885
3415
+ // },
3416
+ // "timestamp": 1751632390031
3050
3417
  // }
3051
3418
  //
3052
- const result = this.safeList(response, 'rows');
3419
+ const data = this.safeDict(response, 'data', {});
3420
+ const rows = this.safeList(data, 'rows', []);
3053
3421
  const rates = [];
3054
- for (let i = 0; i < result.length; i++) {
3055
- const entry = result[i];
3422
+ for (let i = 0; i < rows.length; i++) {
3423
+ const entry = rows[i];
3056
3424
  const marketId = this.safeString(entry, 'symbol');
3057
- const timestamp = this.safeInteger(entry, 'funding_rate_timestamp');
3425
+ const timestamp = this.safeInteger(entry, 'fundingRateTimestamp');
3058
3426
  rates.push({
3059
3427
  'info': entry,
3060
3428
  'symbol': this.safeSymbol(marketId),
3061
- 'fundingRate': this.safeNumber(entry, 'funding_rate'),
3429
+ 'fundingRate': this.safeNumber(entry, 'fundingRate'),
3062
3430
  'timestamp': timestamp,
3063
3431
  'datetime': this.iso8601(timestamp),
3064
3432
  });
@@ -3070,7 +3438,7 @@ class woo extends woo$1 {
3070
3438
  * @method
3071
3439
  * @name woo#setPositionMode
3072
3440
  * @description set hedged to true or false for a market
3073
- * @see https://docs.woox.io/#update-position-mode
3441
+ * @see https://developer.woox.io/api-reference/endpoint/futures/position_mode
3074
3442
  * @param {bool} hedged set to true to use HEDGE_MODE, false for ONE_WAY
3075
3443
  * @param {string} symbol not used by woo setPositionMode
3076
3444
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -3085,14 +3453,13 @@ class woo extends woo$1 {
3085
3453
  hedgeMode = 'ONE_WAY';
3086
3454
  }
3087
3455
  const request = {
3088
- 'position_mode': hedgeMode,
3456
+ 'positionMode': hedgeMode,
3089
3457
  };
3090
- const response = await this.v1PrivatePostClientPositionMode(this.extend(request, params));
3458
+ const response = await this.v3PrivatePutFuturesPositionMode(this.extend(request, params));
3091
3459
  //
3092
3460
  // {
3093
3461
  // "success": true,
3094
- // "data": {},
3095
- // "timestamp": "1709195608551"
3462
+ // "timestamp": 1752550492845
3096
3463
  // }
3097
3464
  //
3098
3465
  return response;
@@ -3101,11 +3468,12 @@ class woo extends woo$1 {
3101
3468
  * @method
3102
3469
  * @name woo#fetchLeverage
3103
3470
  * @description fetch the set leverage for a market
3104
- * @see https://docs.woox.io/#get-account-information-new
3471
+ * @see https://developer.woox.io/api-reference/endpoint/account/get_account_info
3472
+ * @see https://developer.woox.io/api-reference/endpoint/futures/get_leverage
3105
3473
  * @param {string} symbol unified market symbol
3106
3474
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3107
3475
  * @param {string} [params.marginMode] *for swap markets only* 'cross' or 'isolated'
3108
- * @param {string} [params.position_mode] *for swap markets only* 'ONE_WAY' or 'HEDGE_MODE'
3476
+ * @param {string} [params.positionMode] *for swap markets only* 'ONE_WAY' or 'HEDGE_MODE'
3109
3477
  * @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
3110
3478
  */
3111
3479
  async fetchLeverage(symbol, params = {}) {
@@ -3113,7 +3481,7 @@ class woo extends woo$1 {
3113
3481
  const market = this.market(symbol);
3114
3482
  let response = undefined;
3115
3483
  if (market['spot']) {
3116
- response = await this.v3PrivateGetAccountinfo(params);
3484
+ response = await this.v3PrivateGetAccountInfo(params);
3117
3485
  //
3118
3486
  // {
3119
3487
  // "success": true,
@@ -3121,25 +3489,26 @@ class woo extends woo$1 {
3121
3489
  // "applicationId": "dsa",
3122
3490
  // "account": "dsa",
3123
3491
  // "alias": "haha",
3124
- // "accountMode": "MARGIN",
3125
- // "leverage": 1,
3126
- // "takerFeeRate": 1,
3127
- // "makerFeeRate": 1,
3128
- // "interestRate": 1,
3129
- // "futuresTakerFeeRate": 1,
3130
- // "futuresMakerFeeRate": 1,
3131
3492
  // "otpauth": true,
3132
- // "marginRatio": 1,
3133
- // "openMarginRatio": 1,
3134
- // "initialMarginRatio": 1,
3135
- // "maintenanceMarginRatio": 1,
3136
- // "totalCollateral": 1,
3137
- // "freeCollateral": 1,
3138
- // "totalAccountValue": 1,
3139
- // "totalVaultValue": 1,
3140
- // "totalStakingValue": 1
3493
+ // "accountMode": "FUTURES",
3494
+ // "positionMode": "ONE_WAY",
3495
+ // "leverage": 0,
3496
+ // "marginRatio": "10",
3497
+ // "openMarginRatio": "10",
3498
+ // "initialMarginRatio": "10",
3499
+ // "maintenanceMarginRatio": "0.03",
3500
+ // "totalCollateral": "165.6115334",
3501
+ // "freeCollateral": "165.6115334",
3502
+ // "totalAccountValue": "167.52723093",
3503
+ // "totalTradingValue": "167.52723093",
3504
+ // "totalVaultValue": "0",
3505
+ // "totalStakingValue": "0",
3506
+ // "totalLaunchpadValue": "0",
3507
+ // "totalEarnValue": "0",
3508
+ // "referrerID": null,
3509
+ // "accountType": "Main"
3141
3510
  // },
3142
- // "timestamp": 1673323685109
3511
+ // "timestamp": 1752645129054
3143
3512
  // }
3144
3513
  //
3145
3514
  }
@@ -3149,8 +3518,8 @@ class woo extends woo$1 {
3149
3518
  };
3150
3519
  let marginMode = undefined;
3151
3520
  [marginMode, params] = this.handleMarginModeAndParams('fetchLeverage', params, 'cross');
3152
- request['margin_mode'] = this.encodeMarginMode(marginMode);
3153
- response = await this.v1PrivateGetClientFuturesLeverage(this.extend(request, params));
3521
+ request['marginMode'] = this.encodeMarginMode(marginMode);
3522
+ response = await this.v3PrivateGetFuturesLeverage(this.extend(request, params));
3154
3523
  //
3155
3524
  // HEDGE_MODE
3156
3525
  // {
@@ -3158,15 +3527,15 @@ class woo extends woo$1 {
3158
3527
  // "data":
3159
3528
  // {
3160
3529
  // "symbol": "PERP_ETH_USDT",
3161
- // "default_margin_mode": "CROSS",
3162
- // "position_mode": "HEDGE_MODE",
3530
+ // "marginMode": "CROSS",
3531
+ // "positionMode": "HEDGE_MODE",
3163
3532
  // "details": [
3164
3533
  // {
3165
- // "position_side": "LONG",
3534
+ // "positionSide": "LONG",
3166
3535
  // "leverage": 10
3167
3536
  // },
3168
3537
  // {
3169
- // "position_side": "SHORT",
3538
+ // "positionSide": "SHORT",
3170
3539
  // "leverage": 10
3171
3540
  // }
3172
3541
  // ]
@@ -3179,11 +3548,11 @@ class woo extends woo$1 {
3179
3548
  // "success": true,
3180
3549
  // "data": {
3181
3550
  // "symbol": "PERP_ETH_USDT",
3182
- // "default_margin_mode": "ISOLATED",
3183
- // "position_mode": "ONE_WAY",
3551
+ // "marginMode": "ISOLATED",
3552
+ // "positionMode": "ONE_WAY",
3184
3553
  // "details": [
3185
3554
  // {
3186
- // "position_side": "BOTH",
3555
+ // "positionSide": "BOTH",
3187
3556
  // "leverage": 10
3188
3557
  // }
3189
3558
  // ]
@@ -3201,15 +3570,18 @@ class woo extends woo$1 {
3201
3570
  parseLeverage(leverage, market = undefined) {
3202
3571
  const marketId = this.safeString(leverage, 'symbol');
3203
3572
  market = this.safeMarket(marketId, market);
3204
- const marginMode = this.safeStringLower(leverage, 'default_margin_mode');
3205
- const spotLeverage = this.safeInteger(leverage, 'leverage');
3573
+ const marginMode = this.safeStringLower(leverage, 'marginMode');
3574
+ let spotLeverage = this.safeInteger(leverage, 'leverage');
3575
+ if (spotLeverage === 0) {
3576
+ spotLeverage = null;
3577
+ }
3206
3578
  let longLeverage = spotLeverage;
3207
3579
  let shortLeverage = spotLeverage;
3208
3580
  const details = this.safeList(leverage, 'details', []);
3209
3581
  for (let i = 0; i < details.length; i++) {
3210
3582
  const position = this.safeDict(details, i, {});
3211
3583
  const positionLeverage = this.safeInteger(position, 'leverage');
3212
- const side = this.safeString(position, 'position_side');
3584
+ const side = this.safeString(position, 'positionSide');
3213
3585
  if (side === 'BOTH') {
3214
3586
  longLeverage = positionLeverage;
3215
3587
  shortLeverage = positionLeverage;
@@ -3233,13 +3605,13 @@ class woo extends woo$1 {
3233
3605
  * @method
3234
3606
  * @name woo#setLeverage
3235
3607
  * @description set the level of leverage for a market
3236
- * @see https://docs.woox.io/#update-leverage-setting
3237
- * @see https://docs.woox.io/#update-futures-leverage-setting
3608
+ * @see https://developer.woox.io/api-reference/endpoint/spot_margin/set_leverage
3609
+ * @see https://developer.woox.io/api-reference/endpoint/futures/set_leverage
3238
3610
  * @param {float} leverage the rate of leverage (1, 2, 3, 4 or 5 for spot markets, 1, 2, 3, 4, 5, 10, 15, 20 for swap markets)
3239
3611
  * @param {string} [symbol] unified market symbol (is mandatory for swap markets)
3240
3612
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3241
3613
  * @param {string} [params.marginMode] *for swap markets only* 'cross' or 'isolated'
3242
- * @param {string} [params.position_side] *for swap markets only* 'LONG' or 'SHORT' in hedge mode, 'BOTH' in one way mode.
3614
+ * @param {string} [params.positionMode] *for swap markets only* 'ONE_WAY' or 'HEDGE_MODE'
3243
3615
  * @returns {object} response from the exchange
3244
3616
  */
3245
3617
  async setLeverage(leverage, symbol = undefined, params = {}) {
@@ -3252,14 +3624,14 @@ class woo extends woo$1 {
3252
3624
  market = this.market(symbol);
3253
3625
  }
3254
3626
  if ((symbol === undefined) || market['spot']) {
3255
- return await this.v1PrivatePostClientLeverage(this.extend(request, params));
3627
+ return await this.v3PrivatePostSpotMarginLeverage(this.extend(request, params));
3256
3628
  }
3257
3629
  else if (market['swap']) {
3258
3630
  request['symbol'] = market['id'];
3259
3631
  let marginMode = undefined;
3260
3632
  [marginMode, params] = this.handleMarginModeAndParams('fetchLeverage', params, 'cross');
3261
- request['margin_mode'] = this.encodeMarginMode(marginMode);
3262
- return await this.v1PrivatePostClientFuturesLeverage(this.extend(request, params));
3633
+ request['marginMode'] = this.encodeMarginMode(marginMode);
3634
+ return await this.v3PrivatePutFuturesLeverage(this.extend(request, params));
3263
3635
  }
3264
3636
  else {
3265
3637
  throw new errors.NotSupported(this.id + ' fetchLeverage() is not supported for ' + market['type'] + ' markets');
@@ -3304,93 +3676,99 @@ class woo extends woo$1 {
3304
3676
  };
3305
3677
  return await this.v1PrivatePostClientIsolatedMargin(this.extend(request, params));
3306
3678
  }
3679
+ /**
3680
+ * @method
3681
+ * @name woo#fetchPosition
3682
+ * @description fetch data on an open position
3683
+ * @see https://developer.woox.io/api-reference/endpoint/futures/get_positions
3684
+ * @param {string} symbol unified market symbol of the market the position is held in
3685
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3686
+ * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
3687
+ */
3307
3688
  async fetchPosition(symbol, params = {}) {
3308
3689
  await this.loadMarkets();
3309
3690
  const market = this.market(symbol);
3310
3691
  const request = {
3311
3692
  'symbol': market['id'],
3312
3693
  };
3313
- const response = await this.v1PrivateGetPositionSymbol(this.extend(request, params));
3694
+ const response = await this.v3PrivateGetFuturesPositions(this.extend(request, params));
3314
3695
  //
3315
3696
  // {
3316
- // "symbol": "PERP_ETH_USDT",
3317
- // "position_side": "BOTH",
3318
- // "leverage": 10,
3319
- // "margin_mode": "CROSS",
3320
- // "average_open_price": 3139.9,
3321
- // "isolated_margin_amount": 0.0,
3322
- // "isolated_margin_token": "",
3323
- // "opening_time": "1720627963.094",
3324
- // "mark_price": 3155.19169891,
3325
- // "pending_short_qty": 0.0,
3326
- // "pending_long_qty": 0.0,
3327
- // "holding": -0.7,
3328
- // "pnl_24_h": 0.0,
3329
- // "est_liq_price": 9107.40055552,
3330
- // "settle_price": 3151.0319904,
3331
3697
  // "success": true,
3332
- // "fee_24_h": 0.0,
3333
- // "isolated_frozen_long": 0.0,
3334
- // "isolated_frozen_short": 0.0,
3335
- // "timestamp": "1720867502.544"
3698
+ // "data": {
3699
+ // "positions": [
3700
+ // {
3701
+ // "symbol": "PERP_LTC_USDT",
3702
+ // "holding": "0.1",
3703
+ // "pendingLongQty": "0",
3704
+ // "pendingShortQty": "0",
3705
+ // "settlePrice": "96.87",
3706
+ // "averageOpenPrice": "96.87",
3707
+ // "pnl24H": "0",
3708
+ // "fee24H": "0.0048435",
3709
+ // "markPrice": "96.83793449",
3710
+ // "estLiqPrice": "0",
3711
+ // "timestamp": 1752500555823,
3712
+ // "adlQuantile": 2,
3713
+ // "positionSide": "BOTH",
3714
+ // "marginMode": "CROSS",
3715
+ // "isolatedMarginToken": "",
3716
+ // "isolatedMarginAmount": "0",
3717
+ // "isolatedFrozenLong": "0",
3718
+ // "isolatedFrozenShort": "0",
3719
+ // "leverage": 10
3720
+ // }
3721
+ // ]
3722
+ // },
3723
+ // "timestamp": 1752500579848
3336
3724
  // }
3337
3725
  //
3338
- return this.parsePosition(response, market);
3726
+ const result = this.safeDict(response, 'data', {});
3727
+ const positions = this.safeList(result, 'positions', []);
3728
+ const first = this.safeDict(positions, 0, {});
3729
+ return this.parsePosition(first, market);
3339
3730
  }
3731
+ /**
3732
+ * @method
3733
+ * @name woo#fetchPositions
3734
+ * @description fetch all open positions
3735
+ * @see https://developer.woox.io/api-reference/endpoint/futures/get_positions
3736
+ * @param {string[]} [symbols] list of unified market symbols
3737
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3738
+ * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
3739
+ */
3340
3740
  async fetchPositions(symbols = undefined, params = {}) {
3341
3741
  await this.loadMarkets();
3342
- const response = await this.v3PrivateGetPositions(params);
3742
+ const response = await this.v3PrivateGetFuturesPositions(params);
3343
3743
  //
3344
3744
  // {
3345
3745
  // "success": true,
3346
- // "data":
3347
- // {
3746
+ // "data": {
3348
3747
  // "positions": [
3349
3748
  // {
3350
- // "symbol": "PERP_ETH_USDT",
3351
- // "holding": -1.0,
3352
- // "pendingLongQty": 0.0,
3353
- // "pendingShortQty": 0.0,
3354
- // "settlePrice": 3143.2,
3355
- // "averageOpenPrice": 3143.2,
3356
- // "pnl24H": 0.0,
3357
- // "fee24H": 1.5716,
3358
- // "markPrice": 3134.97984158,
3359
- // "estLiqPrice": 3436.176349,
3360
- // "timestamp": 1720628031.463,
3361
- // "adlQuantile": 5,
3362
- // "positionSide": "BOTH",
3363
- // "marginMode": "ISOLATED",
3364
- // "isolatedMarginToken": "USDT",
3365
- // "isolatedMarginAmount": 314.62426,
3366
- // "isolatedFrozenLong": 0.0,
3367
- // "isolatedFrozenShort": 0.0,
3368
- // "leverage": 10
3369
- // },
3370
- // {
3371
- // "symbol": "PERP_SOL_USDT",
3372
- // "holding": -1.0,
3373
- // "pendingLongQty": 0.0,
3374
- // "pendingShortQty": 0.0,
3375
- // "settlePrice": 141.89933923,
3376
- // "averageOpenPrice": 171.38,
3377
- // "pnl24H": 0.0,
3378
- // "fee24H": 0.0,
3379
- // "markPrice": 141.65155427,
3380
- // "estLiqPrice": 4242.73548551,
3381
- // "timestamp": 1720616702.68,
3382
- // "adlQuantile": 5,
3749
+ // "symbol": "PERP_LTC_USDT",
3750
+ // "holding": "0.1",
3751
+ // "pendingLongQty": "0",
3752
+ // "pendingShortQty": "0",
3753
+ // "settlePrice": "96.87",
3754
+ // "averageOpenPrice": "96.87",
3755
+ // "pnl24H": "0",
3756
+ // "fee24H": "0.0048435",
3757
+ // "markPrice": "96.83793449",
3758
+ // "estLiqPrice": "0",
3759
+ // "timestamp": 1752500555823,
3760
+ // "adlQuantile": 2,
3383
3761
  // "positionSide": "BOTH",
3384
3762
  // "marginMode": "CROSS",
3385
3763
  // "isolatedMarginToken": "",
3386
- // "isolatedMarginAmount": 0.0,
3387
- // "isolatedFrozenLong": 0.0,
3388
- // "isolatedFrozenShort": 0.0,
3764
+ // "isolatedMarginAmount": "0",
3765
+ // "isolatedFrozenLong": "0",
3766
+ // "isolatedFrozenShort": "0",
3389
3767
  // "leverage": 10
3390
3768
  // }
3391
3769
  // ]
3392
3770
  // },
3393
- // "timestamp": 1720628675078
3771
+ // "timestamp": 1752500579848
3394
3772
  // }
3395
3773
  //
3396
3774
  const result = this.safeDict(response, 'data', {});
@@ -3425,24 +3803,24 @@ class woo extends woo$1 {
3425
3803
  //
3426
3804
  // v3PrivateGetPositions
3427
3805
  // {
3428
- // "symbol": "PERP_ETH_USDT",
3429
- // "holding": -1.0,
3430
- // "pendingLongQty": 0.0, // todo: check
3431
- // "pendingShortQty": 0.0, // todo: check
3432
- // "settlePrice": 3143.2,
3433
- // "averageOpenPrice": 3143.2,
3434
- // "pnl24H": 0.0, // todo: check
3435
- // "fee24H": 1.5716, // todo: check
3436
- // "markPrice": 3134.97984158,
3437
- // "estLiqPrice": 3436.176349,
3438
- // "timestamp": 1720628031.463,
3439
- // "adlQuantile": 5,
3806
+ // "symbol": "PERP_LTC_USDT",
3807
+ // "holding": "0.1",
3808
+ // "pendingLongQty": "0",
3809
+ // "pendingShortQty": "0",
3810
+ // "settlePrice": "96.87",
3811
+ // "averageOpenPrice": "96.87",
3812
+ // "pnl24H": "0",
3813
+ // "fee24H": "0.0048435",
3814
+ // "markPrice": "96.83793449",
3815
+ // "estLiqPrice": "0",
3816
+ // "timestamp": 1752500555823,
3817
+ // "adlQuantile": 2,
3440
3818
  // "positionSide": "BOTH",
3441
- // "marginMode": "ISOLATED",
3442
- // "isolatedMarginToken": "USDT", // todo: check
3443
- // "isolatedMarginAmount": 314.62426, // todo: check
3444
- // "isolatedFrozenLong": 0.0, // todo: check
3445
- // "isolatedFrozenShort": 0.0, // todo: check
3819
+ // "marginMode": "CROSS",
3820
+ // "isolatedMarginToken": "",
3821
+ // "isolatedMarginAmount": "0",
3822
+ // "isolatedFrozenLong": "0",
3823
+ // "isolatedFrozenShort": "0",
3446
3824
  // "leverage": 10
3447
3825
  // }
3448
3826
  //
@@ -3458,7 +3836,16 @@ class woo extends woo$1 {
3458
3836
  }
3459
3837
  const contractSize = this.safeString(market, 'contractSize');
3460
3838
  const markPrice = this.safeString2(position, 'markPrice', 'mark_price');
3461
- const timestamp = this.safeTimestamp(position, 'timestamp');
3839
+ const timestampString = this.safeString(position, 'timestamp');
3840
+ let timestamp = undefined;
3841
+ if (timestampString !== undefined) {
3842
+ if (timestampString.indexOf('.') > -1) {
3843
+ timestamp = this.safeTimestamp(position, 'timestamp');
3844
+ }
3845
+ else {
3846
+ timestamp = this.safeInteger(position, 'timestamp');
3847
+ }
3848
+ }
3462
3849
  const entryPrice = this.safeString2(position, 'averageOpenPrice', 'average_open_price');
3463
3850
  const priceDifference = Precise["default"].stringSub(markPrice, entryPrice);
3464
3851
  const unrealisedPnl = Precise["default"].stringMul(priceDifference, size);