okx-api 1.3.6 → 1.4.0

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 (51) hide show
  1. package/README.md +22 -11
  2. package/lib/rest-client.d.ts +523 -43
  3. package/lib/rest-client.js +600 -48
  4. package/lib/rest-client.js.map +1 -1
  5. package/lib/types/rest/request/account.d.ts +93 -0
  6. package/lib/types/rest/request/block-trading.d.ts +16 -0
  7. package/lib/types/rest/request/copy-trading.d.ts +117 -0
  8. package/lib/types/rest/request/copy-trading.js +3 -0
  9. package/lib/types/rest/request/copy-trading.js.map +1 -0
  10. package/lib/types/rest/request/funding.d.ts +7 -0
  11. package/lib/types/rest/request/grid-trading.d.ts +14 -0
  12. package/lib/types/rest/request/index.d.ts +5 -0
  13. package/lib/types/rest/request/index.js +5 -0
  14. package/lib/types/rest/request/index.js.map +1 -1
  15. package/lib/types/rest/request/public.d.ts +40 -0
  16. package/lib/types/rest/request/recurring-buy.d.ts +28 -0
  17. package/lib/types/rest/request/recurring-buy.js +3 -0
  18. package/lib/types/rest/request/recurring-buy.js.map +1 -0
  19. package/lib/types/rest/request/signal-bot.d.ts +97 -0
  20. package/lib/types/rest/request/signal-bot.js +3 -0
  21. package/lib/types/rest/request/signal-bot.js.map +1 -0
  22. package/lib/types/rest/request/simple-earn.d.ts +23 -0
  23. package/lib/types/rest/request/simple-earn.js +3 -0
  24. package/lib/types/rest/request/simple-earn.js.map +1 -0
  25. package/lib/types/rest/request/spread-trading.d.ts +69 -0
  26. package/lib/types/rest/request/spread-trading.js +3 -0
  27. package/lib/types/rest/request/spread-trading.js.map +1 -0
  28. package/lib/types/rest/request/subaccount.d.ts +21 -0
  29. package/lib/types/rest/request/trade.d.ts +4 -0
  30. package/lib/types/rest/response/index.d.ts +4 -0
  31. package/lib/types/rest/response/index.js +4 -0
  32. package/lib/types/rest/response/index.js.map +1 -1
  33. package/lib/types/rest/response/private-account.d.ts +113 -0
  34. package/lib/types/rest/response/private-block-trading.d.ts +35 -0
  35. package/lib/types/rest/response/private-copy-trading.d.ts +259 -0
  36. package/lib/types/rest/response/private-copy-trading.js +3 -0
  37. package/lib/types/rest/response/private-copy-trading.js.map +1 -0
  38. package/lib/types/rest/response/private-funding.d.ts +14 -0
  39. package/lib/types/rest/response/private-recurring-buy.d.ts +63 -0
  40. package/lib/types/rest/response/private-recurring-buy.js +3 -0
  41. package/lib/types/rest/response/private-recurring-buy.js.map +1 -0
  42. package/lib/types/rest/response/private-signal-bot.d.ts +22 -0
  43. package/lib/types/rest/response/private-signal-bot.js +3 -0
  44. package/lib/types/rest/response/private-signal-bot.js.map +1 -0
  45. package/lib/types/rest/response/private-spread-trading.d.ts +125 -0
  46. package/lib/types/rest/response/private-spread-trading.js +3 -0
  47. package/lib/types/rest/response/private-spread-trading.js.map +1 -0
  48. package/lib/types/rest/response/private-subaccount.d.ts +16 -0
  49. package/lib/types/rest/response/private-trade.d.ts +5 -0
  50. package/lib/types/rest/response/public-data.d.ts +27 -0
  51. package/package.json +1 -1
@@ -36,11 +36,6 @@ class RestClient extends BaseRestClient_1.default {
36
36
  return timestamp;
37
37
  });
38
38
  }
39
- /**
40
- *
41
- * Trade endpoints (private)
42
- *
43
- */
44
39
  submitOrder(params) {
45
40
  return this.postPrivate('/api/v5/trade/order', params);
46
41
  }
