bybit-api 4.6.0 → 4.6.2

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 (77) hide show
  1. package/README.md +3 -2
  2. package/lib/constants/enum.d.ts +1 -0
  3. package/lib/constants/enum.js +1 -0
  4. package/lib/constants/enum.js.map +1 -1
  5. package/lib/rest-client-v5.d.ts +419 -14
  6. package/lib/rest-client-v5.js +492 -4
  7. package/lib/rest-client-v5.js.map +1 -1
  8. package/lib/types/request/index.d.ts +6 -0
  9. package/lib/types/request/index.js +6 -0
  10. package/lib/types/request/index.js.map +1 -1
  11. package/lib/types/request/v5-account.d.ts +26 -0
  12. package/lib/types/request/v5-alpha-trade.d.ts +52 -0
  13. package/lib/types/request/v5-alpha-trade.js +6 -0
  14. package/lib/types/request/v5-alpha-trade.js.map +1 -0
  15. package/lib/types/request/v5-asset.d.ts +37 -2
  16. package/lib/types/request/v5-broker.d.ts +14 -0
  17. package/lib/types/request/v5-card.d.ts +51 -0
  18. package/lib/types/request/v5-card.js +7 -0
  19. package/lib/types/request/v5-card.js.map +1 -0
  20. package/lib/types/request/v5-earn-advance-discount.d.ts +75 -0
  21. package/lib/types/request/v5-earn-advance-discount.js +3 -0
  22. package/lib/types/request/v5-earn-advance-discount.js.map +1 -0
  23. package/lib/types/request/v5-earn-fixed-term.d.ts +42 -0
  24. package/lib/types/request/v5-earn-fixed-term.js +3 -0
  25. package/lib/types/request/v5-earn-fixed-term.js.map +1 -0
  26. package/lib/types/request/v5-earn-liquidity-mining.d.ts +7 -0
  27. package/lib/types/request/v5-earn-liquidity-mining.js +3 -0
  28. package/lib/types/request/v5-earn-liquidity-mining.js.map +1 -0
  29. package/lib/types/request/v5-earn-token.d.ts +49 -0
  30. package/lib/types/request/v5-earn-token.js +6 -0
  31. package/lib/types/request/v5-earn-token.js.map +1 -0
  32. package/lib/types/request/v5-earn.d.ts +24 -0
  33. package/lib/types/request/v5-market.d.ts +10 -1
  34. package/lib/types/request/v5-spot-leverage-token.d.ts +46 -0
  35. package/lib/types/request/v5-spreadtrading.d.ts +7 -0
  36. package/lib/types/request/v5-user.d.ts +15 -1
  37. package/lib/types/response/index.d.ts +6 -0
  38. package/lib/types/response/index.js +6 -0
  39. package/lib/types/response/index.js.map +1 -1
  40. package/lib/types/response/v5-account.d.ts +76 -0
  41. package/lib/types/response/v5-alpha-trade.d.ts +170 -0
  42. package/lib/types/response/v5-alpha-trade.js +6 -0
  43. package/lib/types/response/v5-alpha-trade.js.map +1 -0
  44. package/lib/types/response/v5-asset.d.ts +158 -10
  45. package/lib/types/response/v5-broker.d.ts +18 -0
  46. package/lib/types/response/v5-card.d.ts +118 -0
  47. package/lib/types/response/v5-card.js +3 -0
  48. package/lib/types/response/v5-card.js.map +1 -0
  49. package/lib/types/response/v5-earn-advance-discount.d.ts +143 -0
  50. package/lib/types/response/v5-earn-advance-discount.js +3 -0
  51. package/lib/types/response/v5-earn-advance-discount.js.map +1 -0
  52. package/lib/types/response/v5-earn-fixed-term.d.ts +102 -0
  53. package/lib/types/response/v5-earn-fixed-term.js +3 -0
  54. package/lib/types/response/v5-earn-fixed-term.js.map +1 -0
  55. package/lib/types/response/v5-earn-liquidity-mining.d.ts +31 -0
  56. package/lib/types/response/v5-earn-liquidity-mining.js +3 -0
  57. package/lib/types/response/v5-earn-liquidity-mining.js.map +1 -0
  58. package/lib/types/response/v5-earn-token.d.ts +62 -0
  59. package/lib/types/response/v5-earn-token.js +6 -0
  60. package/lib/types/response/v5-earn-token.js.map +1 -0
  61. package/lib/types/response/v5-earn.d.ts +103 -0
  62. package/lib/types/response/v5-market.d.ts +14 -0
  63. package/lib/types/response/v5-position.d.ts +4 -0
  64. package/lib/types/response/v5-spot-leverage-token.d.ts +56 -0
  65. package/lib/types/response/v5-spreadtrading.d.ts +5 -0
  66. package/lib/types/response/v5-user.d.ts +43 -0
  67. package/lib/types/shared-v5.d.ts +11 -1
  68. package/lib/types/websockets/ws-events.d.ts +4 -0
  69. package/lib/util/BaseWSClient.js +1 -0
  70. package/lib/util/BaseWSClient.js.map +1 -1
  71. package/lib/util/webCryptoAPI.d.ts +1 -1
  72. package/lib/util/webCryptoAPI.js +1 -1
  73. package/lib/util/webCryptoAPI.js.map +1 -1
  74. package/lib/util/websockets/websocket-util.js +1 -0
  75. package/lib/util/websockets/websocket-util.js.map +1 -1
  76. package/llms.txt +8037 -5345
  77. package/package.json +1 -1
