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