@@ -92,6 +87,21 @@ class RestClient extends BaseRestClient_1.default {
92
87
  getFillsHistory(params) {
93
88
  return this.getPrivate('/api/v5/trade/fills-history', params);
94
89
  }
90
+ applyTransactionDetailsArchive(params) {
91
+ return this.postPrivate('/api/v5/trade/fills-archive', params);
92
+ }
93
+ getTransactionDetailsArchiveLink(params) {
94
+ return this.getPrivate('/api/v5/trade/fills-archive', params);
95
+ }
96
+ cancelMassOrder(params) {
97
+ return this.postPrivate('/api/v5/trade/mass-cancel', params);
98
+ }
99
+ cancelAllAfter(params) {
100
+ return this.postPrivate('/api/v5/trade/cancel-all-after', params);
101
+ }
102
+ getAccountRateLimit() {
103
+ return this.getPrivate('/api/v5/trade/account-rate-limit');
104
+ }
95
105
  placeAlgoOrder(params) {
96
106
  return this.postPrivate('/api/v5/trade/order-algo', params);
97
107
  }
@@ -181,6 +191,21 @@ class RestClient extends BaseRestClient_1.default {
181
191
  executeBlockQuote(params) {
182
192
  return this.postPrivate('/api/v5/rfq/execute-quote', params);
183
193
  }
194
+ getQuoteProducts() {
195
+ return this.getPrivate('/api/v5/rfq/maker-instrument-settings');
196
+ }
197
+ updateBlockQuoteProducts(params) {
198
+ return this.postPrivate('/api/v5/rfq/maker-instrument-settings', params);
199
+ }
200
+ resetBlockMmp() {
201
+ return this.postPrivate('/api/v5/rfq/mmp-reset');
202
+ }
203
+ updateBlockMmpConfig(params) {
204
+ return this.postPrivate('/api/v5/rfq/mmp-config', params);
205
+ }
206
+ getBlockMmpConfig() {
207
+ return this.getPrivate('/api/v5/rfq/mmp-config');
208
+ }
184
209
  createBlockQuote(params) {
185
210
  return this.postPrivate('/api/v5/rfq/create-quote', params);
186
211
  }
@@ -193,6 +218,9 @@ class RestClient extends BaseRestClient_1.default {
193
218
  cancelAllBlockQuotes() {
194
219
  return this.postPrivate('/api/v5/rfq/cancel-all-quotes');
195
220
  }
221
+ cancelAllBlockAfter(params) {
222
+ return this.postPrivate('/api/v5/rfq/cancel-all-after', params);
223
+ }
196
224
  getBlockRFQs(params) {
197
225
  return this.getPrivate('/api/v5/rfq/rfqs', params);
198
226
  }
@@ -205,6 +233,9 @@ class RestClient extends BaseRestClient_1.default {
205
233
  getPublicRFQBlockTrades(params) {
206
234
  return this.get('/api/v5/rfq/public-trades', params);
207
235
  }
236
+ getBlockPublicTrades(params) {
237
+ return this.get('/api/v5/public/block-trades', params);
238
+ }
208
239
  /**
209
240
  *
210
241
  * Funding endpoints (private)
@@ -216,6 +247,9 @@ class RestClient extends BaseRestClient_1.default {
216
247
  getBalances(ccy) {
217
248
  return this.getPrivate('/api/v5/asset/balances', { ccy });
218
249
  }
250
+ getNonTradableAssets(params) {
251
+ return this.getPrivate('/api/v5/asset/non-tradable-assets', params);
252
+ }
219
253
  getAccountAssetValuation(ccy) {
220
254
  return this.getPrivate('/api/v5/asset/asset-valuation', { ccy });
221
255
  }
@@ -254,8 +288,20 @@ class RestClient extends BaseRestClient_1.default {
254
288
  getWithdrawalHistory(params) {
255
289
  return this.getPrivate('/api/v5/asset/withdrawal-history', params);
256
290
  }
291
+ getDepositWithdrawStatus(params) {
292
+ return this.getPrivate('/api/v5/asset/deposit-withdraw-status', params);
293
+ }
257
294
  smallAssetsConvert(ccy) {
258
- return this.getPrivate('/api/v5/asset/convert-dust-assets', { ccy });
295
+ return this.postPrivate('/api/v5/asset/convert-dust-assets', { ccy });
296
+ }
297
+ getExchanges() {
298
+ return this.get('/api/v5/asset/exchange-list');
299
+ }
300
+ applyForMonthlyStatement(params) {
301
+ return this.postPrivate('/api/v5/asset/monthly-statement', params);
302
+ }
303
+ getMonthlyStatement(params) {
304
+ return this.getPrivate('/api/v5/asset/monthly-statement', params);
259
305
  }
260
306
  getSavingBalance(ccy) {
261
307
  return this.getPrivate('/api/v5/finance/savings/balance', { ccy });
@@ -311,6 +357,9 @@ class RestClient extends BaseRestClient_1.default {
311
357
  * Account endpoints (private)
312
358
  *
313
359
  */
360
+ getAccountInstruments(params) {
361
+ return this.getPrivate('/api/v5/account/instruments', params);
362
+ }
314
363
  getBalance(ccy) {
315
364
  return this.getPrivate('/api/v5/account/balance', { ccy });
316
365
  }
@@ -402,6 +451,12 @@ class RestClient extends BaseRestClient_1.default {
402
451
  getAccountRiskState() {
403
452
  return this.getPrivate('/api/v5/account/risk-state');
404
453
  }
454
+ submitQuickMarginBorrowRepay(params) {
455
+ return this.postPrivate('/api/v5/account/quick-margin-borrow-repay', params);
456
+ }
457
+ getQuickMarginBorrowRepayHistory(params) {
458
+ return this.getPrivate('/api/v5/account/quick-margin-borrow-repay-history', params);
459
+ }
405
460
  borrowRepayVIPLoan(ccy, side, amt, ordId) {
406
461
  return this.postPrivate('/api/v5/account/borrow-repay', {
407
462
  ccy,
@@ -413,11 +468,47 @@ class RestClient extends BaseRestClient_1.default {
413
468
  getVIPLoanBorrowRepayHistory(params) {
414
469
  return this.getPrivate('/api/v5/account/borrow-repay-history', params);
415
470
  }
471
+ getVIPInterestAccrued(params) {
472
+ return this.getPrivate('/api/v5/account/vip-interest-accrued', params);
473
+ }
474
+ getVIPInterestDeducted(params) {
475
+ return this.getPrivate('/api/v5/account/vip-interest-deducted', params);
476
+ }
477
+ getVIPLoanOrders(params) {
478
+ return this.getPrivate('/api/v5/account/vip-loan-order-list', params);
479
+ }
480
+ getVIPLoanOrder(params) {
481
+ return this.getPrivate('/api/v5/account/vip-loan-order-detail', params);
482
+ }
416
483
  getBorrowInterestLimits(params) {
417
484
  return this.getPrivate('/api/v5/account/interest-limits', params);
418
485
  }
486
+ getFixedLoanBorrowLimit() {
487
+ return this.getPrivate('/api/v5/account/fixed-loan/borrowing-limit');
488
+ }
489
+ getFixedLoanBorrowQuote(params) {
490
+ return this.getPrivate('/api/v5/account/fixed-loan/borrowing-quote', params);
491
+ }
492
+ submitFixedLoanBorrowOrder(params) {
493
+ return this.postPrivate('/api/v5/account/fixed-loan/borrowing-order', params);
494
+ }
495
+ updateFixedLoanBorrowOrder(params) {
496
+ return this.postPrivate('/api/v5/account/fixed-loan/amend-borrowing-order', params);
497
+ }
498
+ manualRenewFixedLoanBorrowOrder(params) {
499
+ return this.postPrivate('/api/v5/account/fixed-loan/manual-reborrow', params);
500
+ }
501
+ repayFixedLoanBorrowOrder(params) {
502
+ return this.postPrivate('/api/v5/account/fixed-loan/repay-borrowing-order', params);
503
+ }
504
+ getFixedLoanBorrowOrders(params) {
505
+ return this.getPrivate('/api/v5/account/fixed-loan/borrowing-orders-list', params);
506
+ }
419
507
  positionBuilder(params) {
420
- return this.postPrivate('/api/v5/account/simulated_margin', params);
508
+ return this.postPrivate('/api/v5/account/position-builder', params);
509
+ }
510
+ updateRiskOffsetAmount(params) {
511
+ return this.postPrivate('/api/v5/account/set-riskOffset-amt', params);
421
512
  }
422
513
  getGreeks(ccy) {
423
514
  return this.getPrivate('/api/v5/account/greeks', { ccy });
@@ -425,6 +516,21 @@ class RestClient extends BaseRestClient_1.default {
425
516
  getPMLimitation(params) {
426
517
  return this.getPrivate('/api/v5/account/position-tiers', params);
427
518
  }
519
+ updateRiskOffsetType(params) {
520
+ return this.postPrivate('/api/v5/account/set-riskOffset-type', params);
521
+ }
522
+ activateOption() {
523
+ return this.postPrivate('/api/v5/account/activate-option');
524
+ }
525
+ resetMMPStatus(params) {
526
+ return this.postPrivate('/api/v5/account/mmp-reset', params);
527
+ }
528
+ setMMPConfig(params) {
529
+ return this.postPrivate('/api/v5/account/mmp-config', params);
530
+ }
531
+ getMMPConfig(params) {
532
+ return this.getPrivate('/api/v5/account/mmp-config', params);
533
+ }
428
534
  /**
429
535
  *
430
536
  * SubAccount endpoints (private)
@@ -450,10 +556,16 @@ class RestClient extends BaseRestClient_1.default {
450
556
  ccy,
451
557
  });
452
558
  }
559
+ getSubAccountMaxWithdrawal(params) {
560
+ return this.getPrivate('/api/v5/account/subaccount/max-withdrawal', params);
561
+ }
453
562
  /** History of sub-account transfer */
454
563
  getSubAccountTransferHistory(params) {
455
564
  return this.getPrivate('/api/v5/asset/subaccount/bills', params);
456
565
  }
566
+ getManagedSubAccountTransferHistory(params) {
567
+ return this.getPrivate('/api/v5/asset/subaccount/managed-subaccount-bills', params);
568
+ }
457
569
  /** Master accounts manage the transfers between sub-accounts */
458
570
  transferSubAccountBalance(params) {
459
571
  return this.postPrivate('/api/v5/asset/subaccount/transfer', params);
@@ -471,6 +583,12 @@ class RestClient extends BaseRestClient_1.default {
471
583
  subAcct,
472
584
  });
473
585
  }
586
+ setSubAccountLoanAllocation(params) {
587
+ return this.postPrivate('/api/v5/account/subaccount/set-loan-allocation', params);
588
+ }
589
+ getSubAccountBorrowInterestAndLimit(params) {
590
+ return this.getPrivate('/api/v5/account/subaccount/interest-limits', params);
591
+ }
474
592
  /**
475
593
  *
476
594
  * Grid trading endpoints (private)
@@ -486,6 +604,15 @@ class RestClient extends BaseRestClient_1.default {
486
604
  stopGridAlgoOrder(orders) {
487
605
  return this.postPrivate('/api/v5/tradingBot/grid/stop-order-algo', orders);
488
606
  }
607
+ closeGridContractPosition(params) {
608
+ return this.postPrivate('/api/v5/tradingBot/grid/close-position', params);
609
+ }
610
+ cancelGridContractCloseOrder(params) {
611
+ return this.postPrivate('/api/v5/tradingBot/grid/cancel-close-order', params);
612
+ }
613
+ instantTriggerGridAlgoOrder(params) {
614
+ return this.postPrivate('/api/v5/tradingBot/grid/order-instant-trigger', params);
615
+ }
489
616
  getGridAlgoOrderList(params) {
490
617
  return this.getPrivate('/api/v5/tradingBot/grid/orders-algo-pending', params);
491
618
  }
@@ -527,6 +654,9 @@ class RestClient extends BaseRestClient_1.default {
527
654
  return this.postPrivate('/api/v5/tradingBot/grid/margin-balance', Object.assign({ algoId,
528
655
  type }, change));
529
656
  }
657
+ adjustGridInvestment(params) {
658
+ return this.postPrivate('/api/v5/tradingBot/grid/adjust-investment', params);
659
+ }
530
660
  getGridAIParameter(algoOrdType, instId, direction, duration) {
531
661
  return this.get('/api/v5/tradingBot/grid/ai-param', {
532
662
  algoOrdType,
@@ -535,45 +665,11 @@ class RestClient extends BaseRestClient_1.default {
535
665
  duration,
536
666
  });
537
667
  }
538
- /**
539
- *
540
- * Earn/staking endpoints (private)
541
- *
542
- */
543
- /** Get earn offers */
544
- getStakingOffers(params) {
545
- return this.getPrivate('/api/v5/finance/staking-defi/offers', params);
546
- }
547
- /** Earn/staking purchase */
548
- submitStake(productId, investData, term) {
549
- return this.postPrivate('/api/v5/finance/staking-defi/purchase', {
550
- productId,
551
- investData,
552
- term,
553
- });
668
+ computeGridMinInvestment(params) {
669
+ return this.post('/api/v5/tradingBot/grid/min-investment', params);
554
670
  }
555
- /** Earn/staking redeem */
556
- redeemStake(ordId, protocolType, allowEarlyRedeem) {
557
- return this.postPrivate('/api/v5/finance/staking-defi/redeem', {
558
- ordId,
559
- protocolType,
560
- allowEarlyRedeem,
561
- });
562
- }
563
- /** Earn/staking cancel purchases/redemptions */
564
- cancelStakingRequest(ordId, protocolType) {
565
- return this.postPrivate('/api/v5/finance/staking-defi/cancel', {
566
- ordId,
567
- protocolType,
568
- });
569
- }
570
- /** Earn/staking get active orders */
571
- getActiveStakingOrders(params) {
572
- return this.getPrivate('/api/v5/finance/staking-defi/orders-active', params);
573
- }
574
- /** Earn/staking get order history */
575
- getStakingOrderHistory(params) {
576
- return this.getPrivate('/api/v5/finance/staking-defi/orders-history', params);
671
+ getRSIBackTesting(params) {
672
+ return this.get('/api/v5/tradingBot/public/rsi-back-testing', params);
577
673
  }
578
674
  /**
579
675
  *
@@ -597,36 +693,111 @@ class RestClient extends BaseRestClient_1.default {
597
693
  getOrderBook(instId, sz) {
598
694
  return this.get('/api/v5/market/books', { instId, sz });
599
695
  }
696
+ getFullOrderBook(params) {
697
+ return this.get('/api/v5/market/books-full', params);
698
+ }
699
+ /**
700
+ * @deprecated this method's parameters will change to an object in the next release. Use getCandlesV2 instead.
701
+ *
702
+ * @param instId
703
+ * @param bar
704
+ * @param pagination
705
+ * @returns
706
+ */
600
707
  getCandles(instId, bar = '1m', pagination) {
601
708
  return this.get('/api/v5/market/candles', Object.assign({ instId,
602
709
  bar }, pagination));
603
710
  }
711
+ getCandlesV2(params) {
712
+ return this.get('/api/v5/market/candles', params);
713
+ }
714
+ /**
715
+ * @deprecated this method's parameters will change to an object in the next release. Use getHistoricCandlesV2 instead.
716
+ *
717
+ * @param instId
718
+ * @param bar
719
+ * @param pagination
720
+ * @returns
721
+ */
604
722
  getHistoricCandles(instId, bar = '1m', pagination) {
605
723
  return this.get('/api/v5/market/history-candles', Object.assign({ instId,
606
724
  bar }, pagination));
607
725
  }
726
+ getHistoricCandlesV2(params) {
727
+ return this.get('/api/v5/market/history-candles', params);
728
+ }
729
+ /**
730
+ * @deprecated this method's parameters will change to an object in the next release. Use getIndexCandlesV2 instead.
731
+ *
732
+ * @param instId
733
+ * @param bar
734
+ * @param pagination
735
+ * @returns
736
+ */
608
737
  getIndexCandles(instId, bar = '1m', pagination) {
609
738
  return this.get('/api/v5/market/index-candles', Object.assign({ instId,
610
739
  bar }, pagination));
611
740
  }
741
+ getIndexCandlesV2(params) {
742
+ return this.get('/api/v5/market/index-candles', params);
743
+ }
744
+ /**
745
+ * @deprecated this method's parameters will change to an object in the next release. Use getHistoricIndexCandlesV2 instead.
746
+ *
747
+ * @param instId
748
+ * @param bar
749
+ * @param pagination
750
+ * @returns
751
+ */
612
752
  getHistoricIndexCandles(instId, bar = '1m', pagination) {
613
753
  return this.get('/api/v5/market/history-index-candles', Object.assign({ instId,
614
754
  bar }, pagination));
615
755
  }
756
+ getHistoricIndexCandlesV2(params) {
757
+ return this.get('/api/v5/market/history-index-candles', params);
758
+ }
759
+ /**
760
+ * @deprecated this method's parameters will change to an object in the next release. Use getMarkPriceCandlesV2 instead.
761
+ *
762
+ * @param instId
763
+ * @param bar
764
+ * @param pagination
765
+ * @returns
766
+ */
616
767
  getMarkPriceCandles(instId, bar = '1m', pagination) {
617
768
  return this.get('/api/v5/market/mark-price-candles', Object.assign({ instId,
618
769
  bar }, pagination));
619
770
  }
771
+ getMarkPriceCandlesV2(params) {
772
+ return this.get('/api/v5/market/mark-price-candles', params);
773
+ }
774
+ /**
775
+ * @deprecated this method's parameters will change to an object in the next release. Use getHistoricMarkPriceCandlesV2 instead.
776
+ *
777
+ * @param instId
778
+ * @param bar
779
+ * @param pagination
780
+ * @returns
781
+ */
620
782
  getHistoricMarkPriceCandles(instId, bar = '1m', pagination) {
621
783
  return this.get('/api/v5/market/historic-mark-price-candles', Object.assign({ instId,
622
784
  bar }, pagination));
623
785
  }
786
+ getHistoricMarkPriceCandlesV2(params) {
787
+ return this.get('/api/v5/market/history-mark-price-candles', params);
788
+ }
624
789
  getTrades(instId, limit) {
625
790
  return this.get('/api/v5/market/trades', { instId, limit });
626
791
  }
627
792
  getHistoricTrades(instId, pagination) {
628
793
  return this.get('/api/v5/market/history-trades', Object.assign({ instId }, pagination));
629
794
  }
795
+ getOptionTradesByInstrument(params) {
796
+ return this.get('/api/v5/market/option/instrument-family-trades', params);
797
+ }
798
+ getOptionTrades(params) {
799
+ return this.get('/api/v5/public/option-trades', params);
800
+ }
630
801
  get24hrTotalVolume() {
631
802
  return this.get('/api/v5/market/platform-24-volume');
632
803
  }
@@ -645,6 +816,9 @@ class RestClient extends BaseRestClient_1.default {
645
816
  getBlockTicker(instId) {
646
817
  return this.get('/api/v5/market/block-ticker', { instId });
647
818
  }
819
+ /**
820
+ * @deprecated
821
+ */
648
822
  getPublicBlockTrades(instId) {
649
823
  return this.get('/api/v5/market/block-trades', { instId });
650
824
  }
@@ -712,6 +886,12 @@ class RestClient extends BaseRestClient_1.default {
712
886
  getUnitConvert(params) {
713
887
  return this.get('/api/v5/public/convert-contract-coin', params);
714
888
  }
889
+ getOptionTickBands(params) {
890
+ return this.get('/api/v5/public/instrument-tick-bands', params);
891
+ }
892
+ getPremiumHistory(params) {
893
+ return this.get('/api/v5/public/premium-history', params);
894
+ }
715
895
  getEconomicCalendar(params) {
716
896
  return this.getPrivate('/api/v5/public/economic-calendar', params);
717
897
  }
@@ -723,12 +903,27 @@ class RestClient extends BaseRestClient_1.default {
723
903
  getSupportCoin() {
724
904
  return this.get('/api/v5/rubik/stat/trading-data/support-coin');
725
905
  }
726
- getTakerVolume() {
727
- return this.get('/api/v5/rubik/stat/taker-volume');
906
+ getOpenInterestHistory(params) {
907
+ return this.get('/api/v5/rubik/stat/contracts/open-interest-history', params);
908
+ }
909
+ getTakerVolume(params) {
910
+ return this.get('/api/v5/rubik/stat/taker-volume', params);
911
+ }
912
+ getContractTakerVolume(params) {
913
+ return this.get('/api/v5/rubik/stat/taker-volume-contract', params);
728
914
  }
729
915
  getMarginLendingRatio(params) {
730
916
  return this.get('/api/v5/rubik/stat/margin/loan-ratio', params);
731
917
  }
918
+ getTopTradersAccountRatio(params) {
919
+ return this.get('/api/v5/rubik/stat/contracts/long-short-account-ratio-contract-top-trader', params);
920
+ }
921
+ getTopTradersContractPositionRatio(params) {
922
+ return this.get('/api/v5/rubik/stat/contracts/long-short-position-ratio-contract-top-trader', params);
923
+ }
924
+ getLongShortContractRatio(params) {
925
+ return this.get('/api/v5/rubik/stat/contracts/long-short-account-ratio-contract', params);
926
+ }
732
927
  getLongShortRatio(params) {
733
928
  return this.get('/api/v5/rubik/stat/contracts/long-short-account-ratio', params);
734
929
  }
@@ -750,6 +945,360 @@ class RestClient extends BaseRestClient_1.default {
750
945
  getTakerFlow(params) {
751
946
  return this.get('/api/v5/rubik/stat/option/taker-block-volume', params);
752
947
  }
948
+ /**
949
+ *
950
+ * FINANCIAL PRODUCT - On-chain earn endpoints
951
+ *
952
+ */
953
+ /** Get earn offers */
954
+ getStakingOffers(params) {
955
+ return this.getPrivate('/api/v5/finance/staking-defi/offers', params);
956
+ }
957
+ /** Earn/staking purchase */
958
+ submitStake(productId, investData, term) {
959
+ return this.postPrivate('/api/v5/finance/staking-defi/purchase', {
960
+ productId,
961
+ investData,
962
+ term,
963
+ });
964
+ }
965
+ /** Earn/staking redeem */
966
+ redeemStake(ordId, protocolType, allowEarlyRedeem) {
967
+ return this.postPrivate('/api/v5/finance/staking-defi/redeem', {
968
+ ordId,
969
+ protocolType,
970
+ allowEarlyRedeem,
971
+ });
972
+ }
973
+ /** Earn/staking cancel purchases/redemptions */
974
+ cancelStakingRequest(ordId, protocolType) {
975
+ return this.postPrivate('/api/v5/finance/staking-defi/cancel', {
976
+ ordId,
977
+ protocolType,
978
+ });
979
+ }
980
+ /** Earn/staking get active orders */
981
+ getActiveStakingOrders(params) {
982
+ return this.getPrivate('/api/v5/finance/staking-defi/orders-active', params);
983
+ }
984
+ /** Earn/staking get order history */
985
+ getStakingOrderHistory(params) {
986
+ return this.getPrivate('/api/v5/finance/staking-defi/orders-history', params);
987
+ }
988
+ /**
989
+ *
990
+ * FINANCIAL PRODUCT - ETH staking endpoints
991
+ *
992
+ */
993
+ purchaseETHStaking(params) {
994
+ return this.postPrivate('/api/v5/finance/staking-defi/eth/purchase', params);
995
+ }
996
+ redeemETHStaking(params) {
997
+ return this.postPrivate('/api/v5/finance/staking-defi/eth/redeem', params);
998
+ }
999
+ getETHStakingBalance() {
1000
+ return this.getPrivate('/api/v5/finance/staking-defi/eth/balance');
1001
+ }
1002
+ getETHStakingHistory(params) {
1003
+ return this.getPrivate('/api/v5/finance/staking-defi/eth/purchase-redeem-history', params);
1004
+ }
1005
+ getAPYHistory(params) {
1006
+ return this.get('/api/v5/finance/staking-defi/eth/apy-history', params);
1007
+ }
1008
+ /**
1009
+ *
1010
+ * Simple earn fixed endpoints
1011
+ *
1012
+ */
1013
+ getLendingOffers(params) {
1014
+ return this.get('/api/v5/finance/fixed-loan/lending-offers', params);
1015
+ }
1016
+ getLendingAPYHistory(params) {
1017
+ return this.get('/api/v5/finance/fixed-loan/lending-apy-history', params);
1018
+ }
1019
+ getLendingVolume(params) {
1020
+ return this.get('/api/v5/finance/fixed-loan/pending-lending-volume', params);
1021
+ }
1022
+ placeLendingOrder(params) {
1023
+ return this.postPrivate('/api/v5/finance/fixed-loan/lending-order', params);
1024
+ }
1025
+ amendLendingOrder(params) {
1026
+ return this.postPrivate('/api/v5/finance/fixed-loan/lending-order', params);
1027
+ }
1028
+ getLendingOrders(params) {
1029
+ return this.getPrivate('/api/v5/finance/fixed-loan/lending-orders-list', params);
1030
+ }
1031
+ getLendingSubOrders(params) {
1032
+ return this.getPrivate('/api/v5/finance/fixed-loan/lending-sub-orders', params);
1033
+ }
1034
+ /**
1035
+ *
1036
+ * Signal bot trading endpoints
1037
+ *
1038
+ */
1039
+ createSignal(params) {
1040
+ return this.postPrivate('/api/v5/tradingBot/signal/create-signal', params);
1041
+ }
1042
+ getSignals(params) {
1043
+ return this.getPrivate('/api/v5/tradingBot/signal/signals', params);
1044
+ }
1045
+ createSignalBot(params) {
1046
+ return this.postPrivate('/api/v5/tradingBot/signal/order-algo', params);
1047
+ }
1048
+ cancelSignalBots(params) {
1049
+ return this.postPrivate('/api/v5/tradingBot/signal/stop-order-algo', params);
1050
+ }
1051
+ updateSignalMargin(params) {
1052
+ return this.postPrivate('/api/v5/tradingBot/signal/margin-balance', params);
1053
+ }
1054
+ updateSignalTPSL(params) {
1055
+ return this.postPrivate('/api/v5/tradingBot/signal/amendTPSL', params);
1056
+ }
1057
+ setSignalInstruments(params) {
1058
+ return this.postPrivate('/api/v5/tradingBot/signal/set-instruments', params);
1059
+ }
1060
+ getSignalBotOrder(params) {
1061
+ return this.getPrivate('/api/v5/tradingBot/signal/orders-algo-details', params);
1062
+ }
1063
+ getActiveSignalBot(params) {
1064
+ return this.getPrivate('/api/v5/tradingBot/signal/orders-algo-details', params);
1065
+ }
1066
+ getSignalBotHistory(params) {
1067
+ return this.getPrivate('/api/v5/tradingBot/signal/orders-algo-history', params);
1068
+ }
1069
+ getSignalBotPositions(params) {
1070
+ return this.getPrivate('/api/v5/tradingBot/signal/positions', params);
1071
+ }
1072
+ getSignalBotPositionHistory(params) {
1073
+ return this.getPrivate('/api/v5/tradingBot/signal/positions-history', params);
1074
+ }
1075
+ closeSignalBotPosition(params) {
1076
+ return this.postPrivate('/api/v5/tradingBot/signal/close-position', params);
1077
+ }
1078
+ placeSignalBotSubOrder(params) {
1079
+ return this.postPrivate('/api/v5/tradingBot/signal/sub-order', params);
1080
+ }
1081
+ cancelSubOrder(params) {
1082
+ return this.postPrivate('/api/v5/tradingBot/signal/cancel-sub-order', params);
1083
+ }
1084
+ getSignalBotSubOrders(params) {
1085
+ return this.getPrivate('/api/v5/tradingBot/signal/sub-orders', params);
1086
+ }
1087
+ getSignalBotEventHistory(params) {
1088
+ return this.getPrivate('/api/v5/tradingBot/signal/event-history', params);
1089
+ }
1090
+ /**
1091
+ *
1092
+ * Recurring buy endpoints
1093
+ *
1094
+ */
1095
+ submitRecurringBuyOrder(params) {
1096
+ return this.postPrivate('/api/v5/tradingBot/recurring/order-algo', params);
1097
+ }
1098
+ amendRecurringBuyOrder(params) {
1099
+ return this.postPrivate('/api/v5/tradingBot/recurring/amend-order-algo', params);
1100
+ }
1101
+ stopRecurringBuyOrder(params) {
1102
+ return this.postPrivate('/api/v5/tradingBot/recurring/stop-order-algo', params);
1103
+ }
1104
+ getRecurringBuyOrders(params) {
1105
+ return this.getPrivate('/api/v5/tradingBot/recurring/orders-algo-pending', params);
1106
+ }
1107
+ getRecurringBuyOrderHistory(params) {
1108
+ return this.getPrivate('/api/v5/tradingBot/recurring/orders-algo-history', params);
1109
+ }
1110
+ getRecurringBuyOrderDetails(params) {
1111
+ return this.getPrivate('/api/v5/tradingBot/recurring/orders-algo-details', params);
1112
+ }
1113
+ getRecurringBuySubOrders(params) {
1114
+ return this.getPrivate('/api/v5/tradingBot/recurring/sub-orders', params);
1115
+ }
1116
+ /**
1117
+ *
1118
+ * Copy Trading endpoints
1119
+ *
1120
+ */
1121
+ getCopytradingSubpositions(params) {
1122
+ return this.getPrivate('/api/v5/copytrading/current-subpositions', params);
1123
+ }
1124
+ getCopytradingSubpositionsHistory(params) {
1125
+ return this.getPrivate('/api/v5/copytrading/subpositions-history', params);
1126
+ }
1127
+ submitCopytradingAlgoOrder(params) {
1128
+ return this.postPrivate('/api/v5/copytrading/algo-order', params);
1129
+ }
1130
+ closeCopytradingSubposition(params) {
1131
+ return this.postPrivate('/api/v5/copytrading/close-subposition', params);
1132
+ }
1133
+ getCopytradingInstruments(params) {
1134
+ return this.getPrivate('/api/v5/copytrading/instruments', params);
1135
+ }
1136
+ setCopytradingInstruments(params) {
1137
+ return this.postPrivate('/api/v5/copytrading/set-instruments', params);
1138
+ }
1139
+ getCopytradingProfitDetails(params) {
1140
+ return this.getPrivate('/api/v5/copytrading/profit-sharing-details', params);
1141
+ }
1142
+ getCopytradingTotalProfit(params) {
1143
+ return this.getPrivate('/api/v5/copytrading/total-profit-sharing', params);
1144
+ }
1145
+ getCopytradingUnrealizedProfit(params) {
1146
+ return this.getPrivate('/api/v5/copytrading/unrealized-profit-sharing-details', params);
1147
+ }
1148
+ getCopytradingTotalUnrealizedProfit(params) {
1149
+ return this.getPrivate('/api/v5/copytrading/total-unrealized-profit-sharing', params);
1150
+ }
1151
+ applyCopytradingLeadTrading(params) {
1152
+ return this.postPrivate('/api/v5/copytrading/apply-lead-trading', params);
1153
+ }
1154
+ stopCopytradingLeadTrading(params) {
1155
+ return this.postPrivate('/api/v5/copytrading/stop-lead-trading', params);
1156
+ }
1157
+ updateCopytradingProfitSharing(params) {
1158
+ return this.postPrivate('/api/v5/copytrading/amend-profit-sharing-ratio', params);
1159
+ }
1160
+ getCopytradingAccount() {
1161
+ return this.getPrivate('/api/v5/copytrading/config');
1162
+ }
1163
+ setCopytradingFirstCopy(params) {
1164
+ return this.postPrivate('/api/v5/copytrading/first-copy-settings', params);
1165
+ }
1166
+ updateCopytradingCopySettings(params) {
1167
+ return this.postPrivate('/api/v5/copytrading/amend-copy-settings', params);
1168
+ }
1169
+ stopCopytradingCopy(params) {
1170
+ return this.postPrivate('/api/v5/copytrading/stop-copy-trading', params);
1171
+ }
1172
+ getCopytradingCopySettings(params) {
1173
+ return this.getPrivate('/api/v5/copytrading/copy-settings', params);
1174
+ }
1175
+ getCopytradingBatchLeverageInfo(params) {
1176
+ return this.getPrivate('/api/v5/copytrading/batch-leverage-info', params);
1177
+ }
1178
+ setCopytradingBatchLeverage(params) {
1179
+ return this.postPrivate('/api/v5/copytrading/batch-set-leverage', params);
1180
+ }
1181
+ getCopytradingMyLeadTraders(params) {
1182
+ return this.getPrivate('/api/v5/copytrading/current-lead-traders', params);
1183
+ }
1184
+ getCopytradingLeadTradersHistory(params) {
1185
+ return this.getPrivate('/api/v5/copytrading/lead-traders-history', params);
1186
+ }
1187
+ getCopytradingConfig(params) {
1188
+ return this.get('/api/v5/copytrading/public-config', params);
1189
+ }
1190
+ getCopytradingLeadRanks(params) {
1191
+ return this.get('/api/v5/copytrading/public-lead-traders', params);
1192
+ }
1193
+ getCopytradingLeadWeeklyPnl(params) {
1194
+ return this.get('/api/v5/copytrading/public-weekly-pnl', params);
1195
+ }
1196
+ getCopytradingLeadDailyPnl(params) {
1197
+ return this.get('/api/v5/copytrading/public-pnl', params);
1198
+ }
1199
+ getCopytradingLeadStats(params) {
1200
+ return this.get('/api/v5/copytrading/public-stats', params);
1201
+ }
1202
+ getCopytradingLeadPreferences(params) {
1203
+ return this.get('/api/v5/copytrading/public-preference-currency', params);
1204
+ }
1205
+ getCopytradingLeadOpenPositions(params) {
1206
+ return this.get('/api/v5/copytrading/public-current-subpositions', params);
1207
+ }
1208
+ getCopytradingLeadPositionHistory(params) {
1209
+ return this.get('/api/v5/copytrading/public-subpositions-history', params);
1210
+ }
1211
+ getCopyTraders(params) {
1212
+ return this.get('/api/v5/copytrading/public-copy-traders', params);
1213
+ }
1214
+ getCopytradingLeadPrivateRanks(params) {
1215
+ return this.getPrivate('/api/v5/copytrading/lead-traders', params);
1216
+ }
1217
+ getCopytradingLeadPrivateWeeklyPnl(params) {
1218
+ return this.getPrivate('/api/v5/copytrading/weekly-pnl', params);
1219
+ }
1220
+ getCopytradingPLeadPrivateDailyPnl(params) {
1221
+ return this.getPrivate('/api/v5/copytrading/pnl', params);
1222
+ }
1223
+ geCopytradingLeadPrivateStats(params) {
1224
+ return this.getPrivate('/api/v5/copytrading/stats', params);
1225
+ }
1226
+ getCopytradingLeadPrivatePreferences(params) {
1227
+ return this.getPrivate('/api/v5/copytrading/preference-currency', params);
1228
+ }
1229
+ getCopytradingLeadPrivateOpenPositions(params) {
1230
+ return this.getPrivate('/api/v5/copytrading/performance-current-subpositions', params);
1231
+ }
1232
+ getCopytradingLeadPrivatePositionHistory(params) {
1233
+ return this.getPrivate('/api/v5/copytrading/performance-subpositions-history', params);
1234
+ }
1235
+ getCopyTradersPrivate(params) {
1236
+ return this.getPrivate('/api/v5/copytrading/copy-traders', params);
1237
+ }
1238
+ /**
1239
+ *
1240
+ * Spread trading endpoints
1241
+ *
1242
+ */
1243
+ submitSpreadOrder(params) {
1244
+ return this.postPrivate('/api/v5/sprd/order', params);
1245
+ }
1246
+ cancelSpreadOrder(params) {
1247
+ return this.postPrivate('/api/v5/sprd/cancel-order', params);
1248
+ }
1249
+ cancelAllSpreadOrders(params) {
1250
+ return this.postPrivate('/api/v5/sprd/mass-cancel', params);
1251
+ }
1252
+ updateSpreadOrder(params) {
1253
+ return this.postPrivate('/api/v5/sprd/amend-order', params);
1254
+ }
1255
+ getSpreadOrder(params) {
1256
+ return this.getPrivate('/api/v5/sprd/order', params);
1257
+ }
1258
+ getSpreadActiveOrders(params) {
1259
+ return this.getPrivate('/api/v5/sprd/orders-pending', params);
1260
+ }
1261
+ getSpreadOrdersRecent(params) {
1262
+ return this.getPrivate('/api/v5/sprd/orders-history', params);
1263
+ }
1264
+ getSpreadOrdersArchive(params) {
1265
+ return this.getPrivate('/api/v5/sprd/orders-history-archive', params);
1266
+ }
1267
+ getSpreadTrades(params) {
1268
+ return this.getPrivate('/api/v5/sprd/trades', params);
1269
+ }
1270
+ getSpreads(params) {
1271
+ return this.get('/api/v5/sprd/spreads', params);
1272
+ }
1273
+ getSpreadOrderBook(params) {
1274
+ return this.get('/api/v5/sprd/books', params);
1275
+ }
1276
+ getSpreadTicker(params) {
1277
+ return this.get('/api/v5/market/sprd-ticker', params);
1278
+ }
1279
+ getSpreadPublicTrades(params) {
1280
+ return this.get('/api/v5/sprd/public-trades', params);
1281
+ }
1282
+ getSpreadCandles(params) {
1283
+ return this.get('/api/v5/market/sprd-candles', params);
1284
+ }
1285
+ getSpreadHistoryCandles(params) {
1286
+ return this.get('/api/v5/market/sprd-history-candles', params);
1287
+ }
1288
+ cancelSpreadAllAfter(params) {
1289
+ return this.postPrivate('/api/v5/sprd/cancel-all-after', params);
1290
+ }
1291
+ /**
1292
+ *
1293
+ * Affiliate endpoints
1294
+ *
1295
+ */
1296
+ getInviteeDetail(params) {
1297
+ return this.getPrivate('/api/v5/affiliate/invitee/detail', params);
1298
+ }
1299
+ getAffiliateRebateInfo(params) {
1300
+ return this.getPrivate('/api/v5/users/partner/if-rebate', params);
1301
+ }
753
1302
  /**
754
1303
  *
755
1304
  * Status endpoints (public)
@@ -763,7 +1312,10 @@ class RestClient extends BaseRestClient_1.default {
763
1312
  * Broker endpoints (private)
764
1313
  *
765
1314
  */
766
- // TODO: add missing broker endpoints
1315
+ /**
1316
+ *
1317
+ * @deprecated
1318
+ */
767
1319
  getBrokerAccountInformation() {
768
1320
  return this.getPrivate('/api/v5/broker/nd/info');
769
1321
  }