@@ -133,6 +133,13 @@ class RestClientV5 extends BaseRestClient_1.default {
133
133
  getSpreadRecentTrades(params) {
134
134
  return this.get('/v5/spread/recent-trade', params);
135
135
  }
136
+ /**
137
+ * Get Spread Max Qty
138
+ * Max order quantity (available balance) for a spread order at a given side and price.
139
+ */
140
+ getSpreadMaxQty(params) {
141
+ return this.getPrivate('/v5/spread/max-qty', params);
142
+ }
136
143
  /**
137
144
  * Create Spread Order
138
145
  */
@@ -205,7 +212,9 @@ class RestClientV5 extends BaseRestClient_1.default {
205
212
  /**
206
213
  * Query the mark price kline data. Charts are returned in groups based on the requested interval.
207
214
  *
208
- * Covers: Linear contract / Inverse contract
215
+ * Covers: USDT contract / USDC contract / Inverse contract / Options
216
+ *
217
+ * `category` defaults to linear if omitted. For options, `limit` max is 500; futures max is 1000.
209
218
  */
210
219
  getMarkPriceKline(params) {
211
220
  return this.get('/v5/market/mark-price-kline', params);
@@ -232,6 +241,7 @@ class RestClientV5 extends BaseRestClient_1.default {
232
241
  * Covers: Spot / Linear contract / Inverse contract / Option
233
242
  *
234
243
  * Note: Spot does not support pagination, so limit & cursor are invalid.
244
+ * Note: e.g. `symbolType: 'commodity'`, and for linear also `stock`, `forex` (see Bybit Get Instruments Info).
235
245
  */
236
246
  getInstrumentsInfo(params) {
237
247
  return this.get('/v5/market/instruments-info', params);
@@ -764,6 +774,7 @@ class RestClientV5 extends BaseRestClient_1.default {
764
774
  * Covers: SPOT / USDT contract / USDC contract / Inverse contract
765
775
  *
766
776
  * Includes RPI permission information (isPublicRpi, myRpiPermission)
777
+ * Note: e.g. `symbolType: 'commodity'`, and for linear also `stock`, `forex`.
767
778
  */
768
779
  getAccountInstrumentsInfo(params) {
769
780
  return this.getPrivate('/v5/account/instruments-info', params);
@@ -791,6 +802,13 @@ class RestClientV5 extends BaseRestClient_1.default {
791
802
  *
792
803
  * - Input the specific coin: repay the liability of this coin in particular
793
804
  * - No coin specified: repay the liability of all coins
805
+ *
806
+ * Does not repay manual-borrow (spot margin manual borrow) liabilities — use `manualRepay` or
807
+ * `manualRepayWithoutConversion` instead (API error 182120 otherwise).
808
+ * From 2026-03-17 (full 2026-03-24), BYUSDT can be used for repayment. MNT is temporarily not used for
809
+ * this flow; MNT convert-repay is not supported (use `manualRepayWithoutConversion` with existing balance).
810
+ * From 2026-02-10 08:00 UTC, coin-conversion fees use the higher of collateral or debt fee rate, with a
811
+ * per-transaction coin-conversion cap of 300,000 USD equivalent.
794
812
  */
795
813
  repayLiability(params) {
796
814
  return this.postPrivate('/v5/account/quick-repayment', params);
@@ -805,6 +823,14 @@ class RestClientV5 extends BaseRestClient_1.default {
805
823
  * If that's not enough, the remaining amount will be repaid by converting other assets.
806
824
  *
807
825
  * Repayment is prohibited between 04:00 and 05:30 per hour.
826
+ *
827
+ * When `coin` and `amount` are both set, validation depends on `repaymentType` (e.g. amount must not
828
+ * exceed the matching liability pool). If neither `coin` nor `amount` is set, `repaymentType` must be
829
+ * ALL. Response timing: ALL and FIXED are asynchronous; FLEXIBLE is synchronous.
830
+ * For repay-without-convert (spot balance only), use `manualRepayWithoutConversion`.
831
+ * From 2026-03-17 (full 2026-03-24), BYUSDT can be used for repayment. MNT: not via convert-repay;
832
+ * use `manualRepayWithoutConversion` for MNT with existing balance. From 2026-02-10 08:00 UTC,
833
+ * coin-conversion cap 300,000 USD equivalent per transaction applies.
808
834
  */
809
835
  manualRepay(params) {
810
836
  return this.postPrivate('/v5/account/repay', params);
@@ -907,12 +933,20 @@ class RestClientV5 extends BaseRestClient_1.default {
907
933
  return this.postPrivate('/v5/account/set-limit-px-action', params);
908
934
  }
909
935
  /**
910
- * Get Limit Price Behaviour
936
+ * Get Trade Behaviour Config / Get Limit Price Behaviour
911
937
  * You can get configuration how the system behaves when your limit order price exceeds the highest bid or lowest ask price.
938
+ * Response includes `deltaEnable` for Delta Neutral mode, and `smsef` / `fmsef` for Spot and Futures MNT fee deduction.
912
939
  */
913
940
  getLimitPriceAction() {
914
941
  return this.getPrivate('/v5/account/user-setting-config');
915
942
  }
943
+ /**
944
+ * Set Delta Neutral Mode
945
+ * 1: enable, 0: disable. Query current status via `getLimitPriceAction()`.
946
+ */
947
+ setDeltaNeutralMode(params) {
948
+ return this.postPrivate('/v5/account/set-delta-mode', params);
949
+ }
916
950
  /**
917
951
  * Configure Market Maker Protection (MMP)
918
952
  */
@@ -931,11 +965,66 @@ class RestClientV5 extends BaseRestClient_1.default {
931
965
  getMMPState(baseCoin) {
932
966
  return this.getPrivate('/v5/account/mmp-state', { baseCoin });
933
967
  }
968
+ /**
969
+ * Get Option Asset Info
970
+ * P&L per coin for options: delta, RPL, UPL, margin. Result uses a nested `result` list.
971
+ */
972
+ getOptionAssetInfo() {
973
+ return this.getPrivate('/v5/account/option-asset-info');
974
+ }
975
+ /**
976
+ * Get Pay Info
977
+ * Repayment collateral snapshot before `manualRepay` or `repayLiability`. Optional `coin` for one liability; omit for total.
978
+ */
979
+ getPayInfo(params) {
980
+ return this.getPrivate('/v5/account/pay-info', params);
981
+ }
982
+ /**
983
+ * Get Trade Info For Analysis
984
+ * Aggregated spot trade stats for a symbol, including daily breakdown when returned.
985
+ */
986
+ getTradeInfoForAnalysis(params) {
987
+ return this.getPrivate('/v5/account/trade-info-for-analysis', params);
988
+ }
934
989
  /**
935
990
  *
936
991
  ****** Asset APIs
937
992
  *
938
993
  */
994
+ /**
995
+ * Asset Overview
996
+ * Query master account or subaccount's total assets and detailed asset holdings across different accounts and product categories.
997
+ *
998
+ * INFO: For accountType=Alpha, on-chain assets are not included in the returned data in current version.
999
+ * `valuationCurrency` sets fiat for totals; `accountType` filters which account to return. For Alpha + farm, `extMap` may
1000
+ * appear on `coinDetail` (price range and equity unit).
1001
+ */
1002
+ getAssetOverview(params) {
1003
+ return this.getPrivate('/v5/asset/asset-overview', params);
1004
+ }
1005
+ /**
1006
+ * Get Portfolio Margin Info
1007
+ * Wallet and per-base-coin P&L range (aligned with the portfolio margin page).
1008
+ */
1009
+ getPortfolioMarginInfo(params) {
1010
+ return this.getPrivate('/v5/asset/portfolio-margin', params);
1011
+ }
1012
+ /**
1013
+ * Get Total Members Assets
1014
+ * Master + sub-accounts; optional `coin` for valuation (default BTC).
1015
+ */
1016
+ getTotalMembersAssets(params) {
1017
+ return this.getPrivate('/v5/asset/total-members-assets', params);
1018
+ }
1019
+ /**
1020
+ * Funding Account Transaction History
1021
+ * Transaction log in Funding Account. Supports filtering by transaction type and time range.
1022
+ *
1023
+ * INFO: createTimeFrom and createTimeTo must be used together. Interval cannot exceed 7 days. If neither provided, defaults to last 7 days.
1024
+ */
1025
+ getFundingAccountTransactionHistory(params) {
1026
+ return this.getPrivate('/v5/asset/fundinghistory', params);
1027
+ }
939
1028
  /**
940
1029
  * Query option delivery records, sorted by deliveryTime in descending order.
941
1030
  *
@@ -1000,7 +1089,9 @@ class RestClientV5 extends BaseRestClient_1.default {
1000
1089
  return this.getPrivate('/v5/asset/transfer/query-account-coin-balance', params);
1001
1090
  }
1002
1091
  /**
1003
- * Query withdrawable amount.
1092
+ * Query withdrawable amount (incl. risk-frozen `limitAmountUsd` and per-wallet slices).
1093
+ * May include FUND, UTA, EARN, SPOT keys depending on the coin. EARN is present when the coin
1094
+ * supports withdrawal from the Earn account.
1004
1095
  */
1005
1096
  getWithdrawableAmount(params) {
1006
1097
  return this.getPrivate('/v5/asset/withdraw/withdrawable-amount', params);
@@ -1075,6 +1166,7 @@ class RestClientV5 extends BaseRestClient_1.default {
1075
1166
  }
1076
1167
  /**
1077
1168
  * Set auto transfer account after deposit. The same function as the setting for Deposit on web GUI
1169
+ * (UNIFIED, FUND, or EARN; if a coin is not in flexible saving, EARN may route to funding as per Bybit).
1078
1170
  */
1079
1171
  setDepositAccount(params) {
1080
1172
  return this.postPrivate('/v5/asset/deposit/deposit-to-account', params);
@@ -1169,11 +1261,13 @@ class RestClientV5 extends BaseRestClient_1.default {
1169
1261
  return this.getPrivate('/v5/asset/withdraw/vasp/list');
1170
1262
  }
1171
1263
  /**
1172
- * Withdraw assets from the SPOT account.
1264
+ * Withdraw from Funding, Unified, and/or Earn (and combos such as FUND,UTA,EARN per API).
1173
1265
  *
1174
1266
  * CAUTION: Make sure you have whitelisted your wallet address before calling this endpoint.
1175
1267
  *
1176
1268
  * You can make an off-chain transfer if the target wallet address is from Bybit. This means that no blockchain fee will be charged.
1269
+ *
1270
+ * Bybit Turkey (TR) site: `transactionPurpose` is required on the request (see `WithdrawParamsV5`).
1177
1271
  */
1178
1272
  submitWithdrawal(params) {
1179
1273
  return this.postPrivate('/v5/asset/withdraw/create', params);
@@ -1288,6 +1382,8 @@ class RestClientV5 extends BaseRestClient_1.default {
1288
1382
  * Both master and sub user's api key are applicable.
1289
1383
  *
1290
1384
  * TIP: Any permission can access this endpoint.
1385
+ *
1386
+ * Response `permissions` may include `FiatBitPay`; `FiatBybitPay` is deprecated for the same scope.
1291
1387
  */
1292
1388
  getQueryApiKey() {
1293
1389
  return this.getPrivate('/v5/user/query-api');
@@ -1306,6 +1402,8 @@ class RestClientV5 extends BaseRestClient_1.default {
1306
1402
  *
1307
1403
  * TIP: The API key must have one of the permissions to be allowed to call the following API endpoint.
1308
1404
  * - master API key: "Account Transfer", "Subaccount Transfer", "Withdrawal"
1405
+ *
1406
+ * `permissions` may include `FiatBitPay`; `FiatBybitPay` remains during transition for the same scope.
1309
1407
  */
1310
1408
  updateMasterApiKey(params) {
1311
1409
  return this.postPrivate('/v5/user/update-api', params);
@@ -1385,6 +1483,108 @@ class RestClientV5 extends BaseRestClient_1.default {
1385
1483
  getAffiliateUserInfo(params) {
1386
1484
  return this.getPrivate('/v5/user/aff-customer-info', params);
1387
1485
  }
1486
+ /**
1487
+ * Get Friend Referrals
1488
+ * Query the friend's invitee data.
1489
+ *
1490
+ * TIP: Any permission can access this endpoint.
1491
+ */
1492
+ getFriendReferrals(params) {
1493
+ return this.getPrivate('/v5/user/invitation/referrals', params);
1494
+ }
1495
+ /**
1496
+ * Sign Agreement
1497
+ * To trade commodity contracts (e.g. metals XAU/XAG perps, crude oil perps), complete the agreement signing first.
1498
+ * Recommended to sign in advance via API so you can trade immediately when contracts go live.
1499
+ * Send either `category` (legacy) or `categoryV2` (preferred; new agreement types are added to `categoryV2` only).
1500
+ *
1501
+ * INFO
1502
+ * - Only the master account can sign. Subaccounts are not supported.
1503
+ * - Once the master has signed, all subaccounts will be eligible to trade.
1504
+ * - API key must have: Account Transfer, Subaccount Transfer, or Withdrawal.
1505
+ * - Trading without signing returns code=110123, msg=You must agree to the Trading Terms.
1506
+ */
1507
+ signAgreement(params) {
1508
+ return this.postPrivate('/v5/user/agreement', params);
1509
+ }
1510
+ /**
1511
+ *
1512
+ ****** Alpha / Web3 (on-chain) trade APIs
1513
+ *
1514
+ */
1515
+ /**
1516
+ * Get Trade Quote
1517
+ * Get a price quote before a purchase or redeem. Required before `executeAlphaTradePurchase` or `executeAlphaTradeRedeem`.
1518
+ * Pass `quoteData` and `correctingCode` from the response unchanged to the execute endpoints.
1519
+ */
1520
+ getAlphaTradeQuote(params) {
1521
+ return this.postPrivate('/v5/alpha/trade/quote', params);
1522
+ }
1523
+ /**
1524
+ * Execute Purchase
1525
+ * Buy on-chain tokens with a payment token (e.g. USDT). Requires a valid quote; obtain user confirmation first.
1526
+ * HTTP 200 is only an acknowledgment — poll `getAlphaTradeOrderList` for final status. Idempotent by `quoteDataId` in the quote.
1527
+ */
1528
+ executeAlphaTradePurchase(params) {
1529
+ return this.postPrivate('/v5/alpha/trade/purchase', params);
1530
+ }
1531
+ /**
1532
+ * Execute Redeem
1533
+ * Sell on-chain tokens for a payment token. Requires a valid quote; obtain user confirmation first.
1534
+ * HTTP 200 is only an acknowledgment — poll `getAlphaTradeOrderList` for final status. Idempotent by `quoteDataId` in the quote.
1535
+ */
1536
+ executeAlphaTradeRedeem(params) {
1537
+ return this.postPrivate('/v5/alpha/trade/redeem', params);
1538
+ }
1539
+ /**
1540
+ * Get Payment Token List
1541
+ * List payment tokens (e.g. USDT) and CEX token codes (e.g. CEX_1) for quote and execution. Each entry includes `supportChains`.
1542
+ */
1543
+ getAlphaPayTokenList(params) {
1544
+ return this.postPrivate('/v5/alpha/trade/pay-token-list', params);
1545
+ }
1546
+ /**
1547
+ * Get Order List
1548
+ * On-chain trade order history; filters for trade type, status, token, and time. Max 90 days.
1549
+ */
1550
+ getAlphaTradeOrderList(params) {
1551
+ return this.postPrivate('/v5/alpha/trade/order-list', params);
1552
+ }
1553
+ /**
1554
+ * Get Biz Token List
1555
+ * Tradable on-chain tokens (DEX_ prefix ids), risk flags, limits, and supported payment token codes.
1556
+ */
1557
+ getAlphaBizTokenList(params) {
1558
+ return this.postPrivate('/v5/alpha/trade/biz-token-list', params || {});
1559
+ }
1560
+ /**
1561
+ * Get Token Price List
1562
+ * Batch market data (up to 20 `chainCode` + `tokenAddress` pairs). Prices, 24h change, volume, market cap, etc.
1563
+ */
1564
+ getAlphaBizTokenPriceList(params) {
1565
+ return this.postPrivate('/v5/alpha/trade/biz-token-price-list', params);
1566
+ }
1567
+ /**
1568
+ * Get Token Details
1569
+ * One token: description, links, `riskFlag`, and listing status. Use `chainCode` + `tokenAddress` from biz list or assets.
1570
+ */
1571
+ getAlphaBizTokenDetails(params) {
1572
+ return this.postPrivate('/v5/alpha/trade/biz-token-details', params);
1573
+ }
1574
+ /**
1575
+ * Get Asset List
1576
+ * Portfolio of on-chain token holdings (non-zero only), sorted by USD value.
1577
+ */
1578
+ getAlphaAssetList() {
1579
+ return this.postPrivate('/v5/alpha/trade/asset-list', {});
1580
+ }
1581
+ /**
1582
+ * Get Asset Detail
1583
+ * Single-asset view; `result.assetList` has 0 or 1 item.
1584
+ */
1585
+ getAlphaAssetDetail(params) {
1586
+ return this.postPrivate('/v5/alpha/trade/asset-detail', params);
1587
+ }
1388
1588
  /**
1389
1589
  *
1390
1590
  ****** Spot Margin Trade APIs (UTA)
@@ -1409,6 +1609,13 @@ class RestClientV5 extends BaseRestClient_1.default {
1409
1609
  getHistoricalInterestRate(params) {
1410
1610
  return this.getPrivate('/v5/spot-margin-trade/interest-rate-history', params);
1411
1611
  }
1612
+ /**
1613
+ * Get Currency Data
1614
+ * Borrowing currency data: flexible/fixed manual borrow, min qty, precision, interest rate range.
1615
+ */
1616
+ getSpotMarginCurrencyData(params) {
1617
+ return this.getPrivate('/v5/spot-margin-trade/currency-data', params);
1618
+ }
1412
1619
  /**
1413
1620
  * Turn spot margin trade on / off in your UTA account.
1414
1621
  *
@@ -1476,6 +1683,10 @@ class RestClientV5 extends BaseRestClient_1.default {
1476
1683
  *
1477
1684
  * IMPORTANT: Repayment is prohibited between 04:00 and 05:30 per hour.
1478
1685
  * When repaying, system will only use the spot available balance of the debt currency.
1686
+ *
1687
+ * Use `getAvailableAmountToRepay` to check spot available amount. Response timing: ALL and FIXED
1688
+ * asynchronous; FLEXIBLE synchronous. From 2026-03-17 (full 2026-03-24), BYUSDT can be used for
1689
+ * repayment, including MNT using existing spot balance.
1479
1690
  */
1480
1691
  manualRepayWithoutConversion(params) {
1481
1692
  return this.postPrivate('/v5/account/no-convert-repay', params);
@@ -1503,6 +1714,42 @@ class RestClientV5 extends BaseRestClient_1.default {
1503
1714
  setAutoRepayMode(params) {
1504
1715
  return this.postPrivate('/v5/spot-margin-trade/set-auto-repay-mode', params);
1505
1716
  }
1717
+ /**
1718
+ * Get Liability Info (spot margin UTA): fixed vs floating, spot vs derivatives borrow split.
1719
+ */
1720
+ getSpotMarginLiability(params) {
1721
+ return this.getPrivate('/v5/spot-margin-trade/liability', params);
1722
+ }
1723
+ /**
1724
+ * Fixed-rate borrow (place order).
1725
+ */
1726
+ submitFixedRateBorrow(params) {
1727
+ return this.postPrivate('/v5/spot-margin-trade/fixedborrow', params);
1728
+ }
1729
+ /**
1730
+ * Fixed-rate borrow order history (descending by order time).
1731
+ */
1732
+ getFixedRateBorrowOrderInfo(params) {
1733
+ return this.getPrivate('/v5/spot-margin-trade/fixedborrow-order-info', params);
1734
+ }
1735
+ /**
1736
+ * Fixed-rate borrow contract list (descending by borrow time).
1737
+ */
1738
+ getFixedRateBorrowContractInfo(params) {
1739
+ return this.getPrivate('/v5/spot-margin-trade/fixedborrow-contract-info', params);
1740
+ }
1741
+ /**
1742
+ * Fixed-rate borrow order book quotes (sort by apy, term, or quantity).
1743
+ */
1744
+ getFixedRateBorrowOrderQuote(params) {
1745
+ return this.getPrivate('/v5/spot-margin-trade/fixedborrow-order-quote', params);
1746
+ }
1747
+ /**
1748
+ * Renew a fixed-rate loan contract (full remaining amount if `qty` omitted).
1749
+ */
1750
+ renewFixedRateBorrow(params) {
1751
+ return this.postPrivate('/v5/spot-margin-trade/fixedborrow-renew', params);
1752
+ }
1506
1753
  /**
1507
1754
  *
1508
1755
  ****** Spot Margin Trade APIs (Normal)
@@ -2082,6 +2329,47 @@ class RestClientV5 extends BaseRestClient_1.default {
2082
2329
  getBrokerIssuedVoucher(params) {
2083
2330
  return this.postPrivate('/v5/broker/award/distribution-record', params);
2084
2331
  }
2332
+ /**
2333
+ * Set Rate Limit
2334
+ * Exchange broker only. Set the rate limit for sub accounts.
2335
+ *
2336
+ * API rate limit: 1 req per second
2337
+ *
2338
+ * INFO
2339
+ * - If the UID calling this endpoint is a master account, the UIDs specified in the uids parameter must belong to its subaccounts. The master account itself cannot set a custom rate limit.
2340
+ * - If the UID requesting this endpoint is a subaccount, the UID can only be itself in uids.
2341
+ * - Only exchange broker account can call this endpoint
2342
+ */
2343
+ setBrokerRateLimit(params) {
2344
+ return this.postPrivate('/v5/broker/apilimit/set', params);
2345
+ }
2346
+ /**
2347
+ * Get Rate Limit Cap
2348
+ * Get your exchange broker account entity total rate limit usage and cap, across the board.
2349
+ *
2350
+ * API rate limit: 5 req per second
2351
+ *
2352
+ * INFO
2353
+ * - Only Main UIDs can query this endpoint
2354
+ * - Only exchange broker account can call this endpoint
2355
+ * - If you never apply for a specific config via account manager, it gives empty response.
2356
+ */
2357
+ getBrokerRateLimitCap() {
2358
+ return this.getPrivate('/v5/broker/apilimit/query-cap');
2359
+ }
2360
+ /**
2361
+ * Get All Rate Limits
2362
+ * Use the master account to query for all your UID-level rate limits, including all master accounts and subaccounts.
2363
+ *
2364
+ * API rate limit: 1 req per second
2365
+ *
2366
+ * INFO
2367
+ * - Only exchange broker account can call this endpoint
2368
+ * - The accounts that have never had a rate limit configured via Set Rate Limit will not appear in the response and will use the default rate limit.
2369
+ */
2370
+ getAllBrokerRateLimits(params) {
2371
+ return this.getPrivate('/v5/broker/apilimit/query-all', params);
2372
+ }
2085
2373
  /**
2086
2374
  *
2087
2375
  ****** EARN
@@ -2095,6 +2383,103 @@ class RestClientV5 extends BaseRestClient_1.default {
2095
2383
  getEarnProduct(params) {
2096
2384
  return this.get('/v5/earn/product', params);
2097
2385
  }
2386
+ /**
2387
+ * Get Advanced Earn product info (Dual Asset, Double Win, Smart Leverage, etc. via `category`).
2388
+ *
2389
+ * INFO: No authentication. Up to 50 requests/second per IP.
2390
+ */
2391
+ getAdvanceEarnProduct(params) {
2392
+ return this.get('/v5/earn/advance/product', params);
2393
+ }
2394
+ /**
2395
+ * Liquidity mining — product list (Advanced Earn).
2396
+ *
2397
+ * INFO: No authentication. Up to 50 requests/second per IP.
2398
+ */
2399
+ getLiquidityMiningProduct(params) {
2400
+ return this.get('/v5/earn/liquidity-mining/product', params);
2401
+ }
2402
+ /**
2403
+ * Fixed-term / fixed saving — product list (Earn).
2404
+ *
2405
+ * INFO: No authentication. Up to 50 requests/second per IP.
2406
+ */
2407
+ getFixedTermEarnProduct(params) {
2408
+ return this.get('/v5/earn/fixed-term/product', params);
2409
+ }
2410
+ /**
2411
+ * Advanced Earn — quote / extra info (Discount Buy, Dual Assets, …). Call before place order where required.
2412
+ *
2413
+ * INFO: No authentication. Up to 50 requests/second per IP.
2414
+ * Dual Assets: `productId` is required. Response uses `list` with `buyLowPrice` / `sellHighPrice`.
2415
+ */
2416
+ getAdvanceEarnProductExtraInfo(params) {
2417
+ return this.get('/v5/earn/advance/product-extra-info', params);
2418
+ }
2419
+ /**
2420
+ * Advanced Earn — place order (Dual Assets, Discount Buy, …). Async; use getAdvanceEarnOrder to track.
2421
+ *
2422
+ * INFO: API key needs "Earn" permission. Rate limit e.g. 5 req/s (Dual Assets per docs).
2423
+ */
2424
+ submitAdvanceEarnPlaceOrder(params) {
2425
+ return this.postPrivate('/v5/earn/advance/place-order', params);
2426
+ }
2427
+ /**
2428
+ * Advanced Earn — active positions (Dual Assets, Discount Buy, …).
2429
+ *
2430
+ * INFO: API key needs "Earn" permission. E.g. 10 req/s (Dual Assets per docs).
2431
+ */
2432
+ getAdvanceEarnPosition(params) {
2433
+ return this.getPrivate('/v5/earn/advance/position', params);
2434
+ }
2435
+ /**
2436
+ * Advanced Earn — order list (Dual Assets, Discount Buy, …). Distinct from getEarnOrderHistory (/v5/earn/order).
2437
+ *
2438
+ * INFO: API key needs "Earn" permission. E.g. 10 req/s (Dual Assets per docs).
2439
+ */
2440
+ getAdvanceEarnOrder(params) {
2441
+ return this.getPrivate('/v5/earn/advance/order', params);
2442
+ }
2443
+ /**
2444
+ * Fixed-term earn — place order (stake). Async; use getFixedTermEarnOrder to track.
2445
+ *
2446
+ * INFO: API key needs "Earn" permission. Rate limit: 5 req/s.
2447
+ */
2448
+ submitFixedTermEarnOrder(params) {
2449
+ return this.postPrivate('/v5/earn/fixed-term/place-order', params);
2450
+ }
2451
+ /**
2452
+ * Fixed-term earn — early redeem (FundPool only, when product allows).
2453
+ *
2454
+ * INFO: API key needs "Earn" permission. Rate limit: 5 req/s.
2455
+ */
2456
+ redeemFixedTermEarn(params) {
2457
+ return this.postPrivate('/v5/earn/fixed-term/redeem', params);
2458
+ }
2459
+ /**
2460
+ * Fixed-term earn — active positions.
2461
+ *
2462
+ * INFO: API key needs "Earn" permission. Rate limit: 10 req/s.
2463
+ */
2464
+ getFixedTermEarnPosition(params) {
2465
+ return this.getPrivate('/v5/earn/fixed-term/position', params);
2466
+ }
2467
+ /**
2468
+ * Fixed-term earn — order list.
2469
+ *
2470
+ * INFO: API key needs "Earn" permission. Rate limit: 10 req/s.
2471
+ */
2472
+ getFixedTermEarnOrder(params) {
2473
+ return this.getPrivate('/v5/earn/fixed-term/order', params);
2474
+ }
2475
+ /**
2476
+ * Fixed-term earn — enable or disable auto-invest on a position.
2477
+ *
2478
+ * INFO: API key needs "Earn" permission. Rate limit: 5 req/s.
2479
+ */
2480
+ setFixedTermEarnAutoInvest(params) {
2481
+ return this.postPrivate('/v5/earn/fixed-term/position/auto-invest', params);
2482
+ }
2098
2483
  /**
2099
2484
  * Stake or Redeem Earn products
2100
2485
  *
@@ -2127,14 +2512,25 @@ class RestClientV5 extends BaseRestClient_1.default {
2127
2512
  * INFO: API key needs "Earn" permission
2128
2513
  *
2129
2514
  * Note: Fully redeemed position is also returned in the response
2515
+ * Note: Response includes `autoReinvest` where applicable; use `modifyEarnPosition` to change it (OnChain fixed).
2130
2516
  */
2131
2517
  getEarnPosition(params) {
2132
2518
  return this.getPrivate('/v5/earn/position', params);
2133
2519
  }
2520
+ /**
2521
+ * Modify OnChain Earn position (e.g. auto-reinvest for fixed duration products).
2522
+ *
2523
+ * INFO: API key needs "Earn" permission. Only `category=OnChain` and fixed positions (see product).
2524
+ */
2525
+ modifyEarnPosition(params) {
2526
+ return this.postPrivate('/v5/earn/position/modify', params);
2527
+ }
2134
2528
  /**
2135
2529
  * Get Yield History
2136
2530
  *
2137
2531
  * INFO: API key needs "Earn" permission
2532
+ *
2533
+ * Note: `category` includes `OnChain`. For `OnChain`, do not pass `productId` (error).
2138
2534
  */
2139
2535
  getEarnYieldHistory(params) {
2140
2536
  return this.getPrivate('/v5/earn/yield', params);
@@ -2147,6 +2543,98 @@ class RestClientV5 extends BaseRestClient_1.default {
2147
2543
  getEarnHourlyYieldHistory(params) {
2148
2544
  return this.getPrivate('/v5/earn/hourly-yield', params);
2149
2545
  }
2546
+ /**
2547
+ * Get historical APR (FlexibleSaving / OnChain), up to ~6 months.
2548
+ *
2549
+ * INFO: Does not need authentication
2550
+ */
2551
+ getEarnAprHistory(params) {
2552
+ return this.get('/v5/earn/apr-history', params);
2553
+ }
2554
+ /**
2555
+ * Earn token product (e.g. BYUSDT) — Get Product Info
2556
+ * Without auth, user-specific fields are empty or defaulted.
2557
+ */
2558
+ getEarnTokenProduct(params) {
2559
+ return this.get('/v5/earn/token/product', params);
2560
+ }
2561
+ /**
2562
+ * Earn token — Place Order (Mint / Redeem). Accepted response is not final settlement; use `getEarnTokenOrders`.
2563
+ */
2564
+ submitEarnTokenOrder(params) {
2565
+ return this.postPrivate('/v5/earn/token/place-order', params);
2566
+ }
2567
+ /**
2568
+ * Earn token — Get Order List
2569
+ */
2570
+ getEarnTokenOrders(params) {
2571
+ return this.getPrivate('/v5/earn/token/order', params);
2572
+ }
2573
+ /**
2574
+ * Earn token — Get Position Info
2575
+ */
2576
+ getEarnTokenPosition(params) {
2577
+ return this.getPrivate('/v5/earn/token/position', params);
2578
+ }
2579
+ /**
2580
+ * Earn token — Get Daily Yield Records
2581
+ */
2582
+ getEarnTokenDailyYield(params) {
2583
+ return this.getPrivate('/v5/earn/token/yield', params);
2584
+ }
2585
+ /**
2586
+ * Earn token — Get Hourly Yield Records
2587
+ */
2588
+ getEarnTokenHourlyYield(params) {
2589
+ return this.getPrivate('/v5/earn/token/hourly-yield', params);
2590
+ }
2591
+ /**
2592
+ * Earn token — Get History APR (7/30/180 days). No authentication required.
2593
+ */
2594
+ getEarnTokenHistoryApr(params) {
2595
+ return this.get('/v5/earn/token/history-apr', params);
2596
+ }
2597
+ /**
2598
+ *
2599
+ ****** Bybit Card APIs
2600
+ *
2601
+ */
2602
+ /**
2603
+ * Bybit Card — query card transaction / asset history (filter by status, card digits, merchant, time, type, …).
2604
+ */
2605
+ queryCardAssetRecords(params) {
2606
+ return this.postPrivate('/v5/card/transaction/query-asset-records', params);
2607
+ }
2608
+ /**
2609
+ * Bybit Card — point balance (available, pending, account status, …).
2610
+ */
2611
+ queryCardPointsBalance() {
2612
+ return this.postPrivate('/v5/card/reward/points/balance');
2613
+ }
2614
+ /**
2615
+ * Bybit Card — point transaction records.
2616
+ */
2617
+ queryCardPointsRecords(params) {
2618
+ return this.postPrivate('/v5/card/reward/points/records', params);
2619
+ }
2620
+ /**
2621
+ * Bybit Card — reward tier, spending limit, auto cashback.
2622
+ */
2623
+ queryCardPointsTier() {
2624
+ return this.postPrivate('/v5/card/reward/points/tier');
2625
+ }
2626
+ /**
2627
+ * Bybit Card — reward mall item list.
2628
+ */
2629
+ queryCardMallItemList(params) {
2630
+ return this.postPrivate('/v5/card/reward/mall/item/list', params);
2631
+ }
2632
+ /**
2633
+ * Bybit Card — cashback detail for a reward order.
2634
+ */
2635
+ queryCardPointCashbackDetail(params) {
2636
+ return this.postPrivate('/v5/card/reward/point/cashback/detail', params);
2637
+ }
2150
2638
  /**
2151
2639
  *
2152
2640
  ****** RFQ APIs