From de963574d9b1659b14c5f048eb34ec2f46c4186f Mon Sep 17 00:00:00 2001 From: Jerko J <83344666+JJ-Cro@users.noreply.github.com> Date: Thu, 15 Oct 2026 09:53:43 +0200 Subject: [PATCH] feat(v4.8.2): add reviewP2PSellerCancelOrderApply endpoint and update types - Introduced the `reviewP2PSellerCancelOrderApply` method in the RestClientV5 for handling buyer reviews of seller cancel requests. - Added corresponding request and response types for the new endpoint. - Updated package version to 4.8.2 and modified documentation for clarity. - Removed deprecated tax-related types and interfaces from the codebase. --- docs/endpointFunctionList.md | 841 +- .../P2P/review-seller-cancel-order-apply.js | 23 + llms.txt | 22464 ++++++++-------- package-lock.json | 4 +- package.json | 2 +- src/rest-client-v5.ts | 16 + src/types/request/v5-p2p-trading.ts | 17 + src/types/response/v5-p2p-trading.ts | 8 + 8 files changed, 11765 insertions(+), 11610 deletions(-) create mode 100644 examples/apidoc/V5/P2P/review-seller-cancel-order-apply.js diff --git a/docs/endpointFunctionList.md b/docs/endpointFunctionList.md index 9e4ffd0e..e78c6af0 100644 --- a/docs/endpointFunctionList.md +++ b/docs/endpointFunctionList.md @@ -49,426 +49,427 @@ This table includes all endpoints from the official Exchange API docs and corres | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | -| [getSystemStatus()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L721) | :closed_lock_with_key: | GET | `/v5/system/status` | -| [getServerTime()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L738) | | GET | `/v5/market/time` | -| [requestDemoTradingFunds()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L750) | :closed_lock_with_key: | POST | `/v5/account/demo-apply-money` | -| [createDemoAccount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L763) | :closed_lock_with_key: | POST | `/v5/user/create-demo-member` | -| [getSpreadInstrumentsInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L776) | | GET | `/v5/spread/instrument` | -| [getSpreadOrderbook()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L788) | | GET | `/v5/spread/orderbook` | -| [getSpreadTickers()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L798) | | GET | `/v5/spread/tickers` | -| [getSpreadRecentTrades()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L809) | | GET | `/v5/spread/recent-trade` | -| [getSpreadMaxQty()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L821) | :closed_lock_with_key: | GET | `/v5/spread/max-qty` | -| [submitSpreadOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L830) | :closed_lock_with_key: | POST | `/v5/spread/order/create` | -| [amendSpreadOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L843) | :closed_lock_with_key: | POST | `/v5/spread/order/amend` | -| [cancelSpreadOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L855) | :closed_lock_with_key: | POST | `/v5/spread/order/cancel` | -| [cancelAllSpreadOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L873) | :closed_lock_with_key: | POST | `/v5/spread/order/cancel-all` | -| [getSpreadOpenOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L892) | :closed_lock_with_key: | GET | `/v5/spread/order/realtime` | -| [getSpreadOrderHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L909) | :closed_lock_with_key: | GET | `/v5/spread/order/history` | -| [getSpreadTradeHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L925) | :closed_lock_with_key: | GET | `/v5/spread/execution/list` | -| [getKline()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L945) | | GET | `/v5/market/kline` | -| [getMarkPriceKline()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L962) | | GET | `/v5/market/mark-price-kline` | -| [getIndexPriceKline()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L977) | | GET | `/v5/market/index-price-kline` | -| [getPremiumIndexPriceKline()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L992) | | GET | `/v5/market/premium-index-price-kline` | -| [getInstrumentsInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1008) | | GET | `/v5/market/instruments-info` | -| [getOrderbook()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1019) | | GET | `/v5/market/orderbook` | -| [getFullDepthOrderbook()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1025) | | GET | `/v5/market/full_orderbook` | -| [getRPIOrderbook()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1039) | | GET | `/v5/market/rpi_orderbook` | -| [getTickers()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1045) | | GET | `/v5/market/tickers` | -| [getFundingRateHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1083) | | GET | `/v5/market/funding/history` | -| [getPublicTradingHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1098) | | GET | `/v5/market/recent-trade` | -| [getOpenInterest()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1111) | | GET | `/v5/market/open-interest` | -| [getHistoricalVolatility()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1121) | | GET | `/v5/market/historical-volatility` | -| [getInsurance()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1132) | | GET | `/v5/market/insurance` | -| [getRiskLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1143) | | GET | `/v5/market/risk-limit` | -| [getOptionDeliveryPrice()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1158) | | GET | `/v5/market/delivery-price` | -| [getDeliveryPrice()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1171) | | GET | `/v5/market/delivery-price` | -| [getNewDeliveryPrice()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1187) | | GET | `/v5/market/new-delivery-price` | -| [getLongShortRatio()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1203) | | GET | `/v5/market/account-ratio` | -| [getIndexPriceComponents()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1213) | | GET | `/v5/market/index-price-components` | -| [getOrderPriceLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1219) | | GET | `/v5/market/price-limit` | -| [getADLAlert()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1233) | | GET | `/v5/market/adlAlert` | -| [getFeeGroupStructure()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1246) | | GET | `/v5/market/fee-group-info` | -| [getOptionBaseCoins()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1255) | | GET | `/v5/market/option-base-coins` | -| [submitOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1267) | :closed_lock_with_key: | POST | `/v5/order/create` | -| [amendOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1273) | :closed_lock_with_key: | POST | `/v5/order/amend` | -| [cancelOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1279) | :closed_lock_with_key: | POST | `/v5/order/cancel` | -| [getActiveOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1288) | :closed_lock_with_key: | GET | `/v5/order/realtime` | -| [cancelAllOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1294) | :closed_lock_with_key: | POST | `/v5/order/cancel-all` | -| [getHistoricOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1307) | :closed_lock_with_key: | GET | `/v5/order/history` | -| [getExecutionList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1319) | :closed_lock_with_key: | GET | `/v5/execution/list` | -| [batchSubmitOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1337) | :closed_lock_with_key: | POST | `/v5/order/create-batch` | -| [batchAmendOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1362) | :closed_lock_with_key: | POST | `/v5/order/amend-batch` | -| [batchCancelOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1387) | :closed_lock_with_key: | POST | `/v5/order/cancel-batch` | -| [getSpotBorrowCheck()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1409) | :closed_lock_with_key: | GET | `/v5/order/spot-borrow-check` | -| [setDisconnectCancelAllWindow()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1430) | :closed_lock_with_key: | POST | `/v5/order/disconnected-cancel-all` | -| [setDisconnectCancelAllWindowV2()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1448) | :closed_lock_with_key: | POST | `/v5/order/disconnected-cancel-all` | -| [preCheckOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1463) | :closed_lock_with_key: | POST | `/v5/order/pre-check` | -| [createStrategyOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1480) | :closed_lock_with_key: | POST | `/v5/strategy/create` | -| [getStrategyList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1491) | :closed_lock_with_key: | GET | `/v5/strategy/list` | -| [getStrategyOrderList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1502) | :closed_lock_with_key: | GET | `/v5/strategy/order-list` | -| [stopStrategy()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1513) | :closed_lock_with_key: | POST | `/v5/strategy/stop` | -| [getPositionInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1538) | :closed_lock_with_key: | GET | `/v5/position/list` | -| [getFuturesLeverage()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1550) | :closed_lock_with_key: | GET | `/v5/position/symbol-info` | -| [setLeverage()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1565) | :closed_lock_with_key: | POST | `/v5/position/set-leverage` | -| [switchIsolatedMargin()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1578) | :closed_lock_with_key: | POST | `/v5/position/switch-isolated` | -| [setTPSLMode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1592) | :closed_lock_with_key: | POST | `/v5/position/set-tpsl-mode` | -| [switchPositionMode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1607) | :closed_lock_with_key: | POST | `/v5/position/switch-mode` | -| [setRiskLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1621) | :closed_lock_with_key: | POST | `/v5/position/set-risk-limit` | -| [setTradingStop()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1636) | :closed_lock_with_key: | POST | `/v5/position/trading-stop` | -| [setAutoAddMargin()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1647) | :closed_lock_with_key: | POST | `/v5/position/set-auto-add-margin` | -| [addOrReduceMargin()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1659) | :closed_lock_with_key: | POST | `/v5/position/add-margin` | -| [getClosedPnL()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1671) | :closed_lock_with_key: | GET | `/v5/position/closed-pnl` | -| [getClosedOptionsPositions()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1685) | :closed_lock_with_key: | GET | `/v5/position/get-closed-positions` | -| [movePosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1710) | :closed_lock_with_key: | POST | `/v5/position/move-positions` | -| [getMovePositionHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1721) | :closed_lock_with_key: | GET | `/v5/position/move-history` | -| [confirmNewRiskLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1740) | :closed_lock_with_key: | POST | `/v5/position/confirm-pending-mmr` | -| [getPreUpgradeOrderHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1760) | :closed_lock_with_key: | GET | `/v5/pre-upgrade/order/history` | -| [getPreUpgradeTradeHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1775) | :closed_lock_with_key: | GET | `/v5/pre-upgrade/execution/list` | -| [getPreUpgradeClosedPnl()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1786) | :closed_lock_with_key: | GET | `/v5/pre-upgrade/position/closed-pnl` | -| [getPreUpgradeTransactions()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1800) | :closed_lock_with_key: | GET | `/v5/pre-upgrade/account/transaction-log` | -| [getPreUpgradeOptionDeliveryRecord()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1817) | :closed_lock_with_key: | GET | `/v5/pre-upgrade/asset/delivery-record` | -| [getPreUpgradeUSDCSessionSettlements()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1831) | :closed_lock_with_key: | GET | `/v5/pre-upgrade/asset/settlement-record` | -| [getWalletBalance()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1852) | :closed_lock_with_key: | GET | `/v5/account/wallet-balance` | -| [getTransferableAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1863) | :closed_lock_with_key: | GET | `/v5/account/withdrawal` | -| [getAccountInstrumentsInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1880) | :closed_lock_with_key: | GET | `/v5/account/instruments-info` | -| [upgradeToUnifiedAccount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1891) | :closed_lock_with_key: | POST | `/v5/account/upgrade-to-uta` | -| [getBorrowHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1902) | :closed_lock_with_key: | GET | `/v5/account/borrow-history` | -| [repayLiability()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1923) | :closed_lock_with_key: | POST | `/v5/account/quick-repayment` | -| [manualRepay()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1948) | :closed_lock_with_key: | POST | `/v5/account/repay` | -| [setCollateralCoin()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1957) | :closed_lock_with_key: | POST | `/v5/account/set-collateral-switch` | -| [batchSetCollateralCoin()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1963) | :closed_lock_with_key: | POST | `/v5/account/set-collateral-switch-batch` | -| [getCollateralInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1973) | :closed_lock_with_key: | GET | `/v5/account/collateral-info` | -| [getCoinGreeks()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1982) | :closed_lock_with_key: | GET | `/v5/asset/coin-greeks` | -| [getFeeRate()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1995) | :closed_lock_with_key: | GET | `/v5/account/fee-rate` | -| [getAccountInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2004) | :closed_lock_with_key: | GET | `/v5/account/info` | -| [getDCPInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2017) | :closed_lock_with_key: | GET | `/v5/account/query-dcp-info` | -| [getTransactionLog()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2024) | :closed_lock_with_key: | GET | `/v5/account/transaction-log` | -| [getClassicTransactionLogs()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2035) | :closed_lock_with_key: | GET | `/v5/account/contract-transaction-log` | -| [getSMPGroup()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2046) | :closed_lock_with_key: | GET | `/v5/account/smp-group` | -| [setMarginMode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2059) | :closed_lock_with_key: | POST | `/v5/account/set-margin-mode` | -| [setSpotHedging()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2076) | :closed_lock_with_key: | POST | `/v5/account/set-hedging-mode` | -| [setLimitPriceAction()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2089) | :closed_lock_with_key: | POST | `/v5/account/set-limit-px-action` | -| [getLimitPriceAction()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2100) | :closed_lock_with_key: | GET | `/v5/account/user-setting-config` | -| [setDeltaNeutralMode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2108) | :closed_lock_with_key: | POST | `/v5/account/set-delta-mode` | -| [setMMP()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2117) | :closed_lock_with_key: | POST | `/v5/account/mmp-modify` | -| [resetMMP()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2124) | :closed_lock_with_key: | POST | `/v5/account/mmp-reset` | -| [getMMPState()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2131) | :closed_lock_with_key: | GET | `/v5/account/mmp-state` | -| [getOptionAssetInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2141) | :closed_lock_with_key: | GET | `/v5/account/option-asset-info` | -| [getPayInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2151) | :closed_lock_with_key: | GET | `/v5/account/pay-info` | -| [getTradeInfoForAnalysis()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2161) | :closed_lock_with_key: | GET | `/v5/account/trade-info-for-analysis` | -| [getAssetOverview()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2181) | :closed_lock_with_key: | GET | `/v5/asset/asset-overview` | -| [getPortfolioMarginInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2191) | :closed_lock_with_key: | GET | `/v5/asset/portfolio-margin` | -| [getTotalMembersAssets()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2201) | :closed_lock_with_key: | GET | `/v5/asset/total-members-assets` | -| [getFundingAccountTransactionHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2213) | :closed_lock_with_key: | GET | `/v5/asset/fundinghistory` | -| [getDeliveryRecord()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2229) | :closed_lock_with_key: | GET | `/v5/asset/delivery-record` | -| [getSettlementRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2240) | :closed_lock_with_key: | GET | `/v5/asset/settlement-record` | -| [getCoinExchangeRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2253) | :closed_lock_with_key: | GET | `/v5/asset/exchange/order-record` | -| [getCoinInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2268) | :closed_lock_with_key: | GET | `/v5/asset/coin/query-info` | -| [getSubUID()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2282) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-sub-member-list` | -| [getAssetInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2297) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-asset-info` | -| [getAllCoinsBalance()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2308) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-account-coins-balance` | -| [getCoinBalance()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2322) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-account-coin-balance` | -| [getWithdrawableAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2336) | :closed_lock_with_key: | GET | `/v5/asset/withdraw/withdrawable-amount` | -| [getTransferableCoinList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2345) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-transfer-coin-list` | -| [createInternalTransfer()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2361) | :closed_lock_with_key: | POST | `/v5/asset/transfer/inter-transfer` | -| [getInternalTransferRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2380) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-inter-transfer-list` | -| [enableUniversalTransferForSubUIDs()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2400) | :closed_lock_with_key: | POST | `/v5/asset/transfer/save-transfer-sub-member` | -| [createUniversalTransfer()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2411) | :closed_lock_with_key: | POST | `/v5/asset/transfer/universal-transfer` | -| [getUniversalTransferRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2423) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-universal-transfer-list` | -| [getAllowedDepositCoinInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2436) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-allowed-list` | -| [setDepositAccount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2451) | :closed_lock_with_key: | POST | `/v5/asset/deposit/deposit-to-account` | -| [getDepositRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2467) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-record` | -| [getSubAccountDepositRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2482) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-sub-member-record` | -| [getInternalDepositRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2498) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-internal-record` | -| [getMasterDepositAddress()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2510) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-address` | -| [getSubDepositAddress()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2528) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-sub-member-address` | -| [querySubMemberAddress()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2553) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-sub-member-address` | -| [getWithdrawalRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2573) | :closed_lock_with_key: | GET | `/v5/asset/withdraw/query-record` | -| [getWithdrawalAddressList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2585) | :closed_lock_with_key: | GET | `/v5/asset/withdraw/query-address` | -| [getExchangeEntities()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2599) | :closed_lock_with_key: | GET | `/v5/asset/withdraw/vasp/list` | -| [submitDepositOriginatorInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2609) | :closed_lock_with_key: | POST | `/v5/asset/travel-rule/deposit/submit` | -| [submitWithdrawal()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2624) | :closed_lock_with_key: | POST | `/v5/asset/withdraw/create` | -| [cancelWithdrawal()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2635) | :closed_lock_with_key: | POST | `/v5/asset/withdraw/cancel` | -| [getConvertCoins()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2644) | :closed_lock_with_key: | GET | `/v5/asset/exchange/query-coin-list` | -| [requestConvertQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2655) | :closed_lock_with_key: | POST | `/v5/asset/exchange/quote-apply` | -| [confirmConvertQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2664) | :closed_lock_with_key: | POST | `/v5/asset/exchange/convert-execute` | -| [getConvertStatus()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2676) | :closed_lock_with_key: | GET | `/v5/asset/exchange/convert-result-query` | -| [getConvertHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2695) | :closed_lock_with_key: | GET | `/v5/asset/exchange/query-convert-history` | -| [getSmallBalanceList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2712) | :closed_lock_with_key: | GET | `/v5/asset/covert/small-balance-list` | -| [getFiatTradingPairList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2726) | :closed_lock_with_key: | GET | `/v5/fiat/query-coin-list` | -| [createSubMember()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2744) | :closed_lock_with_key: | POST | `/v5/user/create-sub-member` | -| [createSubUIDAPIKey()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2756) | :closed_lock_with_key: | POST | `/v5/user/create-sub-api` | -| [getSubUIDList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2765) | :closed_lock_with_key: | GET | `/v5/user/query-sub-members` | -| [getSubUIDListUnlimited()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2774) | :closed_lock_with_key: | GET | `/v5/user/submembers` | -| [setSubUIDFrozenState()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2792) | :closed_lock_with_key: | POST | `/v5/user/frozen-sub-member` | -| [getQueryApiKey()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2807) | :closed_lock_with_key: | GET | `/v5/user/query-api` | -| [getSubAccountAllApiKeys()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2814) | :closed_lock_with_key: | GET | `/v5/user/sub-apikeys` | -| [getUIDWalletType()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2823) | :closed_lock_with_key: | GET | `/v5/user/get-member-type` | -| [updateMasterApiKey()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2842) | :closed_lock_with_key: | POST | `/v5/user/update-api` | -| [updateSubApiKey()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2856) | :closed_lock_with_key: | POST | `/v5/user/update-sub-api` | -| [deleteSubMember()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2869) | :closed_lock_with_key: | POST | `/v5/user/del-submember` | -| [deleteMasterApiKey()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2884) | :closed_lock_with_key: | POST | `/v5/user/delete-api` | -| [deleteSubApiKey()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2898) | :closed_lock_with_key: | POST | `/v5/user/delete-sub-api` | -| [createTaxBatchExport()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2913) | :closed_lock_with_key: | POST | `/v5/fht/compliance/tax/private/batch_create` | -| [getTaxBatchExport()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2925) | :closed_lock_with_key: | GET | `/v5/fht/compliance/tax/private/batch_query` | -| [getAffiliateUserList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2948) | :closed_lock_with_key: | GET | `/v5/affiliate/aff-user-list` | -| [getAffiliateSubAffiliateList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2966) | :closed_lock_with_key: | GET | `/v5/affiliate/affiliate-sub-list` | -| [getAffiliateUserInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2982) | :closed_lock_with_key: | GET | `/v5/user/aff-customer-info` | -| [getFriendReferrals()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2994) | :closed_lock_with_key: | GET | `/v5/user/invitation/referrals` | -| [getReferralCode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3003) | :closed_lock_with_key: | GET | `/v5/user/invitation/code` | -| [signAgreement()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3019) | :closed_lock_with_key: | POST | `/v5/user/agreement` | -| [getAlphaTradeQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3036) | :closed_lock_with_key: | POST | `/v5/alpha/trade/quote` | -| [executeAlphaTradePurchase()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3047) | :closed_lock_with_key: | POST | `/v5/alpha/trade/purchase` | -| [executeAlphaTradeRedeem()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3058) | :closed_lock_with_key: | POST | `/v5/alpha/trade/redeem` | -| [getAlphaPayTokenList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3068) | :closed_lock_with_key: | POST | `/v5/alpha/trade/pay-token-list` | -| [getAlphaTradeOrderList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3078) | :closed_lock_with_key: | POST | `/v5/alpha/trade/order-list` | -| [getAlphaBizTokenList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3088) | :closed_lock_with_key: | POST | `/v5/alpha/trade/biz-token-list` | -| [getAlphaBizTokenPriceList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3098) | :closed_lock_with_key: | POST | `/v5/alpha/trade/biz-token-price-list` | -| [getAlphaBizTokenDetails()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3108) | :closed_lock_with_key: | POST | `/v5/alpha/trade/biz-token-details` | -| [getAlphaAssetList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3118) | :closed_lock_with_key: | POST | `/v5/alpha/trade/asset-list` | -| [getAlphaAssetDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3126) | :closed_lock_with_key: | POST | `/v5/alpha/trade/asset-detail` | -| [getAlphaPredictionEngineStatus()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3142) | :closed_lock_with_key: | GET | `/v5/alpha/prediction/engine-status` | -| [getAlphaPredictionPayTokenList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3152) | :closed_lock_with_key: | GET | `/v5/alpha/prediction/pay-token-list` | -| [getAlphaPredictionEventDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3162) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/event-detail` | -| [getAlphaPredictionOrderEstimate()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3172) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/order-estimate` | -| [executeAlphaPredictionBuy()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3182) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/buy` | -| [executeAlphaPredictionSell()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3192) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/sell` | -| [getAlphaPredictionOrderList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3202) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/order-list` | -| [getAlphaPredictionOrderBook()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3212) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/order-book` | -| [getAlphaPredictionTokenPrice()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3222) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/token-price` | -| [getAlphaPredictionPriceHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3232) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/price-history` | -| [getAlphaPredictionPositionList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3242) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/position-list` | -| [getAlphaPredictionPositionHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3252) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/position-history` | -| [getAlphaPredictionPortfolioSummary()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3262) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/portfolio-summary` | -| [getAlphaPredictionSideMarketList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3272) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/side-market-list` | -| [getAlphaPredictionSportsMatchList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3282) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/sports/match-list` | -| [getAlphaPredictionSportsTimelineStages()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3292) | :closed_lock_with_key: | GET | `/v5/alpha/prediction/sports/timeline-stages` | -| [getAlphaPredictionSportsGroupStageDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3305) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/sports/group-stage-detail` | -| [getAlphaLPPoolList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3324) | :closed_lock_with_key: | POST | `/v5/alpha/lp/pool-list` | -| [getAlphaLPPoolInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3334) | :closed_lock_with_key: | POST | `/v5/alpha/lp/pool-info` | -| [executeAlphaLPStake()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3344) | :closed_lock_with_key: | POST | `/v5/alpha/lp/stake` | -| [executeAlphaLPRedeem()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3354) | :closed_lock_with_key: | POST | `/v5/alpha/lp/redeem` | -| [getAlphaLPOrderList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3364) | :closed_lock_with_key: | POST | `/v5/alpha/lp/order-list` | -| [getAlphaLPPayTokenList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3374) | :closed_lock_with_key: | POST | `/v5/alpha/lp/pay-token-list` | -| [getAlphaLPPayTokenPrice()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3384) | :closed_lock_with_key: | POST | `/v5/alpha/lp/pay-token-price` | -| [getAlphaLPPositionList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3394) | :closed_lock_with_key: | POST | `/v5/alpha/lp/position-list` | -| [getVIPMarginData()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3414) | | GET | `/v5/spot-margin-trade/data` | -| [getHistoricalInterestRate()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3425) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/interest-rate-history` | -| [getSpotMarginCurrencyData()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3450) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/currency-data` | -| [toggleSpotMarginTrade()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3462) | :closed_lock_with_key: | POST | `/v5/spot-margin-trade/switch-mode` | -| [setSpotMarginLeverage()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3473) | :closed_lock_with_key: | POST | `/v5/spot-margin-trade/set-leverage` | -| [setSpotMarginLeverageV2()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3481) | :closed_lock_with_key: | POST | `/v5/spot-margin-trade/set-leverage` | -| [getSpotMarginState()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3492) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/state` | -| [manualBorrow()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3499) | :closed_lock_with_key: | POST | `/v5/account/borrow` | -| [getMaxBorrowableAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3508) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/max-borrowable` | -| [getPositionTiers()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3517) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/position-tiers` | -| [getCoinState()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3528) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/coinstate` | -| [getAvailableAmountToRepay()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3539) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/repayment-available-amount` | -| [manualRepayWithoutConversion()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3558) | :closed_lock_with_key: | POST | `/v5/account/no-convert-repay` | -| [getAutoRepayMode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3571) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/get-auto-repay-mode` | -| [setAutoRepayMode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3587) | :closed_lock_with_key: | POST | `/v5/spot-margin-trade/set-auto-repay-mode` | -| [getSpotMarginLiability()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3599) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/liability` | -| [submitFixedRateBorrow()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3608) | :closed_lock_with_key: | POST | `/v5/spot-margin-trade/fixedborrow` | -| [getFixedRateBorrowOrderInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3617) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/fixedborrow-order-info` | -| [getFixedRateBorrowContractInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3634) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/fixedborrow-contract-info` | -| [getFixedRateBorrowOrderQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3651) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/fixedborrow-order-quote` | -| [renewFixedRateBorrow()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3663) | :closed_lock_with_key: | POST | `/v5/spot-margin-trade/fixedborrow-renew` | -| [getFlexibleAvailableInventory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3669) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/flexible-available-inventory` | -| [getFixedRateAvailableInventory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3678) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/fixed-available-inventory` | -| [getSpotMarginCoinInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3696) | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/pledge-token` | -| [getSpotMarginBorrowableCoinInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3713) | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/borrow-token` | -| [getSpotMarginInterestAndQuota()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3730) | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/loan-info` | -| [getSpotMarginLoanAccountInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3748) | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/account` | -| [spotMarginBorrow()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3772) | :closed_lock_with_key: | POST | `/v5/spot-cross-margin-trade/loan` | -| [spotMarginRepay()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3783) | :closed_lock_with_key: | POST | `/v5/spot-cross-margin-trade/repay` | -| [getSpotMarginBorrowOrderDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3798) | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/orders` | -| [getSpotMarginRepaymentOrderDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3827) | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/repay-history` | -| [toggleSpotCrossMarginTrade()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3856) | :closed_lock_with_key: | POST | `/v5/spot-cross-margin-trade/switch` | -| [getCollateralCoins()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3876) | | GET | `/v5/crypto-loan/collateral-data` | -| [getBorrowableCoins()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3893) | | GET | `/v5/crypto-loan/loanable-data` | -| [getAccountBorrowCollateralLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3911) | :closed_lock_with_key: | GET | `/v5/crypto-loan/borrowable-collateralisable-number` | -| [borrowCryptoLoan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3931) | :closed_lock_with_key: | POST | `/v5/crypto-loan/borrow` | -| [repayCryptoLoan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3952) | :closed_lock_with_key: | POST | `/v5/crypto-loan/repay` | -| [getUnpaidLoanOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3968) | :closed_lock_with_key: | GET | `/v5/crypto-loan/ongoing-orders` | -| [getRepaymentHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3989) | :closed_lock_with_key: | GET | `/v5/crypto-loan/repayment-history` | -| [getCompletedLoanOrderHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4009) | :closed_lock_with_key: | GET | `/v5/crypto-loan/borrow-history` | -| [getMaxAllowedReductionCollateralAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4028) | :closed_lock_with_key: | GET | `/v5/crypto-loan/max-collateral-amount` | -| [adjustCollateralAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4047) | :closed_lock_with_key: | POST | `/v5/crypto-loan/adjust-ltv` | -| [getLoanLTVAdjustmentHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4071) | :closed_lock_with_key: | GET | `/v5/crypto-loan/adjustment-history` | -| [getLoanBorrowableCoins()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4092) | | GET | `/v5/crypto-loan-common/loanable-data` | -| [getLoanCollateralCoins()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4104) | | GET | `/v5/crypto-loan-common/collateral-data` | -| [getMaxCollateralAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4114) | :closed_lock_with_key: | GET | `/v5/crypto-loan-common/max-collateral-amount` | -| [getMaxLoanAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4133) | :closed_lock_with_key: | POST | `/v5/crypto-loan-common/max-loan` | -| [updateCollateralAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4143) | :closed_lock_with_key: | POST | `/v5/crypto-loan-common/adjust-ltv` | -| [getCollateralAdjustmentHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4154) | :closed_lock_with_key: | GET | `/v5/crypto-loan-common/adjustment-history` | -| [getCryptoLoanPosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4169) | :closed_lock_with_key: | GET | `/v5/crypto-loan-common/position` | -| [borrowFlexible()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4186) | :closed_lock_with_key: | POST | `/v5/crypto-loan-flexible/borrow` | -| [repayFlexible()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4197) | :closed_lock_with_key: | POST | `/v5/crypto-loan-flexible/repay` | -| [repayCollateralFlexible()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4207) | :closed_lock_with_key: | POST | `/v5/crypto-loan-flexible/repay-collateral` | -| [getOngoingFlexibleLoans()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4221) | :closed_lock_with_key: | GET | `/v5/crypto-loan-flexible/ongoing-coin` | -| [getBorrowHistoryFlexible()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4233) | :closed_lock_with_key: | GET | `/v5/crypto-loan-flexible/borrow-history` | -| [getRepaymentHistoryFlexible()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4246) | :closed_lock_with_key: | GET | `/v5/crypto-loan-flexible/repayment-history` | -| [getFlexibleLoanAvailableInventory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4260) | :closed_lock_with_key: | GET | `/v5/crypto-loan-flexible/available-inventory` | -| [getSupplyOrderQuoteFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4280) | | GET | `/v5/crypto-loan-fixed/supply-order-quote` | -| [getBorrowOrderQuoteFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4293) | | GET | `/v5/crypto-loan-fixed/borrow-order-quote` | -| [createBorrowOrderFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4306) | :closed_lock_with_key: | POST | `/v5/crypto-loan-fixed/borrow` | -| [createSupplyOrderFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4319) | :closed_lock_with_key: | POST | `/v5/crypto-loan-fixed/supply` | -| [cancelBorrowOrderFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4329) | :closed_lock_with_key: | POST | `/v5/crypto-loan-fixed/borrow-order-cancel` | -| [cancelSupplyOrderFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4343) | :closed_lock_with_key: | POST | `/v5/crypto-loan-fixed/supply-order-cancel` | -| [getBorrowContractInfoFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4356) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/borrow-contract-info` | -| [getSupplyContractInfoFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4374) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/supply-contract-info` | -| [getBorrowOrderInfoFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4392) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/borrow-order-info` | -| [getSupplyOrderInfoFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4405) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/supply-order-info` | -| [repayFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4419) | :closed_lock_with_key: | POST | `/v5/crypto-loan-fixed/fully-repay` | -| [repayCollateralFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4430) | :closed_lock_with_key: | POST | `/v5/crypto-loan-flexible/repay-collateral` | -| [getRepaymentHistoryFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4443) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/repayment-history` | -| [renewBorrowOrderFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4460) | :closed_lock_with_key: | POST | `/v5/crypto-loan-fixed/renew` | -| [getRenewOrderInfoFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4473) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/renew-info` | -| [getFixedLoanAvailableInventory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4482) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/available-inventory` | -| [getInstitutionalLendingProductInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4497) | | GET | `/v5/ins-loan/product-infos` | -| [getInstitutionalLendingCoinDeltaAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4509) | :closed_lock_with_key: | GET | `/v5/ins-loan/coin-delta-amount` | -| [getInstitutionalLendingDelayLiquidationStatus()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4518) | :closed_lock_with_key: | GET | `/v5/ins-loan/delay-liq-status` | -| [getInstitutionalLendingMarginCoinInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4528) | | GET | `/v5/ins-loan/ensure-tokens` | -| [getInstitutionalLendingMarginCoinInfoWithConversionRate()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4537) | | GET | `/v5/ins-loan/ensure-tokens-convert` | -| [getInstitutionalLendingLoanOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4546) | :closed_lock_with_key: | GET | `/v5/ins-loan/loan-order` | -| [getInstitutionalLendingRepayOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4558) | :closed_lock_with_key: | GET | `/v5/ins-loan/repaid-history` | -| [getInstitutionalLendingLTV()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4570) | :closed_lock_with_key: | GET | `/v5/ins-loan/ltv` | -| [getInstitutionalLendingLTVWithLadderConversionRate()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4579) | :closed_lock_with_key: | GET | `/v5/ins-loan/ltv-convert` | -| [bindOrUnbindUID()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4594) | :closed_lock_with_key: | POST | `/v5/ins-loan/association-uid` | -| [repayInstitutionalLoan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4614) | :closed_lock_with_key: | POST | `/v5/ins-loan/repay-loan` | -| [getExchangeBrokerEarnings()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4635) | :closed_lock_with_key: | GET | `/v5/broker/earnings-info` | -| [getExchangeBrokerAccountInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4648) | :closed_lock_with_key: | GET | `/v5/broker/account-info` | -| [getBrokerSubAccountDeposits()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4664) | :closed_lock_with_key: | GET | `/v5/broker/asset/query-sub-member-deposit-record` | -| [getBrokerVoucherSpec()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4679) | :closed_lock_with_key: | POST | `/v5/broker/award/info` | -| [issueBrokerVoucher()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4691) | :closed_lock_with_key: | POST | `/v5/broker/award/distribute-award` | -| [getBrokerIssuedVoucher()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4703) | :closed_lock_with_key: | POST | `/v5/broker/award/distribution-record` | -| [setBrokerRateLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4720) | :closed_lock_with_key: | POST | `/v5/broker/apilimit/set` | -| [getBrokerRateLimitCap()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4739) | :closed_lock_with_key: | GET | `/v5/broker/apilimit/query-cap` | -| [getAllBrokerRateLimits()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4757) | :closed_lock_with_key: | GET | `/v5/broker/apilimit/query-all` | -| [getEarnProduct()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4777) | | GET | `/v5/earn/product` | -| [getFlexibleSavingAutoSavings()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4788) | :closed_lock_with_key: | GET | `/v5/earn/flexible-saving/auto-savings` | -| [setFlexibleSavingAutoSavings()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4797) | :closed_lock_with_key: | POST | `/v5/earn/flexible-saving/auto-savings` | -| [getEarnCouponList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4807) | :closed_lock_with_key: | GET | `/v5/earn/coupons` | -| [getRWAProductList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4817) | | GET | `/v5/earn/rwa/product` | -| [placeRWAOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4827) | :closed_lock_with_key: | POST | `/v5/earn/rwa/place-order` | -| [getRWAPositionList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4836) | :closed_lock_with_key: | GET | `/v5/earn/rwa/position` | -| [getRWAOrderList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4845) | :closed_lock_with_key: | GET | `/v5/earn/rwa/order` | -| [getRWANavChart()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4855) | | GET | `/v5/earn/rwa/nav-chart` | -| [getHoldToEarnAirdropProducts()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4866) | | GET | `/v5/earn/hold-to-earn/product` | -| [getAdvanceEarnProduct()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4877) | | GET | `/v5/earn/advance/product` | -| [getLiquidityMiningProduct()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4888) | | GET | `/v5/earn/liquidity-mining/product` | -| [reinvestLiquidityMining()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4901) | :closed_lock_with_key: | POST | `/v5/earn/liquidity-mining/reinvest` | -| [getFixedTermEarnProduct()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4912) | | GET | `/v5/earn/fixed-term/product` | -| [getAdvanceEarnProductExtraInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4924) | | GET | `/v5/earn/advance/product-extra-info` | -| [submitAdvanceEarnPlaceOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4935) | :closed_lock_with_key: | POST | `/v5/earn/advance/place-order` | -| [getAdvanceEarnPosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4946) | :closed_lock_with_key: | GET | `/v5/earn/advance/position` | -| [getAdvanceEarnOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4957) | :closed_lock_with_key: | GET | `/v5/earn/advance/order` | -| [submitFixedTermEarnOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4968) | :closed_lock_with_key: | POST | `/v5/earn/fixed-term/place-order` | -| [redeemFixedTermEarn()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4979) | :closed_lock_with_key: | POST | `/v5/earn/fixed-term/redeem` | -| [getFixedTermEarnPosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4990) | :closed_lock_with_key: | GET | `/v5/earn/fixed-term/position` | -| [getFixedTermEarnOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5001) | :closed_lock_with_key: | GET | `/v5/earn/fixed-term/order` | -| [setFixedTermEarnAutoInvest()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5012) | :closed_lock_with_key: | POST | `/v5/earn/fixed-term/position/auto-invest` | -| [submitStakeRedeem()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5028) | :closed_lock_with_key: | POST | `/v5/earn/place-order` | -| [getEarnOrderHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5047) | :closed_lock_with_key: | GET | `/v5/earn/order` | -| [getEarnPosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5065) | :closed_lock_with_key: | GET | `/v5/earn/position` | -| [modifyEarnPosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5078) | :closed_lock_with_key: | POST | `/v5/earn/position/modify` | -| [getEarnYieldHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5091) | :closed_lock_with_key: | GET | `/v5/earn/yield` | -| [getHoldToEarnAirdropYieldHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5105) | :closed_lock_with_key: | GET | `/v5/earn/hold-to-earn/yield-history` | -| [getEarnHourlyYieldHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5116) | :closed_lock_with_key: | GET | `/v5/earn/hourly-yield` | -| [getEarnAprHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5130) | | GET | `/v5/earn/apr-history` | -| [getEarnTokenProduct()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5140) | | GET | `/v5/earn/token/product` | -| [submitEarnTokenOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5149) | :closed_lock_with_key: | POST | `/v5/earn/token/place-order` | -| [getEarnTokenOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5158) | :closed_lock_with_key: | GET | `/v5/earn/token/order` | -| [getEarnTokenPosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5170) | :closed_lock_with_key: | GET | `/v5/earn/token/position` | -| [getEarnTokenDailyYield()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5179) | :closed_lock_with_key: | GET | `/v5/earn/token/yield` | -| [getEarnTokenHourlyYield()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5191) | :closed_lock_with_key: | GET | `/v5/earn/token/hourly-yield` | -| [getEarnTokenHistoryApr()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5203) | | GET | `/v5/earn/token/history-apr` | -| [getPwmInvestmentPlanList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5218) | :closed_lock_with_key: | GET | `/v5/earn/pwm/investment-plan/list` | -| [getPwmInvestmentPlanDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5227) | :closed_lock_with_key: | GET | `/v5/earn/pwm/investment-plan/detail` | -| [getPwmPendingInvestmentPlanDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5236) | :closed_lock_with_key: | GET | `/v5/earn/pwm/investment-plan/new-plan` | -| [claimPwmWithdrawableFunds()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5245) | :closed_lock_with_key: | POST | `/v5/earn/pwm/investment-plan/claim` | -| [getPwmInvestmentPlanAssetTrend()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5254) | :closed_lock_with_key: | GET | `/v5/earn/pwm/investment-plan/asset-trend` | -| [getPwmFundHistoricalNav()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5263) | :closed_lock_with_key: | GET | `/v5/earn/pwm/investment-plan/fund-nav` | -| [subscribePwmInvestmentPlan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5272) | :closed_lock_with_key: | POST | `/v5/earn/pwm/investment-plan/subscribe` | -| [investMorePwmInvestmentPlan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5281) | :closed_lock_with_key: | POST | `/v5/earn/pwm/investment-plan/invest-more` | -| [redeemPwmInvestmentPlan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5290) | :closed_lock_with_key: | POST | `/v5/earn/pwm/investment-plan/redeem` | -| [getPwmInvestmentPlanOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5299) | :closed_lock_with_key: | GET | `/v5/earn/pwm/investment-plan/order` | -| [getPwmSubscribableProductInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5308) | | GET | `/v5/earn/pwm/customize-plan/product` | -| [createPwmCustomizeInvestmentPlan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5317) | :closed_lock_with_key: | POST | `/v5/earn/pwm/customize-plan/create` | -| [getPwmAllFunds()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5332) | :closed_lock_with_key: | GET | `/v5/earn/pwm/asset-manager/all-funds` | -| [settlePwmFundProfit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5341) | :closed_lock_with_key: | POST | `/v5/earn/pwm/asset-manager/settle-profit` | -| [createPwmFund()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5350) | :closed_lock_with_key: | POST | `/v5/earn/pwm/asset-manager/create-fund` | -| [createPwmAssetManagerInvestmentPlan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5359) | :closed_lock_with_key: | POST | `/v5/earn/pwm/asset-manager/create-investment-plan` | -| [getPwmAssetManagerInvestmentPlans()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5373) | :closed_lock_with_key: | GET | `/v5/earn/pwm/asset-manager/get-investment-plan` | -| [managePwmAssetManagerInvestmentPlan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5385) | :closed_lock_with_key: | POST | `/v5/earn/pwm/asset-manager/manage-investment-plan` | -| [getPwmAllFundOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5399) | :closed_lock_with_key: | GET | `/v5/earn/pwm/asset-manager/all-order` | -| [managePwmFundOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5408) | :closed_lock_with_key: | POST | `/v5/earn/pwm/asset-manager/manage-order` | -| [createPwmFundSubAccount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5417) | :closed_lock_with_key: | POST | `/v5/earn/pwm/asset-manager/create-sub-account` | -| [pwmFundTransfer()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5429) | :closed_lock_with_key: | POST | `/v5/earn/pwm/fund-transfer` | -| [getPwmFundTransferRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5438) | :closed_lock_with_key: | GET | `/v5/earn/pwm/query-fund-transfer-result` | -| [queryCardAssetRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5453) | :closed_lock_with_key: | POST | `/v5/card/transaction/query-asset-records` | -| [queryCardPointsBalance()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5462) | :closed_lock_with_key: | POST | `/v5/card/reward/points/balance` | -| [queryCardPointsRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5469) | :closed_lock_with_key: | POST | `/v5/card/reward/points/records` | -| [queryCardPointsTier()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5478) | :closed_lock_with_key: | POST | `/v5/card/reward/points/tier` | -| [queryCardMallItemList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5485) | :closed_lock_with_key: | POST | `/v5/card/reward/mall/item/list` | -| [queryCardPointCashbackDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5494) | :closed_lock_with_key: | POST | `/v5/card/reward/point/cashback/detail` | -| [createRFQ()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5510) | :closed_lock_with_key: | POST | `/v5/rfq/create-rfq` | -| [getRFQConfig()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5521) | :closed_lock_with_key: | GET | `/v5/rfq/config` | -| [cancelRFQ()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5530) | :closed_lock_with_key: | POST | `/v5/rfq/cancel-rfq` | -| [cancelAllRFQ()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5540) | :closed_lock_with_key: | POST | `/v5/rfq/cancel-all-rfq` | -| [createRFQQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5549) | :closed_lock_with_key: | POST | `/v5/rfq/create-quote` | -| [executeRFQQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5560) | :closed_lock_with_key: | POST | `/v5/rfq/execute-quote` | -| [cancelRFQQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5571) | :closed_lock_with_key: | POST | `/v5/rfq/cancel-quote` | -| [cancelAllRFQQuotes()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5581) | :closed_lock_with_key: | POST | `/v5/rfq/cancel-all-quotes` | -| [getRFQRealtimeInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5595) | :closed_lock_with_key: | GET | `/v5/rfq/rfq-realtime` | -| [getRFQHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5607) | :closed_lock_with_key: | GET | `/v5/rfq/rfq-list` | -| [getRFQRealtimeQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5621) | :closed_lock_with_key: | GET | `/v5/rfq/quote-realtime` | -| [getRFQHistoryQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5636) | :closed_lock_with_key: | GET | `/v5/rfq/quote-list` | -| [getRFQTrades()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5649) | :closed_lock_with_key: | GET | `/v5/rfq/trade-list` | -| [getRFQPublicTrades()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5662) | :closed_lock_with_key: | GET | `/v5/rfq/public-trades` | -| [acceptNonLPQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5678) | :closed_lock_with_key: | POST | `/v5/rfq/accept-other-quote` | -| [getRFQDetails()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5684) | :closed_lock_with_key: | GET | `/v5/rfq/rfq-detail-list` | -| [getP2PAccountCoinsBalance()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5709) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-account-coins-balance` | -| [getP2POnlineAds()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5726) | :closed_lock_with_key: | POST | `/v5/p2p/item/online` | -| [createP2PAd()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5735) | :closed_lock_with_key: | POST | `/v5/p2p/item/create` | -| [cancelP2PAd()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5744) | :closed_lock_with_key: | POST | `/v5/p2p/item/cancel` | -| [updateP2PAd()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5758) | :closed_lock_with_key: | POST | `/v5/p2p/item/update` | -| [getP2PPersonalAds()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5768) | :closed_lock_with_key: | POST | `/v5/p2p/item/personal/list` | -| [getP2PAdDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5777) | :closed_lock_with_key: | POST | `/v5/p2p/item/info` | -| [getP2POrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5792) | :closed_lock_with_key: | POST | `/v5/p2p/order/simplifyList` | -| [getP2POrderDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5802) | :closed_lock_with_key: | POST | `/v5/p2p/order/info` | -| [getP2PPendingOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5811) | :closed_lock_with_key: | POST | `/v5/p2p/order/pending/simplifyList` | -| [markP2POrderAsPaid()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5820) | :closed_lock_with_key: | POST | `/v5/p2p/order/pay` | -| [releaseP2POrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5829) | :closed_lock_with_key: | POST | `/v5/p2p/order/finish` | -| [sendP2POrderMessage()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5838) | :closed_lock_with_key: | POST | `/v5/p2p/order/message/send` | -| [getP2PChatSessions()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5853) | :closed_lock_with_key: | POST | `/v5/p2p/chat/session/list_v1` | -| [getP2PChatSessionId()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5863) | :closed_lock_with_key: | POST | `/v5/p2p/chat/session/getSessionId` | -| [sendP2PChatMessage()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5899) | :closed_lock_with_key: | POST | `/v5/p2p/chat/message/send_v1` | -| [getP2PChatMessages()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5911) | :closed_lock_with_key: | POST | `/v5/p2p/chat/message/listpage_v1` | -| [getP2POrderMessages()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5920) | :closed_lock_with_key: | POST | `/v5/p2p/order/message/listpage` | -| [getP2PUserInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5934) | :closed_lock_with_key: | POST | `/v5/p2p/user/personal/info` | -| [getP2PCounterpartyUserInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5941) | :closed_lock_with_key: | POST | `/v5/p2p/user/order/personal/info` | -| [getP2PUserPayments()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5950) | :closed_lock_with_key: | POST | `/v5/p2p/user/payment/list` | -| [setApiRateLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5970) | :closed_lock_with_key: | POST | `/v5/apilimit/set` | -| [queryApiRateLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5999) | :closed_lock_with_key: | GET | `/v5/apilimit/query` | -| [getRateLimitCap()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6018) | :closed_lock_with_key: | GET | `/v5/apilimit/query-cap` | -| [getAllRateLimits()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6037) | :closed_lock_with_key: | GET | `/v5/apilimit/query-all` | -| [getLaunchpoolProjectList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6060) | | GET | `/v5/spot-x/launchpool/project/list` | -| [getLaunchpoolUserActivityLog()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6066) | :closed_lock_with_key: | POST | `/v5/spot-x/launchpool/user/activity-log` | -| [getLaunchpoolCurrentStaking()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6072) | :closed_lock_with_key: | GET | `/v5/spot-x/launchpool/user/current-staking` | -| [getLaunchpoolUserHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6078) | :closed_lock_with_key: | POST | `/v5/spot-x/launchpool/user/history` | -| [getPuzzleProjectList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6084) | | GET | `/v5/spot-x/puzzle/project/list` | -| [getTokenSplashProjectList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6090) | | GET | `/v5/spot-x/token-splash/project/list` | -| [getTokenSplashUserActivityParams()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6096) | :closed_lock_with_key: | GET | `/v5/spot-x/token-splash/user/activity-params` | -| [getEventInstrumentsInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6119) | | GET | `/v5/event/instruments-info` | -| [getEventOrderbook()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6130) | | GET | `/v5/event/orderbook` | -| [getEventOrderHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6141) | :closed_lock_with_key: | GET | `/v5/event/order-list` | -| [getEventActiveOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6152) | :closed_lock_with_key: | GET | `/v5/event/order-realtime` | -| [getEventPositionInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6163) | :closed_lock_with_key: | GET | `/v5/event/positions` | -| [getEventTradeHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6174) | :closed_lock_with_key: | GET | `/v5/event/trades` | -| [getEventSettlementRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6185) | :closed_lock_with_key: | GET | `/v5/event/settlements` | -| [submitEventQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6196) | :closed_lock_with_key: | POST | `/v5/event/quotes` | -| [cancelEventQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6207) | :closed_lock_with_key: | POST | `/v5/event/cancel` | +| [getSystemStatus()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L722) | :closed_lock_with_key: | GET | `/v5/system/status` | +| [getServerTime()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L739) | | GET | `/v5/market/time` | +| [requestDemoTradingFunds()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L751) | :closed_lock_with_key: | POST | `/v5/account/demo-apply-money` | +| [createDemoAccount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L764) | :closed_lock_with_key: | POST | `/v5/user/create-demo-member` | +| [getSpreadInstrumentsInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L777) | | GET | `/v5/spread/instrument` | +| [getSpreadOrderbook()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L789) | | GET | `/v5/spread/orderbook` | +| [getSpreadTickers()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L799) | | GET | `/v5/spread/tickers` | +| [getSpreadRecentTrades()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L810) | | GET | `/v5/spread/recent-trade` | +| [getSpreadMaxQty()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L822) | :closed_lock_with_key: | GET | `/v5/spread/max-qty` | +| [submitSpreadOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L831) | :closed_lock_with_key: | POST | `/v5/spread/order/create` | +| [amendSpreadOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L844) | :closed_lock_with_key: | POST | `/v5/spread/order/amend` | +| [cancelSpreadOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L856) | :closed_lock_with_key: | POST | `/v5/spread/order/cancel` | +| [cancelAllSpreadOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L874) | :closed_lock_with_key: | POST | `/v5/spread/order/cancel-all` | +| [getSpreadOpenOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L893) | :closed_lock_with_key: | GET | `/v5/spread/order/realtime` | +| [getSpreadOrderHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L910) | :closed_lock_with_key: | GET | `/v5/spread/order/history` | +| [getSpreadTradeHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L926) | :closed_lock_with_key: | GET | `/v5/spread/execution/list` | +| [getKline()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L946) | | GET | `/v5/market/kline` | +| [getMarkPriceKline()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L963) | | GET | `/v5/market/mark-price-kline` | +| [getIndexPriceKline()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L978) | | GET | `/v5/market/index-price-kline` | +| [getPremiumIndexPriceKline()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L993) | | GET | `/v5/market/premium-index-price-kline` | +| [getInstrumentsInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1009) | | GET | `/v5/market/instruments-info` | +| [getOrderbook()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1020) | | GET | `/v5/market/orderbook` | +| [getFullDepthOrderbook()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1026) | | GET | `/v5/market/full_orderbook` | +| [getRPIOrderbook()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1040) | | GET | `/v5/market/rpi_orderbook` | +| [getTickers()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1046) | | GET | `/v5/market/tickers` | +| [getFundingRateHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1084) | | GET | `/v5/market/funding/history` | +| [getPublicTradingHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1099) | | GET | `/v5/market/recent-trade` | +| [getOpenInterest()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1112) | | GET | `/v5/market/open-interest` | +| [getHistoricalVolatility()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1122) | | GET | `/v5/market/historical-volatility` | +| [getInsurance()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1133) | | GET | `/v5/market/insurance` | +| [getRiskLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1144) | | GET | `/v5/market/risk-limit` | +| [getOptionDeliveryPrice()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1159) | | GET | `/v5/market/delivery-price` | +| [getDeliveryPrice()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1172) | | GET | `/v5/market/delivery-price` | +| [getNewDeliveryPrice()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1188) | | GET | `/v5/market/new-delivery-price` | +| [getLongShortRatio()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1204) | | GET | `/v5/market/account-ratio` | +| [getIndexPriceComponents()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1214) | | GET | `/v5/market/index-price-components` | +| [getOrderPriceLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1220) | | GET | `/v5/market/price-limit` | +| [getADLAlert()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1234) | | GET | `/v5/market/adlAlert` | +| [getFeeGroupStructure()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1247) | | GET | `/v5/market/fee-group-info` | +| [getOptionBaseCoins()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1256) | | GET | `/v5/market/option-base-coins` | +| [submitOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1268) | :closed_lock_with_key: | POST | `/v5/order/create` | +| [amendOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1274) | :closed_lock_with_key: | POST | `/v5/order/amend` | +| [cancelOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1280) | :closed_lock_with_key: | POST | `/v5/order/cancel` | +| [getActiveOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1289) | :closed_lock_with_key: | GET | `/v5/order/realtime` | +| [cancelAllOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1295) | :closed_lock_with_key: | POST | `/v5/order/cancel-all` | +| [getHistoricOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1308) | :closed_lock_with_key: | GET | `/v5/order/history` | +| [getExecutionList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1320) | :closed_lock_with_key: | GET | `/v5/execution/list` | +| [batchSubmitOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1338) | :closed_lock_with_key: | POST | `/v5/order/create-batch` | +| [batchAmendOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1363) | :closed_lock_with_key: | POST | `/v5/order/amend-batch` | +| [batchCancelOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1388) | :closed_lock_with_key: | POST | `/v5/order/cancel-batch` | +| [getSpotBorrowCheck()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1410) | :closed_lock_with_key: | GET | `/v5/order/spot-borrow-check` | +| [setDisconnectCancelAllWindow()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1431) | :closed_lock_with_key: | POST | `/v5/order/disconnected-cancel-all` | +| [setDisconnectCancelAllWindowV2()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1449) | :closed_lock_with_key: | POST | `/v5/order/disconnected-cancel-all` | +| [preCheckOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1464) | :closed_lock_with_key: | POST | `/v5/order/pre-check` | +| [createStrategyOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1481) | :closed_lock_with_key: | POST | `/v5/strategy/create` | +| [getStrategyList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1492) | :closed_lock_with_key: | GET | `/v5/strategy/list` | +| [getStrategyOrderList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1503) | :closed_lock_with_key: | GET | `/v5/strategy/order-list` | +| [stopStrategy()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1514) | :closed_lock_with_key: | POST | `/v5/strategy/stop` | +| [getPositionInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1539) | :closed_lock_with_key: | GET | `/v5/position/list` | +| [getFuturesLeverage()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1551) | :closed_lock_with_key: | GET | `/v5/position/symbol-info` | +| [setLeverage()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1566) | :closed_lock_with_key: | POST | `/v5/position/set-leverage` | +| [switchIsolatedMargin()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1579) | :closed_lock_with_key: | POST | `/v5/position/switch-isolated` | +| [setTPSLMode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1593) | :closed_lock_with_key: | POST | `/v5/position/set-tpsl-mode` | +| [switchPositionMode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1608) | :closed_lock_with_key: | POST | `/v5/position/switch-mode` | +| [setRiskLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1622) | :closed_lock_with_key: | POST | `/v5/position/set-risk-limit` | +| [setTradingStop()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1637) | :closed_lock_with_key: | POST | `/v5/position/trading-stop` | +| [setAutoAddMargin()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1648) | :closed_lock_with_key: | POST | `/v5/position/set-auto-add-margin` | +| [addOrReduceMargin()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1660) | :closed_lock_with_key: | POST | `/v5/position/add-margin` | +| [getClosedPnL()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1672) | :closed_lock_with_key: | GET | `/v5/position/closed-pnl` | +| [getClosedOptionsPositions()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1686) | :closed_lock_with_key: | GET | `/v5/position/get-closed-positions` | +| [movePosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1711) | :closed_lock_with_key: | POST | `/v5/position/move-positions` | +| [getMovePositionHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1722) | :closed_lock_with_key: | GET | `/v5/position/move-history` | +| [confirmNewRiskLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1741) | :closed_lock_with_key: | POST | `/v5/position/confirm-pending-mmr` | +| [getPreUpgradeOrderHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1761) | :closed_lock_with_key: | GET | `/v5/pre-upgrade/order/history` | +| [getPreUpgradeTradeHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1776) | :closed_lock_with_key: | GET | `/v5/pre-upgrade/execution/list` | +| [getPreUpgradeClosedPnl()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1787) | :closed_lock_with_key: | GET | `/v5/pre-upgrade/position/closed-pnl` | +| [getPreUpgradeTransactions()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1801) | :closed_lock_with_key: | GET | `/v5/pre-upgrade/account/transaction-log` | +| [getPreUpgradeOptionDeliveryRecord()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1818) | :closed_lock_with_key: | GET | `/v5/pre-upgrade/asset/delivery-record` | +| [getPreUpgradeUSDCSessionSettlements()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1832) | :closed_lock_with_key: | GET | `/v5/pre-upgrade/asset/settlement-record` | +| [getWalletBalance()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1853) | :closed_lock_with_key: | GET | `/v5/account/wallet-balance` | +| [getTransferableAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1864) | :closed_lock_with_key: | GET | `/v5/account/withdrawal` | +| [getAccountInstrumentsInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1881) | :closed_lock_with_key: | GET | `/v5/account/instruments-info` | +| [upgradeToUnifiedAccount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1892) | :closed_lock_with_key: | POST | `/v5/account/upgrade-to-uta` | +| [getBorrowHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1903) | :closed_lock_with_key: | GET | `/v5/account/borrow-history` | +| [repayLiability()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1924) | :closed_lock_with_key: | POST | `/v5/account/quick-repayment` | +| [manualRepay()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1949) | :closed_lock_with_key: | POST | `/v5/account/repay` | +| [setCollateralCoin()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1958) | :closed_lock_with_key: | POST | `/v5/account/set-collateral-switch` | +| [batchSetCollateralCoin()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1964) | :closed_lock_with_key: | POST | `/v5/account/set-collateral-switch-batch` | +| [getCollateralInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1974) | :closed_lock_with_key: | GET | `/v5/account/collateral-info` | +| [getCoinGreeks()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1983) | :closed_lock_with_key: | GET | `/v5/asset/coin-greeks` | +| [getFeeRate()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L1996) | :closed_lock_with_key: | GET | `/v5/account/fee-rate` | +| [getAccountInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2005) | :closed_lock_with_key: | GET | `/v5/account/info` | +| [getDCPInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2018) | :closed_lock_with_key: | GET | `/v5/account/query-dcp-info` | +| [getTransactionLog()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2025) | :closed_lock_with_key: | GET | `/v5/account/transaction-log` | +| [getClassicTransactionLogs()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2036) | :closed_lock_with_key: | GET | `/v5/account/contract-transaction-log` | +| [getSMPGroup()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2047) | :closed_lock_with_key: | GET | `/v5/account/smp-group` | +| [setMarginMode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2060) | :closed_lock_with_key: | POST | `/v5/account/set-margin-mode` | +| [setSpotHedging()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2077) | :closed_lock_with_key: | POST | `/v5/account/set-hedging-mode` | +| [setLimitPriceAction()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2090) | :closed_lock_with_key: | POST | `/v5/account/set-limit-px-action` | +| [getLimitPriceAction()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2101) | :closed_lock_with_key: | GET | `/v5/account/user-setting-config` | +| [setDeltaNeutralMode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2109) | :closed_lock_with_key: | POST | `/v5/account/set-delta-mode` | +| [setMMP()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2118) | :closed_lock_with_key: | POST | `/v5/account/mmp-modify` | +| [resetMMP()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2125) | :closed_lock_with_key: | POST | `/v5/account/mmp-reset` | +| [getMMPState()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2132) | :closed_lock_with_key: | GET | `/v5/account/mmp-state` | +| [getOptionAssetInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2142) | :closed_lock_with_key: | GET | `/v5/account/option-asset-info` | +| [getPayInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2152) | :closed_lock_with_key: | GET | `/v5/account/pay-info` | +| [getTradeInfoForAnalysis()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2162) | :closed_lock_with_key: | GET | `/v5/account/trade-info-for-analysis` | +| [getAssetOverview()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2182) | :closed_lock_with_key: | GET | `/v5/asset/asset-overview` | +| [getPortfolioMarginInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2192) | :closed_lock_with_key: | GET | `/v5/asset/portfolio-margin` | +| [getTotalMembersAssets()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2202) | :closed_lock_with_key: | GET | `/v5/asset/total-members-assets` | +| [getFundingAccountTransactionHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2214) | :closed_lock_with_key: | GET | `/v5/asset/fundinghistory` | +| [getDeliveryRecord()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2230) | :closed_lock_with_key: | GET | `/v5/asset/delivery-record` | +| [getSettlementRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2241) | :closed_lock_with_key: | GET | `/v5/asset/settlement-record` | +| [getCoinExchangeRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2254) | :closed_lock_with_key: | GET | `/v5/asset/exchange/order-record` | +| [getCoinInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2269) | :closed_lock_with_key: | GET | `/v5/asset/coin/query-info` | +| [getSubUID()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2283) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-sub-member-list` | +| [getAssetInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2298) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-asset-info` | +| [getAllCoinsBalance()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2309) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-account-coins-balance` | +| [getCoinBalance()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2323) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-account-coin-balance` | +| [getWithdrawableAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2337) | :closed_lock_with_key: | GET | `/v5/asset/withdraw/withdrawable-amount` | +| [getTransferableCoinList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2346) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-transfer-coin-list` | +| [createInternalTransfer()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2362) | :closed_lock_with_key: | POST | `/v5/asset/transfer/inter-transfer` | +| [getInternalTransferRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2381) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-inter-transfer-list` | +| [enableUniversalTransferForSubUIDs()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2401) | :closed_lock_with_key: | POST | `/v5/asset/transfer/save-transfer-sub-member` | +| [createUniversalTransfer()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2412) | :closed_lock_with_key: | POST | `/v5/asset/transfer/universal-transfer` | +| [getUniversalTransferRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2424) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-universal-transfer-list` | +| [getAllowedDepositCoinInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2437) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-allowed-list` | +| [setDepositAccount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2452) | :closed_lock_with_key: | POST | `/v5/asset/deposit/deposit-to-account` | +| [getDepositRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2468) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-record` | +| [getSubAccountDepositRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2483) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-sub-member-record` | +| [getInternalDepositRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2499) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-internal-record` | +| [getMasterDepositAddress()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2511) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-address` | +| [getSubDepositAddress()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2529) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-sub-member-address` | +| [querySubMemberAddress()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2554) | :closed_lock_with_key: | GET | `/v5/asset/deposit/query-sub-member-address` | +| [getWithdrawalRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2574) | :closed_lock_with_key: | GET | `/v5/asset/withdraw/query-record` | +| [getWithdrawalAddressList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2586) | :closed_lock_with_key: | GET | `/v5/asset/withdraw/query-address` | +| [getExchangeEntities()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2600) | :closed_lock_with_key: | GET | `/v5/asset/withdraw/vasp/list` | +| [submitDepositOriginatorInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2610) | :closed_lock_with_key: | POST | `/v5/asset/travel-rule/deposit/submit` | +| [submitWithdrawal()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2625) | :closed_lock_with_key: | POST | `/v5/asset/withdraw/create` | +| [cancelWithdrawal()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2636) | :closed_lock_with_key: | POST | `/v5/asset/withdraw/cancel` | +| [getConvertCoins()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2645) | :closed_lock_with_key: | GET | `/v5/asset/exchange/query-coin-list` | +| [requestConvertQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2656) | :closed_lock_with_key: | POST | `/v5/asset/exchange/quote-apply` | +| [confirmConvertQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2665) | :closed_lock_with_key: | POST | `/v5/asset/exchange/convert-execute` | +| [getConvertStatus()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2677) | :closed_lock_with_key: | GET | `/v5/asset/exchange/convert-result-query` | +| [getConvertHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2696) | :closed_lock_with_key: | GET | `/v5/asset/exchange/query-convert-history` | +| [getSmallBalanceList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2713) | :closed_lock_with_key: | GET | `/v5/asset/covert/small-balance-list` | +| [getFiatTradingPairList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2727) | :closed_lock_with_key: | GET | `/v5/fiat/query-coin-list` | +| [createSubMember()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2745) | :closed_lock_with_key: | POST | `/v5/user/create-sub-member` | +| [createSubUIDAPIKey()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2757) | :closed_lock_with_key: | POST | `/v5/user/create-sub-api` | +| [getSubUIDList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2766) | :closed_lock_with_key: | GET | `/v5/user/query-sub-members` | +| [getSubUIDListUnlimited()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2775) | :closed_lock_with_key: | GET | `/v5/user/submembers` | +| [setSubUIDFrozenState()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2793) | :closed_lock_with_key: | POST | `/v5/user/frozen-sub-member` | +| [getQueryApiKey()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2808) | :closed_lock_with_key: | GET | `/v5/user/query-api` | +| [getSubAccountAllApiKeys()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2815) | :closed_lock_with_key: | GET | `/v5/user/sub-apikeys` | +| [getUIDWalletType()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2824) | :closed_lock_with_key: | GET | `/v5/user/get-member-type` | +| [updateMasterApiKey()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2843) | :closed_lock_with_key: | POST | `/v5/user/update-api` | +| [updateSubApiKey()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2857) | :closed_lock_with_key: | POST | `/v5/user/update-sub-api` | +| [deleteSubMember()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2870) | :closed_lock_with_key: | POST | `/v5/user/del-submember` | +| [deleteMasterApiKey()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2885) | :closed_lock_with_key: | POST | `/v5/user/delete-api` | +| [deleteSubApiKey()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2899) | :closed_lock_with_key: | POST | `/v5/user/delete-sub-api` | +| [createTaxBatchExport()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2914) | :closed_lock_with_key: | POST | `/v5/fht/compliance/tax/private/batch_create` | +| [getTaxBatchExport()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2926) | :closed_lock_with_key: | GET | `/v5/fht/compliance/tax/private/batch_query` | +| [getAffiliateUserList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2949) | :closed_lock_with_key: | GET | `/v5/affiliate/aff-user-list` | +| [getAffiliateSubAffiliateList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2967) | :closed_lock_with_key: | GET | `/v5/affiliate/affiliate-sub-list` | +| [getAffiliateUserInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2983) | :closed_lock_with_key: | GET | `/v5/user/aff-customer-info` | +| [getFriendReferrals()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L2995) | :closed_lock_with_key: | GET | `/v5/user/invitation/referrals` | +| [getReferralCode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3004) | :closed_lock_with_key: | GET | `/v5/user/invitation/code` | +| [signAgreement()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3020) | :closed_lock_with_key: | POST | `/v5/user/agreement` | +| [getAlphaTradeQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3037) | :closed_lock_with_key: | POST | `/v5/alpha/trade/quote` | +| [executeAlphaTradePurchase()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3048) | :closed_lock_with_key: | POST | `/v5/alpha/trade/purchase` | +| [executeAlphaTradeRedeem()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3059) | :closed_lock_with_key: | POST | `/v5/alpha/trade/redeem` | +| [getAlphaPayTokenList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3069) | :closed_lock_with_key: | POST | `/v5/alpha/trade/pay-token-list` | +| [getAlphaTradeOrderList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3079) | :closed_lock_with_key: | POST | `/v5/alpha/trade/order-list` | +| [getAlphaBizTokenList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3089) | :closed_lock_with_key: | POST | `/v5/alpha/trade/biz-token-list` | +| [getAlphaBizTokenPriceList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3099) | :closed_lock_with_key: | POST | `/v5/alpha/trade/biz-token-price-list` | +| [getAlphaBizTokenDetails()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3109) | :closed_lock_with_key: | POST | `/v5/alpha/trade/biz-token-details` | +| [getAlphaAssetList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3119) | :closed_lock_with_key: | POST | `/v5/alpha/trade/asset-list` | +| [getAlphaAssetDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3127) | :closed_lock_with_key: | POST | `/v5/alpha/trade/asset-detail` | +| [getAlphaPredictionEngineStatus()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3143) | :closed_lock_with_key: | GET | `/v5/alpha/prediction/engine-status` | +| [getAlphaPredictionPayTokenList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3153) | :closed_lock_with_key: | GET | `/v5/alpha/prediction/pay-token-list` | +| [getAlphaPredictionEventDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3163) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/event-detail` | +| [getAlphaPredictionOrderEstimate()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3173) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/order-estimate` | +| [executeAlphaPredictionBuy()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3183) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/buy` | +| [executeAlphaPredictionSell()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3193) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/sell` | +| [getAlphaPredictionOrderList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3203) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/order-list` | +| [getAlphaPredictionOrderBook()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3213) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/order-book` | +| [getAlphaPredictionTokenPrice()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3223) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/token-price` | +| [getAlphaPredictionPriceHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3233) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/price-history` | +| [getAlphaPredictionPositionList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3243) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/position-list` | +| [getAlphaPredictionPositionHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3253) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/position-history` | +| [getAlphaPredictionPortfolioSummary()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3263) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/portfolio-summary` | +| [getAlphaPredictionSideMarketList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3273) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/side-market-list` | +| [getAlphaPredictionSportsMatchList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3283) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/sports/match-list` | +| [getAlphaPredictionSportsTimelineStages()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3293) | :closed_lock_with_key: | GET | `/v5/alpha/prediction/sports/timeline-stages` | +| [getAlphaPredictionSportsGroupStageDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3306) | :closed_lock_with_key: | POST | `/v5/alpha/prediction/sports/group-stage-detail` | +| [getAlphaLPPoolList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3325) | :closed_lock_with_key: | POST | `/v5/alpha/lp/pool-list` | +| [getAlphaLPPoolInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3335) | :closed_lock_with_key: | POST | `/v5/alpha/lp/pool-info` | +| [executeAlphaLPStake()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3345) | :closed_lock_with_key: | POST | `/v5/alpha/lp/stake` | +| [executeAlphaLPRedeem()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3355) | :closed_lock_with_key: | POST | `/v5/alpha/lp/redeem` | +| [getAlphaLPOrderList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3365) | :closed_lock_with_key: | POST | `/v5/alpha/lp/order-list` | +| [getAlphaLPPayTokenList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3375) | :closed_lock_with_key: | POST | `/v5/alpha/lp/pay-token-list` | +| [getAlphaLPPayTokenPrice()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3385) | :closed_lock_with_key: | POST | `/v5/alpha/lp/pay-token-price` | +| [getAlphaLPPositionList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3395) | :closed_lock_with_key: | POST | `/v5/alpha/lp/position-list` | +| [getVIPMarginData()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3415) | | GET | `/v5/spot-margin-trade/data` | +| [getHistoricalInterestRate()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3426) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/interest-rate-history` | +| [getSpotMarginCurrencyData()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3451) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/currency-data` | +| [toggleSpotMarginTrade()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3463) | :closed_lock_with_key: | POST | `/v5/spot-margin-trade/switch-mode` | +| [setSpotMarginLeverage()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3474) | :closed_lock_with_key: | POST | `/v5/spot-margin-trade/set-leverage` | +| [setSpotMarginLeverageV2()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3482) | :closed_lock_with_key: | POST | `/v5/spot-margin-trade/set-leverage` | +| [getSpotMarginState()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3493) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/state` | +| [manualBorrow()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3500) | :closed_lock_with_key: | POST | `/v5/account/borrow` | +| [getMaxBorrowableAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3509) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/max-borrowable` | +| [getPositionTiers()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3518) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/position-tiers` | +| [getCoinState()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3529) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/coinstate` | +| [getAvailableAmountToRepay()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3540) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/repayment-available-amount` | +| [manualRepayWithoutConversion()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3559) | :closed_lock_with_key: | POST | `/v5/account/no-convert-repay` | +| [getAutoRepayMode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3572) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/get-auto-repay-mode` | +| [setAutoRepayMode()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3588) | :closed_lock_with_key: | POST | `/v5/spot-margin-trade/set-auto-repay-mode` | +| [getSpotMarginLiability()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3600) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/liability` | +| [submitFixedRateBorrow()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3609) | :closed_lock_with_key: | POST | `/v5/spot-margin-trade/fixedborrow` | +| [getFixedRateBorrowOrderInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3618) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/fixedborrow-order-info` | +| [getFixedRateBorrowContractInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3635) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/fixedborrow-contract-info` | +| [getFixedRateBorrowOrderQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3652) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/fixedborrow-order-quote` | +| [renewFixedRateBorrow()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3664) | :closed_lock_with_key: | POST | `/v5/spot-margin-trade/fixedborrow-renew` | +| [getFlexibleAvailableInventory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3670) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/flexible-available-inventory` | +| [getFixedRateAvailableInventory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3679) | :closed_lock_with_key: | GET | `/v5/spot-margin-trade/fixed-available-inventory` | +| [getSpotMarginCoinInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3697) | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/pledge-token` | +| [getSpotMarginBorrowableCoinInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3714) | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/borrow-token` | +| [getSpotMarginInterestAndQuota()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3731) | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/loan-info` | +| [getSpotMarginLoanAccountInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3749) | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/account` | +| [spotMarginBorrow()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3773) | :closed_lock_with_key: | POST | `/v5/spot-cross-margin-trade/loan` | +| [spotMarginRepay()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3784) | :closed_lock_with_key: | POST | `/v5/spot-cross-margin-trade/repay` | +| [getSpotMarginBorrowOrderDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3799) | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/orders` | +| [getSpotMarginRepaymentOrderDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3828) | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/repay-history` | +| [toggleSpotCrossMarginTrade()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3857) | :closed_lock_with_key: | POST | `/v5/spot-cross-margin-trade/switch` | +| [getCollateralCoins()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3877) | | GET | `/v5/crypto-loan/collateral-data` | +| [getBorrowableCoins()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3894) | | GET | `/v5/crypto-loan/loanable-data` | +| [getAccountBorrowCollateralLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3912) | :closed_lock_with_key: | GET | `/v5/crypto-loan/borrowable-collateralisable-number` | +| [borrowCryptoLoan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3932) | :closed_lock_with_key: | POST | `/v5/crypto-loan/borrow` | +| [repayCryptoLoan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3953) | :closed_lock_with_key: | POST | `/v5/crypto-loan/repay` | +| [getUnpaidLoanOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3969) | :closed_lock_with_key: | GET | `/v5/crypto-loan/ongoing-orders` | +| [getRepaymentHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L3990) | :closed_lock_with_key: | GET | `/v5/crypto-loan/repayment-history` | +| [getCompletedLoanOrderHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4010) | :closed_lock_with_key: | GET | `/v5/crypto-loan/borrow-history` | +| [getMaxAllowedReductionCollateralAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4029) | :closed_lock_with_key: | GET | `/v5/crypto-loan/max-collateral-amount` | +| [adjustCollateralAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4048) | :closed_lock_with_key: | POST | `/v5/crypto-loan/adjust-ltv` | +| [getLoanLTVAdjustmentHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4072) | :closed_lock_with_key: | GET | `/v5/crypto-loan/adjustment-history` | +| [getLoanBorrowableCoins()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4093) | | GET | `/v5/crypto-loan-common/loanable-data` | +| [getLoanCollateralCoins()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4105) | | GET | `/v5/crypto-loan-common/collateral-data` | +| [getMaxCollateralAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4115) | :closed_lock_with_key: | GET | `/v5/crypto-loan-common/max-collateral-amount` | +| [getMaxLoanAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4134) | :closed_lock_with_key: | POST | `/v5/crypto-loan-common/max-loan` | +| [updateCollateralAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4144) | :closed_lock_with_key: | POST | `/v5/crypto-loan-common/adjust-ltv` | +| [getCollateralAdjustmentHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4155) | :closed_lock_with_key: | GET | `/v5/crypto-loan-common/adjustment-history` | +| [getCryptoLoanPosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4170) | :closed_lock_with_key: | GET | `/v5/crypto-loan-common/position` | +| [borrowFlexible()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4187) | :closed_lock_with_key: | POST | `/v5/crypto-loan-flexible/borrow` | +| [repayFlexible()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4198) | :closed_lock_with_key: | POST | `/v5/crypto-loan-flexible/repay` | +| [repayCollateralFlexible()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4208) | :closed_lock_with_key: | POST | `/v5/crypto-loan-flexible/repay-collateral` | +| [getOngoingFlexibleLoans()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4222) | :closed_lock_with_key: | GET | `/v5/crypto-loan-flexible/ongoing-coin` | +| [getBorrowHistoryFlexible()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4234) | :closed_lock_with_key: | GET | `/v5/crypto-loan-flexible/borrow-history` | +| [getRepaymentHistoryFlexible()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4247) | :closed_lock_with_key: | GET | `/v5/crypto-loan-flexible/repayment-history` | +| [getFlexibleLoanAvailableInventory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4261) | :closed_lock_with_key: | GET | `/v5/crypto-loan-flexible/available-inventory` | +| [getSupplyOrderQuoteFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4281) | | GET | `/v5/crypto-loan-fixed/supply-order-quote` | +| [getBorrowOrderQuoteFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4294) | | GET | `/v5/crypto-loan-fixed/borrow-order-quote` | +| [createBorrowOrderFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4307) | :closed_lock_with_key: | POST | `/v5/crypto-loan-fixed/borrow` | +| [createSupplyOrderFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4320) | :closed_lock_with_key: | POST | `/v5/crypto-loan-fixed/supply` | +| [cancelBorrowOrderFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4330) | :closed_lock_with_key: | POST | `/v5/crypto-loan-fixed/borrow-order-cancel` | +| [cancelSupplyOrderFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4344) | :closed_lock_with_key: | POST | `/v5/crypto-loan-fixed/supply-order-cancel` | +| [getBorrowContractInfoFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4357) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/borrow-contract-info` | +| [getSupplyContractInfoFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4375) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/supply-contract-info` | +| [getBorrowOrderInfoFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4393) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/borrow-order-info` | +| [getSupplyOrderInfoFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4406) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/supply-order-info` | +| [repayFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4420) | :closed_lock_with_key: | POST | `/v5/crypto-loan-fixed/fully-repay` | +| [repayCollateralFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4431) | :closed_lock_with_key: | POST | `/v5/crypto-loan-flexible/repay-collateral` | +| [getRepaymentHistoryFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4444) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/repayment-history` | +| [renewBorrowOrderFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4461) | :closed_lock_with_key: | POST | `/v5/crypto-loan-fixed/renew` | +| [getRenewOrderInfoFixed()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4474) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/renew-info` | +| [getFixedLoanAvailableInventory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4483) | :closed_lock_with_key: | GET | `/v5/crypto-loan-fixed/available-inventory` | +| [getInstitutionalLendingProductInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4498) | | GET | `/v5/ins-loan/product-infos` | +| [getInstitutionalLendingCoinDeltaAmount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4510) | :closed_lock_with_key: | GET | `/v5/ins-loan/coin-delta-amount` | +| [getInstitutionalLendingDelayLiquidationStatus()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4519) | :closed_lock_with_key: | GET | `/v5/ins-loan/delay-liq-status` | +| [getInstitutionalLendingMarginCoinInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4529) | | GET | `/v5/ins-loan/ensure-tokens` | +| [getInstitutionalLendingMarginCoinInfoWithConversionRate()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4538) | | GET | `/v5/ins-loan/ensure-tokens-convert` | +| [getInstitutionalLendingLoanOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4547) | :closed_lock_with_key: | GET | `/v5/ins-loan/loan-order` | +| [getInstitutionalLendingRepayOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4559) | :closed_lock_with_key: | GET | `/v5/ins-loan/repaid-history` | +| [getInstitutionalLendingLTV()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4571) | :closed_lock_with_key: | GET | `/v5/ins-loan/ltv` | +| [getInstitutionalLendingLTVWithLadderConversionRate()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4580) | :closed_lock_with_key: | GET | `/v5/ins-loan/ltv-convert` | +| [bindOrUnbindUID()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4595) | :closed_lock_with_key: | POST | `/v5/ins-loan/association-uid` | +| [repayInstitutionalLoan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4615) | :closed_lock_with_key: | POST | `/v5/ins-loan/repay-loan` | +| [getExchangeBrokerEarnings()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4636) | :closed_lock_with_key: | GET | `/v5/broker/earnings-info` | +| [getExchangeBrokerAccountInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4649) | :closed_lock_with_key: | GET | `/v5/broker/account-info` | +| [getBrokerSubAccountDeposits()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4665) | :closed_lock_with_key: | GET | `/v5/broker/asset/query-sub-member-deposit-record` | +| [getBrokerVoucherSpec()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4680) | :closed_lock_with_key: | POST | `/v5/broker/award/info` | +| [issueBrokerVoucher()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4692) | :closed_lock_with_key: | POST | `/v5/broker/award/distribute-award` | +| [getBrokerIssuedVoucher()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4704) | :closed_lock_with_key: | POST | `/v5/broker/award/distribution-record` | +| [setBrokerRateLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4721) | :closed_lock_with_key: | POST | `/v5/broker/apilimit/set` | +| [getBrokerRateLimitCap()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4740) | :closed_lock_with_key: | GET | `/v5/broker/apilimit/query-cap` | +| [getAllBrokerRateLimits()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4758) | :closed_lock_with_key: | GET | `/v5/broker/apilimit/query-all` | +| [getEarnProduct()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4778) | | GET | `/v5/earn/product` | +| [getFlexibleSavingAutoSavings()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4789) | :closed_lock_with_key: | GET | `/v5/earn/flexible-saving/auto-savings` | +| [setFlexibleSavingAutoSavings()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4800) | :closed_lock_with_key: | POST | `/v5/earn/flexible-saving/auto-savings` | +| [getEarnCouponList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4810) | :closed_lock_with_key: | GET | `/v5/earn/coupons` | +| [getRWAProductList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4820) | | GET | `/v5/earn/rwa/product` | +| [placeRWAOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4830) | :closed_lock_with_key: | POST | `/v5/earn/rwa/place-order` | +| [getRWAPositionList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4839) | :closed_lock_with_key: | GET | `/v5/earn/rwa/position` | +| [getRWAOrderList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4848) | :closed_lock_with_key: | GET | `/v5/earn/rwa/order` | +| [getRWANavChart()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4858) | | GET | `/v5/earn/rwa/nav-chart` | +| [getHoldToEarnAirdropProducts()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4869) | | GET | `/v5/earn/hold-to-earn/product` | +| [getAdvanceEarnProduct()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4880) | | GET | `/v5/earn/advance/product` | +| [getLiquidityMiningProduct()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4891) | | GET | `/v5/earn/liquidity-mining/product` | +| [reinvestLiquidityMining()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4904) | :closed_lock_with_key: | POST | `/v5/earn/liquidity-mining/reinvest` | +| [getFixedTermEarnProduct()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4915) | | GET | `/v5/earn/fixed-term/product` | +| [getAdvanceEarnProductExtraInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4927) | | GET | `/v5/earn/advance/product-extra-info` | +| [submitAdvanceEarnPlaceOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4938) | :closed_lock_with_key: | POST | `/v5/earn/advance/place-order` | +| [getAdvanceEarnPosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4949) | :closed_lock_with_key: | GET | `/v5/earn/advance/position` | +| [getAdvanceEarnOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4960) | :closed_lock_with_key: | GET | `/v5/earn/advance/order` | +| [submitFixedTermEarnOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4971) | :closed_lock_with_key: | POST | `/v5/earn/fixed-term/place-order` | +| [redeemFixedTermEarn()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4982) | :closed_lock_with_key: | POST | `/v5/earn/fixed-term/redeem` | +| [getFixedTermEarnPosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L4993) | :closed_lock_with_key: | GET | `/v5/earn/fixed-term/position` | +| [getFixedTermEarnOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5004) | :closed_lock_with_key: | GET | `/v5/earn/fixed-term/order` | +| [setFixedTermEarnAutoInvest()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5015) | :closed_lock_with_key: | POST | `/v5/earn/fixed-term/position/auto-invest` | +| [submitStakeRedeem()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5031) | :closed_lock_with_key: | POST | `/v5/earn/place-order` | +| [getEarnOrderHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5050) | :closed_lock_with_key: | GET | `/v5/earn/order` | +| [getEarnPosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5068) | :closed_lock_with_key: | GET | `/v5/earn/position` | +| [modifyEarnPosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5081) | :closed_lock_with_key: | POST | `/v5/earn/position/modify` | +| [getEarnYieldHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5094) | :closed_lock_with_key: | GET | `/v5/earn/yield` | +| [getHoldToEarnAirdropYieldHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5108) | :closed_lock_with_key: | GET | `/v5/earn/hold-to-earn/yield-history` | +| [getEarnHourlyYieldHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5119) | :closed_lock_with_key: | GET | `/v5/earn/hourly-yield` | +| [getEarnAprHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5133) | | GET | `/v5/earn/apr-history` | +| [getEarnTokenProduct()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5143) | | GET | `/v5/earn/token/product` | +| [submitEarnTokenOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5152) | :closed_lock_with_key: | POST | `/v5/earn/token/place-order` | +| [getEarnTokenOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5161) | :closed_lock_with_key: | GET | `/v5/earn/token/order` | +| [getEarnTokenPosition()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5173) | :closed_lock_with_key: | GET | `/v5/earn/token/position` | +| [getEarnTokenDailyYield()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5182) | :closed_lock_with_key: | GET | `/v5/earn/token/yield` | +| [getEarnTokenHourlyYield()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5194) | :closed_lock_with_key: | GET | `/v5/earn/token/hourly-yield` | +| [getEarnTokenHistoryApr()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5206) | | GET | `/v5/earn/token/history-apr` | +| [getPwmInvestmentPlanList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5221) | :closed_lock_with_key: | GET | `/v5/earn/pwm/investment-plan/list` | +| [getPwmInvestmentPlanDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5230) | :closed_lock_with_key: | GET | `/v5/earn/pwm/investment-plan/detail` | +| [getPwmPendingInvestmentPlanDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5239) | :closed_lock_with_key: | GET | `/v5/earn/pwm/investment-plan/new-plan` | +| [claimPwmWithdrawableFunds()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5248) | :closed_lock_with_key: | POST | `/v5/earn/pwm/investment-plan/claim` | +| [getPwmInvestmentPlanAssetTrend()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5257) | :closed_lock_with_key: | GET | `/v5/earn/pwm/investment-plan/asset-trend` | +| [getPwmFundHistoricalNav()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5266) | :closed_lock_with_key: | GET | `/v5/earn/pwm/investment-plan/fund-nav` | +| [subscribePwmInvestmentPlan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5275) | :closed_lock_with_key: | POST | `/v5/earn/pwm/investment-plan/subscribe` | +| [investMorePwmInvestmentPlan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5284) | :closed_lock_with_key: | POST | `/v5/earn/pwm/investment-plan/invest-more` | +| [redeemPwmInvestmentPlan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5293) | :closed_lock_with_key: | POST | `/v5/earn/pwm/investment-plan/redeem` | +| [getPwmInvestmentPlanOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5302) | :closed_lock_with_key: | GET | `/v5/earn/pwm/investment-plan/order` | +| [getPwmSubscribableProductInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5311) | | GET | `/v5/earn/pwm/customize-plan/product` | +| [createPwmCustomizeInvestmentPlan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5320) | :closed_lock_with_key: | POST | `/v5/earn/pwm/customize-plan/create` | +| [getPwmAllFunds()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5335) | :closed_lock_with_key: | GET | `/v5/earn/pwm/asset-manager/all-funds` | +| [settlePwmFundProfit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5344) | :closed_lock_with_key: | POST | `/v5/earn/pwm/asset-manager/settle-profit` | +| [createPwmFund()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5353) | :closed_lock_with_key: | POST | `/v5/earn/pwm/asset-manager/create-fund` | +| [createPwmAssetManagerInvestmentPlan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5362) | :closed_lock_with_key: | POST | `/v5/earn/pwm/asset-manager/create-investment-plan` | +| [getPwmAssetManagerInvestmentPlans()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5376) | :closed_lock_with_key: | GET | `/v5/earn/pwm/asset-manager/get-investment-plan` | +| [managePwmAssetManagerInvestmentPlan()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5388) | :closed_lock_with_key: | POST | `/v5/earn/pwm/asset-manager/manage-investment-plan` | +| [getPwmAllFundOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5402) | :closed_lock_with_key: | GET | `/v5/earn/pwm/asset-manager/all-order` | +| [managePwmFundOrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5411) | :closed_lock_with_key: | POST | `/v5/earn/pwm/asset-manager/manage-order` | +| [createPwmFundSubAccount()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5420) | :closed_lock_with_key: | POST | `/v5/earn/pwm/asset-manager/create-sub-account` | +| [pwmFundTransfer()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5432) | :closed_lock_with_key: | POST | `/v5/earn/pwm/fund-transfer` | +| [getPwmFundTransferRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5441) | :closed_lock_with_key: | GET | `/v5/earn/pwm/query-fund-transfer-result` | +| [queryCardAssetRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5456) | :closed_lock_with_key: | POST | `/v5/card/transaction/query-asset-records` | +| [queryCardPointsBalance()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5465) | :closed_lock_with_key: | POST | `/v5/card/reward/points/balance` | +| [queryCardPointsRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5472) | :closed_lock_with_key: | POST | `/v5/card/reward/points/records` | +| [queryCardPointsTier()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5481) | :closed_lock_with_key: | POST | `/v5/card/reward/points/tier` | +| [queryCardMallItemList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5488) | :closed_lock_with_key: | POST | `/v5/card/reward/mall/item/list` | +| [queryCardPointCashbackDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5497) | :closed_lock_with_key: | POST | `/v5/card/reward/point/cashback/detail` | +| [createRFQ()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5513) | :closed_lock_with_key: | POST | `/v5/rfq/create-rfq` | +| [getRFQConfig()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5524) | :closed_lock_with_key: | GET | `/v5/rfq/config` | +| [cancelRFQ()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5533) | :closed_lock_with_key: | POST | `/v5/rfq/cancel-rfq` | +| [cancelAllRFQ()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5543) | :closed_lock_with_key: | POST | `/v5/rfq/cancel-all-rfq` | +| [createRFQQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5552) | :closed_lock_with_key: | POST | `/v5/rfq/create-quote` | +| [executeRFQQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5563) | :closed_lock_with_key: | POST | `/v5/rfq/execute-quote` | +| [cancelRFQQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5574) | :closed_lock_with_key: | POST | `/v5/rfq/cancel-quote` | +| [cancelAllRFQQuotes()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5584) | :closed_lock_with_key: | POST | `/v5/rfq/cancel-all-quotes` | +| [getRFQRealtimeInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5598) | :closed_lock_with_key: | GET | `/v5/rfq/rfq-realtime` | +| [getRFQHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5610) | :closed_lock_with_key: | GET | `/v5/rfq/rfq-list` | +| [getRFQRealtimeQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5624) | :closed_lock_with_key: | GET | `/v5/rfq/quote-realtime` | +| [getRFQHistoryQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5639) | :closed_lock_with_key: | GET | `/v5/rfq/quote-list` | +| [getRFQTrades()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5652) | :closed_lock_with_key: | GET | `/v5/rfq/trade-list` | +| [getRFQPublicTrades()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5665) | :closed_lock_with_key: | GET | `/v5/rfq/public-trades` | +| [acceptNonLPQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5681) | :closed_lock_with_key: | POST | `/v5/rfq/accept-other-quote` | +| [getRFQDetails()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5687) | :closed_lock_with_key: | GET | `/v5/rfq/rfq-detail-list` | +| [getP2PAccountCoinsBalance()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5712) | :closed_lock_with_key: | GET | `/v5/asset/transfer/query-account-coins-balance` | +| [getP2POnlineAds()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5729) | :closed_lock_with_key: | POST | `/v5/p2p/item/online` | +| [createP2PAd()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5738) | :closed_lock_with_key: | POST | `/v5/p2p/item/create` | +| [cancelP2PAd()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5747) | :closed_lock_with_key: | POST | `/v5/p2p/item/cancel` | +| [updateP2PAd()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5761) | :closed_lock_with_key: | POST | `/v5/p2p/item/update` | +| [getP2PPersonalAds()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5771) | :closed_lock_with_key: | POST | `/v5/p2p/item/personal/list` | +| [getP2PAdDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5780) | :closed_lock_with_key: | POST | `/v5/p2p/item/info` | +| [getP2POrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5795) | :closed_lock_with_key: | POST | `/v5/p2p/order/simplifyList` | +| [getP2POrderDetail()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5805) | :closed_lock_with_key: | POST | `/v5/p2p/order/info` | +| [getP2PPendingOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5814) | :closed_lock_with_key: | POST | `/v5/p2p/order/pending/simplifyList` | +| [markP2POrderAsPaid()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5823) | :closed_lock_with_key: | POST | `/v5/p2p/order/pay` | +| [releaseP2POrder()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5832) | :closed_lock_with_key: | POST | `/v5/p2p/order/finish` | +| [reviewP2PSellerCancelOrderApply()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5844) | :closed_lock_with_key: | POST | `/v5/p2p/order/buyer/examine/sellerCancelOrderApply` | +| [sendP2POrderMessage()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5856) | :closed_lock_with_key: | POST | `/v5/p2p/order/message/send` | +| [getP2PChatSessions()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5871) | :closed_lock_with_key: | POST | `/v5/p2p/chat/session/list_v1` | +| [getP2PChatSessionId()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5881) | :closed_lock_with_key: | POST | `/v5/p2p/chat/session/getSessionId` | +| [sendP2PChatMessage()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5917) | :closed_lock_with_key: | POST | `/v5/p2p/chat/message/send_v1` | +| [getP2PChatMessages()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5929) | :closed_lock_with_key: | POST | `/v5/p2p/chat/message/listpage_v1` | +| [getP2POrderMessages()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5938) | :closed_lock_with_key: | POST | `/v5/p2p/order/message/listpage` | +| [getP2PUserInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5952) | :closed_lock_with_key: | POST | `/v5/p2p/user/personal/info` | +| [getP2PCounterpartyUserInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5959) | :closed_lock_with_key: | POST | `/v5/p2p/user/order/personal/info` | +| [getP2PUserPayments()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5968) | :closed_lock_with_key: | POST | `/v5/p2p/user/payment/list` | +| [setApiRateLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L5988) | :closed_lock_with_key: | POST | `/v5/apilimit/set` | +| [queryApiRateLimit()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6017) | :closed_lock_with_key: | GET | `/v5/apilimit/query` | +| [getRateLimitCap()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6036) | :closed_lock_with_key: | GET | `/v5/apilimit/query-cap` | +| [getAllRateLimits()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6055) | :closed_lock_with_key: | GET | `/v5/apilimit/query-all` | +| [getLaunchpoolProjectList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6078) | | GET | `/v5/spot-x/launchpool/project/list` | +| [getLaunchpoolUserActivityLog()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6084) | :closed_lock_with_key: | POST | `/v5/spot-x/launchpool/user/activity-log` | +| [getLaunchpoolCurrentStaking()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6090) | :closed_lock_with_key: | GET | `/v5/spot-x/launchpool/user/current-staking` | +| [getLaunchpoolUserHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6096) | :closed_lock_with_key: | POST | `/v5/spot-x/launchpool/user/history` | +| [getPuzzleProjectList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6102) | | GET | `/v5/spot-x/puzzle/project/list` | +| [getTokenSplashProjectList()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6108) | | GET | `/v5/spot-x/token-splash/project/list` | +| [getTokenSplashUserActivityParams()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6114) | :closed_lock_with_key: | GET | `/v5/spot-x/token-splash/user/activity-params` | +| [getEventInstrumentsInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6137) | | GET | `/v5/event/instruments-info` | +| [getEventOrderbook()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6148) | | GET | `/v5/event/orderbook` | +| [getEventOrderHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6159) | :closed_lock_with_key: | GET | `/v5/event/order-list` | +| [getEventActiveOrders()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6170) | :closed_lock_with_key: | GET | `/v5/event/order-realtime` | +| [getEventPositionInfo()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6181) | :closed_lock_with_key: | GET | `/v5/event/positions` | +| [getEventTradeHistory()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6192) | :closed_lock_with_key: | GET | `/v5/event/trades` | +| [getEventSettlementRecords()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6203) | :closed_lock_with_key: | GET | `/v5/event/settlements` | +| [submitEventQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6214) | :closed_lock_with_key: | POST | `/v5/event/quotes` | +| [cancelEventQuote()](https://github.com/sieblyio/bybit-api/blob/master/src/rest-client-v5.ts#L6225) | :closed_lock_with_key: | POST | `/v5/event/cancel` | # websocket-api-client.ts diff --git a/examples/apidoc/V5/P2P/review-seller-cancel-order-apply.js b/examples/apidoc/V5/P2P/review-seller-cancel-order-apply.js new file mode 100644 index 00000000..6a8a0a4b --- /dev/null +++ b/examples/apidoc/V5/P2P/review-seller-cancel-order-apply.js @@ -0,0 +1,23 @@ +import { RestClientV5 } from 'bybit-api'; + +// https://bybit-exchange.github.io/docs/p2p/order/review-seller-cancel-order-apply +const client = new RestClientV5({ + testnet: true, + key: 'YOUR_API_KEY', + secret: 'YOUR_API_SECRET', +}); + +client + .reviewP2PSellerCancelOrderApply({ + orderId: '1899736339155943424', + examineResult: 'REJECT', + rejectReason: 'buyerRefuseOrderCancelReason_haveMadePayment', + rejectProofs: 'https://example.com/proof.jpg', + rejectRemark: 'Payment was already sent.', + }) + .then((response) => { + console.log('Response:', response); + }) + .catch((error) => { + console.error('Error:', error); + }); diff --git a/llms.txt b/llms.txt index 7b9395ce..ab69f368 100644 --- a/llms.txt +++ b/llms.txt @@ -2273,50 +2273,6 @@ export interface GetPreUpgradeUSDCSessionParamsV5 { cursor?: string; } -================ -File: src/types/request/v5-tax.ts -================ -export type TaxReportTypeV5 = - | 'ALL' - | 'TRADE' - | 'P&L' - | 'EARN' - | 'DEPOSIT&WITHDRAWAL' - | 'BONUS' - | 'AIRDROP' - | 'CARD'; -⋮---- -export interface TaxBatchExportItemV5 { - type: TaxReportTypeV5; - /** Subcategory number. Required but ignored when type is ALL; pass "". */ - number: string; -} -⋮---- -/** Subcategory number. Required but ignored when type is ALL; pass "". */ -⋮---- -/** POST /v5/fht/compliance/tax/private/batch_create */ -export interface CreateTaxBatchExportParamsV5 { - /** UNIX seconds. Must be within the last 18 months. */ - startTime: number; - /** UNIX seconds. Later than startTime, span at most 12 months. */ - endTime: number; - items: TaxBatchExportItemV5[]; - sourceInstitution?: string; - /** orc is the default when omitted */ - exportFileType?: 'orc' | 'csv'; -} -⋮---- -/** UNIX seconds. Must be within the last 18 months. */ -⋮---- -/** UNIX seconds. Later than startTime, span at most 12 months. */ -⋮---- -/** orc is the default when omitted */ -⋮---- -/** GET /v5/fht/compliance/tax/private/batch_query */ -export interface GetTaxBatchExportParamsV5 { - batchId: string; -} - ================ File: src/types/response/account-asset.ts ================ @@ -2785,28 +2741,6 @@ export interface PreUpgradeUSDCSessionSettlement { createdTime: string; } -================ -File: src/types/response/v5-tax.ts -================ -export interface TaxBatchExportResultV5 { - batchId: string; -} -⋮---- -export interface TaxBatchExportTaskV5 { - type: string; - number: string; - /** 0 queued, 1 processing, 2 succeeded, -1 failed */ - status: 0 | 1 | 2 | -1; - url: string; - queryId: string; -} -⋮---- -/** 0 queued, 1 processing, 2 succeeded, -1 failed */ -⋮---- -export interface TaxBatchExportStatusV5 { - items: TaxBatchExportTaskV5[]; -} - ================ File: src/types/websockets/index.ts ================ @@ -3306,1547 +3240,1748 @@ File: index.js ================ -File: jest.config.ts +File: jsconfig.json +================ +{ + "compilerOptions": { + "target": "ES6", + "module": "commonjs" + }, + "exclude": [ + "node_modules", + "**/node_modules/*", + "coverage", + "doc", + "examples/ignored/*" + ] +} + +================ +File: LICENSE.md +================ +Copyright 2024 Tiago Siebler + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +================ +File: tsconfig.build.json +================ +{ + "extends": "./tsconfig.json", + "exclude": [ + "node_modules", + "test", + "dist", + "**/*spec.ts", + "**/*test.ts", + "jest.config.ts" + ] +} + +================ +File: tsconfig.examples.json +================ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "distExamples", + "allowJs": true + }, + "include": ["examples/**/*.ts", "examples/**/*.js"] +} + +================ +File: tsconfig.json +================ +{ + "compileOnSave": true, + "compilerOptions": { + "allowJs": true, + "target": "es6", + "module": "commonjs", + "moduleResolution": "node", + "declaration": true, + "removeComments": false, + "noEmitOnError": true, + "noImplicitAny": false, + "strictNullChecks": true, + "skipLibCheck": true, + "sourceMap": true, + "esModuleInterop": true, + "lib": ["es2017", "dom"], + "baseUrl": ".", + "outDir": "./lib" + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "**/node_modules/*", "coverage", "doc"] +} + +================ +File: tsconfig.linting.json +================ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "target": "esnext", + "rootDir": "../", + "allowJs": true + }, + "include": [ + "src/**/*.*", + "test/**/*.*", + "examples/**/*.*", + ".eslintrc.cjs", + "jest.config.ts" + ] +} + +================ +File: tsconfig.test.json +================ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./distTest", + "allowJs": true + }, + "include": ["test/**/*.ts", "test/**/*.js"] +} + +================ +File: examples/Websocket/Private/ws-private-v5.ts ================ +/* eslint-disable @typescript-eslint/no-empty-function */ +import { DefaultLogger, WebsocketClient, WS_KEY_MAP } from '../../../src'; +⋮---- +// or +// import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from 'bybit-api'; +⋮---- +// Create & inject a custom logger to enable the trace logging level (empty function) +⋮---- +// trace: (...params) => console.log('trace', ...params), +⋮---- /** - * For a detailed explanation regarding each configuration property, visit: - * https://jestjs.io/docs/configuration + * Prepare an instance of the WebSocket client. This client handles all aspects of connectivity for you: + * - Connections are opened when you subscribe to topics + * - If key & secret are provided, authentication is handled automatically + * - If you subscribe to topics from different v5 products (e.g. spot and linear perps), + * subscription events are automatically routed to the different ws endpoints on bybit's side + * - Heartbeats/ping/pong/reconnects are all handled automatically. + * If a connection drops, the client will clean it up, respawn a fresh connection and resubscribe for you. */ ⋮---- -import type { Config } from 'jest'; +// testnet: false, +// demoTrading: false, // set testnet to false, if you plan on using demo trading ⋮---- -// All imported modules in your tests should be mocked automatically -// automock: false, +// console.log('raw message received ', JSON.stringify(data, null, 2)); ⋮---- -// Stop running tests after `n` failures -// bail: 0, -bail: false, // enable to stop test when an error occur, +// wsClient.on('exception', (data) => { +// console.error('ws exception: ', data); +// }); ⋮---- -// The directory where Jest should store its cached dependency information -// cacheDirectory: "/private/var/folders/kf/2k3sz4px6c9cbyzj1h_b192h0000gn/T/jest_dx", +/** + * For private V5 topics, us the subscribeV5() method on the ws client or use the original subscribe() method. + * + * Note: for private endpoints the "category" field is ignored since there is only one private endpoint + * (compared to one public one per category). + * The "category" is only needed for public topics since bybit has one endpoint for public events per category. + */ ⋮---- -// Automatically clear mock calls, instances, contexts and results before every test +// wsClient.subscribeV5('execution.fast', 'linear'); +// wsClient.subscribeV5('execution.fast.linear', 'linear'); +// wsClient.subscribeV5('execution.fast.spot', 'spot'); +// wsClient.subscribeV5('execution.fast.option', 'option'); ⋮---- -// Indicates whether the coverage information should be collected while executing the test +/** + * The following has the same effect as above, since there's only one private endpoint for V5 account topics: + */ +// wsClient.subscribe('position'); +// wsClient.subscribe('execution'); +// wsClient.subscribe(['order', 'wallet', 'greek']); ⋮---- -// An array of glob patterns indicating a set of files for which coverage information should be collected +// To unsubscribe from topics (after a 5 second delay, in this example): +// setTimeout(() => { +// console.log('unsubscribing'); +// wsClient.unsubscribeV5('execution', 'linear'); +// }, 5 * 1000); ⋮---- -// The directory where Jest should output its coverage files +// Topics are tracked per websocket type +// Get a list of subscribed topics (e.g. for public v3 spot topics) (after a 5 second delay) + +================ +File: src/constants/enum.ts +================ +/** Full take profit/stop loss mode (a single TP order and a single SL order can be placed, covering the entire position) */ ⋮---- -// An array of regexp pattern strings used to skip coverage collection -// coveragePathIgnorePatterns: [ -// "/node_modules/" -// ], +/** Partial take profit/stop loss mode (multiple TP and SL orders can be placed, covering portions of the position) */ ⋮---- -// Indicates which provider should be used to instrument code for coverage +/** This could mean bad request, incorrect value types or even incorrect/missing values */ ⋮---- -// A list of reporter names that Jest uses when writing coverage reports -// coverageReporters: [ -// "json", -// "text", -// "lcov", -// "clover" -// ], -⋮---- -// An object that configures minimum threshold enforcement for coverage results -// coverageThreshold: undefined, +/** API key requires specific whitelisted IPs, and this IP was not in the list */ ⋮---- -// A path to a custom dependency extractor -// dependencyExtractor: undefined, +/** Account not unified margin, update required */ ⋮---- -// Make calling deprecated APIs throw helpful error messages -// errorOnDeprecated: false, +/** Seen when placing an order */ ⋮---- -// The default configuration for fake timers -// fakeTimers: { -// "enableGlobally": false -// }, +/** Seen if a conditional order is too large */ ⋮---- -// Force coverage collection from ignored files using an array of glob patterns -// forceCoverageMatch: [], +/** E.g. trying to change position margin while on cross */ ⋮---- -// A path to a module which exports an async function that is triggered once before all test suites -// globalSetup: undefined, +/** E.g. USDC Options trading, trying to access a symbol that is no longer active */ ⋮---- -// A path to a module which exports an async function that is triggered once after all test suites -// globalTeardown: undefined, +/** E.g. USDC Options trading when the account hasn't been opened for USDC Options yet */ ⋮---- -// A set of global variables that need to be available in all test environments -// globals: {}, +/** + * Position idx, used to identify positions in different position modes. + * Required if you are under One-Way Mode: + */ +export enum LinearPositionIdx { + OneWayMode = 0, + BuySide = 1, + SellSide = 2, +} + +================ +File: src/types/request/v5-alpha-lp.ts +================ +/** + * V5 private Alpha LP requests. + */ ⋮---- -// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. -// maxWorkers: "50%", +export interface GetAlphaLPPoolListParamsV5 { + tokenSymbol?: string; +} ⋮---- -// An array of directory names to be searched recursively up from the requiring module's location -// moduleDirectories: [ -// "node_modules" -// ], +export interface GetAlphaLPPoolInfoParamsV5 { + poolAddress: string; +} ⋮---- -// An array of file extensions your modules use -// moduleFileExtensions: [ -// "js", -// "mjs", -// "cjs", -// "jsx", -// "ts", -// "tsx", -// "json", -// "node" -// ], +export interface ExecuteAlphaLPStakeParamsV5 { + positionId: number; + poolAddress: string; + payTokenAmount: string; + payTokenCode: string; + rangeUpper?: string; + rangeLower?: string; + priceUpper?: string; + priceLower?: string; +} ⋮---- -// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module -// moduleNameMapper: {}, +export interface ExecuteAlphaLPRedeemParamsV5 { + positionId: number; + poolAddress: string; + dercRatio: string; + receiveTokenCode?: string; +} ⋮---- -// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader -// modulePathIgnorePatterns: [], +export interface GetAlphaLPOrderListParamsV5 { + orderType?: 0 | 1 | 2; + tokenCode?: string; + orderStatus?: number[]; + days?: number; + limit?: number; + pageIndex?: number; + poolAddress?: string; +} ⋮---- -// Activates notifications for test results -// notify: false, +export interface GetAlphaLPPayTokenListParamsV5 { + chainCode?: string; + tokenAddress?: string; +} ⋮---- -// An enum that specifies notification mode. Requires { notify: true } -// notifyMode: "failure-change", +export interface GetAlphaLPPayTokenPriceParamsV5 { + tokenCode: string[]; + chainCode?: string; +} + +================ +File: src/types/request/v5-alpha-prediction.ts +================ +/** + * V5 private Alpha prediction market requests. + */ ⋮---- -// A preset that is used as a base for Jest's configuration -// preset: undefined, +export interface GetAlphaPredictionEventDetailParamsV5 { + eventId?: string; + slug?: string; + hasMoreMarkets?: boolean; +} ⋮---- -// Run tests from one or more projects -// projects: undefined, +export interface GetAlphaPredictionOrderEstimateParamsV5 { + tokenId: string; + side: 1 | 2; + eventId: string; + amount: string; + orderType: 1; + payTokenCode?: string; +} ⋮---- -// Use this configuration option to add custom reporters to Jest -// reporters: undefined, +export interface ExecuteAlphaPredictionBuyParamsV5 { + tokenId: string; + amount: string; + payTokenCode: string; + orderType: 1; + slippage: string; + eventId: string; +} ⋮---- -// Automatically reset mock state before every test -// resetMocks: false, +export interface ExecuteAlphaPredictionSellParamsV5 { + tokenId: string; + size: string; + orderType: 1; + slippage: string; + eventId: string; + toTokenCode?: string; +} ⋮---- -// Reset the module registry before running each individual test -// resetModules: false, +export interface GetAlphaPredictionOrderListParamsV5 { + status?: number; + tokenId?: string; + eventId?: string; + side?: 1 | 2; + days?: number; + limit?: number; + pageIndex?: number; +} ⋮---- -// A path to a custom resolver -// resolver: undefined, +export interface GetAlphaPredictionOrderBookParamsV5 { + tokenIds: string[]; +} ⋮---- -// Automatically restore mock state and implementation before every test -// restoreMocks: false, +export interface GetAlphaPredictionTokenPriceParamsV5 { + tokenIds: string[]; +} ⋮---- -// The root directory that Jest should scan for tests and modules within -// rootDir: undefined, +export interface GetAlphaPredictionPriceHistoryParamsV5 { + tokenId: string; + interval: string; +} ⋮---- -// A list of paths to directories that Jest should use to search for files in -// roots: [ -// "" -// ], +export interface GetAlphaPredictionPositionListParamsV5 { + tokenId?: string; + eventId?: string; + limit?: number; + pageIndex?: number; +} ⋮---- -// Allows you to use a custom runner instead of Jest's default test runner -// runner: "jest-runner", +export interface GetAlphaPredictionPositionHistoryParamsV5 { + tokenId?: string; + eventId?: string; + result?: number; + days?: number; + limit?: number; + pageIndex?: number; +} ⋮---- -// The paths to modules that run some code to configure or set up the testing environment before each test -// setupFiles: [], +export interface GetAlphaPredictionPortfolioSummaryParamsV5 { + eventType?: number; +} ⋮---- -// A list of paths to modules that run some code to configure or set up the testing framework before each test -// setupFilesAfterEnv: [], +export interface GetAlphaPredictionSideMarketListParamsV5 { + eventId: string; + sortBy?: string; + marketType?: number; + limit?: number; + pageIndex?: number; +} ⋮---- -// The number of seconds after which a test is considered as slow and reported as such in the results. -// slowTestThreshold: 5, +export interface GetAlphaPredictionSportsMatchListParamsV5 { + eventType: number; + status?: number; + startTime?: number; + endTime?: number; + stageCode?: string; + limit?: number; + pageIndex?: number; +} ⋮---- -// A list of paths to snapshot serializer modules Jest should use for snapshot testing -// snapshotSerializers: [], +export interface GetAlphaPredictionSportsTimelineStagesParamsV5 { + eventType: number; +} ⋮---- -// The test environment that will be used for testing -// testEnvironment: "jest-environment-node", +export interface GetAlphaPredictionSportsGroupStageDetailParamsV5 { + eventType: number; + groupName?: string; +} + +================ +File: src/types/request/v5-alpha-trade.ts +================ +/** + * V5 private Alpha / on-chain (Web3) trade requests. + */ ⋮---- -// Options that will be passed to the testEnvironment -// testEnvironmentOptions: {}, +export interface GetAlphaTradeQuoteParamsV5 { + tradeType: 1 | 2; + fromTokenCode: string; + fromTokenAmount: string; + toTokenCode: string; + quoteMode?: 0 | 1 | 2; +} ⋮---- -// Adds a location field to test results -// testLocationInResults: false, -⋮---- -// The glob patterns Jest uses to detect test files -⋮---- -// "**/__tests__/**/*.[jt]s?(x)", -⋮---- -// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped -// testPathIgnorePatterns: [ -// "/node_modules/" -// ], -⋮---- -// The regexp pattern or array of patterns that Jest uses to detect test files -// testRegex: [], -⋮---- -// This option allows the use of a custom results processor -// testResultsProcessor: undefined, -⋮---- -// This option allows use of a custom test runner -// testRunner: "jest-circus/runner", -⋮---- -// A map from regular expressions to paths to transformers -// transform: undefined, -⋮---- -// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation -// transformIgnorePatterns: [ -// "/node_modules/", -// "\\.pnp\\.[^\\/]+$" -// ], -⋮---- -// Prevents import esm module error from v1 axios release, issue #5026 -⋮---- -// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them -// unmockedModulePathPatterns: undefined, -⋮---- -// Indicates whether each individual test should be reported during the run -// verbose: undefined, -verbose: true, // report individual test +export interface ExecuteAlphaTradeParamsV5 { + fromTokenCode: string; + fromTokenAmount: string; + toTokenCode: string; + slippage: string; + quoteData: string; + gas: string; + quoteMode: 0 | 1 | 2; + correctingCode: string; + tenant?: string; +} ⋮---- -// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode -// watchPathIgnorePatterns: [], +export interface GetAlphaPayTokenListParamsV5 { + chainCode: string; + tokenAddress: string; +} ⋮---- -// Whether to use watchman for file crawling -// watchman: true, - -================ -File: jsconfig.json -================ -{ - "compilerOptions": { - "target": "ES6", - "module": "commonjs" - }, - "exclude": [ - "node_modules", - "**/node_modules/*", - "coverage", - "doc", - "examples/ignored/*" - ] +export interface GetAlphaTradeOrderListParamsV5 { + limit: number; + pageIndex: number; + tradeType?: number; + tokenCode?: string; + orderStatus?: number[]; + days?: number; + direction?: 'prev' | 'next'; } - -================ -File: LICENSE.md -================ -Copyright 2024 Tiago Siebler - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -================ -File: tsconfig.build.json -================ -{ - "extends": "./tsconfig.json", - "exclude": [ - "node_modules", - "test", - "dist", - "**/*spec.ts", - "**/*test.ts", - "jest.config.ts" - ] +⋮---- +export interface GetAlphaBizTokenListParamsV5 { + tokenTag?: number; } - -================ -File: tsconfig.examples.json -================ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "distExamples", - "allowJs": true - }, - "include": ["examples/**/*.ts", "examples/**/*.js"] +⋮---- +export interface AlphaTokenAddressInfoV5 { + chainCode: string; + tokenAddress: string; } - -================ -File: tsconfig.json -================ -{ - "compileOnSave": true, - "compilerOptions": { - "allowJs": true, - "target": "es6", - "module": "commonjs", - "moduleResolution": "node", - "declaration": true, - "removeComments": false, - "noEmitOnError": true, - "noImplicitAny": false, - "strictNullChecks": true, - "skipLibCheck": true, - "sourceMap": true, - "esModuleInterop": true, - "lib": ["es2017", "dom"], - "baseUrl": ".", - "outDir": "./lib" - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "**/node_modules/*", "coverage", "doc"] +⋮---- +export interface GetAlphaBizTokenPriceListParamsV5 { + tokenAddressInfo: AlphaTokenAddressInfoV5[]; } - -================ -File: tsconfig.linting.json -================ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "commonjs", - "target": "esnext", - "rootDir": "../", - "allowJs": true - }, - "include": [ - "src/**/*.*", - "test/**/*.*", - "examples/**/*.*", - ".eslintrc.cjs", - "jest.config.ts" - ] +⋮---- +export interface GetAlphaBizTokenDetailsParamsV5 { + chainCode: string; + tokenAddress: string; } - -================ -File: tsconfig.test.json -================ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./distTest", - "allowJs": true - }, - "include": ["test/**/*.ts", "test/**/*.js"] +⋮---- +export interface GetAlphaAssetDetailParamsV5 { + chainCode: string; + tokenAddress: string; } ================ -File: examples/Websocket/Private/ws-private-v5.ts +File: src/types/request/v5-card.ts ================ -/* eslint-disable @typescript-eslint/no-empty-function */ -import { DefaultLogger, WebsocketClient, WS_KEY_MAP } from '../../../src'; -⋮---- -// or -// import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from 'bybit-api'; -⋮---- -// Create & inject a custom logger to enable the trace logging level (empty function) -⋮---- -// trace: (...params) => console.log('trace', ...params), -⋮---- /** - * Prepare an instance of the WebSocket client. This client handles all aspects of connectivity for you: - * - Connections are opened when you subscribe to topics - * - If key & secret are provided, authentication is handled automatically - * - If you subscribe to topics from different v5 products (e.g. spot and linear perps), - * subscription events are automatically routed to the different ws endpoints on bybit's side - * - Heartbeats/ping/pong/reconnects are all handled automatically. - * If a connection drops, the client will clean it up, respawn a fresh connection and resubscribe for you. + * Bybit Card — /v5/card/* + * Authenticated; API key permission per Bybit (often card-related). */ ⋮---- -// testnet: false, -// demoTrading: false, // set testnet to false, if you plan on using demo trading +export interface QueryCardAssetRecordsParamsV5 { + /** 0: Pending, 1: Cleared, 2: Declined */ + statusCode?: string; + /** Default 100, range [1, 500] */ + limit?: number; + /** Default 1, min 1 */ + page?: number; + /** Last 2/4 digits of card number */ + pan4?: string; + createBeginTime?: number; + createEndTime?: number; + /** Fuzzy search */ + merchName?: string; + /** Authorization / Clearing / Refund (see Bybit) */ + type?: string; + txnId?: string; + cardToken?: string; + orderNo?: string; +} ⋮---- -// console.log('raw message received ', JSON.stringify(data, null, 2)); +/** 0: Pending, 1: Cleared, 2: Declined */ ⋮---- -// wsClient.on('exception', (data) => { -// console.error('ws exception: ', data); -// }); +/** Default 100, range [1, 500] */ ⋮---- -/** - * For private V5 topics, us the subscribeV5() method on the ws client or use the original subscribe() method. - * - * Note: for private endpoints the "category" field is ignored since there is only one private endpoint - * (compared to one public one per category). - * The "category" is only needed for public topics since bybit has one endpoint for public events per category. - */ +/** Default 1, min 1 */ ⋮---- -// wsClient.subscribeV5('execution.fast', 'linear'); -// wsClient.subscribeV5('execution.fast.linear', 'linear'); -// wsClient.subscribeV5('execution.fast.spot', 'spot'); -// wsClient.subscribeV5('execution.fast.option', 'option'); +/** Last 2/4 digits of card number */ ⋮---- -/** - * The following has the same effect as above, since there's only one private endpoint for V5 account topics: - */ -// wsClient.subscribe('position'); -// wsClient.subscribe('execution'); -// wsClient.subscribe(['order', 'wallet', 'greek']); +/** Fuzzy search */ ⋮---- -// To unsubscribe from topics (after a 5 second delay, in this example): -// setTimeout(() => { -// console.log('unsubscribing'); -// wsClient.unsubscribeV5('execution', 'linear'); -// }, 5 * 1000); -⋮---- -// Topics are tracked per websocket type -// Get a list of subscribed topics (e.g. for public v3 spot topics) (after a 5 second delay) - -================ -File: src/constants/enum.ts -================ -/** Full take profit/stop loss mode (a single TP order and a single SL order can be placed, covering the entire position) */ -⋮---- -/** Partial take profit/stop loss mode (multiple TP and SL orders can be placed, covering portions of the position) */ -⋮---- -/** This could mean bad request, incorrect value types or even incorrect/missing values */ +/** Authorization / Clearing / Refund (see Bybit) */ ⋮---- -/** API key requires specific whitelisted IPs, and this IP was not in the list */ +export interface QueryCardPointRecordsParamsV5 { + type?: string; + pageSize?: number; + pageNo?: number; + startTime?: number; + endTime?: number; + outOrderId?: string; + bizId?: string; + bizTxnId?: string; + /** 1: Earn, 2: Deduct */ + side?: string; +} ⋮---- -/** Account not unified margin, update required */ +/** 1: Earn, 2: Deduct */ ⋮---- -/** Seen when placing an order */ +export interface QueryCardMallItemListParamsV5 { + pageNo?: number; + pageSize?: number; + /** 1: Virtual, 2: Physical */ + itemType?: number; + /** 1: POINTS, 2: CURRENCY */ + itemBizType?: number; + /** 1: Priority, 2: Listing time, 3: Price */ + orderBy?: number; + asc?: boolean; + /** 0: Default, 1: VIP */ + source?: number; +} ⋮---- -/** Seen if a conditional order is too large */ +/** 1: Virtual, 2: Physical */ ⋮---- -/** E.g. trying to change position margin while on cross */ +/** 1: POINTS, 2: CURRENCY */ ⋮---- -/** E.g. USDC Options trading, trying to access a symbol that is no longer active */ +/** 1: Priority, 2: Listing time, 3: Price */ ⋮---- -/** E.g. USDC Options trading when the account hasn't been opened for USDC Options yet */ +/** 0: Default, 1: VIP */ ⋮---- -/** - * Position idx, used to identify positions in different position modes. - * Required if you are under One-Way Mode: - */ -export enum LinearPositionIdx { - OneWayMode = 0, - BuySide = 1, - SellSide = 2, +export interface QueryCardPointCashbackDetailParamsV5 { + bizTxnId: string; } ================ -File: src/types/request/v5-alpha-lp.ts +File: src/types/request/v5-earn-advance-discount.ts ================ /** - * V5 private Alpha LP requests. + * /v5/earn/advance/ — product-extra, place order, position, order (Discount Buy, Dual Assets, etc.) */ +export type GetAdvanceEarnProductExtraInfoParamsV5 = + | { + category: 'DiscountBuy'; + productId?: string; + } + | { + category: 'DualAssets'; + /** Required for Dual Assets quote. */ + productId: string; + }; ⋮---- -export interface GetAlphaLPPoolListParamsV5 { - tokenSymbol?: string; +/** Required for Dual Assets quote. */ +⋮---- +export interface AdvanceEarnDiscountBuyExtraV5 { + initialPrice: string; + purchasePrice: string; + knockoutPrice: string; + knockoutCouponE8: string; + settleType: 'Base' | 'Quote'; + instUid: string; } ⋮---- -export interface GetAlphaLPPoolInfoParamsV5 { - poolAddress: string; +export interface AdvanceEarnDualAssetsExtraV5 { + orderDirection: 'BuyLow' | 'SellHigh'; + selectPrice: string; + /** Expected APY in e8 precision; API may return int. */ + apyE8: string | number; } ⋮---- -export interface ExecuteAlphaLPStakeParamsV5 { - positionId: number; - poolAddress: string; - payTokenAmount: string; - payTokenCode: string; - rangeUpper?: string; - rangeLower?: string; - priceUpper?: string; - priceLower?: string; +/** Expected APY in e8 precision; API may return int. */ +⋮---- +export interface AdvanceEarnInterestCardExtraV5 { + awardId: string | number; + specCode: string; } ⋮---- -export interface ExecuteAlphaLPRedeemParamsV5 { - positionId: number; - poolAddress: string; - dercRatio: string; - receiveTokenCode?: string; +/** + * POST /v5/earn/advance/place-order — Discount Buy + */ +export interface SubmitAdvanceEarnPlaceOrderDiscountBuyV5 { + category: 'DiscountBuy'; + productId: string; + orderType: 'Stake'; + amount: string; + coin: string; + accountType: 'FUND' | 'UNIFIED'; + orderLinkId: string; + discountBuyExtra: AdvanceEarnDiscountBuyExtraV5; } ⋮---- -export interface GetAlphaLPOrderListParamsV5 { - orderType?: 0 | 1 | 2; - tokenCode?: string; - orderStatus?: number[]; - days?: number; - limit?: number; - pageIndex?: number; - poolAddress?: string; +/** + * POST /v5/earn/advance/place-order — Dual Assets + */ +export interface SubmitAdvanceEarnPlaceOrderDualAssetsV5 { + category: 'DualAssets'; + productId: string; + orderType: 'Stake'; + amount: string; + coin: string; + accountType: 'FUND' | 'UNIFIED'; + orderLinkId: string; + dualAssetsExtra: AdvanceEarnDualAssetsExtraV5; + interestCard?: AdvanceEarnInterestCardExtraV5; } ⋮---- -export interface GetAlphaLPPayTokenListParamsV5 { - chainCode?: string; - tokenAddress?: string; +export type SubmitAdvanceEarnPlaceOrderParamsV5 = + | SubmitAdvanceEarnPlaceOrderDiscountBuyV5 + | SubmitAdvanceEarnPlaceOrderDualAssetsV5; +⋮---- +export interface GetAdvanceEarnPositionListParamsV5 { + category: 'DiscountBuy' | 'DualAssets' | string; + productId?: string; + coin?: string; + limit?: number; + cursor?: string; } ⋮---- -export interface GetAlphaLPPayTokenPriceParamsV5 { - tokenCode: string[]; - chainCode?: string; +export interface GetAdvanceEarnOrderListParamsV5 { + category: 'DiscountBuy' | 'DualAssets' | string; + orderId?: string; + orderLinkId?: string; + productId?: string; + /** Dual Assets docs use string ms; other categories may use number. */ + startTime?: string | number; + endTime?: string | number; + limit?: number; + cursor?: string; } +⋮---- +/** Dual Assets docs use string ms; other categories may use number. */ ================ -File: src/types/request/v5-alpha-prediction.ts +File: src/types/request/v5-earn-fixed-term.ts ================ /** - * V5 private Alpha prediction market requests. + * /v5/earn/fixed-term/* */ -⋮---- -export interface GetAlphaPredictionEventDetailParamsV5 { - eventId?: string; - slug?: string; - hasMoreMarkets?: boolean; +export interface GetFixedTermEarnProductParamsV5 { + coin?: string; } ⋮---- -export interface GetAlphaPredictionOrderEstimateParamsV5 { - tokenId: string; - side: 1 | 2; - eventId: string; +export interface SubmitFixedTermEarnOrderParamsV5 { + productId: string; + category: 'FixedTermSaving' | 'FundPool' | 'FundPoolPremium'; + coin: string; amount: string; - orderType: 1; - payTokenCode?: string; + accountType: 'FUND' | 'UNIFIED'; + orderLinkId: string; + autoInvest?: boolean; } ⋮---- -export interface ExecuteAlphaPredictionBuyParamsV5 { - tokenId: string; - amount: string; - payTokenCode: string; - orderType: 1; - slippage: string; - eventId: string; +export interface RedeemFixedTermEarnParamsV5 { + productId: string; + /** Early redemption: FundPool only */ + category: 'FundPool'; + positionId: string; } ⋮---- -export interface ExecuteAlphaPredictionSellParamsV5 { - tokenId: string; - size: string; - orderType: 1; - slippage: string; - eventId: string; - toTokenCode?: string; +/** Early redemption: FundPool only */ +⋮---- +export interface GetFixedTermEarnPositionParamsV5 { + productId?: string; + category?: 'FixedTermSaving' | 'FundPool' | 'FundPoolPremium'; + coin?: string; } ⋮---- -export interface GetAlphaPredictionOrderListParamsV5 { - status?: number; - tokenId?: string; - eventId?: string; - side?: 1 | 2; - days?: number; +export interface GetFixedTermEarnOrderListParamsV5 { + orderType?: 'Stake' | 'Redeem' | 'Reinvest'; + productId?: string; + category?: 'FixedTermSaving' | 'FundPool' | 'FundPoolPremium'; + orderId?: string; + startTime?: number; + endTime?: number; limit?: number; - pageIndex?: number; + cursor?: string; } ⋮---- -export interface GetAlphaPredictionOrderBookParamsV5 { - tokenIds: string[]; +export interface SetFixedTermEarnAutoInvestParamsV5 { + productId: string; + category: 'FixedTermSaving' | 'FundPool' | 'FundPoolPremium'; + positionId: string; + status: 'Enable' | 'Disable'; +} + +================ +File: src/types/request/v5-earn-pwm.ts +================ +/** GET /v5/earn/pwm/investment-plan/detail */ +export interface GetPwmInvestmentPlanDetailParamsV5 { + planId: string; } ⋮---- -export interface GetAlphaPredictionTokenPriceParamsV5 { - tokenIds: string[]; +/** GET /v5/earn/pwm/investment-plan/new-plan */ +export interface GetPwmPendingInvestmentPlanDetailParamsV5 { + planId: string; } ⋮---- -export interface GetAlphaPredictionPriceHistoryParamsV5 { - tokenId: string; - interval: string; +/** POST /v5/earn/pwm/investment-plan/claim */ +export interface ClaimPwmWithdrawableFundsParamsV5 { + planId: string; + /** Default: FUND */ + toAccountType?: string; + orderLinkId: string; } ⋮---- -export interface GetAlphaPredictionPositionListParamsV5 { - tokenId?: string; - eventId?: string; - limit?: number; - pageIndex?: number; +/** Default: FUND */ +⋮---- +/** GET /v5/earn/pwm/investment-plan/asset-trend */ +export interface GetPwmInvestmentPlanAssetTrendParamsV5 { + planId: string; + startTime?: number; + endTime?: number; } ⋮---- -export interface GetAlphaPredictionPositionHistoryParamsV5 { - tokenId?: string; - eventId?: string; - result?: number; - days?: number; - limit?: number; - pageIndex?: number; +/** GET /v5/earn/pwm/investment-plan/fund-nav */ +export interface GetPwmFundHistoricalNavParamsV5 { + fundId: string; + startTime?: number; + endTime?: number; } ⋮---- -export interface GetAlphaPredictionPortfolioSummaryParamsV5 { - eventType?: number; +/** POST /v5/earn/pwm/investment-plan/subscribe */ +export interface SubscribePwmInvestmentPlanParamsV5 { + planId: string; + /** Default: FUND */ + accountType?: string; + orderLinkId: string; } ⋮---- -export interface GetAlphaPredictionSideMarketListParamsV5 { - eventId: string; - sortBy?: string; - marketType?: number; +/** Default: FUND */ +⋮---- +/** POST /v5/earn/pwm/investment-plan/invest-more */ +export interface InvestMorePwmInvestmentPlanParamsV5 { + planId: string; + /** Default: FUND */ + accountType?: string; + category: string; + productId: string; + amount: string; + orderLinkId: string; +} +⋮---- +/** Default: FUND */ +⋮---- +/** POST /v5/earn/pwm/investment-plan/redeem */ +export interface RedeemPwmInvestmentPlanParamsV5 { + planId: string; + category: string; + productId: string; + orderLinkId: string; + /** Required for fund products */ + shares?: string; + /** Required for non-fund products */ + amount?: string; + /** Required for FundPool and On-chain Earn */ + positionId?: string; +} +⋮---- +/** Required for fund products */ +⋮---- +/** Required for non-fund products */ +⋮---- +/** Required for FundPool and On-chain Earn */ +⋮---- +/** GET /v5/earn/pwm/investment-plan/order */ +export interface GetPwmInvestmentPlanOrdersParamsV5 { + planId?: string; + category?: string; + type?: 'Subscribe' | 'Redeem' | 'AutoReinvest' | string; + status?: 'Completed' | 'Pending' | 'Failed' | string; + startTime?: string; + endTime?: string; limit?: number; - pageIndex?: number; + cursor?: string; + orderLinkId?: string; } ⋮---- -export interface GetAlphaPredictionSportsMatchListParamsV5 { - eventType: number; - status?: number; - startTime?: number; - endTime?: number; - stageCode?: string; +/** POST /v5/earn/pwm/customize-plan/create */ +export interface CreatePwmCustomizeInvestmentPlanProductV5 { + category: string; + productId: string; + fundName: string; + amount: string; +} +⋮---- +export interface CreatePwmCustomizeInvestmentPlanParamsV5 { + accountType?: string; + products: CreatePwmCustomizeInvestmentPlanProductV5[]; +} +⋮---- +/** GET /v5/earn/pwm/asset-manager/all-funds */ +export interface GetPwmAllFundsParamsV5 { + coin?: string; + fundId?: string; + status?: string; limit?: number; - pageIndex?: number; + cursor?: string; } ⋮---- -export interface GetAlphaPredictionSportsTimelineStagesParamsV5 { - eventType: number; +/** POST /v5/earn/pwm/asset-manager/settle-profit */ +export interface SettlePwmFundProfitParamsV5 { + fundId: string; + reqLinkId: string; } ⋮---- -export interface GetAlphaPredictionSportsGroupStageDetailParamsV5 { - eventType: number; - groupName?: string; +/** POST /v5/earn/pwm/asset-manager/create-fund */ +export interface CreatePwmFundParamsV5 { + fundName: string; + coin: string; + profitShareRate: string; + managementFeeRate: string; + fundIntroduction?: string; + reqLinkId: string; } - -================ -File: src/types/request/v5-alpha-trade.ts -================ -/** - * V5 private Alpha / on-chain (Web3) trade requests. - */ ⋮---- -export interface GetAlphaTradeQuoteParamsV5 { - tradeType: 1 | 2; - fromTokenCode: string; - fromTokenAmount: string; - toTokenCode: string; - quoteMode?: 0 | 1 | 2; +/** POST /v5/earn/pwm/asset-manager/create-investment-plan */ +export interface CreatePwmAssetManagerInvestmentPlanDistributionV5 { + productId: string; + amount: string; } ⋮---- -export interface ExecuteAlphaTradeParamsV5 { - fromTokenCode: string; - fromTokenAmount: string; - toTokenCode: string; - slippage: string; - quoteData: string; - gas: string; - quoteMode: 0 | 1 | 2; - correctingCode: string; - tenant?: string; +export interface CreatePwmAssetManagerInvestmentPlanParamsV5 { + accountUid: string; + planName: string; + planType: 'stable' | 'advanced' | string; + investmentDistribution: CreatePwmAssetManagerInvestmentPlanDistributionV5[]; + reqLinkId: string; } ⋮---- -export interface GetAlphaPayTokenListParamsV5 { - chainCode: string; - tokenAddress: string; +/** GET /v5/earn/pwm/asset-manager/get-investment-plan */ +export interface GetPwmAssetManagerInvestmentPlansParamsV5 { + planId?: string; + status?: string; + subscriptionUid?: string; + limit?: number; + cursor?: string; } ⋮---- -export interface GetAlphaTradeOrderListParamsV5 { - limit: number; - pageIndex: number; - tradeType?: number; - tokenCode?: string; - orderStatus?: number[]; - days?: number; - direction?: 'prev' | 'next'; +/** POST /v5/earn/pwm/asset-manager/manage-investment-plan */ +export interface ManagePwmAssetManagerInvestmentPlanFundV5 { + fundId: string; + amount: string; } ⋮---- -export interface GetAlphaBizTokenListParamsV5 { - tokenTag?: number; +export interface ManagePwmAssetManagerInvestmentPlanParamsV5 { + planId: string; + updateStatus?: 'Closed' | 'Deleted' | string; + updateFunds?: ManagePwmAssetManagerInvestmentPlanFundV5[]; + reqLinkId: string; } ⋮---- -export interface AlphaTokenAddressInfoV5 { - chainCode: string; - tokenAddress: string; +/** GET /v5/earn/pwm/asset-manager/all-order */ +export interface GetPwmAllFundOrdersParamsV5 { + fundId?: string; + orderType?: 'Subscribe' | 'Redeem' | string; + status?: string; + startTime?: number; + endTime?: number; + limit?: number; + cursor?: string; } ⋮---- -export interface GetAlphaBizTokenPriceListParamsV5 { - tokenAddressInfo: AlphaTokenAddressInfoV5[]; +/** POST /v5/earn/pwm/asset-manager/manage-order */ +export interface ManagePwmFundOrderParamsV5 { + orderId: string; + action: 'approve' | 'reject' | string; + reqLinkId: string; } ⋮---- -export interface GetAlphaBizTokenDetailsParamsV5 { - chainCode: string; - tokenAddress: string; +/** POST /v5/earn/pwm/asset-manager/create-sub-account */ +export interface CreatePwmFundSubAccountParamsV5 { + fundId: string; + reqLinkId: string; } ⋮---- -export interface GetAlphaAssetDetailParamsV5 { - chainCode: string; - tokenAddress: string; +/** POST /v5/earn/pwm/fund-transfer */ +export interface PwmFundTransferParamsV5 { + transferId: string; + fromUserId: number; + toUserId: number; + amount: string; + coin: string; +} +⋮---- +/** GET /v5/earn/pwm/query-fund-transfer-result */ +export interface GetPwmFundTransferRecordsParamsV5 { + transferId?: string; + fromUserId?: number; } ================ -File: src/types/request/v5-card.ts +File: src/types/request/v5-earn-token.ts ================ /** - * Bybit Card — /v5/card/* - * Authenticated; API key permission per Bybit (often card-related). + * Earn token product (e.g. BYUSDT) — /v5/earn/token/* */ ⋮---- -export interface QueryCardAssetRecordsParamsV5 { - /** 0: Pending, 1: Cleared, 2: Declined */ - statusCode?: string; - /** Default 100, range [1, 500] */ - limit?: number; - /** Default 1, min 1 */ - page?: number; - /** Last 2/4 digits of card number */ - pan4?: string; - createBeginTime?: number; - createEndTime?: number; - /** Fuzzy search */ - merchName?: string; - /** Authorization / Clearing / Refund (see Bybit) */ - type?: string; - txnId?: string; - cardToken?: string; - orderNo?: string; +export interface GetEarnTokenProductParamsV5 { + /** Currently only BYUSDT */ + coin: string; } ⋮---- -/** 0: Pending, 1: Cleared, 2: Declined */ -⋮---- -/** Default 100, range [1, 500] */ -⋮---- -/** Default 1, min 1 */ -⋮---- -/** Last 2/4 digits of card number */ +/** Currently only BYUSDT */ ⋮---- -/** Fuzzy search */ +export interface PlaceEarnTokenOrderParamsV5 { + coin: string; + orderLinkId: string; + orderType: 'Mint' | 'Redeem'; + amount: string; + /** Mint: FlexibleSaving; Redeem: UNIFIED */ + accountType: 'FlexibleSaving' | 'UNIFIED'; +} ⋮---- -/** Authorization / Clearing / Refund (see Bybit) */ +/** Mint: FlexibleSaving; Redeem: UNIFIED */ ⋮---- -export interface QueryCardPointRecordsParamsV5 { - type?: string; - pageSize?: number; - pageNo?: number; +export interface GetEarnTokenOrderListParamsV5 { + coin: string; + orderLinkId?: string; + orderId?: string; + orderType?: 'Mint' | 'Redeem'; + /** seconds */ startTime?: number; + /** seconds */ endTime?: number; - outOrderId?: string; - bizId?: string; - bizTxnId?: string; - /** 1: Earn, 2: Deduct */ - side?: string; + cursor?: string; + limit?: number; } ⋮---- -/** 1: Earn, 2: Deduct */ -⋮---- -export interface QueryCardMallItemListParamsV5 { - pageNo?: number; - pageSize?: number; - /** 1: Virtual, 2: Physical */ - itemType?: number; - /** 1: POINTS, 2: CURRENCY */ - itemBizType?: number; - /** 1: Priority, 2: Listing time, 3: Price */ - orderBy?: number; - asc?: boolean; - /** 0: Default, 1: VIP */ - source?: number; -} +/** seconds */ ⋮---- -/** 1: Virtual, 2: Physical */ +/** seconds */ ⋮---- -/** 1: POINTS, 2: CURRENCY */ +export interface GetEarnTokenPositionParamsV5 { + coin: string; +} ⋮---- -/** 1: Priority, 2: Listing time, 3: Price */ +export interface GetEarnTokenDailyYieldParamsV5 { + coin: string; + startTime?: number; + endTime?: number; + cursor?: string; + limit?: number; +} ⋮---- -/** 0: Default, 1: VIP */ +export interface GetEarnTokenHourlyYieldParamsV5 { + coin: string; + startTime?: number; + endTime?: number; + cursor?: string; + limit?: number; +} ⋮---- -export interface QueryCardPointCashbackDetailParamsV5 { - bizTxnId: string; +export interface GetEarnTokenHistoryAprParamsV5 { + coin: string; + /** 1 = 7d, 2 = 30d, 3 = 180d */ + range: 1 | 2 | 3; } +⋮---- +/** 1 = 7d, 2 = 30d, 3 = 180d */ ================ -File: src/types/request/v5-earn-advance-discount.ts +File: src/types/request/v5-event.ts ================ -/** - * /v5/earn/advance/ — product-extra, place order, position, order (Discount Buy, Dual Assets, etc.) - */ -export type GetAdvanceEarnProductExtraInfoParamsV5 = - | { - category: 'DiscountBuy'; - productId?: string; - } - | { - category: 'DualAssets'; - /** Required for Dual Assets quote. */ - productId: string; - }; -⋮---- -/** Required for Dual Assets quote. */ -⋮---- -export interface AdvanceEarnDiscountBuyExtraV5 { - initialPrice: string; - purchasePrice: string; - knockoutPrice: string; - knockoutCouponE8: string; - settleType: 'Base' | 'Quote'; - instUid: string; +export interface GetEventInstrumentsInfoParamsV5 { + symbol?: string; + status?: 'PreLaunch' | 'Trading' | 'Delivering' | 'Closed'; + limit?: number; + cursor?: string; } ⋮---- -export interface AdvanceEarnDualAssetsExtraV5 { - orderDirection: 'BuyLow' | 'SellHigh'; - selectPrice: string; - /** Expected APY in e8 precision; API may return int. */ - apyE8: string | number; +export interface GetEventOrderbookParamsV5 { + symbol: string; } ⋮---- -/** Expected APY in e8 precision; API may return int. */ -⋮---- -export interface AdvanceEarnInterestCardExtraV5 { - awardId: string | number; - specCode: string; +export interface GetEventOrderHistoryParamsV5 { + symbol?: string; + orderId?: string; + orderLinkId?: string; + startTime?: number; + endTime?: number; + limit?: number; + cursor?: string; } ⋮---- -/** - * POST /v5/earn/advance/place-order — Discount Buy - */ -export interface SubmitAdvanceEarnPlaceOrderDiscountBuyV5 { - category: 'DiscountBuy'; - productId: string; - orderType: 'Stake'; - amount: string; - coin: string; - accountType: 'FUND' | 'UNIFIED'; - orderLinkId: string; - discountBuyExtra: AdvanceEarnDiscountBuyExtraV5; +export interface GetEventActiveOrdersParamsV5 { + symbol?: string; + orderId?: string; + orderLinkId?: string; + limit?: number; + cursor?: string; } ⋮---- -/** - * POST /v5/earn/advance/place-order — Dual Assets - */ -export interface SubmitAdvanceEarnPlaceOrderDualAssetsV5 { - category: 'DualAssets'; - productId: string; - orderType: 'Stake'; - amount: string; - coin: string; - accountType: 'FUND' | 'UNIFIED'; - orderLinkId: string; - dualAssetsExtra: AdvanceEarnDualAssetsExtraV5; - interestCard?: AdvanceEarnInterestCardExtraV5; +export interface GetEventPositionInfoParamsV5 { + symbol?: string; + baseCoin?: string; + settleCoin?: string; + limit?: number; + cursor?: string; } ⋮---- -export type SubmitAdvanceEarnPlaceOrderParamsV5 = - | SubmitAdvanceEarnPlaceOrderDiscountBuyV5 - | SubmitAdvanceEarnPlaceOrderDualAssetsV5; -⋮---- -export interface GetAdvanceEarnPositionListParamsV5 { - category: 'DiscountBuy' | 'DualAssets' | string; - productId?: string; - coin?: string; +export interface GetEventTradeHistoryParamsV5 { + symbol: string; + orderId?: string; + orderLinkId?: string; + startTime?: number; + endTime?: number; limit?: number; cursor?: string; } ⋮---- -export interface GetAdvanceEarnOrderListParamsV5 { - category: 'DiscountBuy' | 'DualAssets' | string; +export interface GetEventSettlementRecordsParamsV5 { + symbol: string; orderId?: string; - orderLinkId?: string; - productId?: string; - /** Dual Assets docs use string ms; other categories may use number. */ - startTime?: string | number; - endTime?: string | number; + startTime?: number; + endTime?: number; limit?: number; cursor?: string; } ⋮---- -/** Dual Assets docs use string ms; other categories may use number. */ +export interface SubmitEventQuoteParamsV5 { + symbol: string; + orderLinkId: string; + grossPayoutRatio: string; + amount: string; +} +⋮---- +export interface CancelEventQuoteParamsV5 { + orderLinkId?: string; + orderId?: string; +} ================ -File: src/types/request/v5-earn-fixed-term.ts +File: src/types/request/v5-p2p-trading.ts ================ -/** - * /v5/earn/fixed-term/* - */ -export interface GetFixedTermEarnProductParamsV5 { +export interface GetP2PAccountCoinsBalanceParamsV5 { + memberId?: string; + accountType: string; coin?: string; + withBonus?: 0 | 1; } ⋮---- -export interface SubmitFixedTermEarnOrderParamsV5 { - productId: string; - category: 'FixedTermSaving' | 'FundPool' | 'FundPoolPremium'; - coin: string; - amount: string; - accountType: 'FUND' | 'UNIFIED'; - orderLinkId: string; - autoInvest?: boolean; -} -⋮---- -export interface RedeemFixedTermEarnParamsV5 { - productId: string; - /** Early redemption: FundPool only */ - category: 'FundPool'; - positionId: string; +export interface GetP2POnlineAdsParamsV5 { + tokenId: string; + currencyId: string; + side: '0' | '1'; // 0: buy; 1: sell + page?: string; + size?: string; } ⋮---- -/** Early redemption: FundPool only */ +side: '0' | '1'; // 0: buy; 1: sell ⋮---- -export interface GetFixedTermEarnPositionParamsV5 { - productId?: string; - category?: 'FixedTermSaving' | 'FundPool' | 'FundPoolPremium'; - coin?: string; +export interface P2PTradingPreferenceSetV5 { + hasUnPostAd?: 0 | 1; + isKyc?: 0 | 1; + isEmail?: 0 | 1; + isMobile?: 0 | 1; + hasRegisterTime?: 0 | 1; + registerTimeThreshold?: number; + orderFinishNumberDay30?: number; + completeRateDay30?: string; + nationalLimit?: string; + hasOrderFinishNumberDay30?: 0 | 1; + hasCompleteRateDay30?: 0 | 1; + hasNationalLimit?: 0 | 1; } ⋮---- -export interface GetFixedTermEarnOrderListParamsV5 { - orderType?: 'Stake' | 'Redeem' | 'Reinvest'; - productId?: string; - category?: 'FixedTermSaving' | 'FundPool' | 'FundPoolPremium'; - orderId?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; +export interface CreateP2PAdParamsV5 { + tokenId: string; + currencyId: string; + side: '0' | '1'; // 0: buy; 1: sell + priceType: '0' | '1'; // 0: fixed rate; 1: floating rate + premium: string; + price: string; + minAmount: string; + maxAmount: string; + remark: string; + tradingPreferenceSet: P2PTradingPreferenceSetV5; + paymentIds: string[]; + quantity: string; + paymentPeriod: string; + itemType: 'ORIGIN' | 'BULK'; } ⋮---- -export interface SetFixedTermEarnAutoInvestParamsV5 { - productId: string; - category: 'FixedTermSaving' | 'FundPool' | 'FundPoolPremium'; - positionId: string; - status: 'Enable' | 'Disable'; -} - -================ -File: src/types/request/v5-earn-pwm.ts -================ -/** GET /v5/earn/pwm/investment-plan/detail */ -export interface GetPwmInvestmentPlanDetailParamsV5 { - planId: string; -} +side: '0' | '1'; // 0: buy; 1: sell +priceType: '0' | '1'; // 0: fixed rate; 1: floating rate ⋮---- -/** GET /v5/earn/pwm/investment-plan/new-plan */ -export interface GetPwmPendingInvestmentPlanDetailParamsV5 { - planId: string; +export interface UpdateP2PAdParamsV5 { + id: string; + priceType: '0' | '1'; // 0: fixed rate; 1: floating rate + premium: string; + price: string; + minAmount: string; + maxAmount: string; + remark: string; + tradingPreferenceSet: P2PTradingPreferenceSetV5; + paymentIds: string[]; + actionType: 'MODIFY' | 'ACTIVE'; // MODIFY: modify adv; ACTIVE: reonline adv + quantity: string; + paymentPeriod: string; + itemType?: 'ORIGIN' | 'BULK'; + subsidyAd?: boolean; + securityRiskToken?: string; } ⋮---- -/** POST /v5/earn/pwm/investment-plan/claim */ -export interface ClaimPwmWithdrawableFundsParamsV5 { - planId: string; - /** Default: FUND */ - toAccountType?: string; - orderLinkId: string; -} +priceType: '0' | '1'; // 0: fixed rate; 1: floating rate ⋮---- -/** Default: FUND */ +actionType: 'MODIFY' | 'ACTIVE'; // MODIFY: modify adv; ACTIVE: reonline adv ⋮---- -/** GET /v5/earn/pwm/investment-plan/asset-trend */ -export interface GetPwmInvestmentPlanAssetTrendParamsV5 { - planId: string; - startTime?: number; - endTime?: number; +export interface GetP2PPersonalAdsParamsV5 { + itemId?: string; + status?: '1' | '2'; // 1: Sold Out; 2: Available + side?: '0' | '1'; // 0: buy; 1: sell + tokenId?: string; + page?: string; + size?: string; + currencyId?: string; } ⋮---- -/** GET /v5/earn/pwm/investment-plan/fund-nav */ -export interface GetPwmFundHistoricalNavParamsV5 { - fundId: string; - startTime?: number; - endTime?: number; -} +status?: '1' | '2'; // 1: Sold Out; 2: Available +side?: '0' | '1'; // 0: buy; 1: sell ⋮---- -/** POST /v5/earn/pwm/investment-plan/subscribe */ -export interface SubscribePwmInvestmentPlanParamsV5 { - planId: string; - /** Default: FUND */ - accountType?: string; - orderLinkId: string; +export interface GetP2POrdersParamsV5 { + status?: number; + beginTime?: string; + endTime?: string; + tokenId?: string; + side?: number[]; + page: number; + size: number; } ⋮---- -/** Default: FUND */ -⋮---- -/** POST /v5/earn/pwm/investment-plan/invest-more */ -export interface InvestMorePwmInvestmentPlanParamsV5 { - planId: string; - /** Default: FUND */ - accountType?: string; - category: string; - productId: string; - amount: string; - orderLinkId: string; +export interface GetP2PPendingOrdersParamsV5 { + status?: number; + beginTime?: string; + endTime?: string; + tokenId?: string; + side?: number[]; + page: number; + size: number; } ⋮---- -/** Default: FUND */ -⋮---- -/** POST /v5/earn/pwm/investment-plan/redeem */ -export interface RedeemPwmInvestmentPlanParamsV5 { - planId: string; - category: string; - productId: string; - orderLinkId: string; - /** Required for fund products */ - shares?: string; - /** Required for non-fund products */ - amount?: string; - /** Required for FundPool and On-chain Earn */ - positionId?: string; +export interface MarkP2POrderAsPaidParamsV5 { + orderId: string; + paymentType: string; + paymentId: string; } ⋮---- -/** Required for fund products */ -⋮---- -/** Required for non-fund products */ +export type P2PSellerCancelExamineResultV5 = 'PASS' | 'REJECT'; ⋮---- -/** Required for FundPool and On-chain Earn */ +export type P2PSellerCancelRejectReasonV5 = + | 'buyerRefuseOrderCancelReason_haveMadePayment' + | 'buyerRefuseOrderCancelReason_haveNotReceivedFullRefund' + | 'buyerRefuseOrderCancelReason_others'; ⋮---- -/** GET /v5/earn/pwm/investment-plan/order */ -export interface GetPwmInvestmentPlanOrdersParamsV5 { - planId?: string; - category?: string; - type?: 'Subscribe' | 'Redeem' | 'AutoReinvest' | string; - status?: 'Completed' | 'Pending' | 'Failed' | string; - startTime?: string; - endTime?: string; - limit?: number; - cursor?: string; - orderLinkId?: string; +export interface ReviewP2PSellerCancelOrderApplyParamsV5 { + orderId: string; + examineResult: P2PSellerCancelExamineResultV5; + /** Required when examineResult is REJECT. */ + rejectReason?: P2PSellerCancelRejectReasonV5; + /** Comma-separated proof URLs. Required when examineResult is REJECT. */ + rejectProofs?: string; + rejectRemark?: string; } ⋮---- -/** POST /v5/earn/pwm/customize-plan/create */ -export interface CreatePwmCustomizeInvestmentPlanProductV5 { - category: string; - productId: string; - fundName: string; - amount: string; -} +/** Required when examineResult is REJECT. */ ⋮---- -export interface CreatePwmCustomizeInvestmentPlanParamsV5 { - accountType?: string; - products: CreatePwmCustomizeInvestmentPlanProductV5[]; -} +/** Comma-separated proof URLs. Required when examineResult is REJECT. */ ⋮---- -/** GET /v5/earn/pwm/asset-manager/all-funds */ -export interface GetPwmAllFundsParamsV5 { - coin?: string; - fundId?: string; - status?: string; - limit?: number; - cursor?: string; +export interface SendP2POrderMessageParamsV5 { + message: string; + contentType: string; + orderId: string; + msgUuid?: string; + fileName?: string; } ⋮---- -/** POST /v5/earn/pwm/asset-manager/settle-profit */ -export interface SettlePwmFundProfitParamsV5 { - fundId: string; - reqLinkId: string; +export interface GetP2POrderMessagesParamsV5 { + orderId: string; + currentPage?: string; + size: string; } ⋮---- -/** POST /v5/earn/pwm/asset-manager/create-fund */ -export interface CreatePwmFundParamsV5 { - fundName: string; - coin: string; - profitShareRate: string; - managementFeeRate: string; - fundIntroduction?: string; - reqLinkId: string; +export interface GetP2PCounterpartyUserInfoParamsV5 { + originalUid: string; + orderId: string; } ⋮---- -/** POST /v5/earn/pwm/asset-manager/create-investment-plan */ -export interface CreatePwmAssetManagerInvestmentPlanDistributionV5 { - productId: string; - amount: string; +export interface GetP2PChatSessionsParamsV5 { + /** Pagination cursor. Pass 0 for the first page. */ + lastId: number; + size: number; + /** 0: unread; 1: read; 2: all. */ + readStatus: 0 | 1 | 2; + type?: 'GROUP' | 'SINGLE'; } ⋮---- -export interface CreatePwmAssetManagerInvestmentPlanParamsV5 { - accountUid: string; - planName: string; - planType: 'stable' | 'advanced' | string; - investmentDistribution: CreatePwmAssetManagerInvestmentPlanDistributionV5[]; - reqLinkId: string; -} +/** Pagination cursor. Pass 0 for the first page. */ ⋮---- -/** GET /v5/earn/pwm/asset-manager/get-investment-plan */ -export interface GetPwmAssetManagerInvestmentPlansParamsV5 { - planId?: string; - status?: string; - subscriptionUid?: string; - limit?: number; - cursor?: string; -} +/** 0: unread; 1: read; 2: all. */ ⋮---- -/** POST /v5/earn/pwm/asset-manager/manage-investment-plan */ -export interface ManagePwmAssetManagerInvestmentPlanFundV5 { - fundId: string; - amount: string; +export interface GetP2PChatSessionIdParamsV5 { + /** Counterparty mask ID from the order detail's targetUserMaskId. */ + userMaskId: string; } ⋮---- -export interface ManagePwmAssetManagerInvestmentPlanParamsV5 { - planId: string; - updateStatus?: 'Closed' | 'Deleted' | string; - updateFunds?: ManagePwmAssetManagerInvestmentPlanFundV5[]; - reqLinkId: string; -} +/** Counterparty mask ID from the order detail's targetUserMaskId. */ ⋮---- -/** GET /v5/earn/pwm/asset-manager/all-order */ -export interface GetPwmAllFundOrdersParamsV5 { - fundId?: string; - orderType?: 'Subscribe' | 'Redeem' | string; - status?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; -} -⋮---- -/** POST /v5/earn/pwm/asset-manager/manage-order */ -export interface ManagePwmFundOrderParamsV5 { +export interface SendP2PChatMessageParamsV5 { + /** Message content, up to 1000 characters. Use the uploaded URL for files. */ + message: string; + contentType: 'str' | 'pic' | 'pdf' | 'video'; + /** AES encrypted session ID. */ + sessionId: string; orderId: string; - action: 'approve' | 'reject' | string; - reqLinkId: string; } ⋮---- -/** POST /v5/earn/pwm/asset-manager/create-sub-account */ -export interface CreatePwmFundSubAccountParamsV5 { - fundId: string; - reqLinkId: string; -} +/** Message content, up to 1000 characters. Use the uploaded URL for files. */ ⋮---- -/** POST /v5/earn/pwm/fund-transfer */ -export interface PwmFundTransferParamsV5 { - transferId: string; - fromUserId: number; - toUserId: number; - amount: string; - coin: string; -} +/** AES encrypted session ID. */ ⋮---- -/** GET /v5/earn/pwm/query-fund-transfer-result */ -export interface GetPwmFundTransferRecordsParamsV5 { - transferId?: string; - fromUserId?: number; +export interface GetP2PChatMessagesParamsV5 { + /** Pagination cursor. Pass 0 to start from the latest message. */ + lastId: number; + /** Page size, up to 30. */ + limit: number; + /** AES encrypted session ID. */ + sessionId: string; } +⋮---- +/** Pagination cursor. Pass 0 to start from the latest message. */ +⋮---- +/** Page size, up to 30. */ +⋮---- +/** AES encrypted session ID. */ ================ -File: src/types/request/v5-earn-token.ts +File: src/types/request/v5-position.ts ================ -/** - * Earn token product (e.g. BYUSDT) — /v5/earn/token/* - */ -⋮---- -export interface GetEarnTokenProductParamsV5 { - /** Currently only BYUSDT */ - coin: string; -} -⋮---- -/** Currently only BYUSDT */ +import { + CategoryV5, + ExecTypeV5, + OrderTriggerByV5, + OrderTypeV5, + PositionIdx, + TPSLModeV5, +} from '../shared-v5'; ⋮---- -export interface PlaceEarnTokenOrderParamsV5 { - coin: string; - orderLinkId: string; - orderType: 'Mint' | 'Redeem'; - amount: string; - /** Mint: FlexibleSaving; Redeem: UNIFIED */ - accountType: 'FlexibleSaving' | 'UNIFIED'; +export interface GetFuturesLeverageParamsV5 { + category: 'linear' | 'inverse'; + symbol?: string; } ⋮---- -/** Mint: FlexibleSaving; Redeem: UNIFIED */ -⋮---- -export interface GetEarnTokenOrderListParamsV5 { - coin: string; - orderLinkId?: string; - orderId?: string; - orderType?: 'Mint' | 'Redeem'; - /** seconds */ - startTime?: number; - /** seconds */ - endTime?: number; - cursor?: string; +export interface PositionInfoParamsV5 { + category: CategoryV5; + symbol?: string; + baseCoin?: string; + settleCoin?: string; limit?: number; + cursor?: string; } ⋮---- -/** seconds */ +export interface SetLeverageParamsV5 { + category: 'linear' | 'inverse'; + symbol: string; + buyLeverage: string; + sellLeverage: string; +} ⋮---- -/** seconds */ +export interface SwitchIsolatedMarginParamsV5 { + category: 'linear' | 'inverse'; + symbol: string; + tradeMode: 0 | 1; + buyLeverage: string; + sellLeverage: string; +} ⋮---- -export interface GetEarnTokenPositionParamsV5 { - coin: string; +export interface SetTPSLModeParamsV5 { + category: 'linear' | 'inverse'; + symbol: string; + tpSlMode: TPSLModeV5; } ⋮---- -export interface GetEarnTokenDailyYieldParamsV5 { - coin: string; - startTime?: number; - endTime?: number; - cursor?: string; - limit?: number; +export interface SwitchPositionModeParamsV5 { + category: 'linear' | 'inverse'; + symbol?: string; + coin?: string; + mode: 0 | 3; } ⋮---- -export interface GetEarnTokenHourlyYieldParamsV5 { - coin: string; - startTime?: number; - endTime?: number; - cursor?: string; - limit?: number; +export interface SetRiskLimitParamsV5 { + category: 'linear' | 'inverse'; + symbol: string; + riskId: number; + positionIdx?: PositionIdx; } ⋮---- -export interface GetEarnTokenHistoryAprParamsV5 { - coin: string; - /** 1 = 7d, 2 = 30d, 3 = 180d */ - range: 1 | 2 | 3; +export interface SetTradingStopParamsV5 { + category: CategoryV5; + symbol: string; + takeProfit?: string; + stopLoss?: string; + trailingStop?: string; + tpTriggerBy?: OrderTriggerByV5; + slTriggerBy?: OrderTriggerByV5; + activePrice?: string; + tpslMode?: TPSLModeV5; + tpSize?: string; + slSize?: string; + tpLimitPrice?: string; + slLimitPrice?: string; + tpOrderType?: OrderTypeV5; + slOrderType?: OrderTypeV5; + positionIdx: PositionIdx; } ⋮---- -/** 1 = 7d, 2 = 30d, 3 = 180d */ - -================ -File: src/types/request/v5-event.ts -================ -export interface GetEventInstrumentsInfoParamsV5 { - symbol?: string; - status?: 'PreLaunch' | 'Trading' | 'Delivering' | 'Closed'; - limit?: number; - cursor?: string; +export interface SetAutoAddMarginParamsV5 { + category: 'linear'; + symbol: string; + autoAddMargin: 0 | 1; + positionIdx?: PositionIdx; } ⋮---- -export interface GetEventOrderbookParamsV5 { +export interface AddOrReduceMarginParamsV5 { + category: 'linear' | 'inverse'; symbol: string; + margin: string; + positionIDex?: PositionIdx; } ⋮---- -export interface GetEventOrderHistoryParamsV5 { +export interface GetExecutionListParamsV5 { + category: CategoryV5; symbol?: string; orderId?: string; orderLinkId?: string; + baseCoin?: string; + settleCoin?: string; // Settle coin, uppercase only. For linear, inverse, option startTime?: number; endTime?: number; + execType?: ExecTypeV5; limit?: number; cursor?: string; } ⋮---- -export interface GetEventActiveOrdersParamsV5 { +settleCoin?: string; // Settle coin, uppercase only. For linear, inverse, option +⋮---- +export interface GetClosedPnLParamsV5 { + category: CategoryV5; symbol?: string; - orderId?: string; - orderLinkId?: string; + startTime?: number; + endTime?: number; limit?: number; cursor?: string; } ⋮---- -export interface GetEventPositionInfoParamsV5 { - symbol?: string; - baseCoin?: string; - settleCoin?: string; - limit?: number; - cursor?: string; +export interface MovePositionParamsV5 { + fromUid: string; + toUid: string; + list: { + category: 'linear' | 'spot' | 'option' | 'inverse'; + symbol: string; + price: string; + side: 'Buy' | 'Sell'; + qty: string; + }[]; } ⋮---- -export interface GetEventTradeHistoryParamsV5 { - symbol: string; - orderId?: string; - orderLinkId?: string; +export interface GetMovePositionHistoryParamsV5 { + category?: 'linear' | 'spot' | 'option'; + symbol?: string; startTime?: number; endTime?: number; - limit?: number; + status?: 'Processing' | 'Filled' | 'Rejected'; + blockTradeId?: string; + limit?: string; cursor?: string; } ⋮---- -export interface GetEventSettlementRecordsParamsV5 { +export interface ConfirmNewRiskLimitParamsV5 { + category: 'linear' | 'inverse'; symbol: string; - orderId?: string; +} +⋮---- +export interface GetClosedOptionsPositionsParamsV5 { + category: 'option'; + symbol?: string; startTime?: number; endTime?: number; limit?: number; cursor?: string; } -⋮---- -export interface SubmitEventQuoteParamsV5 { - symbol: string; - orderLinkId: string; - grossPayoutRatio: string; - amount: string; -} -⋮---- -export interface CancelEventQuoteParamsV5 { - orderLinkId?: string; - orderId?: string; -} ================ -File: src/types/request/v5-p2p-trading.ts +File: src/types/request/v5-rfq.ts ================ -export interface GetP2PAccountCoinsBalanceParamsV5 { - memberId?: string; - accountType: string; - coin?: string; - withBonus?: 0 | 1; -} -⋮---- -export interface GetP2POnlineAdsParamsV5 { - tokenId: string; - currencyId: string; - side: '0' | '1'; // 0: buy; 1: sell - page?: string; - size?: string; +export interface RFQTransactionV5 { + category: 'spot' | 'linear' | 'inverse' | 'option'; // Product type + symbol: string; // Name of the trading contract + side: 'buy' | 'sell'; // Inquiry transaction direction + qty: string; // Transaction quantity + isLeverage?: boolean; // For spot lending, default false } ⋮---- -side: '0' | '1'; // 0: buy; 1: sell +category: 'spot' | 'linear' | 'inverse' | 'option'; // Product type +symbol: string; // Name of the trading contract +side: 'buy' | 'sell'; // Inquiry transaction direction +qty: string; // Transaction quantity +isLeverage?: boolean; // For spot lending, default false ⋮---- -export interface P2PTradingPreferenceSetV5 { - hasUnPostAd?: 0 | 1; - isKyc?: 0 | 1; - isEmail?: 0 | 1; - isMobile?: 0 | 1; - hasRegisterTime?: 0 | 1; - registerTimeThreshold?: number; - orderFinishNumberDay30?: number; - completeRateDay30?: string; - nationalLimit?: string; - hasOrderFinishNumberDay30?: 0 | 1; - hasCompleteRateDay30?: 0 | 1; - hasNationalLimit?: 0 | 1; +export interface RFQHedgeLegV5 { + category: string; + symbol: string; + side: string; + qty: string; + price?: string; } ⋮---- -export interface CreateP2PAdParamsV5 { - tokenId: string; - currencyId: string; - side: '0' | '1'; // 0: buy; 1: sell - priceType: '0' | '1'; // 0: fixed rate; 1: floating rate - premium: string; - price: string; - minAmount: string; - maxAmount: string; - remark: string; - tradingPreferenceSet: P2PTradingPreferenceSetV5; - paymentIds: string[]; - quantity: string; - paymentPeriod: string; - itemType: 'ORIGIN' | 'BULK'; +export interface CreateRFQParamsV5 { + counterparties: string[]; // Array of deskCode + rfqLinkId?: string; // Custom ID for inquiry form, 1-32 characters + anonymous?: boolean; // Whether it is anonymous inquiry, default false + strategyType?: string; // Inquiry label, max 36 characters + list: RFQTransactionV5[]; // Transaction list, up to 10 sets + hedge?: RFQHedgeLegV5[]; } ⋮---- -side: '0' | '1'; // 0: buy; 1: sell -priceType: '0' | '1'; // 0: fixed rate; 1: floating rate +counterparties: string[]; // Array of deskCode +rfqLinkId?: string; // Custom ID for inquiry form, 1-32 characters +anonymous?: boolean; // Whether it is anonymous inquiry, default false +strategyType?: string; // Inquiry label, max 36 characters +list: RFQTransactionV5[]; // Transaction list, up to 10 sets ⋮---- -export interface UpdateP2PAdParamsV5 { - id: string; - priceType: '0' | '1'; // 0: fixed rate; 1: floating rate - premium: string; - price: string; - minAmount: string; - maxAmount: string; - remark: string; - tradingPreferenceSet: P2PTradingPreferenceSetV5; - paymentIds: string[]; - actionType: 'MODIFY' | 'ACTIVE'; // MODIFY: modify adv; ACTIVE: reonline adv - quantity: string; - paymentPeriod: string; - itemType?: 'ORIGIN' | 'BULK'; - subsidyAd?: boolean; - securityRiskToken?: string; +export interface CancelRFQParamsV5 { + rfqId?: string; // Inquiry ID + rfqLinkId?: string; // Inquiry Custom ID } ⋮---- -priceType: '0' | '1'; // 0: fixed rate; 1: floating rate -⋮---- -actionType: 'MODIFY' | 'ACTIVE'; // MODIFY: modify adv; ACTIVE: reonline adv +rfqId?: string; // Inquiry ID +rfqLinkId?: string; // Inquiry Custom ID ⋮---- -export interface GetP2PPersonalAdsParamsV5 { - itemId?: string; - status?: '1' | '2'; // 1: Sold Out; 2: Available - side?: '0' | '1'; // 0: buy; 1: sell - tokenId?: string; - page?: string; - size?: string; - currencyId?: string; +export interface RFQQuoteV5 { + category: 'spot' | 'linear' | 'option'; // Product type + symbol: string; // Name of the trading contract + price: string; // Quote price + isLeverage?: boolean; // For spot lending, default false } ⋮---- -status?: '1' | '2'; // 1: Sold Out; 2: Available -side?: '0' | '1'; // 0: buy; 1: sell -⋮---- -export interface GetP2POrdersParamsV5 { - status?: number; - beginTime?: string; - endTime?: string; - tokenId?: string; - side?: number[]; - page: number; - size: number; -} +category: 'spot' | 'linear' | 'option'; // Product type +symbol: string; // Name of the trading contract +price: string; // Quote price +isLeverage?: boolean; // For spot lending, default false ⋮---- -export interface GetP2PPendingOrdersParamsV5 { - status?: number; - beginTime?: string; - endTime?: string; - tokenId?: string; - side?: number[]; - page: number; - size: number; +export interface CreateRFQQuoteParamsV5 { + rfqId: string; // Inquiry ID + quoteLinkId?: string; // Quotation custom ID, 1-32 characters + anonymous?: boolean; // Whether it is anonymous quotation, default false + expiresIn?: number; // Validity period in seconds, default 60 + quoteBuyList?: RFQQuoteV5[]; // Quotation buy direction + quoteSellList?: RFQQuoteV5[]; // Quotation sell direction } ⋮---- -export interface MarkP2POrderAsPaidParamsV5 { - orderId: string; - paymentType: string; - paymentId: string; -} +rfqId: string; // Inquiry ID +quoteLinkId?: string; // Quotation custom ID, 1-32 characters +anonymous?: boolean; // Whether it is anonymous quotation, default false +expiresIn?: number; // Validity period in seconds, default 60 +quoteBuyList?: RFQQuoteV5[]; // Quotation buy direction +quoteSellList?: RFQQuoteV5[]; // Quotation sell direction ⋮---- -export interface SendP2POrderMessageParamsV5 { - message: string; - contentType: string; - orderId: string; - msgUuid?: string; - fileName?: string; +export interface ExecuteRFQQuoteParamsV5 { + rfqId: string; // Inquiry ID + quoteId: string; // Quotation ID + quoteSide: 'buy' | 'sell'; // The direction of the quote + isHedge?: boolean; } ⋮---- -export interface GetP2POrderMessagesParamsV5 { - orderId: string; - currentPage?: string; - size: string; -} +rfqId: string; // Inquiry ID +quoteId: string; // Quotation ID +quoteSide: 'buy' | 'sell'; // The direction of the quote ⋮---- -export interface GetP2PCounterpartyUserInfoParamsV5 { - originalUid: string; - orderId: string; +export interface GetRFQDetailsParamsV5 { + rfqId?: string; + rfqLinkId?: string; + status?: + | 'Active' + | 'PendingFill' + | 'Canceled' + | 'Filled' + | 'Expired' + | 'Failed'; + traderType?: 'quote' | 'request'; + startTime?: number; + endTime?: number; + limit?: number; + cursor?: string; } ⋮---- -export interface GetP2PChatSessionsParamsV5 { - /** Pagination cursor. Pass 0 for the first page. */ - lastId: number; - size: number; - /** 0: unread; 1: read; 2: all. */ - readStatus: 0 | 1 | 2; - type?: 'GROUP' | 'SINGLE'; +export interface CancelRFQQuoteParamsV5 { + quoteId?: string; // Quotation ID + rfqId?: string; // Inquiry ID + quoteLinkId?: string; // Quotation Custom ID } ⋮---- -/** Pagination cursor. Pass 0 for the first page. */ -⋮---- -/** 0: unread; 1: read; 2: all. */ +quoteId?: string; // Quotation ID +rfqId?: string; // Inquiry ID +quoteLinkId?: string; // Quotation Custom ID ⋮---- -export interface GetP2PChatSessionIdParamsV5 { - /** Counterparty mask ID from the order detail's targetUserMaskId. */ - userMaskId: string; +export interface GetRFQRealtimeParamsV5 { + rfqId?: string; // Inquiry ID + rfqLinkId?: string; // Inquiry Custom ID + traderType?: 'quote' | 'request'; // Trader type, default 'request' } ⋮---- -/** Counterparty mask ID from the order detail's targetUserMaskId. */ +rfqId?: string; // Inquiry ID +rfqLinkId?: string; // Inquiry Custom ID +traderType?: 'quote' | 'request'; // Trader type, default 'request' ⋮---- -export interface SendP2PChatMessageParamsV5 { - /** Message content, up to 1000 characters. Use the uploaded URL for files. */ - message: string; - contentType: 'str' | 'pic' | 'pdf' | 'video'; - /** AES encrypted session ID. */ - sessionId: string; - orderId: string; +export interface GetRFQListParamsV5 { + rfqId?: string; // Inquiry ID + rfqLinkId?: string; // Custom ID for inquiry form + traderType?: 'quoter' | 'request'; // Trader type, default 'request' + status?: + | 'Active' + | 'Canceled' + | 'PendingFill' + | 'Filled' + | 'Expired' + | 'Failed'; // Status of the inquiry form + limit?: number; // Return number of items, max 100, default 50 + cursor?: string; // Page turning mark } ⋮---- -/** Message content, up to 1000 characters. Use the uploaded URL for files. */ +rfqId?: string; // Inquiry ID +rfqLinkId?: string; // Custom ID for inquiry form +traderType?: 'quoter' | 'request'; // Trader type, default 'request' ⋮---- -/** AES encrypted session ID. */ +| 'Failed'; // Status of the inquiry form +limit?: number; // Return number of items, max 100, default 50 +cursor?: string; // Page turning mark ⋮---- -export interface GetP2PChatMessagesParamsV5 { - /** Pagination cursor. Pass 0 to start from the latest message. */ - lastId: number; - /** Page size, up to 30. */ - limit: number; - /** AES encrypted session ID. */ - sessionId: string; +export interface GetRFQQuoteRealtimeParamsV5 { + rfqId?: string; // Inquiry ID + quoteId?: string; // Quotation ID + quoteLinkId?: string; // Quotation Custom ID + traderType?: 'quote' | 'request'; // Trader type, default 'quote' } ⋮---- -/** Pagination cursor. Pass 0 to start from the latest message. */ +rfqId?: string; // Inquiry ID +quoteId?: string; // Quotation ID +quoteLinkId?: string; // Quotation Custom ID +traderType?: 'quote' | 'request'; // Trader type, default 'quote' ⋮---- -/** Page size, up to 30. */ +export interface GetRFQHistoryParamsV5 { + rfqId?: string; // Inquiry ID + quoteId?: string; // Quotation ID + quoteLinkId?: string; // Quotation custom ID, can only check last 3 months + traderType?: 'quote' | 'request'; // Trader type, default 'quote' + status?: + | 'Active' + | 'Canceled' + | 'PendingFill' + | 'Filled' + | 'Expired' + | 'Failed'; // Status of quotation + limit?: number; // Return number of items, max 100, default 50 + cursor?: string; // Page turning mark +} ⋮---- -/** AES encrypted session ID. */ +rfqId?: string; // Inquiry ID +quoteId?: string; // Quotation ID +quoteLinkId?: string; // Quotation custom ID, can only check last 3 months +traderType?: 'quote' | 'request'; // Trader type, default 'quote' +⋮---- +| 'Failed'; // Status of quotation +limit?: number; // Return number of items, max 100, default 50 +cursor?: string; // Page turning mark +⋮---- +export interface GetRFQTradeListParamsV5 { + rfqId?: string; // Inquiry ID + rfqLinkId?: string; // Custom ID for inquiry form, can only check last 3 months + quoteId?: string; // Quotation ID + quoteLinkId?: string; // Quotation custom ID, can only check last 3 months + status?: 'Filled' | 'Rejected'; // Status + limit?: number; // Return number of items, max 100, default 50 + cursor?: string; // Page turning mark +} +⋮---- +rfqId?: string; // Inquiry ID +rfqLinkId?: string; // Custom ID for inquiry form, can only check last 3 months +quoteId?: string; // Quotation ID +quoteLinkId?: string; // Quotation custom ID, can only check last 3 months +status?: 'Filled' | 'Rejected'; // Status +limit?: number; // Return number of items, max 100, default 50 +cursor?: string; // Page turning mark +⋮---- +export interface GetRFQPublicTradesParamsV5 { + startTime?: number; // Timestamp in milliseconds, time range is 7 days + endTime?: number; // Timestamp in milliseconds, time range is 7 days + limit?: number; // Return number of items, max 100, default 50 + cursor?: string; // Page turning mark +} +⋮---- +startTime?: number; // Timestamp in milliseconds, time range is 7 days +endTime?: number; // Timestamp in milliseconds, time range is 7 days +limit?: number; // Return number of items, max 100, default 50 +cursor?: string; // Page turning mark +⋮---- +export interface AcceptNonLPQuoteParamsV5 { + rfqId: string; // Inquiry ID +} +⋮---- +rfqId: string; // Inquiry ID ================ -File: src/types/request/v5-position.ts +File: src/types/request/v5-rwa.ts ================ -import { - CategoryV5, - ExecTypeV5, - OrderTriggerByV5, - OrderTypeV5, - PositionIdx, - TPSLModeV5, -} from '../shared-v5'; +/** + * V5 RWA (Real World Assets) earn requests. + */ ⋮---- -export interface GetFuturesLeverageParamsV5 { - category: 'linear' | 'inverse'; - symbol?: string; +export interface GetRWAProductListParamsV5 { + coin?: string; } ⋮---- -export interface PositionInfoParamsV5 { - category: CategoryV5; - symbol?: string; - baseCoin?: string; - settleCoin?: string; +export interface PlaceRWAOrderParamsV5 { + productId: number; + orderType: 'Stake' | 'Redeem'; + coin: string; + orderLinkId: string; + stakeAmount?: string; + redeemShares?: string; + accountType?: 'FUND' | 'UNIFIED'; +} +⋮---- +export interface GetRWAOrderListParamsV5 { + orderId?: string; + orderLinkId?: string; + orderType?: 'Stake' | 'Redeem'; + productId?: number; + startTime?: number; + endTime?: number; limit?: number; cursor?: string; } ⋮---- -export interface SetLeverageParamsV5 { - category: 'linear' | 'inverse'; - symbol: string; - buyLeverage: string; - sellLeverage: string; +export interface GetRWANavChartParamsV5 { + productId: number; + startTime?: number; + endTime?: number; +} + +================ +File: src/types/request/v5-spot-x.ts +================ +export interface GetLaunchpoolProjectListParamsV5 { + status: number; + activityCoin?: string; + projectId?: string; + cursor?: string; + limit?: number; } ⋮---- -export interface SwitchIsolatedMarginParamsV5 { - category: 'linear' | 'inverse'; - symbol: string; - tradeMode: 0 | 1; - buyLeverage: string; - sellLeverage: string; +export interface GetLaunchpoolUserActivityLogParamsV5 { + stakeCoin?: string; + type?: number; + status?: number; + startTime?: string; + endTime?: string; + pageSize?: number; + current?: number; } ⋮---- -export interface SetTPSLModeParamsV5 { - category: 'linear' | 'inverse'; - symbol: string; - tpSlMode: TPSLModeV5; +export interface GetLaunchpoolUserHistoryParamsV5 { + stakeCoin?: string; + rewardCoin?: string; + startTime?: string; + endTime?: string; + pageSize?: number; + current?: number; } ⋮---- -export interface SwitchPositionModeParamsV5 { - category: 'linear' | 'inverse'; - symbol?: string; - coin?: string; - mode: 0 | 3; +export interface GetPuzzleProjectListParamsV5 { + status: number; + projectId?: string; + activityCoin?: string; + cursor?: string; + limit?: number; } ⋮---- -export interface SetRiskLimitParamsV5 { - category: 'linear' | 'inverse'; - symbol: string; - riskId: number; - positionIdx?: PositionIdx; +export interface GetTokenSplashProjectListParamsV5 { + status: number; + projectId?: string; + activityCoin?: string; + cursor?: string; + limit?: number; } ⋮---- -export interface SetTradingStopParamsV5 { - category: CategoryV5; +export interface GetTokenSplashUserActivityParamsV5 { + projectId?: string; + activityCoin?: string; +} + +================ +File: src/types/request/v5-spreadtrading.ts +================ +export interface GetSpreadInstrumentsInfoParamsV5 { + symbol?: string; + baseCoin?: string; + limit?: number; + cursor?: string; +} +⋮---- +/** GET /v5/spread/max-qty */ +export interface GetSpreadMaxQtyParamsV5 { symbol: string; - takeProfit?: string; - stopLoss?: string; - trailingStop?: string; - tpTriggerBy?: OrderTriggerByV5; - slTriggerBy?: OrderTriggerByV5; - activePrice?: string; - tpslMode?: TPSLModeV5; - tpSize?: string; - slSize?: string; - tpLimitPrice?: string; - slLimitPrice?: string; - tpOrderType?: OrderTypeV5; - slOrderType?: OrderTypeV5; - positionIdx: PositionIdx; + /** 1: Buy, 2: Sell */ + side: '1' | '2'; + orderPrice: string; } ⋮---- -export interface SetAutoAddMarginParamsV5 { - category: 'linear'; +/** 1: Buy, 2: Sell */ +⋮---- +export interface SubmitSpreadOrderParamsV5 { symbol: string; - autoAddMargin: 0 | 1; - positionIdx?: PositionIdx; + side: 'Buy' | 'Sell'; + orderType: 'Limit' | 'Market'; + qty: string; + price: string; + orderLinkId: string; + timeInForce: 'IOC' | 'FOK' | 'GTC' | 'PostOnly'; } ⋮---- -export interface AddOrReduceMarginParamsV5 { - category: 'linear' | 'inverse'; +export interface AmendSpreadOrderParamsV5 { symbol: string; - margin: string; - positionIDex?: PositionIdx; + orderId?: string; + orderLinkId?: string; + qty?: string; + price?: string; } ⋮---- -export interface GetExecutionListParamsV5 { - category: CategoryV5; +export interface GetSpreadOpenOrdersParamsV5 { symbol?: string; + baseCoin?: string; orderId?: string; orderLinkId?: string; + limit?: number; + cursor?: string; +} +export interface GetSpreadOrderHistoryParamsV5 { + symbol?: string; baseCoin?: string; - settleCoin?: string; // Settle coin, uppercase only. For linear, inverse, option + orderId?: string; + orderLinkId?: string; startTime?: number; endTime?: number; - execType?: ExecTypeV5; limit?: number; cursor?: string; } ⋮---- -settleCoin?: string; // Settle coin, uppercase only. For linear, inverse, option -⋮---- -export interface GetClosedPnLParamsV5 { - category: CategoryV5; - symbol?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; -} -⋮---- -export interface MovePositionParamsV5 { - fromUid: string; - toUid: string; - list: { - category: 'linear' | 'spot' | 'option' | 'inverse'; - symbol: string; - price: string; - side: 'Buy' | 'Sell'; - qty: string; - }[]; -} -⋮---- -export interface GetMovePositionHistoryParamsV5 { - category?: 'linear' | 'spot' | 'option'; - symbol?: string; - startTime?: number; - endTime?: number; - status?: 'Processing' | 'Filled' | 'Rejected'; - blockTradeId?: string; - limit?: string; - cursor?: string; -} -⋮---- -export interface ConfirmNewRiskLimitParamsV5 { - category: 'linear' | 'inverse'; - symbol: string; -} -⋮---- -export interface GetClosedOptionsPositionsParamsV5 { - category: 'option'; +export interface GetSpreadTradeHistoryParamsV5 { symbol?: string; + orderId?: string; + orderLinkId?: string; startTime?: number; endTime?: number; limit?: number; @@ -4854,887 +4989,555 @@ export interface GetClosedOptionsPositionsParamsV5 { } ================ -File: src/types/request/v5-rfq.ts +File: src/types/request/v5-strategy.ts ================ -export interface RFQTransactionV5 { - category: 'spot' | 'linear' | 'inverse' | 'option'; // Product type - symbol: string; // Name of the trading contract - side: 'buy' | 'sell'; // Inquiry transaction direction - qty: string; // Transaction quantity - isLeverage?: boolean; // For spot lending, default false -} -⋮---- -category: 'spot' | 'linear' | 'inverse' | 'option'; // Product type -symbol: string; // Name of the trading contract -side: 'buy' | 'sell'; // Inquiry transaction direction -qty: string; // Transaction quantity -isLeverage?: boolean; // For spot lending, default false +import { + OrderSideV5, + PositionIdx, + PovModeV5, + StrategyCategoryV5, + StrategyPreferV5, + StrategyTypeV5, +} from '../shared-v5'; ⋮---- -export interface RFQHedgeLegV5 { - category: string; +/** POST /v5/strategy/create */ +export interface CreateStrategyOrderParamsV5 { + category: StrategyCategoryV5; symbol: string; - side: string; - qty: string; - price?: string; -} -⋮---- -export interface CreateRFQParamsV5 { - counterparties: string[]; // Array of deskCode - rfqLinkId?: string; // Custom ID for inquiry form, 1-32 characters - anonymous?: boolean; // Whether it is anonymous inquiry, default false - strategyType?: string; // Inquiry label, max 36 characters - list: RFQTransactionV5[]; // Transaction list, up to 10 sets - hedge?: RFQHedgeLegV5[]; + side: OrderSideV5; + strategyType: StrategyTypeV5; + /** Total order quantity (coin). Either size or positionValue is required */ + size?: string; + /** Total order quantity (value). Either size or positionValue is required */ + positionValue?: string; + reduceOnly?: boolean; + positionIdx?: PositionIdx; + /** Spot leverage type. 0: normal, 1: borrow to trade (UTA_SPOT only) */ + leverageType?: 0 | 1; + /** TWAP / POV: total execution duration (seconds). Range [300, 86400]; TWAP must be divisible by interval */ + duration?: number; + /** TWAP / POV: sub-order placement interval (seconds) */ + interval?: 5 | 10 | 15 | 30 | 60 | 120; + /** TWAP: randomize each sub-order quantity by ±20% */ + isRandom?: boolean; + /** Advanced: activate when market price reaches this value */ + triggerPrice?: string; + /** Advanced: terminate when last traded price reaches this value */ + maxChasePrice?: string; + /** Limit chase: absolute distance from best bid/ask. Mutually exclusive with chasePercentE4 */ + chaseDistance?: string; + /** Limit chase: offset in basis points (1/10000). Mutually exclusive with chaseDistance */ + chasePercentE4?: number; + /** Chase / Iceberg: reference price side, e.g. Bid1, Ask1 */ + chasePrice?: string; + strategyPrefer?: StrategyPreferV5; + limitPrice?: string; + strategySl?: string; + strategyTp?: string; + /** Iceberg: 0 = taker allowed, 1 = post-only */ + postOnly?: 0 | 1; + isRebalance?: boolean; + /** 1: market, 2: limit */ + orderType?: 1 | 2; + orderPriceOffset?: string; + strategyName?: string; + /** POV execution mode */ + mode?: PovModeV5; + /** POV participation rate */ + participationRate?: string; + /** POV: historical traded volume window (seconds), range [60, 14400] */ + referenceWindow?: string; + /** POV: book depth reference levels [1, 10] */ + depthReference?: string; } ⋮---- -counterparties: string[]; // Array of deskCode -rfqLinkId?: string; // Custom ID for inquiry form, 1-32 characters -anonymous?: boolean; // Whether it is anonymous inquiry, default false -strategyType?: string; // Inquiry label, max 36 characters -list: RFQTransactionV5[]; // Transaction list, up to 10 sets +/** Total order quantity (coin). Either size or positionValue is required */ ⋮---- -export interface CancelRFQParamsV5 { - rfqId?: string; // Inquiry ID - rfqLinkId?: string; // Inquiry Custom ID -} +/** Total order quantity (value). Either size or positionValue is required */ ⋮---- -rfqId?: string; // Inquiry ID -rfqLinkId?: string; // Inquiry Custom ID +/** Spot leverage type. 0: normal, 1: borrow to trade (UTA_SPOT only) */ ⋮---- -export interface RFQQuoteV5 { - category: 'spot' | 'linear' | 'option'; // Product type - symbol: string; // Name of the trading contract - price: string; // Quote price - isLeverage?: boolean; // For spot lending, default false -} +/** TWAP / POV: total execution duration (seconds). Range [300, 86400]; TWAP must be divisible by interval */ ⋮---- -category: 'spot' | 'linear' | 'option'; // Product type -symbol: string; // Name of the trading contract -price: string; // Quote price -isLeverage?: boolean; // For spot lending, default false +/** TWAP / POV: sub-order placement interval (seconds) */ ⋮---- -export interface CreateRFQQuoteParamsV5 { - rfqId: string; // Inquiry ID - quoteLinkId?: string; // Quotation custom ID, 1-32 characters - anonymous?: boolean; // Whether it is anonymous quotation, default false - expiresIn?: number; // Validity period in seconds, default 60 - quoteBuyList?: RFQQuoteV5[]; // Quotation buy direction - quoteSellList?: RFQQuoteV5[]; // Quotation sell direction -} +/** TWAP: randomize each sub-order quantity by ±20% */ ⋮---- -rfqId: string; // Inquiry ID -quoteLinkId?: string; // Quotation custom ID, 1-32 characters -anonymous?: boolean; // Whether it is anonymous quotation, default false -expiresIn?: number; // Validity period in seconds, default 60 -quoteBuyList?: RFQQuoteV5[]; // Quotation buy direction -quoteSellList?: RFQQuoteV5[]; // Quotation sell direction +/** Advanced: activate when market price reaches this value */ ⋮---- -export interface ExecuteRFQQuoteParamsV5 { - rfqId: string; // Inquiry ID - quoteId: string; // Quotation ID - quoteSide: 'buy' | 'sell'; // The direction of the quote - isHedge?: boolean; -} +/** Advanced: terminate when last traded price reaches this value */ ⋮---- -rfqId: string; // Inquiry ID -quoteId: string; // Quotation ID -quoteSide: 'buy' | 'sell'; // The direction of the quote +/** Limit chase: absolute distance from best bid/ask. Mutually exclusive with chasePercentE4 */ ⋮---- -export interface GetRFQDetailsParamsV5 { - rfqId?: string; - rfqLinkId?: string; - status?: - | 'Active' - | 'PendingFill' - | 'Canceled' - | 'Filled' - | 'Expired' - | 'Failed'; - traderType?: 'quote' | 'request'; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; -} +/** Limit chase: offset in basis points (1/10000). Mutually exclusive with chaseDistance */ ⋮---- -export interface CancelRFQQuoteParamsV5 { - quoteId?: string; // Quotation ID - rfqId?: string; // Inquiry ID - quoteLinkId?: string; // Quotation Custom ID -} +/** Chase / Iceberg: reference price side, e.g. Bid1, Ask1 */ ⋮---- -quoteId?: string; // Quotation ID -rfqId?: string; // Inquiry ID -quoteLinkId?: string; // Quotation Custom ID +/** Iceberg: 0 = taker allowed, 1 = post-only */ ⋮---- -export interface GetRFQRealtimeParamsV5 { - rfqId?: string; // Inquiry ID - rfqLinkId?: string; // Inquiry Custom ID - traderType?: 'quote' | 'request'; // Trader type, default 'request' -} +/** 1: market, 2: limit */ ⋮---- -rfqId?: string; // Inquiry ID -rfqLinkId?: string; // Inquiry Custom ID -traderType?: 'quote' | 'request'; // Trader type, default 'request' +/** POV execution mode */ ⋮---- -export interface GetRFQListParamsV5 { - rfqId?: string; // Inquiry ID - rfqLinkId?: string; // Custom ID for inquiry form - traderType?: 'quoter' | 'request'; // Trader type, default 'request' - status?: - | 'Active' - | 'Canceled' - | 'PendingFill' - | 'Filled' - | 'Expired' - | 'Failed'; // Status of the inquiry form - limit?: number; // Return number of items, max 100, default 50 - cursor?: string; // Page turning mark -} +/** POV participation rate */ ⋮---- -rfqId?: string; // Inquiry ID -rfqLinkId?: string; // Custom ID for inquiry form -traderType?: 'quoter' | 'request'; // Trader type, default 'request' +/** POV: historical traded volume window (seconds), range [60, 14400] */ ⋮---- -| 'Failed'; // Status of the inquiry form -limit?: number; // Return number of items, max 100, default 50 -cursor?: string; // Page turning mark +/** POV: book depth reference levels [1, 10] */ ⋮---- -export interface GetRFQQuoteRealtimeParamsV5 { - rfqId?: string; // Inquiry ID - quoteId?: string; // Quotation ID - quoteLinkId?: string; // Quotation Custom ID - traderType?: 'quote' | 'request'; // Trader type, default 'quote' +/** GET /v5/strategy/list */ +export interface GetStrategyListParamsV5 { + strategyId?: string; + symbol?: string; + /** 2: running, 3: terminated, 4: terminated unfilled, 5: paused, 6: untriggered */ + status?: '2' | '3' | '4' | '5' | '6'; + category?: StrategyCategoryV5; + strategyType?: StrategyTypeV5; + beginTimeE0?: number; + endTimeE0?: number; + pageSize?: number; + cursor?: string; } ⋮---- -rfqId?: string; // Inquiry ID -quoteId?: string; // Quotation ID -quoteLinkId?: string; // Quotation Custom ID -traderType?: 'quote' | 'request'; // Trader type, default 'quote' +/** 2: running, 3: terminated, 4: terminated unfilled, 5: paused, 6: untriggered */ ⋮---- -export interface GetRFQHistoryParamsV5 { - rfqId?: string; // Inquiry ID - quoteId?: string; // Quotation ID - quoteLinkId?: string; // Quotation custom ID, can only check last 3 months - traderType?: 'quote' | 'request'; // Trader type, default 'quote' - status?: - | 'Active' - | 'Canceled' - | 'PendingFill' - | 'Filled' - | 'Expired' - | 'Failed'; // Status of quotation - limit?: number; // Return number of items, max 100, default 50 - cursor?: string; // Page turning mark +/** GET /v5/strategy/order-list */ +export interface GetStrategyOrderListParamsV5 { + strategyId: string; + /** 2: created, 3: create failed, 4: partially filled, 5: fully filled, 6: rejected, 7: canceled */ + status?: '2' | '3' | '4' | '5' | '6' | '7'; + symbol?: string; + strategyType?: StrategyTypeV5; + beginTimeE0?: number; + endTimeE0?: number; + pageSize?: number; + cursor?: string; } ⋮---- -rfqId?: string; // Inquiry ID -quoteId?: string; // Quotation ID -quoteLinkId?: string; // Quotation custom ID, can only check last 3 months -traderType?: 'quote' | 'request'; // Trader type, default 'quote' +/** 2: created, 3: create failed, 4: partially filled, 5: fully filled, 6: rejected, 7: canceled */ ⋮---- -| 'Failed'; // Status of quotation -limit?: number; // Return number of items, max 100, default 50 -cursor?: string; // Page turning mark +/** POST /v5/strategy/stop */ +export interface StopStrategyParamsV5 { + strategyId: string; +} + +================ +File: src/types/request/v5-tax.ts +================ +export type TaxReportTypeV5 = + | 'ALL' + | 'TRADE' + | 'P&L' + | 'EARN' + | 'DEPOSIT&WITHDRAWAL' + | 'BONUS' + | 'AIRDROP' + | 'CARD'; ⋮---- -export interface GetRFQTradeListParamsV5 { - rfqId?: string; // Inquiry ID - rfqLinkId?: string; // Custom ID for inquiry form, can only check last 3 months - quoteId?: string; // Quotation ID - quoteLinkId?: string; // Quotation custom ID, can only check last 3 months - status?: 'Filled' | 'Rejected'; // Status - limit?: number; // Return number of items, max 100, default 50 - cursor?: string; // Page turning mark +export interface TaxBatchExportItemV5 { + type: TaxReportTypeV5; + /** Subcategory number. Required but ignored when type is ALL; pass "". */ + number: string; } ⋮---- -rfqId?: string; // Inquiry ID -rfqLinkId?: string; // Custom ID for inquiry form, can only check last 3 months -quoteId?: string; // Quotation ID -quoteLinkId?: string; // Quotation custom ID, can only check last 3 months -status?: 'Filled' | 'Rejected'; // Status -limit?: number; // Return number of items, max 100, default 50 -cursor?: string; // Page turning mark +/** Subcategory number. Required but ignored when type is ALL; pass "". */ ⋮---- -export interface GetRFQPublicTradesParamsV5 { - startTime?: number; // Timestamp in milliseconds, time range is 7 days - endTime?: number; // Timestamp in milliseconds, time range is 7 days - limit?: number; // Return number of items, max 100, default 50 - cursor?: string; // Page turning mark +/** POST /v5/fht/compliance/tax/private/batch_create */ +export interface CreateTaxBatchExportParamsV5 { + /** UNIX seconds. Must be within the last 18 months. */ + startTime: number; + /** UNIX seconds. Later than startTime, span at most 12 months. */ + endTime: number; + items: TaxBatchExportItemV5[]; + sourceInstitution?: string; + /** orc is the default when omitted */ + exportFileType?: 'orc' | 'csv'; } ⋮---- -startTime?: number; // Timestamp in milliseconds, time range is 7 days -endTime?: number; // Timestamp in milliseconds, time range is 7 days -limit?: number; // Return number of items, max 100, default 50 -cursor?: string; // Page turning mark +/** UNIX seconds. Must be within the last 18 months. */ ⋮---- -export interface AcceptNonLPQuoteParamsV5 { - rfqId: string; // Inquiry ID -} +/** UNIX seconds. Later than startTime, span at most 12 months. */ ⋮---- -rfqId: string; // Inquiry ID +/** orc is the default when omitted */ +⋮---- +/** GET /v5/fht/compliance/tax/private/batch_query */ +export interface GetTaxBatchExportParamsV5 { + batchId: string; +} ================ -File: src/types/request/v5-rwa.ts +File: src/types/response/contract.ts ================ -/** - * V5 RWA (Real World Assets) earn requests. - */ -⋮---- -export interface GetRWAProductListParamsV5 { - coin?: string; +/* eslint-disable @typescript-eslint/no-explicit-any */ +export interface PaginatedResult { + nextPageCursor: string; + list: TList[]; } -⋮---- -export interface PlaceRWAOrderParamsV5 { - productId: number; - orderType: 'Stake' | 'Redeem'; - coin: string; - orderLinkId: string; - stakeAmount?: string; - redeemShares?: string; - accountType?: 'FUND' | 'UNIFIED'; +export interface ContractListResult { + category: string; + list: TList[]; } ⋮---- -export interface GetRWAOrderListParamsV5 { - orderId?: string; - orderLinkId?: string; - orderType?: 'Stake' | 'Redeem'; - productId?: number; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; +export interface ContractHistoricOrder { + symbol: string; + orderId: string; + orderLinkId: string; + side: string; + orderType: string; + price: string; + iv: string; + qty: string; + timeInForce: string; + orderStatus: string; + positionIdx: number; + lastPriceOnCreated: string; + createdTime: string; + updatedTime: string; + cancelType: string; + rejectReason: string; + stopOrderType: string; + triggerDirection: number; + triggerBy: string; + triggerPrice: string; + cumExecValue: string; + cumExecFee: string; + cumExecQty: string; + leavesValue: string; + leavesQty: string; + takeProfit: string; + stopLoss: string; + tpslMode: string; + tpLimitPrice: string; + slLimitPrice: string; + tpTriggerBy: string; + slTriggerBy: string; + reduceOnly: boolean; + closeOnTrigger: boolean; + blockTradeId: string; + smpType: string; + smpGroup: string; + smpOrderId: string; } ⋮---- -export interface GetRWANavChartParamsV5 { - productId: number; - startTime?: number; - endTime?: number; +export interface ContractSymbolTicker { + symbol: string; + bidPrice: string; + askPrice: string; + lastPrice: string; + lastTickDirection: string; + prevPrice24h: string; + price24hPcnt: string; + highPrice24h: string; + lowPrice24h: string; + prevPrice1h: string; + markPrice: string; + indexPrice: string; + openInterest: string; + turnover24h: string; + volume24h: string; + fundingRate: string; + nextFundingTime: string; + predictedDeliveryPrice: string; + basisRate: string; + deliveryFeeRate: string; + deliveryTime: string; } ================ -File: src/types/request/v5-spot-x.ts +File: src/types/response/v5-alpha-lp.ts ================ -export interface GetLaunchpoolProjectListParamsV5 { - status: number; - activityCoin?: string; - projectId?: string; - cursor?: string; - limit?: number; +/** + * V5 private Alpha LP responses. + */ +⋮---- +export interface AlphaLPPoolV5 { + poolAddress: string; + poolName: string; + poolTag: string; + apy: string; + tvl: string; + token0Symbol: string; + token0IconUrlDay: string; + token0IconUrlNight: string; + token1Symbol: string; + token1IconUrlDay: string; + token1IconUrlNight: string; + chainCode: string; + chainIconUrl: string; } ⋮---- -export interface GetLaunchpoolUserActivityLogParamsV5 { - stakeCoin?: string; - type?: number; - status?: number; - startTime?: string; - endTime?: string; - pageSize?: number; - current?: number; +export interface AlphaLPPoolListResultV5 { + pools: AlphaLPPoolV5[]; } ⋮---- -export interface GetLaunchpoolUserHistoryParamsV5 { - stakeCoin?: string; - rewardCoin?: string; - startTime?: string; - endTime?: string; - pageSize?: number; - current?: number; +export interface AlphaLPPoolInfoV5 { + poolAddress: string; + poolName: string; + apy: string; + tvl: string; + feeRate: string; + token0Symbol: string; + token0Reserve: string; + token1Symbol: string; + token1Reserve: string; + priceRangeLower: string; + priceRangeUpper: string; + currentPrice: string; } ⋮---- -export interface GetPuzzleProjectListParamsV5 { - status: number; - projectId?: string; - activityCoin?: string; - cursor?: string; - limit?: number; +export interface ExecuteAlphaLPStakeResultV5 { + positionId: number; + orderNo: string; } ⋮---- -export interface GetTokenSplashProjectListParamsV5 { - status: number; - projectId?: string; - activityCoin?: string; - cursor?: string; - limit?: number; +export interface ExecuteAlphaLPRedeemResultV5 { + orderNo: string; } ⋮---- -export interface GetTokenSplashUserActivityParamsV5 { - projectId?: string; - activityCoin?: string; -} - -================ -File: src/types/request/v5-spreadtrading.ts -================ -export interface GetSpreadInstrumentsInfoParamsV5 { - symbol?: string; - baseCoin?: string; - limit?: number; - cursor?: string; +export interface AlphaLPOrderV5 { + orderType: number; + orderNo: string; + orderStatus: number; + poolAddress: string; + poolName: string; + positionId: number; + tokenCode: string; + tokenSymbol: string; + tokenIconUrlDay: string; + tokenIconUrlNight: string; + amount: string; + chainCode: string; + chainIconUrl: string; + gasTokenSymbol: string; + gasOnchain: string; + gasUsd: string | null; + platformFee: string; + platformFeeUsd: string | null; + createTime: number; + executionTime: number; + failureReason?: string; + dercRatio?: string; } ⋮---- -/** GET /v5/spread/max-qty */ -export interface GetSpreadMaxQtyParamsV5 { - symbol: string; - /** 1: Buy, 2: Sell */ - side: '1' | '2'; - orderPrice: string; +export interface AlphaLPOrderListResultV5 { + total: number; + pageIndex: number; + orders: AlphaLPOrderV5[]; } ⋮---- -/** 1: Buy, 2: Sell */ +export interface AlphaLPPayTokenV5 { + tokenCode: string; + tokenSymbol: string; + chainCode: string; + chainIconUrl: string; + decimals: number; + availableBalance: string; + tokenIconUrlDay: string; + tokenIconUrlNight: string; + minStakeAmount: string; + maxStakeAmount: string; +} ⋮---- -export interface SubmitSpreadOrderParamsV5 { - symbol: string; - side: 'Buy' | 'Sell'; - orderType: 'Limit' | 'Market'; - qty: string; - price: string; - orderLinkId: string; - timeInForce: 'IOC' | 'FOK' | 'GTC' | 'PostOnly'; +export interface AlphaLPPayTokenListResultV5 { + tokens: AlphaLPPayTokenV5[]; } ⋮---- -export interface AmendSpreadOrderParamsV5 { - symbol: string; - orderId?: string; - orderLinkId?: string; - qty?: string; - price?: string; +export interface AlphaLPPayTokenPriceV5 { + tokenCode: string; + tokenSymbol: string; + priceUsd: string; + chainCode: string; + updateTime: number; } ⋮---- -export interface GetSpreadOpenOrdersParamsV5 { - symbol?: string; - baseCoin?: string; - orderId?: string; - orderLinkId?: string; - limit?: number; - cursor?: string; +export interface AlphaLPPayTokenPriceResultV5 { + prices: AlphaLPPayTokenPriceV5[]; } -export interface GetSpreadOrderHistoryParamsV5 { - symbol?: string; - baseCoin?: string; - orderId?: string; - orderLinkId?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; +⋮---- +export interface AlphaLPPositionV5 { + positionId: number; + poolAddress: string; + poolName: string; + stakedAmount: string; + stakedTokenCode: string; + stakedTokenSymbol: string; + currentValueUsd: string; + earnedRewardsUsd: string; + unrealizedPnl: string; + realizedPnl: string; + apy: string; + token0Amount: string; + token0Symbol: string; + token1Amount: string; + token1Symbol: string; + rangeUpper: string; + rangeLower: string; + createTime: number; + updateTime: number; + status: number; } ⋮---- -export interface GetSpreadTradeHistoryParamsV5 { - symbol?: string; - orderId?: string; - orderLinkId?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; +export interface AlphaLPPositionListResultV5 { + positions: AlphaLPPositionV5[]; } ================ -File: src/types/request/v5-strategy.ts +File: src/types/response/v5-alpha-prediction.ts ================ -import { - OrderSideV5, - PositionIdx, - PovModeV5, - StrategyCategoryV5, - StrategyPreferV5, - StrategyTypeV5, -} from '../shared-v5'; +/** + * V5 private Alpha prediction market responses. + */ ⋮---- -/** POST /v5/strategy/create */ -export interface CreateStrategyOrderParamsV5 { - category: StrategyCategoryV5; - symbol: string; - side: OrderSideV5; - strategyType: StrategyTypeV5; - /** Total order quantity (coin). Either size or positionValue is required */ - size?: string; - /** Total order quantity (value). Either size or positionValue is required */ - positionValue?: string; - reduceOnly?: boolean; - positionIdx?: PositionIdx; - /** Spot leverage type. 0: normal, 1: borrow to trade (UTA_SPOT only) */ - leverageType?: 0 | 1; - /** TWAP / POV: total execution duration (seconds). Range [300, 86400]; TWAP must be divisible by interval */ - duration?: number; - /** TWAP / POV: sub-order placement interval (seconds) */ - interval?: 5 | 10 | 15 | 30 | 60 | 120; - /** TWAP: randomize each sub-order quantity by ±20% */ - isRandom?: boolean; - /** Advanced: activate when market price reaches this value */ - triggerPrice?: string; - /** Advanced: terminate when last traded price reaches this value */ - maxChasePrice?: string; - /** Limit chase: absolute distance from best bid/ask. Mutually exclusive with chasePercentE4 */ - chaseDistance?: string; - /** Limit chase: offset in basis points (1/10000). Mutually exclusive with chaseDistance */ - chasePercentE4?: number; - /** Chase / Iceberg: reference price side, e.g. Bid1, Ask1 */ - chasePrice?: string; - strategyPrefer?: StrategyPreferV5; - limitPrice?: string; - strategySl?: string; - strategyTp?: string; - /** Iceberg: 0 = taker allowed, 1 = post-only */ - postOnly?: 0 | 1; - isRebalance?: boolean; - /** 1: market, 2: limit */ - orderType?: 1 | 2; - orderPriceOffset?: string; - strategyName?: string; - /** POV execution mode */ - mode?: PovModeV5; - /** POV participation rate */ - participationRate?: string; - /** POV: historical traded volume window (seconds), range [60, 14400] */ - referenceWindow?: string; - /** POV: book depth reference levels [1, 10] */ - depthReference?: string; +export interface AlphaPredictionEngineStatusV5 { + available: boolean; } ⋮---- -/** Total order quantity (coin). Either size or positionValue is required */ -⋮---- -/** Total order quantity (value). Either size or positionValue is required */ -⋮---- -/** Spot leverage type. 0: normal, 1: borrow to trade (UTA_SPOT only) */ +export interface AlphaPredictionPayTokenV5 { + tokenCode: string; + symbol: string; + tokenDecimals: number; + tokenIconUrlDay: string; + tokenIconUrlNight: string; + supportChains: string[]; +} ⋮---- -/** TWAP / POV: total execution duration (seconds). Range [300, 86400]; TWAP must be divisible by interval */ +export interface AlphaPredictionMarketV5 { + tokenId: string; + outcome: string; + price: string; + side: number; + volume: string; + liquidity: string; +} ⋮---- -/** TWAP / POV: sub-order placement interval (seconds) */ +export interface AlphaPredictionEventDetailV5 { + eventId: string; + slug: string; + title: string; + description: string; + category: string; + endDate: number; + resolved: boolean; + volume: string; + liquidity: string; + markets: AlphaPredictionMarketV5[]; +} ⋮---- -/** TWAP: randomize each sub-order quantity by ±20% */ +export interface AlphaPredictionOrderEstimateFeeDetailV5 { + serverFee: string; + polymarketFee: string; +} ⋮---- -/** Advanced: activate when market price reaches this value */ +export interface AlphaPredictionOrderEstimateV5 { + avgPrice: string; + estimatedCost: string; + estimatedReceive: string; + toWin?: string; + feeAmount: string; + feeDetail: AlphaPredictionOrderEstimateFeeDetailV5; + slippage: string; +} ⋮---- -/** Advanced: terminate when last traded price reaches this value */ +export interface ExecuteAlphaPredictionOrderResultV5 { + orderNo: string; +} ⋮---- -/** Limit chase: absolute distance from best bid/ask. Mutually exclusive with chasePercentE4 */ -⋮---- -/** Limit chase: offset in basis points (1/10000). Mutually exclusive with chaseDistance */ -⋮---- -/** Chase / Iceberg: reference price side, e.g. Bid1, Ask1 */ -⋮---- -/** Iceberg: 0 = taker allowed, 1 = post-only */ -⋮---- -/** 1: market, 2: limit */ -⋮---- -/** POV execution mode */ -⋮---- -/** POV participation rate */ -⋮---- -/** POV: historical traded volume window (seconds), range [60, 14400] */ -⋮---- -/** POV: book depth reference levels [1, 10] */ -⋮---- -/** GET /v5/strategy/list */ -export interface GetStrategyListParamsV5 { - strategyId?: string; - symbol?: string; - /** 2: running, 3: terminated, 4: terminated unfilled, 5: paused, 6: untriggered */ - status?: '2' | '3' | '4' | '5' | '6'; - category?: StrategyCategoryV5; - strategyType?: StrategyTypeV5; - beginTimeE0?: number; - endTimeE0?: number; - pageSize?: number; - cursor?: string; +export interface AlphaPredictionOrderV5 { + orderNo: string; + tokenId: string; + eventId: string; + side: number; + orderType: number; + orderAmount: string; + filledSize: string; + filledPrice: string; + totalFee: string; + status: number; + createdAt: number; + updatedAt: number; } ⋮---- -/** 2: running, 3: terminated, 4: terminated unfilled, 5: paused, 6: untriggered */ -⋮---- -/** GET /v5/strategy/order-list */ -export interface GetStrategyOrderListParamsV5 { - strategyId: string; - /** 2: created, 3: create failed, 4: partially filled, 5: fully filled, 6: rejected, 7: canceled */ - status?: '2' | '3' | '4' | '5' | '6' | '7'; - symbol?: string; - strategyType?: StrategyTypeV5; - beginTimeE0?: number; - endTimeE0?: number; - pageSize?: number; - cursor?: string; +export interface AlphaPredictionOrderListResultV5 { + orders: AlphaPredictionOrderV5[]; + total: number; + pageIndex: number; } ⋮---- -/** 2: created, 3: create failed, 4: partially filled, 5: fully filled, 6: rejected, 7: canceled */ -⋮---- -/** POST /v5/strategy/stop */ -export interface StopStrategyParamsV5 { - strategyId: string; -} - -================ -File: src/types/response/contract.ts -================ -/* eslint-disable @typescript-eslint/no-explicit-any */ -export interface PaginatedResult { - nextPageCursor: string; - list: TList[]; -} -export interface ContractListResult { - category: string; - list: TList[]; +export interface AlphaPredictionOrderBookLevelV5 { + price: string; + size: string; } ⋮---- -export interface ContractHistoricOrder { - symbol: string; - orderId: string; - orderLinkId: string; - side: string; - orderType: string; - price: string; - iv: string; - qty: string; - timeInForce: string; - orderStatus: string; - positionIdx: number; - lastPriceOnCreated: string; - createdTime: string; - updatedTime: string; - cancelType: string; - rejectReason: string; - stopOrderType: string; - triggerDirection: number; - triggerBy: string; - triggerPrice: string; - cumExecValue: string; - cumExecFee: string; - cumExecQty: string; - leavesValue: string; - leavesQty: string; - takeProfit: string; - stopLoss: string; - tpslMode: string; - tpLimitPrice: string; - slLimitPrice: string; - tpTriggerBy: string; - slTriggerBy: string; - reduceOnly: boolean; - closeOnTrigger: boolean; - blockTradeId: string; - smpType: string; - smpGroup: string; - smpOrderId: string; +export interface AlphaPredictionOrderBookV5 { + tokenId: string; + bids: AlphaPredictionOrderBookLevelV5[]; + asks: AlphaPredictionOrderBookLevelV5[]; } ⋮---- -export interface ContractSymbolTicker { - symbol: string; - bidPrice: string; - askPrice: string; +export interface AlphaPredictionTokenPriceV5 { + tokenId: string; + bestBid: string; + bestAsk: string; lastPrice: string; - lastTickDirection: string; - prevPrice24h: string; - price24hPcnt: string; - highPrice24h: string; - lowPrice24h: string; - prevPrice1h: string; - markPrice: string; - indexPrice: string; - openInterest: string; - turnover24h: string; volume24h: string; - fundingRate: string; - nextFundingTime: string; - predictedDeliveryPrice: string; - basisRate: string; - deliveryFeeRate: string; - deliveryTime: string; + updateTime: number; } - -================ -File: src/types/response/v5-alpha-lp.ts -================ -/** - * V5 private Alpha LP responses. - */ ⋮---- -export interface AlphaLPPoolV5 { - poolAddress: string; - poolName: string; - poolTag: string; - apy: string; - tvl: string; - token0Symbol: string; - token0IconUrlDay: string; - token0IconUrlNight: string; - token1Symbol: string; - token1IconUrlDay: string; - token1IconUrlNight: string; - chainCode: string; - chainIconUrl: string; +export interface AlphaPredictionPriceHistoryCandleV5 { + openTime: number; + open: string; + high: string; + low: string; + close: string; + volume: string; } ⋮---- -export interface AlphaLPPoolListResultV5 { - pools: AlphaLPPoolV5[]; +export interface AlphaPredictionPriceHistoryV5 { + tokenId: string; + interval: string; + list: AlphaPredictionPriceHistoryCandleV5[]; } ⋮---- -export interface AlphaLPPoolInfoV5 { - poolAddress: string; - poolName: string; - apy: string; - tvl: string; - feeRate: string; - token0Symbol: string; - token0Reserve: string; - token1Symbol: string; - token1Reserve: string; - priceRangeLower: string; - priceRangeUpper: string; +export interface AlphaPredictionPositionV5 { + positionId: string; + tokenId: string; + eventId: string; + outcomeName: string; + shares: string; + cost: string; + avgPrice: string; currentPrice: string; + value: string; + unrealizedPnl: string; + unrealizedPnlRate: string; + createdAt: number; + finished: boolean; } ⋮---- -export interface ExecuteAlphaLPStakeResultV5 { - positionId: number; - orderNo: string; +export interface AlphaPredictionPositionListResultV5 { + positions: AlphaPredictionPositionV5[]; + total: number; + totalAssetUsd: string; } ⋮---- -export interface ExecuteAlphaLPRedeemResultV5 { - orderNo: string; +export interface AlphaPredictionPositionHistoryV5 { + positionId: string; + tokenId: string; + eventId: string; + outcomeName: string; + shares: string; + cost: string; + avgPrice: string; + exitPrice: string; + realizedPnl: string; + realizedPnlRate: string; + result: number; + closedAt: number; } ⋮---- -export interface AlphaLPOrderV5 { - orderType: number; - orderNo: string; - orderStatus: number; - poolAddress: string; - poolName: string; - positionId: number; - tokenCode: string; - tokenSymbol: string; - tokenIconUrlDay: string; - tokenIconUrlNight: string; - amount: string; - chainCode: string; - chainIconUrl: string; - gasTokenSymbol: string; - gasOnchain: string; - gasUsd: string | null; - platformFee: string; - platformFeeUsd: string | null; - createTime: number; - executionTime: number; - failureReason?: string; - dercRatio?: string; -} -⋮---- -export interface AlphaLPOrderListResultV5 { - total: number; - pageIndex: number; - orders: AlphaLPOrderV5[]; -} -⋮---- -export interface AlphaLPPayTokenV5 { - tokenCode: string; - tokenSymbol: string; - chainCode: string; - chainIconUrl: string; - decimals: number; - availableBalance: string; - tokenIconUrlDay: string; - tokenIconUrlNight: string; - minStakeAmount: string; - maxStakeAmount: string; -} -⋮---- -export interface AlphaLPPayTokenListResultV5 { - tokens: AlphaLPPayTokenV5[]; -} -⋮---- -export interface AlphaLPPayTokenPriceV5 { - tokenCode: string; - tokenSymbol: string; - priceUsd: string; - chainCode: string; - updateTime: number; -} -⋮---- -export interface AlphaLPPayTokenPriceResultV5 { - prices: AlphaLPPayTokenPriceV5[]; -} -⋮---- -export interface AlphaLPPositionV5 { - positionId: number; - poolAddress: string; - poolName: string; - stakedAmount: string; - stakedTokenCode: string; - stakedTokenSymbol: string; - currentValueUsd: string; - earnedRewardsUsd: string; - unrealizedPnl: string; - realizedPnl: string; - apy: string; - token0Amount: string; - token0Symbol: string; - token1Amount: string; - token1Symbol: string; - rangeUpper: string; - rangeLower: string; - createTime: number; - updateTime: number; - status: number; -} -⋮---- -export interface AlphaLPPositionListResultV5 { - positions: AlphaLPPositionV5[]; -} - -================ -File: src/types/response/v5-alpha-prediction.ts -================ -/** - * V5 private Alpha prediction market responses. - */ -⋮---- -export interface AlphaPredictionEngineStatusV5 { - available: boolean; -} -⋮---- -export interface AlphaPredictionPayTokenV5 { - tokenCode: string; - symbol: string; - tokenDecimals: number; - tokenIconUrlDay: string; - tokenIconUrlNight: string; - supportChains: string[]; -} -⋮---- -export interface AlphaPredictionMarketV5 { - tokenId: string; - outcome: string; - price: string; - side: number; - volume: string; - liquidity: string; -} -⋮---- -export interface AlphaPredictionEventDetailV5 { - eventId: string; - slug: string; - title: string; - description: string; - category: string; - endDate: number; - resolved: boolean; - volume: string; - liquidity: string; - markets: AlphaPredictionMarketV5[]; -} -⋮---- -export interface AlphaPredictionOrderEstimateFeeDetailV5 { - serverFee: string; - polymarketFee: string; -} -⋮---- -export interface AlphaPredictionOrderEstimateV5 { - avgPrice: string; - estimatedCost: string; - estimatedReceive: string; - toWin?: string; - feeAmount: string; - feeDetail: AlphaPredictionOrderEstimateFeeDetailV5; - slippage: string; -} -⋮---- -export interface ExecuteAlphaPredictionOrderResultV5 { - orderNo: string; -} -⋮---- -export interface AlphaPredictionOrderV5 { - orderNo: string; - tokenId: string; - eventId: string; - side: number; - orderType: number; - orderAmount: string; - filledSize: string; - filledPrice: string; - totalFee: string; - status: number; - createdAt: number; - updatedAt: number; -} -⋮---- -export interface AlphaPredictionOrderListResultV5 { - orders: AlphaPredictionOrderV5[]; - total: number; - pageIndex: number; -} -⋮---- -export interface AlphaPredictionOrderBookLevelV5 { - price: string; - size: string; -} -⋮---- -export interface AlphaPredictionOrderBookV5 { - tokenId: string; - bids: AlphaPredictionOrderBookLevelV5[]; - asks: AlphaPredictionOrderBookLevelV5[]; -} -⋮---- -export interface AlphaPredictionTokenPriceV5 { - tokenId: string; - bestBid: string; - bestAsk: string; - lastPrice: string; - volume24h: string; - updateTime: number; -} -⋮---- -export interface AlphaPredictionPriceHistoryCandleV5 { - openTime: number; - open: string; - high: string; - low: string; - close: string; - volume: string; -} -⋮---- -export interface AlphaPredictionPriceHistoryV5 { - tokenId: string; - interval: string; - list: AlphaPredictionPriceHistoryCandleV5[]; -} -⋮---- -export interface AlphaPredictionPositionV5 { - positionId: string; - tokenId: string; - eventId: string; - outcomeName: string; - shares: string; - cost: string; - avgPrice: string; - currentPrice: string; - value: string; - unrealizedPnl: string; - unrealizedPnlRate: string; - createdAt: number; - finished: boolean; -} -⋮---- -export interface AlphaPredictionPositionListResultV5 { - positions: AlphaPredictionPositionV5[]; - total: number; - totalAssetUsd: string; -} -⋮---- -export interface AlphaPredictionPositionHistoryV5 { - positionId: string; - tokenId: string; - eventId: string; - outcomeName: string; - shares: string; - cost: string; - avgPrice: string; - exitPrice: string; - realizedPnl: string; - realizedPnlRate: string; - result: number; - closedAt: number; -} -⋮---- -export interface AlphaPredictionPositionHistoryResultV5 { - positions: AlphaPredictionPositionHistoryV5[]; - total: number; +export interface AlphaPredictionPositionHistoryResultV5 { + positions: AlphaPredictionPositionHistoryV5[]; + total: number; } ⋮---- export interface AlphaPredictionPortfolioSummaryV5 { @@ -7401,6 +7204,8 @@ export interface P2PAdDetailV5 { status: number; createDate: string; payments: string[]; + /** Personal ads list only. Empty string means the ad is not hidden. */ + hiddenReason?: string; orderNum: number; finishNum: number; recentOrderNum: number; @@ -7462,6 +7267,8 @@ export interface P2PAdDetailV5 { itemType: string; } ⋮---- +/** Personal ads list only. Empty string means the ad is not hidden. */ +⋮---- export interface P2PPersonalAdsResponseV5 { count: number; items: P2PAdDetailV5[]; @@ -7487,6 +7294,8 @@ export interface P2POrderV5 { fee: string; targetNickName: string; targetUserId: string; + /** Pending orders. Pass this to getP2PChatSessionId as userMaskId. */ + targetUserMaskId?: string; status: number; selfUnreadMsgCount: string; createDate: string; @@ -7506,6 +7315,8 @@ export interface P2POrderV5 { bulkOrderFlag: boolean; } ⋮---- +/** Pending orders. Pass this to getP2PChatSessionId as userMaskId. */ +⋮---- export interface P2POrdersResponseV5 { count: number; items: P2POrderV5[]; @@ -7589,6 +7400,8 @@ export interface P2POrderDetailV5 { targetAccountId: string; targetUserId: string; targetNickName: string; + /** Counterparty mask ID. Pass this to getP2PChatSessionId as userMaskId. */ + targetUserMaskId: string; targetFirstName: string; targetSecondName: string; targetUserAuthStatus: number; @@ -7666,6 +7479,8 @@ export interface P2POrderDetailV5 { cancelReason: string; sellerCancelExamineRemainTime: string; needSellerExamineCancel: boolean; + /** True when the buyer must review a pending seller cancel request. */ + needBuyerExamineCancel: boolean; couponCurrencyAmount: string; totalCurrencyAmount: string; usedCoupon: boolean; @@ -7686,6 +7501,10 @@ export interface P2POrderDetailV5 { appealNegotiationNode: number; } ⋮---- +/** Counterparty mask ID. Pass this to getP2PChatSessionId as userMaskId. */ +⋮---- +/** True when the buyer must review a pending seller cancel request. */ +⋮---- export interface P2POrderMessageV5 { id: string; message: string; @@ -8354,157 +8173,27 @@ export interface RWANavChartResultV5 { } ================ -File: src/types/response/v5-spot-x.ts +File: src/types/response/v5-spreadtrading.ts ================ -export interface LaunchpoolPoolV5 { - poolId: string; - stakeCoin: string; - apr: string; - totalStakedAmount: string; - participantCount: string; -} -⋮---- -export interface LaunchpoolProjectV5 { - projectId: string; - activityCoin: string; - rewardCoin: string; - status: number; - totalReward: string; - stakeStartTime: string; - stakeEndTime: string; - totalParticipantCount: string; - pools: LaunchpoolPoolV5[]; -} -⋮---- -export interface LaunchpoolProjectListResultV5 { - list: LaunchpoolProjectV5[]; - nextPageCursor: string; -} -⋮---- -export interface LaunchpoolActivityLogItemV5 { - stakeCoin: string; - rewardCoin: string; - amount: string; - type: number; - status: number; - createdTime: string; - orderId: string; -} -⋮---- -export interface LaunchpoolActivityLogResultV5 { - list: LaunchpoolActivityLogItemV5[]; - total: number; - pageSize: number; - current: number; -} -⋮---- -export interface LaunchpoolStakingPositionV5 { - stakeCoin: string; - rewardCoin: string; - stakeAmount: string; - totalReward: string; - autoRedeemDate: string; -} -⋮---- -export interface LaunchpoolCurrentStakingResultV5 { - totalInvestmentUsd: string; - totalEarningsUsd: string; - todayEarningsUsd: string; - list: LaunchpoolStakingPositionV5[]; -} -⋮---- -export interface LaunchpoolUserHistoryItemV5 { - stakeCoin: string; - rewardCoin: string; - totalReward: string; - stakeStartTime: string; - stakeEndTime: string; -} -⋮---- -export interface LaunchpoolUserHistoryResultV5 { - list: LaunchpoolUserHistoryItemV5[]; - total: number; - pageSize: number; - current: number; -} -⋮---- -export interface PuzzleProjectV5 { - projectId: string; - activityCoin: string; - rewardCoin: string; - status: number; - startTime: string; - endTime: string; - totalReward: string; - participantCount: string; -} -⋮---- -export interface PuzzleProjectListResultV5 { - list: PuzzleProjectV5[]; - nextPageCursor: string; -} -⋮---- -export interface TokenSplashProjectV5 { - status: number; - projectId: string; - activityCoin: string; - rewardCoin: string; - totalReward: string; - participantCount: string; - registrationStartTime: string; - activityEndTime: string; -} -⋮---- -export interface TokenSplashProjectListResultV5 { - list: TokenSplashProjectV5[]; - nextPageCursor: string; -} -⋮---- -export interface TokenSplashTradeTaskV5 { - tradeRequiredAmount: string; - tradeUnit: string; - /** Token counted by the trade task. On-chain tasks use the activity token ID. */ - tradeToken?: string; - tradedAmount: string; - maxRewardAmount: string; - estimatedRewardAmount: string; - rewardCoin: string; -} -⋮---- -/** Token counted by the trade task. On-chain tasks use the activity token ID. */ -⋮---- -export interface TokenSplashUserActivityItemV5 { - projectId: string; - activityCoin: string; - tradeTask: TokenSplashTradeTaskV5; -} -⋮---- -export interface TokenSplashUserActivityResultV5 { - list: TokenSplashUserActivityItemV5[]; -} - -================ -File: src/types/response/v5-spreadtrading.ts -================ -export interface SpreadInstrumentInfoV5 { - symbol: string; - contractType: 'FundingRateArb' | 'CarryTrade' | 'FutureSpread' | 'PerpBasis'; - status: 'Trading' | 'Settling'; - baseCoin: string; - quoteCoin: string; - settleCoin: string; - tickSize: string; - minPrice: string; - maxPrice: string; - lotSize: string; - minSize: string; - maxSize: string; - launchTime: string; - deliveryTime: string; - legs: { - symbol: string; - contractType: 'LinearPerpetual' | 'LinearFutures' | 'Spot'; - }[]; +export interface SpreadInstrumentInfoV5 { + symbol: string; + contractType: 'FundingRateArb' | 'CarryTrade' | 'FutureSpread' | 'PerpBasis'; + status: 'Trading' | 'Settling'; + baseCoin: string; + quoteCoin: string; + settleCoin: string; + tickSize: string; + minPrice: string; + maxPrice: string; + lotSize: string; + minSize: string; + maxSize: string; + launchTime: string; + deliveryTime: string; + legs: { + symbol: string; + contractType: 'LinearPerpetual' | 'LinearFutures' | 'Spot'; + }[]; } ⋮---- export interface SpreadOrderbookResponseV5 { @@ -8774,6 +8463,28 @@ export interface StrategyOrderListResultV5 { prevCursor: string; } +================ +File: src/types/response/v5-tax.ts +================ +export interface TaxBatchExportResultV5 { + batchId: string; +} +⋮---- +export interface TaxBatchExportTaskV5 { + type: string; + number: string; + /** 0 queued, 1 processing, 2 succeeded, -1 failed */ + status: 0 | 1 | 2 | -1; + url: string; + queryId: string; +} +⋮---- +/** 0 queued, 1 processing, 2 succeeded, -1 failed */ +⋮---- +export interface TaxBatchExportStatusV5 { + items: TaxBatchExportTaskV5[]; +} + ================ File: src/types/shared.ts ================ @@ -9010,1081 +8721,789 @@ File: .nvmrc v24.18.0 ================ -File: src/types/request/v5-broker.ts +File: jest.config.ts ================ -export interface GetExchangeBrokerEarningsParamsV5 { - bizType?: 'SPOT' | 'DERIVATIVES' | 'OPTIONS' | 'CONVERT' | 'FIAT_CONVERT'; - begin?: string; - end?: string; - uid?: string; - limit?: number; - cursor?: string; -} +/** + * For a detailed explanation regarding each configuration property, visit: + * https://jestjs.io/docs/configuration + */ ⋮---- -export interface GetBrokerSubAccountDepositsV5 { - id?: string; - txID?: string; - subMemberId?: string; - coin?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; -} +import type { Config } from 'jest'; ⋮---- -export interface IssueVoucherParamsV5 { - accountId: string; - awardId: string; - specCode: string; - amount: string; - brokerId: string; -} +// All imported modules in your tests should be mocked automatically +// automock: false, ⋮---- -export interface GetBrokerIssuedVoucherParamsV5 { - accountId: string; - awardId: string; - specCode: string; - withUsedAmount?: boolean; -} +// Stop running tests after `n` failures +// bail: 0, +bail: false, // enable to stop test when an error occur, ⋮---- -/** Set Rate Limit - exchange broker only. API rate limit: 1 req per second. */ -export interface SetBrokerRateLimitParamsV5 { - list: { - uids: string; - bizType: string; - rate: number; - }[]; -} +// The directory where Jest should store its cached dependency information +// cacheDirectory: "/private/var/folders/kf/2k3sz4px6c9cbyzj1h_b192h0000gn/T/jest_dx", ⋮---- -/** Get All Rate Limits - exchange broker only. API rate limit: 1 req per second. */ -export interface GetAllBrokerRateLimitsParamsV5 { - limit?: string; - cursor?: string; - uids?: string; -} - -================ -File: src/types/request/v5-earn-liquidity-mining.ts -================ -/** - * GET /v5/earn/liquidity-mining/product (public, 50 req/s per IP) - */ -export interface GetLiquidityMiningProductParamsV5 { - baseCoin?: string; - quoteCoin?: string; -} +// Automatically clear mock calls, instances, contexts and results before every test ⋮---- -export interface ReinvestLiquidityMiningParamsV5 { - productId: string; - orderLinkId: string; - positionId: string; - leverage?: string; -} - -================ -File: src/types/request/v5-spot-leverage-token.ts -================ -import { LTOrderTypeV5 } from '../shared-v5'; +// Indicates whether the coverage information should be collected while executing the test ⋮---- -export interface PurchaseSpotLeveragedTokenParamsV5 { - ltCoin: string; - amount: string; - serialNo?: string; -} +// An array of glob patterns indicating a set of files for which coverage information should be collected ⋮---- -export interface RedeemSpotLeveragedTokenParamsV5 { - ltCoin: string; - quantity: string; - serialNo?: string; -} +// The directory where Jest should output its coverage files ⋮---- -export interface GetSpotLeveragedTokenOrderHistoryParamsV5 { - ltCoin?: string; - orderId?: string; - startTime?: number; - endTime?: number; - limit?: number; - ltOrderType?: LTOrderTypeV5; - serialNo?: string; -} +// An array of regexp pattern strings used to skip coverage collection +// coveragePathIgnorePatterns: [ +// "/node_modules/" +// ], ⋮---- -export interface GetVIPMarginDataParamsV5 { - vipLevel?: string; - currency?: string; -} +// Indicates which provider should be used to instrument code for coverage ⋮---- -export interface GetSpotMarginCurrencyDataParamsV5 { - currency?: string; -} +// A list of reporter names that Jest uses when writing coverage reports +// coverageReporters: [ +// "json", +// "text", +// "lcov", +// "clover" +// ], ⋮---- -// Spot Margin Trade (UTA) endpoints -export interface ManualBorrowParamsV5 { - coin: string; - amount: string; -} +// An object that configures minimum threshold enforcement for coverage results +// coverageThreshold: undefined, ⋮---- -export interface GetMaxBorrowableAmountParamsV5 { - currency: string; -} +// A path to a custom dependency extractor +// dependencyExtractor: undefined, ⋮---- -export interface GetPositionTiersParamsV5 { - currency?: string; -} +// Make calling deprecated APIs throw helpful error messages +// errorOnDeprecated: false, ⋮---- -export interface GetCoinStateParamsV5 { - currency?: string; -} +// The default configuration for fake timers +// fakeTimers: { +// "enableGlobally": false +// }, ⋮---- -export interface GetAvailableAmountToRepayParamsV5 { - currency: string; -} +// Force coverage collection from ignored files using an array of glob patterns +// forceCoverageMatch: [], ⋮---- -export interface SetSpotMarginLeverageParamsV5 { - leverage: string; - currency?: string; -} +// A path to a module which exports an async function that is triggered once before all test suites +// globalSetup: undefined, ⋮---- -export interface ManualRepayWithoutConversionParamsV5 { - coin: string; - amount?: string; - /** - * ALL: fixed + floating (floating first); FIXED: fixed only; FLEXIBLE: floating only. Default: FLEXIBLE. - */ - repaymentType?: 'ALL' | 'FIXED' | 'FLEXIBLE'; -} +// A path to a module which exports an async function that is triggered once after all test suites +// globalTeardown: undefined, ⋮---- -/** - * ALL: fixed + floating (floating first); FIXED: fixed only; FLEXIBLE: floating only. Default: FLEXIBLE. - */ +// A set of global variables that need to be available in all test environments +// globals: {}, ⋮---- -export interface GetAutoRepayModeParamsV5 { - currency?: string; // Coin name, uppercase only. If not passed, returns all currencies -} +// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. +// maxWorkers: "50%", ⋮---- -currency?: string; // Coin name, uppercase only. If not passed, returns all currencies +// An array of directory names to be searched recursively up from the requiring module's location +// moduleDirectories: [ +// "node_modules" +// ], ⋮---- -export interface SetAutoRepayModeParamsV5 { - currency?: string; // Coin name, uppercase only. If not passed, enables for all currencies - autoRepayMode: '0' | '1'; // 0: Off, 1: On -} +// An array of file extensions your modules use +// moduleFileExtensions: [ +// "js", +// "mjs", +// "cjs", +// "jsx", +// "ts", +// "tsx", +// "json", +// "node" +// ], ⋮---- -currency?: string; // Coin name, uppercase only. If not passed, enables for all currencies -autoRepayMode: '0' | '1'; // 0: Off, 1: On +// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module +// moduleNameMapper: {}, ⋮---- -export interface GetSpotMarginLiabilityInfoParamsV5 { - currency: string; -} +// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader +// modulePathIgnorePatterns: [], ⋮---- -export interface FixedRateBorrowParamsV5 { - orderCurrency: string; - orderAmount: string; - /** e.g. 0.02 = 2% p.a. */ - annualRate: string; - /** 7, 14, 30, 90, 180 (days) */ - term: string; - /** 1: auto repayment; 2: transfer to flexible loan */ - repayType?: '1' | '2'; -} +// Activates notifications for test results +// notify: false, ⋮---- -/** e.g. 0.02 = 2% p.a. */ +// An enum that specifies notification mode. Requires { notify: true } +// notifyMode: "failure-change", ⋮---- -/** 7, 14, 30, 90, 180 (days) */ +// A preset that is used as a base for Jest's configuration +// preset: undefined, ⋮---- -/** 1: auto repayment; 2: transfer to flexible loan */ +// Run tests from one or more projects +// projects: undefined, ⋮---- -export interface GetFixedRateBorrowOrderInfoParamsV5 { - orderId?: string; - orderCurrency?: string; - state?: string; - term?: string; - limit?: string; - cursor?: string; -} +// Use this configuration option to add custom reporters to Jest +// reporters: undefined, ⋮---- -export interface GetFixedRateBorrowContractInfoParamsV5 { - orderId?: string; - orderCurrency?: string; - term?: string; - limit?: string; - cursor?: string; -} +// Automatically reset mock state before every test +// resetMocks: false, ⋮---- -export interface GetFixedRateBorrowOrderQuoteParamsV5 { - orderCurrency: string; - term?: string; - orderBy?: 'apy' | 'term' | 'quantity'; - sort?: 0 | 1; - limit?: number; -} +// Reset the module registry before running each individual test +// resetModules: false, ⋮---- -export interface RenewFixedRateBorrowParamsV5 { - loanId: string; - qty?: string; -} +// A path to a custom resolver +// resolver: undefined, ⋮---- -export interface GetFlexibleAvailableInventoryParamsV5 { - currency: string; -} +// Automatically restore mock state and implementation before every test +// restoreMocks: false, ⋮---- -export interface GetFixedRateAvailableInventoryParamsV5 { - currency: string; - term: string; - annualRate: string; -} - -================ -File: src/types/request/v5-trade.ts -================ -import { - CategoryV5, - OrderFilterV5, - OrderSideV5, - OrderSMPTypeV5, - OrderStatusV5, - OrderTimeInForceV5, - OrderTriggerByV5, - OrderTypeV5, - PositionIdx, - StopOrderTypeV5, -} from '../shared-v5'; +// The root directory that Jest should scan for tests and modules within +// rootDir: undefined, ⋮---- -export interface OrderParamsV5 { - category: CategoryV5; - symbol: string; - isLeverage?: 0 | 1; - side: OrderSideV5; - orderType: OrderTypeV5; - qty: string; - marketUnit?: 'baseCoin' | 'quoteCoin'; - slippageToleranceType?: string; - slippageTolerance?: string; - price?: string; - triggerDirection?: 1 | 2; - orderFilter?: OrderFilterV5; - triggerPrice?: string; - triggerBy?: OrderTriggerByV5; - orderIv?: string; - timeInForce?: OrderTimeInForceV5; - positionIdx?: PositionIdx; - orderLinkId?: string; - takeProfit?: string; - stopLoss?: string; - tpTriggerBy?: OrderTriggerByV5; - slTriggerBy?: OrderTriggerByV5; - reduceOnly?: boolean; - closeOnTrigger?: boolean; - smpType?: OrderSMPTypeV5; - mmp?: boolean; - tpslMode?: 'Full' | 'Partial'; - tpLimitPrice?: string; - slLimitPrice?: string; - tpOrderType?: OrderTypeV5; - slOrderType?: OrderTypeV5; - bboSideType?: 'Queue' | 'Counterparty'; - bboLevel?: '1' | '2' | '3' | '4' | '5'; - /** Limit IOC/FOK is supported when this is true. */ - rpiTakerAccess?: boolean; -} +// A list of paths to directories that Jest should use to search for files in +// roots: [ +// "" +// ], ⋮---- -/** Limit IOC/FOK is supported when this is true. */ +// Allows you to use a custom runner instead of Jest's default test runner +// runner: "jest-runner", ⋮---- -export interface AmendOrderParamsV5 { - category: CategoryV5; - symbol: string; - orderId?: string; - orderLinkId?: string; - orderIv?: string; - triggerPrice?: string; - qty?: string; - price?: string; - tpslMode?: 'Full' | 'Partial'; - takeProfit?: string; - stopLoss?: string; - tpTriggerBy?: OrderTriggerByV5; - slTriggerBy?: OrderTriggerByV5; - triggerBy?: OrderTriggerByV5; - tpLimitPrice?: string; - slLimitPrice?: string; -} +// The paths to modules that run some code to configure or set up the testing environment before each test +// setupFiles: [], ⋮---- -export interface CancelOrderParamsV5 { - category: CategoryV5; - symbol: string; - orderId?: string; - orderLinkId?: string; - orderFilter?: OrderFilterV5; -} +// A list of paths to modules that run some code to configure or set up the testing framework before each test +// setupFilesAfterEnv: [], ⋮---- -export interface GetAccountOrdersParamsV5 { - category: CategoryV5; - symbol?: string; - baseCoin?: string; - settleCoin?: string; - orderId?: string; - orderLinkId?: string; - openOnly?: 0 | 1 | 2; - orderFilter?: OrderFilterV5; - orderStatus?: OrderStatusV5; +// The number of seconds after which a test is considered as slow and reported as such in the results. +// slowTestThreshold: 5, +⋮---- +// A list of paths to snapshot serializer modules Jest should use for snapshot testing +// snapshotSerializers: [], +⋮---- +// The test environment that will be used for testing +// testEnvironment: "jest-environment-node", +⋮---- +// Options that will be passed to the testEnvironment +// testEnvironmentOptions: {}, +⋮---- +// Adds a location field to test results +// testLocationInResults: false, +⋮---- +// The glob patterns Jest uses to detect test files +⋮---- +// "**/__tests__/**/*.[jt]s?(x)", +⋮---- +// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped +// testPathIgnorePatterns: [ +// "/node_modules/" +// ], +⋮---- +// The regexp pattern or array of patterns that Jest uses to detect test files +// testRegex: [], +⋮---- +// This option allows the use of a custom results processor +// testResultsProcessor: undefined, +⋮---- +// This option allows use of a custom test runner +// testRunner: "jest-circus/runner", +⋮---- +// A map from regular expressions to paths to transformers +// transform: undefined, +⋮---- +// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation +// transformIgnorePatterns: [ +// "/node_modules/", +// "\\.pnp\\.[^\\/]+$" +// ], +⋮---- +// Prevents import esm module error from v1 axios release, issue #5026 +⋮---- +// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them +// unmockedModulePathPatterns: undefined, +⋮---- +// Indicates whether each individual test should be reported during the run +// verbose: undefined, +verbose: true, // report individual test +⋮---- +// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode +// watchPathIgnorePatterns: [], +⋮---- +// Whether to use watchman for file crawling +// watchman: true, + +================ +File: src/types/request/v5-broker.ts +================ +export interface GetExchangeBrokerEarningsParamsV5 { + bizType?: 'SPOT' | 'DERIVATIVES' | 'OPTIONS' | 'CONVERT' | 'FIAT_CONVERT'; + begin?: string; + end?: string; + uid?: string; limit?: number; cursor?: string; } ⋮---- -export interface GetAccountHistoricOrdersParamsV5 { - category: CategoryV5; - symbol?: string; - baseCoin?: string; - settleCoin?: string; - orderId?: string; - orderLinkId?: string; - orderFilter?: OrderFilterV5; - orderStatus?: OrderStatusV5; +export interface GetBrokerSubAccountDepositsV5 { + id?: string; + txID?: string; + subMemberId?: string; + coin?: string; startTime?: number; endTime?: number; limit?: number; cursor?: string; } ⋮---- -export interface CancelAllOrdersParamsV5 { - category: CategoryV5; - symbol?: string; - baseCoin?: string; - settleCoin?: string; - orderFilter?: OrderFilterV5; - stopOrderType?: StopOrderTypeV5; +export interface IssueVoucherParamsV5 { + accountId: string; + awardId: string; + specCode: string; + amount: string; + brokerId: string; } ⋮---- -export interface BatchOrderParamsV5 { - symbol: string; - side: OrderSideV5; - isLeverage?: 0 | 1; - orderType: OrderTypeV5; - qty: string; - price?: string; - triggerDirection?: 1 | 2; - triggerBy?: OrderTriggerByV5; - orderIv?: string; - timeInForce?: OrderTimeInForceV5; - positionIdx?: PositionIdx; - orderLinkId?: string; - takeProfit?: string; - stopLoss?: string; - tpTriggerBy?: OrderTriggerByV5; - slTriggerBy?: OrderTriggerByV5; - reduceOnly?: boolean; - closeOnTrigger?: boolean; - smpType?: OrderSMPTypeV5; - mmp?: boolean; - tpslMode?: 'Full' | 'Partial'; - tpLimitPrice?: string; - slLimitPrice?: string; - tpOrderType?: OrderTypeV5; - slOrderType?: OrderTypeV5; +export interface GetBrokerIssuedVoucherParamsV5 { + accountId: string; + awardId: string; + specCode: string; + withUsedAmount?: boolean; } ⋮---- -export interface BatchAmendOrderParamsV5 { - symbol: string; - orderId?: string; - orderLinkId?: string; - orderIv?: string; - triggerPrice?: string; - qty?: string; - price?: string; - tpslMode?: 'Full' | 'Partial'; - takeProfit?: string; - stopLoss?: string; - tpTriggerBy?: OrderTriggerByV5; - slTriggerBy?: OrderTriggerByV5; - triggerBy?: OrderTriggerByV5; - tpLimitPrice?: string; - slLimitPrice?: string; +/** Set Rate Limit - exchange broker only. API rate limit: 1 req per second. */ +export interface SetBrokerRateLimitParamsV5 { + list: { + uids: string; + bizType: string; + rate: number; + }[]; } ⋮---- -export interface BatchCancelOrderParamsV5 { - symbol: string; - orderId?: string; - orderLinkId?: string; +/** Get All Rate Limits - exchange broker only. API rate limit: 1 req per second. */ +export interface GetAllBrokerRateLimitsParamsV5 { + limit?: string; + cursor?: string; + uids?: string; } ================ -File: src/types/response/v5-broker.ts +File: src/types/request/v5-earn-liquidity-mining.ts ================ -interface EarningDetailV5 { - userId: string; - bizType: 'SPOT' | 'DERIVATIVES' | 'OPTIONS' | 'CONVERT' | 'FIAT_CONVERT'; - symbol: string; - coin: string; - earning: string; - markupEarning: string; - baseFeeEarning: string; - orderId: string; - execTime: string; +/** + * GET /v5/earn/liquidity-mining/product (public, 50 req/s per IP) + */ +export interface GetLiquidityMiningProductParamsV5 { + baseCoin?: string; + quoteCoin?: string; } ⋮---- -interface TotalEarningCategoryV5 { - coin: string; - earning: string; +export interface ReinvestLiquidityMiningParamsV5 { + productId: string; + orderLinkId: string; + positionId: string; + leverage?: string; } + +================ +File: src/types/request/v5-spot-leverage-token.ts +================ +import { LTOrderTypeV5 } from '../shared-v5'; ⋮---- -export interface ExchangeBrokerEarningResultV5 { - totalEarningCat: { - spot: TotalEarningCategoryV5[]; - derivatives: TotalEarningCategoryV5[]; - options: TotalEarningCategoryV5[]; - convert: TotalEarningCategoryV5[]; - fiatConvert?: TotalEarningCategoryV5[]; - total: TotalEarningCategoryV5[]; - }; - details: EarningDetailV5[]; - nextPageCursor: string; +export interface PurchaseSpotLeveragedTokenParamsV5 { + ltCoin: string; + amount: string; + serialNo?: string; } ⋮---- -export interface ExchangeBrokerAccountInfoV5 { - subAcctQty: string; - maxSubAcctQty: string; - baseFeeRebateRate: { - spot: string; - derivatives: string; - }; - markupFeeRebateRate: { - spot: string; - derivatives: string; - convert: string; - }; - ts: string; +export interface RedeemSpotLeveragedTokenParamsV5 { + ltCoin: string; + quantity: string; + serialNo?: string; } ⋮---- -export interface ExchangeBrokerSubAccountDepositRecordV5 { - id: string; - subMemberId: string; - coin: string; - chain: string; - amount: string; - txID: string; - status: number; - toAddress: string; - tag: string; - depositFee: string; - successAt: string; - confirmations: string; - txIndex: string; - blockHash: string; - batchReleaseLimit: string; - depositType: string; +export interface GetSpotLeveragedTokenOrderHistoryParamsV5 { + ltCoin?: string; + orderId?: string; + startTime?: number; + endTime?: number; + limit?: number; + ltOrderType?: LTOrderTypeV5; + serialNo?: string; } ⋮---- -export interface BrokerVoucherSpecV5 { - id: string; - coin: string; - amountUnit: 'AWARD_AMOUNT_UNIT_USD' | 'AWARD_AMOUNT_UNIT_COIN'; - productLine: string; - subProductLine: string; - totalAmount: { - [key: string]: string; - }; - usedAmount: string; +export interface GetVIPMarginDataParamsV5 { + vipLevel?: string; + currency?: string; } ⋮---- -export interface BrokerIssuedVoucherV5 { - accountId: string; - awardId: string; - specCode: string; - amount: string; - isClaimed: boolean; - startAt: string; - endAt: string; - effectiveAt: string; - ineffectiveAt: string; - usedAmount: string; +export interface GetSpotMarginCurrencyDataParamsV5 { + currency?: string; } ⋮---- -export interface BrokerRateLimitSetResultItemV5 { - uids: string; - bizType: string; - rate: number; - success: boolean; - msg: string; +// Spot Margin Trade (UTA) endpoints +export interface ManualBorrowParamsV5 { + coin: string; + amount: string; } ⋮---- -export interface BrokerRateLimitCapItemV5 { - bizType: string; - totalRate: string; - ebCap: string; - uidCap: string; +export interface GetMaxBorrowableAmountParamsV5 { + currency: string; } ⋮---- -export interface BrokerRateLimitAllItemV5 { - uids: string; - bizType: string; - rate: number; -} - -================ -File: src/types/response/v5-crypto-loan.ts -================ -export interface CollateralCoinV5 { - collateralAccuracy: number; - initialLTV: string; - liquidationLTV: string; - marginCallLTV: string; - maxLimit: string; +export interface GetPositionTiersParamsV5 { + currency?: string; } ⋮---- -export interface VipCollateralCoinsV5 { - list: CollateralCoinV5[]; - vipLevel: string; +export interface GetCoinStateParamsV5 { + currency?: string; } ⋮---- -export interface BorrowableCoinV5 { - borrowingAccuracy: number; +export interface GetAvailableAmountToRepayParamsV5 { currency: string; - flexibleHourlyInterestRate: string; - hourlyInterestRate7D: string; - hourlyInterestRate14D: string; - hourlyInterestRate30D: string; - hourlyInterestRate90D: string; - hourlyInterestRate180D: string; - maxBorrowingAmount: string; - minBorrowingAmount: string; } ⋮---- -export interface VipBorrowableCoinsV5 { - list: BorrowableCoinV5[]; - vipLevel: string; +export interface SetSpotMarginLeverageParamsV5 { + leverage: string; + currency?: string; } ⋮---- -export interface AccountBorrowCollateralLimitV5 { - collateralCurrency: string; - loanCurrency: string; - maxCollateralAmount: string; - maxLoanAmount: string; - minCollateralAmount: string; - minLoanAmount: string; +export interface ManualRepayWithoutConversionParamsV5 { + coin: string; + amount?: string; + /** + * ALL: fixed + floating (floating first); FIXED: fixed only; FLEXIBLE: floating only. Default: FLEXIBLE. + */ + repaymentType?: 'ALL' | 'FIXED' | 'FLEXIBLE'; } ⋮---- -export interface UnpaidLoanOrderV5 { - collateralAmount: string; - collateralCurrency: string; - currentLTV: string; - expirationTime: string; - hourlyInterestRate: string; - loanCurrency: string; - loanTerm: string; - orderId: string; - residualInterest: string; - residualPenaltyInterest: string; - totalDebt: string; -} +/** + * ALL: fixed + floating (floating first); FIXED: fixed only; FLEXIBLE: floating only. Default: FLEXIBLE. + */ ⋮---- -export interface RepaymentHistoryV5 { - collateralCurrency: string; - collateralReturn: string; - loanCurrency: string; - loanTerm: string; - orderId: string; - repayAmount: string; - repayId: string; - repayStatus: number; - repayTime: string; - repayType: string; +export interface GetAutoRepayModeParamsV5 { + currency?: string; // Coin name, uppercase only. If not passed, returns all currencies } ⋮---- -export interface CompletedLoanOrderV5 { - borrowTime: string; - collateralCurrency: string; - expirationTime: string; - hourlyInterestRate: string; - initialCollateralAmount: string; - initialLoanAmount: string; - loanCurrency: string; - loanTerm: string; - orderId: string; - repaidInterest: string; - repaidPenaltyInterest: string; - status: number; -} -export interface LoanLTVAdjustmentHistoryV5 { - collateralCurrency: string; - orderId: string; - adjustId: string; - adjustTime: string; - preLTV: string; - afterLTV: string; - direction: number; - amount: string; +currency?: string; // Coin name, uppercase only. If not passed, returns all currencies +⋮---- +export interface SetAutoRepayModeParamsV5 { + currency?: string; // Coin name, uppercase only. If not passed, enables for all currencies + autoRepayMode: '0' | '1'; // 0: Off, 1: On } ⋮---- -// New Crypto Loan Types +currency?: string; // Coin name, uppercase only. If not passed, enables for all currencies +autoRepayMode: '0' | '1'; // 0: Off, 1: On ⋮---- -export interface BorrowCoinV5 { +export interface GetSpotMarginLiabilityInfoParamsV5 { currency: string; - fixedBorrowable: boolean; - fixedBorrowingAccuracy: number; - flexibleBorrowable: boolean; - flexibleBorrowingAccuracy: number; - maxBorrowingAmount: string; - minFixedBorrowingAmount: string; - minFlexibleBorrowingAmount: string; - vipLevel: string; - flexibleAnnualizedInterestRate: string; - annualizedInterestRate7D: string; - annualizedInterestRate14D: string; - annualizedInterestRate30D: string; - annualizedInterestRate60D: string; - annualizedInterestRate90D: string; - annualizedInterestRate180D: string; } ⋮---- -export interface CollateralRatioV5 { - collateralRatio: string; - maxValue: string; - minValue: string; +export interface FixedRateBorrowParamsV5 { + orderCurrency: string; + orderAmount: string; + /** e.g. 0.02 = 2% p.a. */ + annualRate: string; + /** 7, 14, 30, 90, 180 (days) */ + term: string; + /** 1: auto repayment; 2: transfer to flexible loan */ + repayType?: '1' | '2'; } ⋮---- -export interface CollateralRatioConfigV5 { - collateralRatioList: CollateralRatioV5[]; - currencies: string; -} +/** e.g. 0.02 = 2% p.a. */ ⋮---- -export interface CurrencyLiquidationV5 { - currency: string; - liquidationOrder: number; -} +/** 7, 14, 30, 90, 180 (days) */ ⋮---- -export interface CollateralDataV5 { - collateralRatioConfigList: CollateralRatioConfigV5[]; - currencyLiquidationList: CurrencyLiquidationV5[]; -} +/** 1: auto repayment; 2: transfer to flexible loan */ ⋮---- -// Additional New Crypto Loan Types +export interface GetFixedRateBorrowOrderInfoParamsV5 { + orderId?: string; + orderCurrency?: string; + state?: string; + term?: string; + limit?: string; + cursor?: string; +} ⋮---- -export interface AdjustCollateralAmountV5 { - adjustId: number; +export interface GetFixedRateBorrowContractInfoParamsV5 { + orderId?: string; + orderCurrency?: string; + term?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface CollateralAdjustmentHistoryV5 { - adjustId: number; - adjustTime: number; - afterLTV: string; - amount: string; - collateralCurrency: string; - direction: number; - preLTV: string; - status: number; +export interface GetFixedRateBorrowOrderQuoteParamsV5 { + orderCurrency: string; + term?: string; + orderBy?: 'apy' | 'term' | 'quantity'; + sort?: 0 | 1; + limit?: number; } ⋮---- -export interface BorrowListV5 { - fixedTotalDebt: string; - fixedTotalDebtUSD: string; - flexibleHourlyInterestRate: string; - flexibleTotalDebt: string; - flexibleTotalDebtUSD: string; - loanCurrency: string; +export interface RenewFixedRateBorrowParamsV5 { + loanId: string; + qty?: string; } ⋮---- -export interface CollateralListV5 { - amount: string; - amountUSD: string; +export interface GetFlexibleAvailableInventoryParamsV5 { currency: string; - ltv: string; } ⋮---- -export interface SupplyListV5 { - amount: string; - amountUSD: string; +export interface GetFixedRateAvailableInventoryParamsV5 { currency: string; + term: string; + annualRate: string; } + +================ +File: src/types/request/v5-trade.ts +================ +import { + CategoryV5, + OrderFilterV5, + OrderSideV5, + OrderSMPTypeV5, + OrderStatusV5, + OrderTimeInForceV5, + OrderTriggerByV5, + OrderTypeV5, + PositionIdx, + StopOrderTypeV5, +} from '../shared-v5'; ⋮---- -export interface CryptoLoanPositionV5 { - borrowList: BorrowListV5[]; - collateralList: CollateralListV5[]; - supplyList: SupplyListV5[]; - totalCollateral: string; - totalDebt: string; - totalSupply: string; - colRes?: string; +export interface OrderParamsV5 { + category: CategoryV5; + symbol: string; + isLeverage?: 0 | 1; + side: OrderSideV5; + orderType: OrderTypeV5; + qty: string; + marketUnit?: 'baseCoin' | 'quoteCoin'; + slippageToleranceType?: string; + slippageTolerance?: string; + price?: string; + triggerDirection?: 1 | 2; + orderFilter?: OrderFilterV5; + triggerPrice?: string; + triggerBy?: OrderTriggerByV5; + orderIv?: string; + timeInForce?: OrderTimeInForceV5; + positionIdx?: PositionIdx; + orderLinkId?: string; + takeProfit?: string; + stopLoss?: string; + tpTriggerBy?: OrderTriggerByV5; + slTriggerBy?: OrderTriggerByV5; + reduceOnly?: boolean; + closeOnTrigger?: boolean; + smpType?: OrderSMPTypeV5; + mmp?: boolean; + tpslMode?: 'Full' | 'Partial'; + tpLimitPrice?: string; + slLimitPrice?: string; + tpOrderType?: OrderTypeV5; + slOrderType?: OrderTypeV5; + bboSideType?: 'Queue' | 'Counterparty'; + bboLevel?: '1' | '2' | '3' | '4' | '5'; + /** Limit IOC/FOK is supported when this is true. */ + rpiTakerAccess?: boolean; } ⋮---- -// Flexible Loan Types +/** Limit IOC/FOK is supported when this is true. */ ⋮---- -export interface BorrowFlexibleV5 { - orderId: string; +export interface AmendOrderParamsV5 { + category: CategoryV5; + symbol: string; + orderId?: string; + orderLinkId?: string; + orderIv?: string; + triggerPrice?: string; + qty?: string; + price?: string; + tpslMode?: 'Full' | 'Partial'; + takeProfit?: string; + stopLoss?: string; + tpTriggerBy?: OrderTriggerByV5; + slTriggerBy?: OrderTriggerByV5; + triggerBy?: OrderTriggerByV5; + tpLimitPrice?: string; + slLimitPrice?: string; } ⋮---- -export interface RepayFlexibleV5 { - repayId: string; +export interface CancelOrderParamsV5 { + category: CategoryV5; + symbol: string; + orderId?: string; + orderLinkId?: string; + orderFilter?: OrderFilterV5; } ⋮---- -export interface OngoingFlexibleLoanV5 { - hourlyInterestRate: string; - loanCurrency: string; - totalDebt: string; - unpaidAmount: string; - unpaidInterest: string; +export interface GetAccountOrdersParamsV5 { + category: CategoryV5; + symbol?: string; + baseCoin?: string; + settleCoin?: string; + orderId?: string; + orderLinkId?: string; + openOnly?: 0 | 1 | 2; + orderFilter?: OrderFilterV5; + orderStatus?: OrderStatusV5; + limit?: number; + cursor?: string; } ⋮---- -export interface BorrowHistoryFlexibleV5 { - borrowTime: number; - initialLoanAmount: string; - loanCurrency: string; - orderId: string; - status: number; +export interface GetAccountHistoricOrdersParamsV5 { + category: CategoryV5; + symbol?: string; + baseCoin?: string; + settleCoin?: string; + orderId?: string; + orderLinkId?: string; + orderFilter?: OrderFilterV5; + orderStatus?: OrderStatusV5; + startTime?: number; + endTime?: number; + limit?: number; + cursor?: string; } ⋮---- -export interface RepaymentHistoryFlexibleV5 { - loanCurrency: string; - repayAmount: string; - repayId: string; - repayStatus: number; - repayTime: number; - repayType: number; +export interface CancelAllOrdersParamsV5 { + category: CategoryV5; + symbol?: string; + baseCoin?: string; + settleCoin?: string; + orderFilter?: OrderFilterV5; + stopOrderType?: StopOrderTypeV5; } ⋮---- -// Fixed Loan Types -⋮---- -export interface SupplyOrderQuoteFixedV5 { - orderCurrency: string; - term: number; - annualRate: string; +export interface BatchOrderParamsV5 { + symbol: string; + side: OrderSideV5; + isLeverage?: 0 | 1; + orderType: OrderTypeV5; qty: string; + price?: string; + triggerDirection?: 1 | 2; + triggerBy?: OrderTriggerByV5; + orderIv?: string; + timeInForce?: OrderTimeInForceV5; + positionIdx?: PositionIdx; + orderLinkId?: string; + takeProfit?: string; + stopLoss?: string; + tpTriggerBy?: OrderTriggerByV5; + slTriggerBy?: OrderTriggerByV5; + reduceOnly?: boolean; + closeOnTrigger?: boolean; + smpType?: OrderSMPTypeV5; + mmp?: boolean; + tpslMode?: 'Full' | 'Partial'; + tpLimitPrice?: string; + slLimitPrice?: string; + tpOrderType?: OrderTypeV5; + slOrderType?: OrderTypeV5; } ⋮---- -export interface BorrowOrderQuoteFixedV5 { - orderCurrency: string; - term: number; - annualRate: string; - qty: string; +export interface BatchAmendOrderParamsV5 { + symbol: string; + orderId?: string; + orderLinkId?: string; + orderIv?: string; + triggerPrice?: string; + qty?: string; + price?: string; + tpslMode?: 'Full' | 'Partial'; + takeProfit?: string; + stopLoss?: string; + tpTriggerBy?: OrderTriggerByV5; + slTriggerBy?: OrderTriggerByV5; + triggerBy?: OrderTriggerByV5; + tpLimitPrice?: string; + slLimitPrice?: string; } ⋮---- -export interface CreateBorrowOrderFixedV5 { - orderId: string; +export interface BatchCancelOrderParamsV5 { + symbol: string; + orderId?: string; + orderLinkId?: string; } -⋮---- -export interface CreateSupplyOrderFixedV5 { + +================ +File: src/types/response/v5-broker.ts +================ +interface EarningDetailV5 { + userId: string; + bizType: 'SPOT' | 'DERIVATIVES' | 'OPTIONS' | 'CONVERT' | 'FIAT_CONVERT'; + symbol: string; + coin: string; + earning: string; + markupEarning: string; + baseFeeEarning: string; orderId: string; + execTime: string; } ⋮---- -export interface BorrowContractInfoFixedV5 { - annualRate: string; - autoRepay: string; // Deprecated - borrowCurrency: string; - borrowTime: string; - interestPaid: string; - loanId: string; - orderId: string; - repayType: string; // 1: Auto Repayment; 2: Transfer to flexible loan; 0: No Automatic Repayment - repaymentTime: string; - residualPenaltyInterest: string; - residualPrincipal: string; - status: number; - term: string; +interface TotalEarningCategoryV5 { + coin: string; + earning: string; } ⋮---- -autoRepay: string; // Deprecated -⋮---- -repayType: string; // 1: Auto Repayment; 2: Transfer to flexible loan; 0: No Automatic Repayment +export interface ExchangeBrokerEarningResultV5 { + totalEarningCat: { + spot: TotalEarningCategoryV5[]; + derivatives: TotalEarningCategoryV5[]; + options: TotalEarningCategoryV5[]; + convert: TotalEarningCategoryV5[]; + fiatConvert?: TotalEarningCategoryV5[]; + total: TotalEarningCategoryV5[]; + }; + details: EarningDetailV5[]; + nextPageCursor: string; +} ⋮---- -export interface SupplyContractInfoFixedV5 { - annualRate: string; - supplyCurrency: string; - supplyTime: string; - supplyAmount: string; - interestPaid: string; - supplyId: string; - orderId: string; - redemptionTime: string; - penaltyInterest: string; - actualRedemptionTime: string; - status: number; - term: string; -} -⋮---- -export interface BorrowOrderInfoFixedV5 { - annualRate: string; - orderId: number; - orderTime: string; - filledQty: string; - orderQty: string; - orderCurrency: string; - state: number; - term: number; - repayType: string; // 1: Auto Repayment; 2: Transfer to flexible loan; 0: No Automatic Repayment - strategyType?: 'PARTIAL' | 'FULL' | string; +export interface ExchangeBrokerAccountInfoV5 { + subAcctQty: string; + maxSubAcctQty: string; + baseFeeRebateRate: { + spot: string; + derivatives: string; + }; + markupFeeRebateRate: { + spot: string; + derivatives: string; + convert: string; + }; + ts: string; } ⋮---- -repayType: string; // 1: Auto Repayment; 2: Transfer to flexible loan; 0: No Automatic Repayment -⋮---- -export interface FixedLoanAvailableInventoryV5 { - currency: string; - term: string; - annualRate: string; - availableInventory: string; - updateTime: string; +export interface ExchangeBrokerSubAccountDepositRecordV5 { + id: string; + subMemberId: string; + coin: string; + chain: string; + amount: string; + txID: string; + status: number; + toAddress: string; + tag: string; + depositFee: string; + successAt: string; + confirmations: string; + txIndex: string; + blockHash: string; + batchReleaseLimit: string; + depositType: string; } ⋮---- -export interface FlexibleLoanAvailableInventoryV5 { - currency: string; - availableInventory: string; - updateTime: string; +export interface BrokerVoucherSpecV5 { + id: string; + coin: string; + amountUnit: 'AWARD_AMOUNT_UNIT_USD' | 'AWARD_AMOUNT_UNIT_COIN'; + productLine: string; + subProductLine: string; + totalAmount: { + [key: string]: string; + }; + usedAmount: string; } ⋮---- -export interface SupplyOrderInfoFixedV5 { - annualRate: string; - orderId: number; - orderTime: string; - filledQty: string; - orderQty: string; - orderCurrency: string; - state: number; - term: number; +export interface BrokerIssuedVoucherV5 { + accountId: string; + awardId: string; + specCode: string; + amount: string; + isClaimed: boolean; + startAt: string; + endAt: string; + effectiveAt: string; + ineffectiveAt: string; + usedAmount: string; } ⋮---- -export interface RepayFixedV5 { - repayId: string; +export interface BrokerRateLimitSetResultItemV5 { + uids: string; + bizType: string; + rate: number; + success: boolean; + msg: string; } ⋮---- -export interface RepaymentHistoryFixedV5 { - details: { - loanCurrency: string; - loanId: string; - repayAmount: string; - }[]; - loanCurrency: string; - repayAmount: string; - repayId: string; - repayStatus: number; - repayTime: number; - repayType: number; +export interface BrokerRateLimitCapItemV5 { + bizType: string; + totalRate: string; + ebCap: string; + uidCap: string; } ⋮---- -export interface RenewBorrowOrderFixedV5 { - orderId: string; +export interface BrokerRateLimitAllItemV5 { + uids: string; + bizType: string; + rate: number; } -⋮---- -export interface RenewOrderInfoFixedV5 { - amount: string; - autoRepay: number; - borrowCurrency: string; - contractNo: string; - dueTime: string; - loanId: string; - orderId: number; - renewLoanNo: string; - time: string; + +================ +File: src/types/response/v5-earn-liquidity-mining.ts +================ +export interface LiquidityMiningApyBreakdownV5 { + coin: string; + apy: string; } ⋮---- -// Institutional Loan Types -⋮---- -export interface InstitutionalLendingProductInfoV5 { +export interface LiquidityMiningProductV5 { productId: string; - leverage: string; - supportSpot: number; - supportContract: number; - supportMarginTrading: number; - withdrawLine: string; - transferLine: string; - spotBuyLine: string; - spotSellLine: string; - contractOpenLine: string; - liquidationLine: string; - stopLiquidationLine: string; - contractLeverage: string; - transferRatio: string; - spotSymbols: unknown[]; - contractSymbols: unknown[]; - supportUSDCContract: number; - supportUSDCOptions: number; - USDTPerpetualOpenLine?: string; - USDCContractOpenLine?: string; - USDCOptionsOpenLine?: string; - USDTPerpetualCloseLine?: string; - USDCContractCloseLine?: string; - USDCOptionsCloseLine?: string; - USDTPerpetualLeverage?: { symbol: string; leverage: string }[]; - USDCContractLeverage?: { symbol: string; leverage: string }[]; - deferredLiquidationLine?: string; - deferredLiquidationTime?: string; - marginLeverage?: string; - /** `0`: Default, `1`: CTA, `2`: Hedge */ - productType?: '0' | '1' | '2' | string; + baseCoin: string; + quoteCoin: string; + status: 'Available' | 'NotAvailable' | string; + maxLeverage: number; + minInvestmentQuote: string; + minInvestmentBase: string; + maxInvestmentQuote: string; + maxInvestmentBase: string; + minWithdrawalAmount: string; + minReinvestAmount: string; + baseCoinPrecision: number; + quoteCoinPrecision: number; + yieldCoins: string[]; + apyE8: string; + apy7dE8: string; + poolLiquidityValue: string; + dailyYield: string; + slippageRateE8List: string[]; + apyBreakdown: LiquidityMiningApyBreakdownV5[]; + apy7dBreakdown: LiquidityMiningApyBreakdownV5[]; + slippage_levels?: string[]; } ⋮---- -/** `0`: Default, `1`: CTA, `2`: Hedge */ +export interface LiquidityMiningProductResultV5 { + products: LiquidityMiningProductV5[]; +} ⋮---- -export interface InstitutionalLendingCoinDeltaItemV5 { - coin: string; - coinDeltaSize: string; - coinDeltaAvailableAmount: string; - coinDeltaAmount: string; +export interface ReinvestLiquidityMiningResultV5 { + orderId: string; + orderLinkId: string; } + +================ +File: src/types/response/v5-spot-leverage-token.ts +================ +import { + LeverageTokenStatusV5, + LTOrderStatusV5, + LTOrderTypeV5, +} from '../shared-v5'; ⋮---- -export interface InstitutionalLendingCoinDeltaAmountV5 { - riskUnitDeltaAmount: string; - riskUnitDeltaAvailableAmount: string; - riskUnitDelta?: string; - list: InstitutionalLendingCoinDeltaItemV5[]; +export interface LeverageTokenInfoV5 { + ltCoin: string; + ltName: string; + maxPurchase: string; + minPurchase: string; + maxPurchaseDaily: string; + maxRedeem: string; + minRedeem: string; + maxRedeemDaily: string; + purchaseFeeRate: string; + redeemFeeRate: string; + ltStatus: LeverageTokenStatusV5; + fundFee: string; + fundFeeTime: string; + manageFeeRate: string; + manageFeeTime: string; + value: string; + netValue: string; + total: string; } ⋮---- -export interface InstitutionalLendingDelayLiquidationStatusV5 { - ltv: string; - /** 0 normal, 1 passive liquidation, 2 callback liquidation, 3 delay liquidation */ - liquidationStatus: 0 | 1 | 2 | 3; - delayLiqStartTime: string; - delayLiqRemainingSec: string; -} -⋮---- -/** 0 normal, 1 passive liquidation, 2 callback liquidation, 3 delay liquidation */ -⋮---- -export interface UnpaidInfoV5 { - token: string; // Coin - unpaidQty: string; // Unpaid principle - unpaidInterest: string; // Unpaid interest -} -⋮---- -token: string; // Coin -unpaidQty: string; // Unpaid principle -unpaidInterest: string; // Unpaid interest -⋮---- -export interface BalanceInfoV5 { - token: string; // Margin coin - price: string; // Margin coin price - qty: string; // Margin coin quantity - convertedAmount: string; // Margin conversion amount -} -⋮---- -token: string; // Margin coin -price: string; // Margin coin price -qty: string; // Margin coin quantity -convertedAmount: string; // Margin conversion amount -⋮---- -export interface LTVInfoV5 { - ltv: string; // Risk rate (when liqStatus != 0, returns empty string) - rst: string; // Remaining liquidation time in UTC seconds (when liqStatus != 0, returns empty string) - parentUid: string; // The designated Risk Unit ID - subAccountUids: string[]; // Bound user IDs - unpaidAmount: string; // Total debt in USDT (when liqStatus != 0, returns empty string) - unpaidInfo: UnpaidInfoV5[]; // Debt details (when liqStatus != 0, returns empty array) - balance: string; // Total asset in USDT (when liqStatus != 0, returns empty string) - balanceInfo: BalanceInfoV5[]; // Asset details (when liqStatus != 0, returns empty array) - liqStatus?: number; // Liquidation status: 0=Normal, 1=Under liquidation, 2=Manual repayment in progress, 3=Transfer in progress -} -⋮---- -ltv: string; // Risk rate (when liqStatus != 0, returns empty string) -rst: string; // Remaining liquidation time in UTC seconds (when liqStatus != 0, returns empty string) -parentUid: string; // The designated Risk Unit ID -subAccountUids: string[]; // Bound user IDs -unpaidAmount: string; // Total debt in USDT (when liqStatus != 0, returns empty string) -unpaidInfo: UnpaidInfoV5[]; // Debt details (when liqStatus != 0, returns empty array) -balance: string; // Total asset in USDT (when liqStatus != 0, returns empty string) -balanceInfo: BalanceInfoV5[]; // Asset details (when liqStatus != 0, returns empty array) -liqStatus?: number; // Liquidation status: 0=Normal, 1=Under liquidation, 2=Manual repayment in progress, 3=Transfer in progress -⋮---- -export interface InstitutionalLoanLTVV5 { - ltvInfo: LTVInfoV5[]; // LTV info array - liqStatus?: number; // Liquidation status: 0=Normal, 1=Under liquidation, 2=Manual repayment in progress, 3=Transfer in progress -} -⋮---- -ltvInfo: LTVInfoV5[]; // LTV info array -liqStatus?: number; // Liquidation status: 0=Normal, 1=Under liquidation, 2=Manual repayment in progress, 3=Transfer in progress -⋮---- -export interface RepayInstitutionalLoanResultV5 { - repayOrderStatus: string; // P: processing -} -⋮---- -repayOrderStatus: string; // P: processing -⋮---- -// Max Loan Amount Response Types -⋮---- -export interface MaxLoanAmountV5 { - currency: string; // Coin to borrow - maxLoan: string; // Maximum borrowable amount based on current collateral - notionalUsd: string; // Notional USD value - remainingQuota: string; // Remaining individual platform borrowing limit (shared between main and sub accounts) -} -⋮---- -currency: string; // Coin to borrow -maxLoan: string; // Maximum borrowable amount based on current collateral -notionalUsd: string; // Notional USD value -remainingQuota: string; // Remaining individual platform borrowing limit (shared between main and sub accounts) - -================ -File: src/types/response/v5-earn-liquidity-mining.ts -================ -export interface LiquidityMiningApyBreakdownV5 { - coin: string; - apy: string; -} -⋮---- -export interface LiquidityMiningProductV5 { - productId: string; - baseCoin: string; - quoteCoin: string; - status: 'Available' | 'NotAvailable' | string; - maxLeverage: number; - minInvestmentQuote: string; - minInvestmentBase: string; - maxInvestmentQuote: string; - maxInvestmentBase: string; - minWithdrawalAmount: string; - minReinvestAmount: string; - baseCoinPrecision: number; - quoteCoinPrecision: number; - yieldCoins: string[]; - apyE8: string; - apy7dE8: string; - poolLiquidityValue: string; - dailyYield: string; - slippageRateE8List: string[]; - apyBreakdown: LiquidityMiningApyBreakdownV5[]; - apy7dBreakdown: LiquidityMiningApyBreakdownV5[]; - slippage_levels?: string[]; -} -⋮---- -export interface LiquidityMiningProductResultV5 { - products: LiquidityMiningProductV5[]; -} -⋮---- -export interface ReinvestLiquidityMiningResultV5 { - orderId: string; - orderLinkId: string; -} - -================ -File: src/types/response/v5-spot-leverage-token.ts -================ -import { - LeverageTokenStatusV5, - LTOrderStatusV5, - LTOrderTypeV5, -} from '../shared-v5'; -⋮---- -export interface LeverageTokenInfoV5 { - ltCoin: string; - ltName: string; - maxPurchase: string; - minPurchase: string; - maxPurchaseDaily: string; - maxRedeem: string; - minRedeem: string; - maxRedeemDaily: string; - purchaseFeeRate: string; - redeemFeeRate: string; - ltStatus: LeverageTokenStatusV5; - fundFee: string; - fundFeeTime: string; - manageFeeRate: string; - manageFeeTime: string; - value: string; - netValue: string; - total: string; -} -⋮---- -export interface LeveragedTokenMarketResultV5 { - ltCoin: string; - nav: string; - navTime: string; - circulation: string; - basket: string; - leverage: string; +export interface LeveragedTokenMarketResultV5 { + ltCoin: string; + nav: string; + navTime: string; + circulation: string; + basket: string; + leverage: string; } ⋮---- export interface PurchaseSpotLeveragedTokenResultV5 { @@ -10283,92 +9702,222 @@ export interface FixedRateAvailableInventoryV5 { } ================ -File: src/types/response/v5-trade.ts +File: src/types/response/v5-spot-x.ts ================ -import { - CategoryV5, - OrderCancelTypeV5, - OrderCreateTypeV5, - OrderRejectReasonV5, - OrderSideV5, - OrderStatusV5, - OrderTimeInForceV5, - OrderTriggerByV5, - OrderTypeV5, - PositionIdx, - StopOrderTypeV5, -} from '../shared-v5'; -⋮---- -export interface OrderResultV5 { - orderId: string; - orderLinkId: string; +export interface LaunchpoolPoolV5 { + poolId: string; + stakeCoin: string; + apr: string; + totalStakedAmount: string; + participantCount: string; } ⋮---- -export interface AccountOrderV5 { - orderId: string; - orderLinkId: string; - parentOrderLinkId?: string; // Linked parent order for attached TP/SL orders (futures & options) - blockTradeId: string; - symbol: string; - price: string; - qty: string; - side: OrderSideV5; - isLeverage: '0' | '1'; - positionIdx: PositionIdx; - orderStatus: OrderStatusV5; - createType: OrderCreateTypeV5; - cancelType: OrderCancelTypeV5; - rejectReason: OrderRejectReasonV5; - avgPrice: string; - leavesQty: string; - leavesValue: string; - cumExecQty: string; - cumExecValue: string; - cumExecFee: string; - timeInForce: OrderTimeInForceV5; - orderType: OrderTypeV5; - stopOrderType: StopOrderTypeV5; - orderIv: string; - marketUnit: 'baseCoin' | 'quoteCoin'; - slippageToleranceType: string; - slippageTolerance: string; - triggerPrice: string; - takeProfit: string; - stopLoss: string; - tpslMode: 'Full' | 'Partial' | ''; - ocoTriggerType: - | 'OcoTriggerByUnknown' - | 'OcoTriggerTp' - | 'OcoTriggerBySl' - | ''; - tpLimitPrice: string; - slLimitPrice: string; - tpTriggerBy: OrderTriggerByV5; - slTriggerBy: OrderTriggerByV5; - triggerDirection: 1 | 2; - triggerBy: OrderTriggerByV5; - lastPriceOnCreated: string; - basePrice: string; - reduceOnly: boolean; - closeOnTrigger: boolean; - placeType: 'iv' | 'price' | ''; - smpType: string; - smpGroup: string; - smpOrderId: string; - createdTime: string; - updatedTime: string; - extraFees: string; - cumFeeDetail?: Record; // Cumulative trading fee details instead of cumExecFee - rpiTakerAccess?: boolean; - rpiMatchedQty?: string; - fromAccount?: string; - toAccount?: string; - externalEventType?: string; +export interface LaunchpoolProjectV5 { + projectId: string; + activityCoin: string; + rewardCoin: string; + status: number; + totalReward: string; + stakeStartTime: string; + stakeEndTime: string; + totalParticipantCount: string; + pools: LaunchpoolPoolV5[]; } ⋮---- -parentOrderLinkId?: string; // Linked parent order for attached TP/SL orders (futures & options) +export interface LaunchpoolProjectListResultV5 { + list: LaunchpoolProjectV5[]; + nextPageCursor: string; +} ⋮---- -cumFeeDetail?: Record; // Cumulative trading fee details instead of cumExecFee +export interface LaunchpoolActivityLogItemV5 { + stakeCoin: string; + rewardCoin: string; + amount: string; + type: number; + status: number; + createdTime: string; + orderId: string; +} +⋮---- +export interface LaunchpoolActivityLogResultV5 { + list: LaunchpoolActivityLogItemV5[]; + total: number; + pageSize: number; + current: number; +} +⋮---- +export interface LaunchpoolStakingPositionV5 { + stakeCoin: string; + rewardCoin: string; + stakeAmount: string; + totalReward: string; + autoRedeemDate: string; +} +⋮---- +export interface LaunchpoolCurrentStakingResultV5 { + totalInvestmentUsd: string; + totalEarningsUsd: string; + todayEarningsUsd: string; + list: LaunchpoolStakingPositionV5[]; +} +⋮---- +export interface LaunchpoolUserHistoryItemV5 { + stakeCoin: string; + rewardCoin: string; + totalReward: string; + stakeStartTime: string; + stakeEndTime: string; +} +⋮---- +export interface LaunchpoolUserHistoryResultV5 { + list: LaunchpoolUserHistoryItemV5[]; + total: number; + pageSize: number; + current: number; +} +⋮---- +export interface PuzzleProjectV5 { + projectId: string; + activityCoin: string; + rewardCoin: string; + status: number; + startTime: string; + endTime: string; + totalReward: string; + participantCount: string; +} +⋮---- +export interface PuzzleProjectListResultV5 { + list: PuzzleProjectV5[]; + nextPageCursor: string; +} +⋮---- +export interface TokenSplashProjectV5 { + status: number; + projectId: string; + activityCoin: string; + rewardCoin: string; + totalReward: string; + participantCount: string; + registrationStartTime: string; + activityEndTime: string; +} +⋮---- +export interface TokenSplashProjectListResultV5 { + list: TokenSplashProjectV5[]; + nextPageCursor: string; +} +⋮---- +export interface TokenSplashTradeTaskV5 { + tradeRequiredAmount: string; + tradeUnit: string; + /** Token counted by the trade task. On-chain tasks use the activity token ID. */ + tradeToken?: string; + tradedAmount: string; + maxRewardAmount: string; + estimatedRewardAmount: string; + rewardCoin: string; +} +⋮---- +/** Token counted by the trade task. On-chain tasks use the activity token ID. */ +⋮---- +export interface TokenSplashUserActivityItemV5 { + projectId: string; + activityCoin: string; + tradeTask: TokenSplashTradeTaskV5; +} +⋮---- +export interface TokenSplashUserActivityResultV5 { + list: TokenSplashUserActivityItemV5[]; +} + +================ +File: src/types/response/v5-trade.ts +================ +import { + CategoryV5, + OrderCancelTypeV5, + OrderCreateTypeV5, + OrderRejectReasonV5, + OrderSideV5, + OrderStatusV5, + OrderTimeInForceV5, + OrderTriggerByV5, + OrderTypeV5, + PositionIdx, + StopOrderTypeV5, +} from '../shared-v5'; +⋮---- +export interface OrderResultV5 { + orderId: string; + orderLinkId: string; +} +⋮---- +export interface AccountOrderV5 { + orderId: string; + orderLinkId: string; + parentOrderLinkId?: string; // Linked parent order for attached TP/SL orders (futures & options) + blockTradeId: string; + symbol: string; + price: string; + qty: string; + side: OrderSideV5; + isLeverage: '0' | '1'; + positionIdx: PositionIdx; + orderStatus: OrderStatusV5; + createType: OrderCreateTypeV5; + cancelType: OrderCancelTypeV5; + rejectReason: OrderRejectReasonV5; + avgPrice: string; + leavesQty: string; + leavesValue: string; + cumExecQty: string; + cumExecValue: string; + cumExecFee: string; + timeInForce: OrderTimeInForceV5; + orderType: OrderTypeV5; + stopOrderType: StopOrderTypeV5; + orderIv: string; + marketUnit: 'baseCoin' | 'quoteCoin'; + slippageToleranceType: string; + slippageTolerance: string; + triggerPrice: string; + takeProfit: string; + stopLoss: string; + tpslMode: 'Full' | 'Partial' | ''; + ocoTriggerType: + | 'OcoTriggerByUnknown' + | 'OcoTriggerTp' + | 'OcoTriggerBySl' + | ''; + tpLimitPrice: string; + slLimitPrice: string; + tpTriggerBy: OrderTriggerByV5; + slTriggerBy: OrderTriggerByV5; + triggerDirection: 1 | 2; + triggerBy: OrderTriggerByV5; + lastPriceOnCreated: string; + basePrice: string; + reduceOnly: boolean; + closeOnTrigger: boolean; + placeType: 'iv' | 'price' | ''; + smpType: string; + smpGroup: string; + smpOrderId: string; + createdTime: string; + updatedTime: string; + extraFees: string; + cumFeeDetail?: Record; // Cumulative trading fee details instead of cumExecFee + rpiTakerAccess?: boolean; + rpiMatchedQty?: string; + fromAccount?: string; + toAccount?: string; + externalEventType?: string; +} +⋮---- +parentOrderLinkId?: string; // Linked parent order for attached TP/SL orders (futures & options) +⋮---- +cumFeeDetail?: Record; // Cumulative trading fee details instead of cumExecFee ⋮---- export interface BatchCreateOrderResultV5 { category: CategoryV5; @@ -10839,161 +10388,45 @@ token: string; // Coin name quantity: string; // The qty to be repaid ================ -File: src/types/request/v5-earn.ts +File: src/types/request/v5-user.ts ================ -export interface GetEarnCouponListParamsV5 { - category: 'FlexibleSaving' | 'DualAssets'; -} +import { PermissionsV5 } from '../shared-v5'; ⋮---- -/** GET /v5/earn/flexible-saving/auto-savings. coins is a repeated query param, max 50. */ -export interface GetFlexibleSavingAutoSavingsParamsV5 { - coins?: string[]; +export interface CreateSubMemberParamsV5 { + username: string; + password?: string; + /** + * 1: normal, 6: custodial + */ + memberType: 1 | 6; + /** + * 0: quick login disabled (default), 1: quick login enabled + */ + switch?: 0 | 1; + isUta?: boolean; + note?: string; } ⋮---- -/** POST /v5/earn/flexible-saving/auto-savings. Omit coin to update the global setting. */ -export interface SetFlexibleSavingAutoSavingsParamsV5 { - coin?: string; - isSelected: boolean; - purchaseImmediately?: boolean; -} +/** + * 1: normal, 6: custodial + */ ⋮---- -export interface SubmitStakeRedeemParamsV5 { - category: string; - orderType: 'Stake' | 'Redeem'; - accountType: 'FUND' | 'UNIFIED'; - amount: string; - coin: string; - productId: string; - orderLinkId: string; - toAccountType?: 'FUND' | 'UNIFIED'; -} +/** + * 0: quick login disabled (default), 1: quick login enabled + */ ⋮---- -export interface GetEarnOrderHistoryParamsV5 { - category: string; - orderId?: string; - orderLinkId?: string; - productId?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; +export interface CreateSubApiKeyParamsV5 { + subuid: number; + note?: string; + readOnly: 0 | 1; + ips?: string; + permissions: PermissionsV5; } ⋮---- -export interface GetEarnPositionParamsV5 { - category: string; - productId?: string; - coin?: string; -} -⋮---- -export interface GetEarnYieldHistoryParamsV5 { - category: string; - productId?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; -} -⋮---- -export interface GetEarnHourlyYieldHistoryParamsV5 { - category: string; - productId?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; -} -⋮---- -export interface ModifyEarnPositionParamsV5 { - category: 'OnChain'; - productId: number; - positionId: number; - autoReinvest: 0 | 1; -} -⋮---- -export interface GetEarnAprHistoryParamsV5 { - category: 'FlexibleSaving' | 'OnChain'; - productId: string; - startTime?: number; - endTime?: number; -} -⋮---- -/** - * GET /v5/earn/advance/product — Advanced Earn: Dual Asset, Double Win, Smart Leverage, etc. - * Public, no auth. Rate limit: 50 req/s per IP. - */ -export interface GetAdvanceEarnProductParamsV5 { - category: 'DualAssets' | 'DoubleWin' | 'SmartLeverage' | 'DiscountBuy'; - coin?: string; - /** - * Product duration, e.g. 8h, 1d, 2d, 3d, 6d, 7d, 12d (depends on product). - */ - duration?: string; -} -⋮---- -/** - * Product duration, e.g. 8h, 1d, 2d, 3d, 6d, 7d, 12d (depends on product). - */ -⋮---- -/** GET /v5/earn/hold-to-earn/yield-history — Hold to Earn airdrop daily PnL (Earn permission) */ -export interface GetHoldToEarnAirdropYieldHistoryParamsV5 { - /** Unix seconds. Cannot be earlier than now minus 3 months */ - timeStart?: number; - /** Unix seconds. Requires timeStart ≤ timeEnd */ - timeEnd?: number; - /** Page size [1, 49] */ - limit: number; - /** Pagination cursor from previous `nextCursor` */ - cursor?: string; -} -⋮---- -/** Unix seconds. Cannot be earlier than now minus 3 months */ -⋮---- -/** Unix seconds. Requires timeStart ≤ timeEnd */ -⋮---- -/** Page size [1, 49] */ -⋮---- -/** Pagination cursor from previous `nextCursor` */ - -================ -File: src/types/request/v5-user.ts -================ -import { PermissionsV5 } from '../shared-v5'; -⋮---- -export interface CreateSubMemberParamsV5 { - username: string; - password?: string; - /** - * 1: normal, 6: custodial - */ - memberType: 1 | 6; - /** - * 0: quick login disabled (default), 1: quick login enabled - */ - switch?: 0 | 1; - isUta?: boolean; - note?: string; -} -⋮---- -/** - * 1: normal, 6: custodial - */ -⋮---- -/** - * 0: quick login disabled (default), 1: quick login enabled - */ -⋮---- -export interface CreateSubApiKeyParamsV5 { - subuid: number; - note?: string; - readOnly: 0 | 1; - ips?: string; - permissions: PermissionsV5; -} -⋮---- -export interface UpdateApiKeyParamsV5 { - apikey?: string; - readOnly?: 0 | 1; - permissions: PermissionsV5; +export interface UpdateApiKeyParamsV5 { + apikey?: string; + readOnly?: 0 | 1; + permissions: PermissionsV5; } ⋮---- export interface UpdateSubApiKeyUpdateParamsV5 { @@ -11080,10127 +10513,10742 @@ export interface SignAgreementParamsV5 { } ================ -File: examples/Rest/rest-v5-custom-url.ts -================ -import { RestClientV5 } from '../../src/index'; -⋮---- -// or -// import { RestClientV5 } from 'bybit-api'; -⋮---- -/** - * The first parameter of the REST client allows you to pass any configuration parameters supported by the SDK. - * - * These include API keys, if you wish to use private endpoints, but also expose other features such as - * setting a custom base URL (e.g. for Turkish users). - * - * Refer to the API documentation for a complete list of domains: https://bybit-exchange.github.io/docs/v5/guide#authentication - */ -⋮---- -/** - * You can pass a completely custom base URL, - * e.g. if you're trying to use a domain that hasn't been added yet (please let us know) - */ -// baseUrl: 'https://api5.bybit.com', -// -// -/** - * - * Predefined API regions are available through the `apiRegion` property. - * Choose the region where your Bybit account is registered: - * - */ -// -// -// default: routes to api.bybit.com -// apiRegion: 'default', -// -// -// bytick: routes to api.bytick.com -// apiRegion: 'bytick', -// -// -// NL: Bybit removed api.bybit.nl from Integration Guidance on 2026-09-22. apiRegion no longer includes NL. -// -// -// TK: routes to api.bybit.tr (for Turkey users) -// apiRegion: 'TK', -// -// -// KZ: routes to api.bybit.kz (for Kazakhstan users) -// apiRegion: 'KZ', -// -// -// HK: routes to api.spark-fintech.com and adds x-refer-site-id: HKG -// Testnet routes to api-testnet.spark-fintech.com -// apiRegion: 'HK', -// -// -// GE: routes to api.bybitgeorgia.ge (for Georgia users) -// apiRegion: 'GE', -// -// -// UAE: routes to api.bybit.ae (for United Arab Emirates users) -// apiRegion: 'UAE', -// -// -// EU: routes to api.bybit.eu (for EU and EEA users) -// apiRegion: 'EU', -// -// -// ID: routes to api.bybit.id (for Indonesian users) -// apiRegion: 'ID', -// -// -// JP: routes to api.manepa.jp (for Japan users) -// Testnet routes to api-testnet.manepa.jp -// apiRegion: 'JP', -// -// -/** - * Brazil and Argentina international accounts use the global API domain - * with an x-site-id header. Choose the site ID for your account: - */ -// siteId: 'BRA_BTL', -// siteId: 'ARG_BTL', - -================ -File: src/types/request/v5-asset.ts +File: src/types/response/v5-crypto-loan.ts ================ -import { AccountTypeV5, CategoryV5 } from '../shared-v5'; +export interface CollateralCoinV5 { + collateralAccuracy: number; + initialLTV: string; + liquidationLTV: string; + marginCallLTV: string; + maxLimit: string; +} ⋮---- -export interface GetCoinExchangeRecordParamsV5 { - fromCoin?: string; - toCoin?: string; - limit?: number; - cursor?: string; +export interface VipCollateralCoinsV5 { + list: CollateralCoinV5[]; + vipLevel: string; } ⋮---- -export interface GetDeliveryRecordParamsV5 { - category: CategoryV5; - symbol?: string; - startTime?: number; - endTime?: number; - expDate?: string; - limit?: number; - cursor?: string; +export interface BorrowableCoinV5 { + borrowingAccuracy: number; + currency: string; + flexibleHourlyInterestRate: string; + hourlyInterestRate7D: string; + hourlyInterestRate14D: string; + hourlyInterestRate30D: string; + hourlyInterestRate90D: string; + hourlyInterestRate180D: string; + maxBorrowingAmount: string; + minBorrowingAmount: string; } ⋮---- -export interface GetSettlementRecordParamsV5 { - category: CategoryV5; - symbol?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; +export interface VipBorrowableCoinsV5 { + list: BorrowableCoinV5[]; + vipLevel: string; } ⋮---- -export interface GetAssetInfoParamsV5 { - accountType: AccountTypeV5; - coin?: string; +export interface AccountBorrowCollateralLimitV5 { + collateralCurrency: string; + loanCurrency: string; + maxCollateralAmount: string; + maxLoanAmount: string; + minCollateralAmount: string; + minLoanAmount: string; } ⋮---- -export interface GetAllCoinsBalanceParamsV5 { - memberId?: string; - accountType: AccountTypeV5; - coin?: string; - withBonus?: number; +export interface UnpaidLoanOrderV5 { + collateralAmount: string; + collateralCurrency: string; + currentLTV: string; + expirationTime: string; + hourlyInterestRate: string; + loanCurrency: string; + loanTerm: string; + orderId: string; + residualInterest: string; + residualPenaltyInterest: string; + totalDebt: string; } ⋮---- -export interface GetAccountCoinBalanceParamsV5 { - memberId?: string; - toMemberId?: string; - accountType: AccountTypeV5; - coin: string; - toAccountType?: AccountTypeV5; - withBonus?: number; - withTransferSafeAmount?: 0 | 1; - withLtvTransferSafeAmount?: 0 | 1; +export interface RepaymentHistoryV5 { + collateralCurrency: string; + collateralReturn: string; + loanCurrency: string; + loanTerm: string; + orderId: string; + repayAmount: string; + repayId: string; + repayStatus: number; + repayTime: string; + repayType: string; } ⋮---- -export interface GetInternalTransferParamsV5 { - transferId?: string; - coin?: string; - status?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; +export interface CompletedLoanOrderV5 { + borrowTime: string; + collateralCurrency: string; + expirationTime: string; + hourlyInterestRate: string; + initialCollateralAmount: string; + initialLoanAmount: string; + loanCurrency: string; + loanTerm: string; + orderId: string; + repaidInterest: string; + repaidPenaltyInterest: string; + status: number; } -⋮---- -export interface UniversalTransferParamsV5 { - transferId: string; - coin: string; +export interface LoanLTVAdjustmentHistoryV5 { + collateralCurrency: string; + orderId: string; + adjustId: string; + adjustTime: string; + preLTV: string; + afterLTV: string; + direction: number; amount: string; - fromMemberId: number; - toMemberId: number; - fromAccountType: AccountTypeV5; - toAccountType: AccountTypeV5; } ⋮---- -export interface GetUniversalTransferRecordsParamsV5 { - transferId?: string; - coin?: string; - status?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; - fromMemberId?: string; - toMemberId?: string; +// New Crypto Loan Types +⋮---- +export interface BorrowCoinV5 { + currency: string; + fixedBorrowable: boolean; + fixedBorrowingAccuracy: number; + flexibleBorrowable: boolean; + flexibleBorrowingAccuracy: number; + maxBorrowingAmount: string; + minFixedBorrowingAmount: string; + minFlexibleBorrowingAmount: string; + vipLevel: string; + flexibleAnnualizedInterestRate: string; + annualizedInterestRate7D: string; + annualizedInterestRate14D: string; + annualizedInterestRate30D: string; + annualizedInterestRate60D: string; + annualizedInterestRate90D: string; + annualizedInterestRate180D: string; } ⋮---- -export interface GetAllowedDepositCoinInfoParamsV5 { - coin?: string; - chain?: string; - limit?: number; - cursor?: string; +export interface CollateralRatioV5 { + collateralRatio: string; + maxValue: string; + minValue: string; } ⋮---- -export interface GetDepositRecordParamsV5 { - id?: string; - txID?: string; - coin?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; +export interface CollateralRatioConfigV5 { + collateralRatioList: CollateralRatioV5[]; + currencies: string; } ⋮---- -export interface GetSubAccountDepositRecordParamsV5 { - id?: string; - txID?: string; - subMemberId: string; - coin?: string; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; +export interface CurrencyLiquidationV5 { + currency: string; + liquidationOrder: number; } ⋮---- -export interface GetInternalDepositRecordParamsV5 { - txID?: string; - startTime?: number; - endTime?: number; - coin?: string; - cursor?: string; - limit?: number; +export interface CollateralDataV5 { + collateralRatioConfigList: CollateralRatioConfigV5[]; + currencyLiquidationList: CurrencyLiquidationV5[]; } ⋮---- -export interface GetWithdrawalRecordsParamsV5 { - withdrawID?: string; - txID?: string; - coin?: string; - withdrawType?: number; - startTime?: number; - endTime?: number; - limit?: number; - cursor?: string; +// Additional New Crypto Loan Types +⋮---- +export interface AdjustCollateralAmountV5 { + adjustId: number; } ⋮---- -export interface GetWithdrawalAddressListParamsV5 { - coin?: string; - chain?: string; - addressType?: 0 | 1 | 2; - limit?: number; - cursor?: string; +export interface CollateralAdjustmentHistoryV5 { + adjustId: number; + adjustTime: number; + afterLTV: string; + amount: string; + collateralCurrency: string; + direction: number; + preLTV: string; + status: number; } ⋮---- -export interface SubmitDepositOriginatorInfoParamsV5 { - depositId: number; - subAccountId?: number; - /** Travel Rule questionnaire JSON string. See Questionnaire docs. */ - questionnaire: string; +export interface BorrowListV5 { + fixedTotalDebt: string; + fixedTotalDebtUSD: string; + flexibleHourlyInterestRate: string; + flexibleTotalDebt: string; + flexibleTotalDebtUSD: string; + loanCurrency: string; } ⋮---- -/** Travel Rule questionnaire JSON string. See Questionnaire docs. */ +export interface CollateralListV5 { + amount: string; + amountUSD: string; + currency: string; + ltv: string; +} ⋮---- -export interface WithdrawParamsV5 { - coin: string; - /** - * When forceChain is 0 or 1, required. When forceChain is 2 (Bybit UID withdraw), may be null/omitted. - */ - chain?: string; - address: string; - tag?: string; +export interface SupplyListV5 { amount: string; - timestamp: number; - forceChain?: number; - /** - * FUND, UTA, or EARN; or comma combo e.g. FUND,UTA,EARN (funding first, then UTA and Earn for remainder). - * SPOT is legacy if still supported for older integrations. - */ - accountType: string; - feeType?: 0 | 1; - requestId?: string; - /** - * Required for Bybit Turkey (TR) site users when creating a withdrawal. Omitted for other regions unless the API requires it. - */ - transactionPurpose?: string; - /** - * Travel Rule questionnaire JSON string (max 16384 bytes). Takes precedence over `beneficiary` / `transactionPurpose` when both are set. - */ - questionnaire?: string; - beneficiary?: { - vaspEntityId?: string; - beneficiaryName?: string; - beneficiaryLegalType?: string; - beneficiaryWalletType?: string; - beneficiaryUnhostedWalletType?: string; - beneficiaryPoiNumber?: string; - beneficiaryPoiType?: string; - beneficiaryPoiIssuingCountry?: string; - beneficiaryPoiExpiredDate?: string; - }; + amountUSD: string; + currency: string; } ⋮---- -/** - * When forceChain is 0 or 1, required. When forceChain is 2 (Bybit UID withdraw), may be null/omitted. - */ +export interface CryptoLoanPositionV5 { + borrowList: BorrowListV5[]; + collateralList: CollateralListV5[]; + supplyList: SupplyListV5[]; + totalCollateral: string; + totalDebt: string; + totalSupply: string; + colRes?: string; +} ⋮---- -/** - * FUND, UTA, or EARN; or comma combo e.g. FUND,UTA,EARN (funding first, then UTA and Earn for remainder). - * SPOT is legacy if still supported for older integrations. - */ +// Flexible Loan Types ⋮---- -/** - * Required for Bybit Turkey (TR) site users when creating a withdrawal. Omitted for other regions unless the API requires it. - */ +export interface BorrowFlexibleV5 { + orderId: string; +} ⋮---- -/** - * Travel Rule questionnaire JSON string (max 16384 bytes). Takes precedence over `beneficiary` / `transactionPurpose` when both are set. - */ +export interface RepayFlexibleV5 { + repayId: string; +} ⋮---- -export interface ConvertCoinsParamsV5 { - coin?: string; - side?: number; - accountType: - | 'eb_convert_funding' - | 'eb_convert_uta' - | 'eb_convert_spot' - | 'eb_convert_contract' - | 'eb_convert_inverse'; +export interface OngoingFlexibleLoanV5 { + hourlyInterestRate: string; + loanCurrency: string; + totalDebt: string; + unpaidAmount: string; + unpaidInterest: string; } ⋮---- -export interface RequestConvertQuoteParamsV5 { - fromCoin: string; - toCoin: string; - fromCoinType?: string; - toCoinType?: string; - requestCoin: string; - requestAmount: string; - accountType: - | 'eb_convert_funding' - | 'eb_convert_uta' - | 'eb_convert_spot' - | 'eb_convert_contract' - | 'eb_convert_inverse'; - requestId?: string; +export interface BorrowHistoryFlexibleV5 { + borrowTime: number; + initialLoanAmount: string; + loanCurrency: string; + orderId: string; + status: number; } ⋮---- -export interface GetConvertHistoryParamsV5 { - accountType?: string; - index?: number; - limit?: number; +export interface RepaymentHistoryFlexibleV5 { + loanCurrency: string; + repayAmount: string; + repayId: string; + repayStatus: number; + repayTime: number; + repayType: number; } ⋮---- -export interface GetSmallBalanceListParamsV5 { - accountType: 'eb_convert_uta'; // Wallet type, only supports Unified wallet - fromCoin?: string; // Source currency -} +// Fixed Loan Types ⋮---- -accountType: 'eb_convert_uta'; // Wallet type, only supports Unified wallet -fromCoin?: string; // Source currency +export interface SupplyOrderQuoteFixedV5 { + orderCurrency: string; + term: number; + annualRate: string; + qty: string; +} ⋮---- -export interface GetFiatTradingPairListParamsV5 { - side?: 0 | 1; // 0: buy (buy crypto, sell fiat), 1: sell (sell crypto, buy fiat) +export interface BorrowOrderQuoteFixedV5 { + orderCurrency: string; + term: number; + annualRate: string; + qty: string; } ⋮---- -side?: 0 | 1; // 0: buy (buy crypto, sell fiat), 1: sell (sell crypto, buy fiat) +export interface CreateBorrowOrderFixedV5 { + orderId: string; +} ⋮---- -/** Funding Account Transaction History. Interval createTimeFrom-createTimeTo max 7 days. */ -export interface GetFundingAccountTransactionHistoryParamsV5 { - createTimeFrom?: string; - createTimeTo?: string; - limit?: string; - cursor?: string; +export interface CreateSupplyOrderFixedV5 { + orderId: string; } ⋮---- -/** Asset Overview. memberId required when querying sub account via master API key. */ -export interface GetAssetOverviewParamsV5 { - memberId?: string; - /** Fiat currency for valuation; defaults to USD if omitted. */ - valuationCurrency?: string; - /** Account type filter; returns all if omitted. */ - accountType?: string; +export interface BorrowContractInfoFixedV5 { + annualRate: string; + autoRepay: string; // Deprecated + borrowCurrency: string; + borrowTime: string; + interestPaid: string; + loanId: string; + orderId: string; + repayType: string; // 1: Auto Repayment; 2: Transfer to flexible loan; 0: No Automatic Repayment + repaymentTime: string; + residualPenaltyInterest: string; + residualPrincipal: string; + status: number; + term: string; } ⋮---- -/** Fiat currency for valuation; defaults to USD if omitted. */ +autoRepay: string; // Deprecated ⋮---- -/** Account type filter; returns all if omitted. */ +repayType: string; // 1: Auto Repayment; 2: Transfer to flexible loan; 0: No Automatic Repayment ⋮---- -/** GET /v5/asset/portfolio-margin */ -export interface GetPortfolioMarginInfoParamsV5 { - baseCoin?: string; +export interface SupplyContractInfoFixedV5 { + annualRate: string; + supplyCurrency: string; + supplyTime: string; + supplyAmount: string; + interestPaid: string; + supplyId: string; + orderId: string; + redemptionTime: string; + penaltyInterest: string; + actualRedemptionTime: string; + status: number; + term: string; } ⋮---- -/** GET /v5/asset/total-members-assets */ -export interface GetTotalMembersAssetsParamsV5 { - /** If omitted, defaults to BTC. Total is quoted in this coin. */ - coin?: string; +export interface BorrowOrderInfoFixedV5 { + annualRate: string; + orderId: number; + orderTime: string; + filledQty: string; + orderQty: string; + orderCurrency: string; + state: number; + term: number; + repayType: string; // 1: Auto Repayment; 2: Transfer to flexible loan; 0: No Automatic Repayment + strategyType?: 'PARTIAL' | 'FULL' | string; } ⋮---- -/** If omitted, defaults to BTC. Total is quoted in this coin. */ - -================ -File: src/types/request/v5-market.ts -================ -import { KlineIntervalV3 } from '../shared'; -import { - CategoryV5, - InstrumentStatusV5, - InstrumentSymbolTypeV5, - OptionTypeV5, -} from '../shared-v5'; +repayType: string; // 1: Auto Repayment; 2: Transfer to flexible loan; 0: No Automatic Repayment ⋮---- -export interface GetKlineParamsV5 { - category: 'spot' | 'linear' | 'inverse'; - symbol: string; - interval: KlineIntervalV3; - start?: number; - end?: number; - limit?: number; +export interface FixedLoanAvailableInventoryV5 { + currency: string; + term: string; + annualRate: string; + availableInventory: string; + updateTime: string; } ⋮---- -export interface GetMarkPriceKlineParamsV5 { - /** - * linear (default if omitted), inverse, or option. - */ - category?: 'linear' | 'inverse' | 'option'; - symbol: string; - interval: KlineIntervalV3; - start?: number; - end?: number; - /** - * Futures: [1, 1000], default 200. Options: [1, 500], default 200. - */ - limit?: number; +export interface FlexibleLoanAvailableInventoryV5 { + currency: string; + availableInventory: string; + updateTime: string; } ⋮---- -/** - * linear (default if omitted), inverse, or option. - */ -⋮---- -/** - * Futures: [1, 1000], default 200. Options: [1, 500], default 200. - */ -⋮---- -export interface GetIndexPriceKlineParamsV5 { - category: 'linear' | 'inverse'; - symbol: string; - interval: KlineIntervalV3; - start?: number; - end?: number; - limit?: number; +export interface SupplyOrderInfoFixedV5 { + annualRate: string; + orderId: number; + orderTime: string; + filledQty: string; + orderQty: string; + orderCurrency: string; + state: number; + term: number; } ⋮---- -export interface GetPremiumIndexPriceKlineParamsV5 { - category: 'linear'; - symbol: string; - interval: KlineIntervalV3; - start?: number; - end?: number; - limit?: number; +export interface RepayFixedV5 { + repayId: string; } ⋮---- -export interface GetInstrumentsInfoParamsV5 { - category: CategoryV5; - symbol?: string; - /** Filter by instrument `symbolType` (e.g. `commodity`, `stock`, `forex` for linear). */ - symbolType?: InstrumentSymbolTypeV5; - status?: InstrumentStatusV5; - /** For `category=option`, pass `All` to return all option symbols. */ - baseCoin?: string; - limit?: number; - cursor?: string; +export interface RepaymentHistoryFixedV5 { + details: { + loanCurrency: string; + loanId: string; + repayAmount: string; + }[]; + loanCurrency: string; + repayAmount: string; + repayId: string; + repayStatus: number; + repayTime: number; + repayType: number; } ⋮---- -/** Filter by instrument `symbolType` (e.g. `commodity`, `stock`, `forex` for linear). */ -⋮---- -/** For `category=option`, pass `All` to return all option symbols. */ -⋮---- -export interface GetOrderbookParamsV5 { - category: CategoryV5; - symbol: string; - limit?: number; +export interface RenewBorrowOrderFixedV5 { + orderId: string; } ⋮---- -export interface GetRPIOrderbookParamsV5 { - category?: 'spot' | 'linear' | 'inverse'; - symbol: string; - limit: number; // Required for RPI orderbook, [1, 50] +export interface RenewOrderInfoFixedV5 { + amount: string; + autoRepay: number; + borrowCurrency: string; + contractNo: string; + dueTime: string; + loanId: string; + orderId: number; + renewLoanNo: string; + time: string; } ⋮---- -limit: number; // Required for RPI orderbook, [1, 50] +// Institutional Loan Types ⋮---- -export interface GetIndexPriceComponentsParamsV5 { - indexName: string; // Index name, like BTCUSDT +export interface InstitutionalLendingProductInfoV5 { + productId: string; + leverage: string; + supportSpot: number; + supportContract: number; + supportMarginTrading: number; + withdrawLine: string; + transferLine: string; + spotBuyLine: string; + spotSellLine: string; + contractOpenLine: string; + liquidationLine: string; + stopLiquidationLine: string; + contractLeverage: string; + transferRatio: string; + spotSymbols: unknown[]; + contractSymbols: unknown[]; + supportUSDCContract: number; + supportUSDCOptions: number; + USDTPerpetualOpenLine?: string; + USDCContractOpenLine?: string; + USDCOptionsOpenLine?: string; + USDTPerpetualCloseLine?: string; + USDCContractCloseLine?: string; + USDCOptionsCloseLine?: string; + USDTPerpetualLeverage?: { symbol: string; leverage: string }[]; + USDCContractLeverage?: { symbol: string; leverage: string }[]; + deferredLiquidationLine?: string; + deferredLiquidationTime?: string; + marginLeverage?: string; + /** `0`: Default, `1`: CTA, `2`: Hedge */ + productType?: '0' | '1' | '2' | string; } ⋮---- -indexName: string; // Index name, like BTCUSDT +/** `0`: Default, `1`: CTA, `2`: Hedge */ ⋮---- -export interface GetADLAlertParamsV5 { - symbol?: string; // Contract name, e.g. BTCUSDT. Uppercase only +export interface InstitutionalLendingCoinDeltaItemV5 { + coin: string; + coinDeltaSize: string; + coinDeltaAvailableAmount: string; + coinDeltaAmount: string; } ⋮---- -symbol?: string; // Contract name, e.g. BTCUSDT. Uppercase only +export interface InstitutionalLendingCoinDeltaAmountV5 { + riskUnitDeltaAmount: string; + riskUnitDeltaAvailableAmount: string; + riskUnitDelta?: string; + list: InstitutionalLendingCoinDeltaItemV5[]; +} ⋮---- -export interface GetFeeGroupStructureParamsV5 { - productType: string; // Product type. contract only for now - groupId?: string; // Group ID. 1, 2, 3, 4, 5, 6, 7 +export interface InstitutionalLendingDelayLiquidationStatusV5 { + ltv: string; + /** 0 normal, 1 passive liquidation, 2 callback liquidation, 3 delay liquidation */ + liquidationStatus: 0 | 1 | 2 | 3; + delayLiqStartTime: string; + delayLiqRemainingSec: string; } ⋮---- -productType: string; // Product type. contract only for now -groupId?: string; // Group ID. 1, 2, 3, 4, 5, 6, 7 +/** 0 normal, 1 passive liquidation, 2 callback liquidation, 3 delay liquidation */ ⋮---- -export interface GetTickersParamsV5 { - category: TCategory; - symbol?: string; - baseCoin?: string; - expDate?: string; +export interface UnpaidInfoV5 { + token: string; // Coin + unpaidQty: string; // Unpaid principle + unpaidInterest: string; // Unpaid interest } ⋮---- -export interface GetFundingRateHistoryParamsV5 { - category: 'linear' | 'inverse'; - symbol: string; - startTime?: number; - endTime?: number; - limit?: number; +token: string; // Coin +unpaidQty: string; // Unpaid principle +unpaidInterest: string; // Unpaid interest +⋮---- +export interface BalanceInfoV5 { + token: string; // Margin coin + price: string; // Margin coin price + qty: string; // Margin coin quantity + convertedAmount: string; // Margin conversion amount } ⋮---- -export interface GetPublicTradingHistoryParamsV5 { - category: CategoryV5; - symbol: string; - baseCoin?: string; - optionType?: OptionTypeV5; - limit?: number; +token: string; // Margin coin +price: string; // Margin coin price +qty: string; // Margin coin quantity +convertedAmount: string; // Margin conversion amount +⋮---- +export interface LTVInfoV5 { + ltv: string; // Risk rate (when liqStatus != 0, returns empty string) + rst: string; // Remaining liquidation time in UTC seconds (when liqStatus != 0, returns empty string) + parentUid: string; // The designated Risk Unit ID + subAccountUids: string[]; // Bound user IDs + unpaidAmount: string; // Total debt in USDT (when liqStatus != 0, returns empty string) + unpaidInfo: UnpaidInfoV5[]; // Debt details (when liqStatus != 0, returns empty array) + balance: string; // Total asset in USDT (when liqStatus != 0, returns empty string) + balanceInfo: BalanceInfoV5[]; // Asset details (when liqStatus != 0, returns empty array) + liqStatus?: number; // Liquidation status: 0=Normal, 1=Under liquidation, 2=Manual repayment in progress, 3=Transfer in progress } ⋮---- -export type OpenInterestIntervalV5 = - | '5min' - | '15min' - | '30min' - | '1h' - | '4h' - | '1d'; +ltv: string; // Risk rate (when liqStatus != 0, returns empty string) +rst: string; // Remaining liquidation time in UTC seconds (when liqStatus != 0, returns empty string) +parentUid: string; // The designated Risk Unit ID +subAccountUids: string[]; // Bound user IDs +unpaidAmount: string; // Total debt in USDT (when liqStatus != 0, returns empty string) +unpaidInfo: UnpaidInfoV5[]; // Debt details (when liqStatus != 0, returns empty array) +balance: string; // Total asset in USDT (when liqStatus != 0, returns empty string) +balanceInfo: BalanceInfoV5[]; // Asset details (when liqStatus != 0, returns empty array) +liqStatus?: number; // Liquidation status: 0=Normal, 1=Under liquidation, 2=Manual repayment in progress, 3=Transfer in progress ⋮---- -export interface GetOpenInterestParamsV5 { - category: 'linear' | 'inverse'; - symbol: string; - intervalTime: OpenInterestIntervalV5; +export interface InstitutionalLoanLTVV5 { + ltvInfo: LTVInfoV5[]; // LTV info array + liqStatus?: number; // Liquidation status: 0=Normal, 1=Under liquidation, 2=Manual repayment in progress, 3=Transfer in progress +} +⋮---- +ltvInfo: LTVInfoV5[]; // LTV info array +liqStatus?: number; // Liquidation status: 0=Normal, 1=Under liquidation, 2=Manual repayment in progress, 3=Transfer in progress +⋮---- +export interface RepayInstitutionalLoanResultV5 { + repayOrderStatus: string; // P: processing +} +⋮---- +repayOrderStatus: string; // P: processing +⋮---- +// Max Loan Amount Response Types +⋮---- +export interface MaxLoanAmountV5 { + currency: string; // Coin to borrow + maxLoan: string; // Maximum borrowable amount based on current collateral + notionalUsd: string; // Notional USD value + remainingQuota: string; // Remaining individual platform borrowing limit (shared between main and sub accounts) +} +⋮---- +currency: string; // Coin to borrow +maxLoan: string; // Maximum borrowable amount based on current collateral +notionalUsd: string; // Notional USD value +remainingQuota: string; // Remaining individual platform borrowing limit (shared between main and sub accounts) + +================ +File: src/types/request/v5-asset.ts +================ +import { AccountTypeV5, CategoryV5 } from '../shared-v5'; +⋮---- +export interface GetCoinExchangeRecordParamsV5 { + fromCoin?: string; + toCoin?: string; + limit?: number; + cursor?: string; +} +⋮---- +export interface GetDeliveryRecordParamsV5 { + category: CategoryV5; + symbol?: string; startTime?: number; endTime?: number; + expDate?: string; limit?: number; cursor?: string; } ⋮---- -export interface GetHistoricalVolatilityParamsV5 { - category: 'option'; - baseCoin?: string; - period?: 7 | 14 | 21 | 30 | 60 | 90 | 180 | 270; +export interface GetSettlementRecordParamsV5 { + category: CategoryV5; + symbol?: string; startTime?: number; endTime?: number; + limit?: number; + cursor?: string; } ⋮---- -export interface GetInsuranceParamsV5 { +export interface GetAssetInfoParamsV5 { + accountType: AccountTypeV5; coin?: string; } ⋮---- -export interface GetRiskLimitParamsV5 { - category?: 'linear' | 'inverse'; - symbol?: string; +export interface GetAllCoinsBalanceParamsV5 { + memberId?: string; + accountType: AccountTypeV5; + coin?: string; + withBonus?: number; +} +⋮---- +export interface GetAccountCoinBalanceParamsV5 { + memberId?: string; + toMemberId?: string; + accountType: AccountTypeV5; + coin: string; + toAccountType?: AccountTypeV5; + withBonus?: number; + withTransferSafeAmount?: 0 | 1; + withLtvTransferSafeAmount?: 0 | 1; +} +⋮---- +export interface GetInternalTransferParamsV5 { + transferId?: string; + coin?: string; + status?: string; + startTime?: number; + endTime?: number; + limit?: number; cursor?: string; } ⋮---- -export interface GetOptionDeliveryPriceParamsV5 { - category: 'option'; - symbol?: string; - baseCoin?: string; +export interface UniversalTransferParamsV5 { + transferId: string; + coin: string; + amount: string; + fromMemberId: number; + toMemberId: number; + fromAccountType: AccountTypeV5; + toAccountType: AccountTypeV5; +} +⋮---- +export interface GetUniversalTransferRecordsParamsV5 { + transferId?: string; + coin?: string; + status?: string; + startTime?: number; + endTime?: number; limit?: number; cursor?: string; + fromMemberId?: string; + toMemberId?: string; } ⋮---- -export interface GetDeliveryPriceParamsV5 { - category: 'linear' | 'inverse' | 'option'; - symbol?: string; - baseCoin?: string; - settleCoin?: string; +export interface GetAllowedDepositCoinInfoParamsV5 { + coin?: string; + chain?: string; limit?: number; cursor?: string; } ⋮---- -export interface GetLongShortRatioParamsV5 { - category: 'linear' | 'inverse'; - symbol: string; - period: OpenInterestIntervalV5; - startTime?: string; - endTime?: string; +export interface GetDepositRecordParamsV5 { + id?: string; + txID?: string; + coin?: string; + startTime?: number; + endTime?: number; limit?: number; cursor?: string; } ⋮---- -export interface GetFullDepthOrderbookParamsV5 { - category: 'spot' | 'linear' | 'inverse'; - symbol: string; +export interface GetSubAccountDepositRecordParamsV5 { + id?: string; + txID?: string; + subMemberId: string; + coin?: string; + startTime?: number; + endTime?: number; + limit?: number; + cursor?: string; } ⋮---- -export interface GetOptionBaseCoinsParamsV5 { +export interface GetInternalDepositRecordParamsV5 { + txID?: string; + startTime?: number; + endTime?: number; + coin?: string; + cursor?: string; + limit?: number; +} +⋮---- +export interface GetWithdrawalRecordsParamsV5 { + withdrawID?: string; + txID?: string; + coin?: string; + withdrawType?: number; + startTime?: number; + endTime?: number; + limit?: number; + cursor?: string; +} +⋮---- +export interface GetWithdrawalAddressListParamsV5 { + coin?: string; + chain?: string; + addressType?: 0 | 1 | 2; + limit?: number; + cursor?: string; +} +⋮---- +export interface SubmitDepositOriginatorInfoParamsV5 { + depositId: number; + subAccountId?: number; + /** Travel Rule questionnaire JSON string. See Questionnaire docs. */ + questionnaire: string; +} +⋮---- +/** Travel Rule questionnaire JSON string. See Questionnaire docs. */ +⋮---- +export interface WithdrawParamsV5 { + coin: string; /** - * Comma-separated underlying types. - * 0 crypto, 1 commodity, 2 stock, 3 forex, 4 oil. Omit to return all types. + * When forceChain is 0 or 1, required. When forceChain is 2 (Bybit UID withdraw), may be null/omitted. */ - underlyingType?: string; + chain?: string; + address: string; + tag?: string; + amount: string; + timestamp: number; + forceChain?: number; + /** + * FUND, UTA, or EARN; or comma combo e.g. FUND,UTA,EARN (funding first, then UTA and Earn for remainder). + * SPOT is legacy if still supported for older integrations. + */ + accountType: string; + feeType?: 0 | 1; + requestId?: string; + /** + * Required for Bybit Turkey (TR) site users when creating a withdrawal. Omitted for other regions unless the API requires it. + */ + transactionPurpose?: string; + /** + * Travel Rule questionnaire JSON string (max 16384 bytes). Takes precedence over `beneficiary` / `transactionPurpose` when both are set. + */ + questionnaire?: string; + beneficiary?: { + vaspEntityId?: string; + beneficiaryName?: string; + beneficiaryLegalType?: string; + beneficiaryWalletType?: string; + beneficiaryUnhostedWalletType?: string; + beneficiaryPoiNumber?: string; + beneficiaryPoiType?: string; + beneficiaryPoiIssuingCountry?: string; + beneficiaryPoiExpiredDate?: string; + }; } ⋮---- /** - * Comma-separated underlying types. - * 0 crypto, 1 commodity, 2 stock, 3 forex, 4 oil. Omit to return all types. + * When forceChain is 0 or 1, required. When forceChain is 2 (Bybit UID withdraw), may be null/omitted. */ - -================ -File: src/types/response/v5-account.ts -================ -import { - AccountMarginModeV5, - AccountTypeV5, - CategoryV5, - TransactionTypeV5, - UnifiedUpdateStatusV5, -} from '../shared-v5'; ⋮---- -export interface WalletBalanceV5Coin { - coin: string; - equity: string; - usdValue: string; - walletBalance: string; - free: string; // spot only - locked: string; // spot only - borrowAmount: string; - availableToBorrow: string; // deprecated field - availableToWithdraw: string; - accruedInterest: string; - totalOrderIM: string; - totalPositionIM: string; - totalPositionMM: string; - unrealisedPnl: string; - cumRealisedPnl: string; - bonus: string; - marginCollateral: boolean; - collateralSwitch: boolean; - spotBorrow: string; - colRes?: string; -} +/** + * FUND, UTA, or EARN; or comma combo e.g. FUND,UTA,EARN (funding first, then UTA and Earn for remainder). + * SPOT is legacy if still supported for older integrations. + */ ⋮---- -free: string; // spot only -locked: string; // spot only +/** + * Required for Bybit Turkey (TR) site users when creating a withdrawal. Omitted for other regions unless the API requires it. + */ ⋮---- -availableToBorrow: string; // deprecated field +/** + * Travel Rule questionnaire JSON string (max 16384 bytes). Takes precedence over `beneficiary` / `transactionPurpose` when both are set. + */ ⋮---- -export interface WalletBalanceV5 { - accountType: AccountTypeV5; - accountLTV: string; - accountIMRate: string; - accountMMRate: string; - accountIMRateByMp: string; - accountMMRateByMp: string; - totalInitialMarginByMp: string; - totalMaintenanceMarginByMp: string; - totalEquity: string; - totalWalletBalance: string; - totalMarginBalance: string; - totalAvailableBalance: string; - totalPerpUPL: string; - totalInitialMargin: string; - totalMaintenanceMargin: string; - coin: WalletBalanceV5Coin[]; +export interface ConvertCoinsParamsV5 { + coin?: string; + side?: number; + accountType: + | 'eb_convert_funding' + | 'eb_convert_uta' + | 'eb_convert_spot' + | 'eb_convert_contract' + | 'eb_convert_inverse'; } ⋮---- -export interface UnifiedAccountUpgradeResultV5 { - unifiedUpdateStatus: UnifiedUpdateStatusV5; - unifiedUpdateMsg: { - msg: string[] | null; - }; +export interface RequestConvertQuoteParamsV5 { + fromCoin: string; + toCoin: string; + fromCoinType?: string; + toCoinType?: string; + requestCoin: string; + requestAmount: string; + accountType: + | 'eb_convert_funding' + | 'eb_convert_uta' + | 'eb_convert_spot' + | 'eb_convert_contract' + | 'eb_convert_inverse'; + requestId?: string; } ⋮---- -export interface BorrowHistoryRecordV5 { - currency: string; - createdTime: number; - borrowCost: string; - hourlyBorrowRate: string; - InterestBearingBorrowSize: string; - costExemption: string; - borrowAmount: string; - unrealisedLoss: string; - freeBorrowedAmount: string; +export interface GetConvertHistoryParamsV5 { + accountType?: string; + index?: number; + limit?: number; } ⋮---- -export interface CollateralInfoV5 { - currency: string; - hourlyBorrowRate: string; - maxBorrowingAmount: string; - freeBorrowAmount: string; - freeBorrowingLimit: string; - borrowAmount: string; - availableToBorrow: string; - borrowable: boolean; - borrowUsageRate: string; - marginCollateral: boolean; - collateralSwitch: boolean; - collateralRatio: string; +export interface GetSmallBalanceListParamsV5 { + accountType: 'eb_convert_uta'; // Wallet type, only supports Unified wallet + fromCoin?: string; // Source currency } ⋮---- -export interface CoinGreeksV5 { - baseCoin: string; - totalDelta: string; - totalGamma: string; - totalVega: string; - totalTheta: string; -} +accountType: 'eb_convert_uta'; // Wallet type, only supports Unified wallet +fromCoin?: string; // Source currency ⋮---- -export interface FeeRateV5 { - symbol: string; - baseCoin: string; - takerFeeRate: string; - makerFeeRate: string; - rpiMakerFeeRate?: string; +export interface GetFiatTradingPairListParamsV5 { + side?: 0 | 1; // 0: buy (buy crypto, sell fiat), 1: sell (sell crypto, buy fiat) } ⋮---- -export interface AccountInfoV5 { - unifiedMarginStatus: number; - marginMode: AccountMarginModeV5; - isMasterTrader: boolean; - spotHedgingStatus: string; - updatedTime: string; -} +side?: 0 | 1; // 0: buy (buy crypto, sell fiat), 1: sell (sell crypto, buy fiat) ⋮---- -/** - * Get Trade Behaviour Config / `getLimitPriceAction()` — `/v5/account/user-setting-config` - */ -export interface UserSettingConfigV5 { - lpaSpot: boolean; - lpaPerp: boolean; - /** Spot MNT fee deduction enabled. */ - smsef?: boolean; - /** Futures MNT fee deduction enabled. */ - fmsef?: boolean; - /** Delta Neutral mode; may be absent on older API responses. */ - deltaEnable?: boolean; - smpType?: '0' | '1' | '2' | '3' | string; +/** Funding Account Transaction History. Interval createTimeFrom-createTimeTo max 7 days. */ +export interface GetFundingAccountTransactionHistoryParamsV5 { + createTimeFrom?: string; + createTimeTo?: string; + limit?: string; + cursor?: string; } ⋮---- -/** Spot MNT fee deduction enabled. */ +/** Asset Overview. memberId required when querying sub account via master API key. */ +export interface GetAssetOverviewParamsV5 { + memberId?: string; + /** Fiat currency for valuation; defaults to USD if omitted. */ + valuationCurrency?: string; + /** Account type filter; returns all if omitted. */ + accountType?: string; +} ⋮---- -/** Futures MNT fee deduction enabled. */ +/** Fiat currency for valuation; defaults to USD if omitted. */ ⋮---- -/** Delta Neutral mode; may be absent on older API responses. */ +/** Account type filter; returns all if omitted. */ ⋮---- -export interface TransactionLogV5 { - symbol: string; - category: CategoryV5; - side: string; - transactionTime: string; - type: TransactionTypeV5; - qty: string; - size: string; - currency: string; - tradePrice: string; - funding: string; - fee: string; - cashFlow: string; - change: string; - cashBalance: string; - feeRate: string; - bonusChange: string; - tradeId: string; - orderId: string; - orderLinkId: string; - extraFees: string; - transSubType: string; - displayType?: string; +/** GET /v5/asset/portfolio-margin */ +export interface GetPortfolioMarginInfoParamsV5 { + baseCoin?: string; } ⋮---- -export interface MMPStateV5 { - baseCoin: string; - mmpEnabled: boolean; - window: string; - frozenPeriod: string; - qtyLimit: string; - deltaLimit: string; - vegaLimit?: string; - mmpFrozenUntil: string; - mmpFrozen: boolean; +/** GET /v5/asset/total-members-assets */ +export interface GetTotalMembersAssetsParamsV5 { + /** If omitted, defaults to BTC. Total is quoted in this coin. */ + coin?: string; } ⋮---- -export interface RepayLiabilityResultV5 { - coin: string; - repaymentQty: string; +/** If omitted, defaults to BTC. Total is quoted in this coin. */ + +================ +File: src/types/request/v5-earn.ts +================ +export interface GetEarnCouponListParamsV5 { + category: 'FlexibleSaving' | 'DualAssets'; } ⋮---- -export interface DCPInfoV5 { - product: 'SPOT' | 'DERIVATIVES' | 'OPTIONS'; - dcpStatus: 'ON'; - timeWindow: string; +/** GET /v5/earn/flexible-saving/auto-savings. coins is a repeated query param, max 50. */ +export interface GetFlexibleSavingAutoSavingsParamsV5 { + coins?: string[]; } ⋮---- -export interface ManualRepayResultV5 { - resultStatus: 'P' | 'SU' | 'FA'; +/** POST /v5/earn/flexible-saving/auto-savings. Omit coin to update the global setting. */ +export interface SetFlexibleSavingAutoSavingsParamsV5 { + coin?: string; + isSelected: boolean; + purchaseImmediately?: boolean; } ⋮---- -/** GET /v5/account/option-asset-info — response `result` wraps a nested `result` array. */ -export interface OptionAssetInfoRowV5 { +export interface SubmitStakeRedeemParamsV5 { + category: string; + orderType: 'Stake' | 'Redeem'; + accountType: 'FUND' | 'UNIFIED'; + amount: string; coin: string; - totalDelta: string; - totalRPL: string; - totalUPL: string; - assetIM: string; - assetMM: string; - sendTime: number; -} -⋮---- -export interface OptionAssetInfoNestedResultV5 { - result: OptionAssetInfoRowV5[]; + productId: string; + orderLinkId: string; + toAccountType?: 'FUND' | 'UNIFIED'; } ⋮---- -/** GET /v5/account/pay-info */ -export interface PayInfoCollateralItemV5 { - coin: string; - availableSize: string; - availableValue: string; - coinScale: number; - borrowSize: string; - spotHedgeAmount: string; - assetFrozen: string; +export interface GetEarnOrderHistoryParamsV5 { + category: string; + orderId?: string; + orderLinkId?: string; + productId?: string; + startTime?: number; + endTime?: number; + limit?: number; + cursor?: string; } ⋮---- -export interface PayInfoBorrowBlockV5 { +export interface GetEarnPositionParamsV5 { + category: string; + productId?: string; coin?: string; - borrowSize: string; - borrowValue?: string; - assetFrozen: string; - availableBalance: string; } ⋮---- -export interface PayInfoResultV5 { - collateralInfo: { - collateralList: PayInfoCollateralItemV5[]; - }; - borrowInfo: PayInfoBorrowBlockV5; +export interface GetEarnYieldHistoryParamsV5 { + category: string; + productId?: string; + startTime?: number; + endTime?: number; + limit?: number; + cursor?: string; } ⋮---- -/** GET /v5/account/trade-info-for-analysis */ -export interface TradeInfoAnalysisDailyV5 { - day: string; - sumBuyExecValue: string; - sumSellExecValue: string; - sumExecValue: string; +export interface GetEarnHourlyYieldHistoryParamsV5 { + category: string; + productId?: string; + startTime?: number; + endTime?: number; + limit?: number; + cursor?: string; } ⋮---- -export interface TradeInfoForAnalysisResultV5 { - symbolRnl: string; - netExecQty: string; - sumExecValue: string; - sumExecQty: string; - avgBuyExecPrice: string; - sumBuyExecValue: string; - sumBuyExecQty: string; - sumBuyExecFee: string; - sumBuyOrderQty: string; - avgSellExecPrice: string; - sumSellExecValue: string; - sumSellExecQty: string; - sumSellExecFee: string; - sumSellOrderQty: string; - maxMarginVersion: number; - baseCoin: string; - settleCoin: string; - sumPriceList?: TradeInfoAnalysisDailyV5[]; -} - -================ -File: src/types/response/v5-earn.ts -================ -export interface EarnInterestCardV5 { - awardId: number; - specCode: string; - coin: string; - apy: string; - duration: number; - claimedAt: number; - expireAt: number; - usedAt: number; - status: 'InUse' | 'NotUse' | 'Expired' | 'AlreadyUsed' | string; - currentPnl: string; - limitPnl: string; - positionEffectiveAmount: string; +export interface ModifyEarnPositionParamsV5 { + category: 'OnChain'; productId: number; - category: 'FlexibleSaving' | 'DualAssets' | string; + positionId: number; + autoReinvest: 0 | 1; } ⋮---- -export interface EarnAwardCardV5 { - awardId: number; - specCode: string; - claimedAt: number; - usedAt: number; - expireAt: number; - status: 'InUse' | 'NotUse' | 'Expired' | 'AlreadyUsed' | string; - amount: string; - limitPnlPercentage: string; - baseCoin: string; - quoteCoin: string; - direction: 1 | 2; - category: 'FlexibleSaving' | 'DualAssets' | string; +export interface GetEarnAprHistoryParamsV5 { + category: 'FlexibleSaving' | 'OnChain'; + productId: string; + startTime?: number; + endTime?: number; } ⋮---- -export interface EarnCouponListResultV5 { - interestCards: EarnInterestCardV5[]; - awardCards: EarnAwardCardV5[]; +/** + * GET /v5/earn/advance/product — Advanced Earn: Dual Asset, Double Win, Smart Leverage, etc. + * Public, no auth. Rate limit: 50 req/s per IP. + */ +export interface GetAdvanceEarnProductParamsV5 { + category: 'DualAssets' | 'DoubleWin' | 'SmartLeverage' | 'DiscountBuy'; + coin?: string; + /** + * Product duration, e.g. 8h, 1d, 2d, 3d, 6d, 7d, 12d (depends on product). + */ + duration?: string; } ⋮---- -export interface FlexibleSavingAutoSavingsCoinV5 { - coin: string; - isSelected: boolean; - maxStakingAmount: string; - apr: string; -} +/** + * Product duration, e.g. 8h, 1d, 2d, 3d, 6d, 7d, 12d (depends on product). + */ ⋮---- -export interface FlexibleSavingAutoSavingsV5 { - selectedAll: boolean; - coins: FlexibleSavingAutoSavingsCoinV5[]; +/** GET /v5/earn/hold-to-earn/yield-history — Hold to Earn airdrop daily PnL (Earn permission) */ +export interface GetHoldToEarnAirdropYieldHistoryParamsV5 { + /** Unix seconds. Cannot be earlier than now minus 3 months */ + timeStart?: number; + /** Unix seconds. Requires timeStart ≤ timeEnd */ + timeEnd?: number; + /** Page size [1, 49] */ + limit: number; + /** Pagination cursor from previous `nextCursor` */ + cursor?: string; } ⋮---- -export interface EarnProductV5 { - category: string; - estimateApr: string; - coin: string; - minStakeAmount: string; - maxStakeAmount: string; - precision: string; - productId: string; - status: 'Available' | 'NotAvailable'; -} +/** Unix seconds. Cannot be earlier than now minus 3 months */ ⋮---- -export interface EarnOrderHistoryV5 { - coin: string; - orderValue: string; - orderType: 'Redeem' | 'Stake'; - orderId: string; - orderLinkId: string; - status: 'Success' | 'Fail' | 'Pending'; - createdAt: string; - productId: string; - updatedAt: string; - swapOrderValue: string; - estimateRedeemTime: string; - estimateStakeTime: string; -} +/** Unix seconds. Requires timeStart ≤ timeEnd */ ⋮---- -export interface EarnPositionFreezeDetailV5 { - amount: string; - description: string; -} +/** Page size [1, 49] */ ⋮---- -export interface EarnPositionV5 { +/** Pagination cursor from previous `nextCursor` */ + +================ +File: src/types/response/v5-account.ts +================ +import { + AccountMarginModeV5, + AccountTypeV5, + CategoryV5, + TransactionTypeV5, + UnifiedUpdateStatusV5, +} from '../shared-v5'; +⋮---- +export interface WalletBalanceV5Coin { coin: string; - productId: string; - amount: string; - totalPnl: string; - claimableYield: string; - id?: string; - status?: string; - orderId?: string; - estimateRedeemTime?: string; - estimateStakeTime?: string; - estimateInterestCalculationTime?: string; - settlementTime?: string; - autoReinvest?: string; - /** Redeemable amount */ - availableAmount: string; - freezeDetails: EarnPositionFreezeDetailV5[]; + equity: string; + usdValue: string; + walletBalance: string; + free: string; // spot only + locked: string; // spot only + borrowAmount: string; + availableToBorrow: string; // deprecated field + availableToWithdraw: string; + accruedInterest: string; + totalOrderIM: string; + totalPositionIM: string; + totalPositionMM: string; + unrealisedPnl: string; + cumRealisedPnl: string; + bonus: string; + marginCollateral: boolean; + collateralSwitch: boolean; + spotBorrow: string; + colRes?: string; } ⋮---- -/** Redeemable amount */ +free: string; // spot only +locked: string; // spot only ⋮---- -export interface EarnYieldHistoryV5 { - productId: string; - coin: string; - id: string; - amount: string; - yieldType: string; - distributionMode: string; - effectiveStakingAmount: string; - orderId: string; - status: 'Pending' | 'Success' | 'Fail'; - createdAt: string; +availableToBorrow: string; // deprecated field +⋮---- +export interface WalletBalanceV5 { + accountType: AccountTypeV5; + accountLTV: string; + accountIMRate: string; + accountMMRate: string; + accountIMRateByMp: string; + accountMMRateByMp: string; + totalInitialMarginByMp: string; + totalMaintenanceMarginByMp: string; + totalEquity: string; + totalWalletBalance: string; + totalMarginBalance: string; + totalAvailableBalance: string; + totalPerpUPL: string; + totalInitialMargin: string; + totalMaintenanceMargin: string; + coin: WalletBalanceV5Coin[]; } ⋮---- -export interface EarnHourlyYieldHistoryV5 { - productId: string; - coin: string; - id: string; - amount: string; - effectiveStakingAmount: string; - status: 'Pending' | 'Success' | 'Fail'; - hourlyDate: string; - createdAt: string; +export interface UnifiedAccountUpgradeResultV5 { + unifiedUpdateStatus: UnifiedUpdateStatusV5; + unifiedUpdateMsg: { + msg: string[] | null; + }; } ⋮---- -export interface EarnAprHistoryPointV5 { - timestamp: string; - apr: string; +export interface BorrowHistoryRecordV5 { + currency: string; + createdTime: number; + borrowCost: string; + hourlyBorrowRate: string; + InterestBearingBorrowSize: string; + costExemption: string; + borrowAmount: string; + unrealisedLoss: string; + freeBorrowedAmount: string; } ⋮---- -/** - * Advanced Earn — Dual Asset product (GET /v5/earn/advance/product). - */ -export interface AdvanceEarnDualAssetProductV5 { - category: string; - productId: string; - baseCoin: string; - quoteCoin: string; - expectReceiveAt: string; - duration: string; - status: 'Available' | 'NotAvailable'; - isVipProduct: boolean; - subscribeStartAt: string; - subscribeEndAt: string; - applyStartAt: string; - settlementTime: string; - minPurchaseQuoteAmount: string; - minPurchaseBaseAmount: string; - remainingAmountQuote: string; - remainingAmountBase: string; - orderPrecisionDigitalQuote: number; - orderPrecisionDigitalBase: number; +export interface CollateralInfoV5 { + currency: string; + hourlyBorrowRate: string; + maxBorrowingAmount: string; + freeBorrowAmount: string; + freeBorrowingLimit: string; + borrowAmount: string; + availableToBorrow: string; + borrowable: boolean; + borrowUsageRate: string; + marginCollateral: boolean; + collateralSwitch: boolean; + collateralRatio: string; } ⋮---- -export interface AdvanceEarnDualAssetProductInfoV5 { - category: string; - list: AdvanceEarnDualAssetProductV5[]; +export interface CoinGreeksV5 { + baseCoin: string; + totalDelta: string; + totalGamma: string; + totalVega: string; + totalTheta: string; } ⋮---- -/** - * Advanced Earn — Double Win (GET /v5/earn/advance/product?category=DoubleWin). - */ -export interface AdvanceEarnDoubleWinProductV5 { - category: string; - productId: string; - investCoin: string; - underlyingAsset: string; - duration: string; - subscribeStartAt: string; - subscribeEndAt: string; - settlementTime: string; - expectReceiveAt: string; - minPurchaseAmount: string; - orderPrecisionDigital: number; - isRfqProduct: boolean; - lowerPriceBuffer: string; - upperPriceBuffer: string; - minDeviationRatio: string; - maxDeviationRatio: string; - priceTickSize: string; +export interface FeeRateV5 { + symbol: string; + baseCoin: string; + takerFeeRate: string; + makerFeeRate: string; + rpiMakerFeeRate?: string; } ⋮---- -/** - * Advanced Earn — Smart Leverage (GET /v5/earn/advance/product?category=SmartLeverage). - */ -export interface AdvanceEarnSmartLeverageProductV5 { - category: string; - productId: string; - investCoin: string; - underlyingAsset: string; - direction: 'Long' | 'Short'; - leverage: string; - duration: string; - subscribeStartAt: string; - subscribeEndAt: string; - settlementTime: string; - expectReceiveAt: string; - minPurchaseAmount: string; - remainingAmount: string; - orderPrecisionDigital: number; +export interface AccountInfoV5 { + unifiedMarginStatus: number; + marginMode: AccountMarginModeV5; + isMasterTrader: boolean; + spotHedgingStatus: string; + updatedTime: string; } ⋮---- /** - * Advanced Earn — Discount Buy (GET /v5/earn/advance/product?category=DiscountBuy). + * Get Trade Behaviour Config / `getLimitPriceAction()` — `/v5/account/user-setting-config` */ -export interface AdvanceEarnDiscountBuyProductV5 { - category: string; - productId: string; - coin: string; - underlyingAsset: string; - settlementTime: string; - duration: string; - isVipProduct: boolean; - subscribeStartAt: string; - subscribeEndAt: string; - minPurchaseAmount: string; - remainingAmount: string; - orderPrecisionDigital: number; - expectReceiveAt: string; +export interface UserSettingConfigV5 { + lpaSpot: boolean; + lpaPerp: boolean; + /** Spot MNT fee deduction enabled. */ + smsef?: boolean; + /** Futures MNT fee deduction enabled. */ + fmsef?: boolean; + /** Delta Neutral mode; may be absent on older API responses. */ + deltaEnable?: boolean; + smpType?: '0' | '1' | '2' | '3' | string; } ⋮---- -export type AdvanceEarnAdvanceProductListItemV5 = - | AdvanceEarnDualAssetProductV5 - | AdvanceEarnDoubleWinProductV5 - | AdvanceEarnSmartLeverageProductV5 - | AdvanceEarnDiscountBuyProductV5; +/** Spot MNT fee deduction enabled. */ ⋮---- -export interface AdvanceEarnAdvanceProductInfoV5 { - category: string; - list: AdvanceEarnAdvanceProductListItemV5[]; +/** Futures MNT fee deduction enabled. */ +⋮---- +/** Delta Neutral mode; may be absent on older API responses. */ +⋮---- +export interface TransactionLogV5 { + symbol: string; + category: CategoryV5; + side: string; + transactionTime: string; + type: TransactionTypeV5; + qty: string; + size: string; + currency: string; + tradePrice: string; + funding: string; + fee: string; + cashFlow: string; + change: string; + cashBalance: string; + feeRate: string; + bonusChange: string; + tradeId: string; + orderId: string; + orderLinkId: string; + extraFees: string; + transSubType: string; + displayType?: string; } ⋮---- -/** GET /v5/earn/hold-to-earn/product — Hold to Earn airdrop products */ -export type HoldToEarnAirdropProductStatusV5 = - | 'NotStarted' - | 'Online' - | 'Ended'; +export interface MMPStateV5 { + baseCoin: string; + mmpEnabled: boolean; + window: string; + frozenPeriod: string; + qtyLimit: string; + deltaLimit: string; + vegaLimit?: string; + mmpFrozenUntil: string; + mmpFrozen: boolean; +} ⋮---- -export interface HoldToEarnAirdropProductYieldV5 { - coinName: string; - /** Yesterday's APR for display, e.g. "10%", "0%" */ - apy: string; - personalApy?: string; - multiplier?: string; +export interface RepayLiabilityResultV5 { + coin: string; + repaymentQty: string; } ⋮---- -/** Yesterday's APR for display, e.g. "10%", "0%" */ +export interface DCPInfoV5 { + product: 'SPOT' | 'DERIVATIVES' | 'OPTIONS'; + dcpStatus: 'ON'; + timeWindow: string; +} ⋮---- -export interface HoldToEarnAirdropProductV5 { - coinName: string; - yields: HoldToEarnAirdropProductYieldV5[]; - status: HoldToEarnAirdropProductStatusV5; - announcementUrl: string; - /** Yesterday's avg APR across yield coins */ - apy: string; - personalApy?: string; +export interface ManualRepayResultV5 { + resultStatus: 'P' | 'SU' | 'FA'; } ⋮---- -/** Yesterday's avg APR across yield coins */ +/** GET /v5/account/option-asset-info — response `result` wraps a nested `result` array. */ +export interface OptionAssetInfoRowV5 { + coin: string; + totalDelta: string; + totalRPL: string; + totalUPL: string; + assetIM: string; + assetMM: string; + sendTime: number; +} ⋮---- -export interface HoldToEarnAirdropProductsResultV5 { - products: HoldToEarnAirdropProductV5[]; +export interface OptionAssetInfoNestedResultV5 { + result: OptionAssetInfoRowV5[]; } ⋮---- -/** GET /v5/earn/hold-to-earn/yield-history */ -export interface HoldToEarnAirdropDailyPnlV5 { - coinName: string; - yieldCoinName: string; - effectiveAmount: string; - pnl: string; - apy: string; - createdAt: number; +/** GET /v5/account/pay-info */ +export interface PayInfoCollateralItemV5 { + coin: string; + availableSize: string; + availableValue: string; + coinScale: number; + borrowSize: string; + spotHedgeAmount: string; + assetFrozen: string; } ⋮---- -export interface HoldToEarnAirdropYieldHistoryResultV5 { - nextCursor: string; - airdropDailyPnls: HoldToEarnAirdropDailyPnlV5[]; +export interface PayInfoBorrowBlockV5 { + coin?: string; + borrowSize: string; + borrowValue?: string; + assetFrozen: string; + availableBalance: string; +} +⋮---- +export interface PayInfoResultV5 { + collateralInfo: { + collateralList: PayInfoCollateralItemV5[]; + }; + borrowInfo: PayInfoBorrowBlockV5; +} +⋮---- +/** GET /v5/account/trade-info-for-analysis */ +export interface TradeInfoAnalysisDailyV5 { + day: string; + sumBuyExecValue: string; + sumSellExecValue: string; + sumExecValue: string; +} +⋮---- +export interface TradeInfoForAnalysisResultV5 { + symbolRnl: string; + netExecQty: string; + sumExecValue: string; + sumExecQty: string; + avgBuyExecPrice: string; + sumBuyExecValue: string; + sumBuyExecQty: string; + sumBuyExecFee: string; + sumBuyOrderQty: string; + avgSellExecPrice: string; + sumSellExecValue: string; + sumSellExecQty: string; + sumSellExecFee: string; + sumSellOrderQty: string; + maxMarginVersion: number; + baseCoin: string; + settleCoin: string; + sumPriceList?: TradeInfoAnalysisDailyV5[]; } ================ -File: src/types/response/v5-market.ts +File: src/types/response/v5-position.ts ================ import { - CategoryCursorListV5, CategoryV5, - ContractTypeV5, - CopyTradingV5, - InstrumentStatusV5, - InstrumentSymbolTypeV5, - MarginTradingV5, - OptionTypeV5, + ExecTypeV5, OrderSideV5, + OrderTypeV5, + PositionIdx, + PositionSideV5, + PositionStatusV5, + StopOrderTypeV5, + TPSLModeV5, + TradeModeV5, } from '../shared-v5'; ⋮---- -/** - * OHLCVT candle used by v5 APIs - * - * - list[0]: startTime string Start time of the candle (ms) - * - list[1]: openPrice string Open price - * - list[2]: highPrice string Highest price - * - list[3]: lowPrice string Lowest price - * - list[4]: closePrice string Close price. Is the last traded price when the candle is not closed - * - list[5]: volume string Trade volume. Unit of contract: pieces of contract. Unit of spot: quantity of coins - * - list[6]: turnover string Turnover. Unit of figure: quantity of quota coin - */ -export type OHLCVKlineV5 = [ - string, - string, - string, - string, - string, - string, - string, -]; +export interface FuturesLeverageItemV5 { + symbol: string; + leverage: string; + side: OrderSideV5 | ''; + positionIdx: PositionIdx; +} ⋮---- -/** - * OHLC candle used by v5 APIs - * - * - list[0]: startTime string Start time of the candle (ms) - * - list[1]: openPrice string Open price - * - list[2]: highPrice string Highest price - * - list[3]: lowPrice string Lowest price - * - list[4]: closePrice string Close price. Is the last traded price when the candle is not closed - */ -export type OHLCKlineV5 = [string, string, string, string, string]; +export interface FuturesLeverageResultV5 { + category: 'linear' | 'inverse'; + list: FuturesLeverageItemV5[]; +} ⋮---- -export interface LinearInverseInstrumentInfoV5 { - /** The ID of the symbol name. */ - symbolId: number; +export interface PositionV5 { + positionIdx: PositionIdx; + riskId: number; + riskLimitValue: string; symbol: string; - contractType: ContractTypeV5; - status: InstrumentStatusV5; - baseCoin: string; - quoteCoin: string; - /** Region / product class for the pair (`stock`, `forex`, `commodity`, `xstocks`, etc.). */ - symbolType: InstrumentSymbolTypeV5; - launchTime: string; - deliveryTime?: string; - deliveryFeeRate?: string; - priceScale: string; - leverageFilter: { - minLeverage: string; - maxLeverage: string; - leverageStep: string; - }; - priceFilter: { - minPrice: string; - maxPrice: string; - tickSize: string; - }; - lotSizeFilter: { - maxOrderQty: string; - maxMktOrderQty: string; - minOrderQty: string; - qtyStep: string; - postOnlyMaxOrderQty?: string; - minNotionalValue?: string; - }; - unifiedMarginTrade: boolean; - fundingInterval: number; - settleCoin: string; - copyTrading: CopyTradingV5; - upperFundingRate: string; - lowerFundingRate: string; - riskParameters: { - priceLimitRatioX: string; - priceLimitRatioY: string; - }; - isPreListing: boolean; - preListingInfo: { - curAuctionPhase: string; - phases: { - phase: string; - startTime: string; - endTime: string; - }[]; - auctionFeeInfo: { - auctionFeeRate: string; - takerFeeRate: string; - makerFeeRate: string; - }; - } | null; - skipCallAuction?: boolean; // For USDT pre-market contract - displayName: string; - fullName?: string; - marketRegion?: string; - underlyingTicker?: string; - /** Symbol tags such as `ST`. Linear and inverse only. */ - tags?: string[]; + side: PositionSideV5; + size: string; + avgPrice: string; + positionValue: string; + tradeMode: TradeModeV5; + autoAddMargin?: number; + positionStatus: PositionStatusV5; + leverage?: string; + breakEvenPrice?: string; // Break even price, only for linear & inverse + markPrice: string; + liqPrice: string | ''; + bustPrice?: string; + positionIM?: string; + positionMM?: string; + positionBalance?: string; + tpslMode?: TPSLModeV5; + takeProfit?: string; + stopLoss?: string; + trailingStop?: string; + sessionAvgPrice: string | ''; + delta?: string; + gamma?: string; + vega?: string; + theta?: string; + unrealisedPnl: string; + curRealisedPnl: string; + cumRealisedPnl: string; + adlRankIndicator: number; + isReduceOnly: boolean; + mmrSysUpdatedTime: string | ''; + leverageSysUpdatedTime: string | ''; + createdTime: string; + updatedTime: string; + /** Position open timestamp (ms). Default `0` when not set. */ + openTime: number; + positionIMByMp: string; + positionMMByMp: string; + seq: number; + netDeltaRatio?: string; } ⋮---- -/** The ID of the symbol name. */ +breakEvenPrice?: string; // Break even price, only for linear & inverse ⋮---- -/** Region / product class for the pair (`stock`, `forex`, `commodity`, `xstocks`, etc.). */ +/** Position open timestamp (ms). Default `0` when not set. */ ⋮---- -skipCallAuction?: boolean; // For USDT pre-market contract +export interface SetRiskLimitResultV5 { + category: CategoryV5; + riskId: number; + riskLimitValue: string; +} ⋮---- -/** Symbol tags such as `ST`. Linear and inverse only. */ +export interface AddOrReduceMarginResultV5 { + category: CategoryV5; + symbol: string; + positionIdx: PositionIdx; + riskId: number; + riskLimitValue: string; + size: string; + avgPrice: string; + liqPrice: string; + bustPrice: string; + markPrice: string; + positionValue: string; + leverage: string; + autoAddMargin: 0 | 1; + positionStatus: PositionStatusV5; + positionIM: string; + positionMM: string; + takeProfit: string; + stopLoss: string; + trailingStop: string; + unrealisedPnl: string; + cumRealisedPnl: string; + createdTime: string; + updatedTime: string; +} ⋮---- -export interface OptionInstrumentInfoV5 { - /** The ID of the symbol name. */ - symbolId: number; +export interface ExecutionV5 { symbol: string; - optionsType: OptionTypeV5; - status: InstrumentStatusV5; - baseCoin: string; - quoteCoin: string; - settleCoin: string; - symbolType: InstrumentSymbolTypeV5; - launchTime: string; - deliveryTime: string; - deliveryFeeRate: string; - priceFilter: { - minPrice: string; - maxPrice: string; - tickSize: string; - }; - lotSizeFilter: { - maxOrderQty: string; - minOrderQty: string; - qtyStep: string; - }; - displayName: string; + orderId: string; + orderLinkId: string; + side: OrderSideV5; + orderPrice: string; + orderQty: string; + leavesQty: string; + orderType: OrderTypeV5; + stopOrderType?: StopOrderTypeV5; + execFee: string; + execFeeV2: string; + feeCurrency: string; // Trading fee currency + execId: string; + execPrice: string; + execQty: string; + execType: ExecTypeV5; + execValue: string; + execTime: string; + isMaker: boolean; + feeRate: string; + tradeIv?: string; + markIv?: string; + markPrice: string; + indexPrice: string; + underlyingPrice?: string; + blockTradeId?: string; + closedSize?: string; + seq: number; + extraFees: string; } ⋮---- -/** The ID of the symbol name. */ +feeCurrency: string; // Trading fee currency ⋮---- -export interface SpotInstrumentInfoV5 { - /** The ID of the symbol name. */ - symbolId: number; +export interface ClosedPnLV5 { symbol: string; - baseCoin: string; - quoteCoin: string; - /** - * Xstock multiplier for `symbolType` = xstocks pairs. `stock_price = token_price / multiplier`, - * `stock_qty = token_qty * multiplier`. Default `"1"`. - */ - xstockMultiplier?: string; - symbolType: InstrumentSymbolTypeV5; - innovation: '0' | '1'; // Deprecated, always 0 - status: InstrumentStatusV5; - marginTrading: MarginTradingV5; - stTag: '0' | '1'; - lotSizeFilter: { - basePrecision: string; - quotePrecision: string; - minOrderQty: string; - maxOrderQty: string; - minOrderAmt: string; - maxOrderAmt: string; - maxLimitOrderQty: string; - maxMarketOrderQty: string; - postOnlyMaxLimitOrderSize: string; - }; - priceFilter: { - tickSize: string; - }; - riskParameters: { - priceLimitRatioX: string; - priceLimitRatioY: string; - }; - forbidUplWithdrawal: boolean; + orderId: string; + side: string; + qty: string; + orderPrice: string; + orderType: OrderTypeV5; + execType: ExecTypeV5; + closedSize: string; + openFee: string; + closeFee: string; + cumEntryValue: string; + avgEntryPrice: string; + cumExitValue: string; + avgExitPrice: string; + closedPnl: string; + fillCount: string; + leverage: string; + createdTime: string; + updatedTime: string; } ⋮---- -/** The ID of the symbol name. */ +export interface MovePositionResultV5 { + blockTradeId: string; + status: 'Processing' | 'Rejected'; + rejectParty: '' | 'Taker' | 'Maker' | 'bybit'; +} ⋮---- -/** - * Xstock multiplier for `symbolType` = xstocks pairs. `stock_price = token_price / multiplier`, - * `stock_qty = token_qty * multiplier`. Default `"1"`. - */ +export interface MovePositionHistoryV5 { + blockTradeId: string; + category: 'linear' | 'spot' | 'option'; + orderId: string; + userId: number; + symbol: string; + side: 'Buy' | 'Sell'; + price: string; + qty: string; + execFee: string; + status: 'Processing' | 'Filled' | 'Rejected'; + execId: string; + resultCode: number; + resultMessage: string; + createdAt: number; + updatedAt: number; + rejectParty: '' | 'Taker' | 'Maker' | 'bybit'; +} ⋮---- -innovation: '0' | '1'; // Deprecated, always 0 +export interface ClosedOptionsPositionV5 { + symbol: string; + side: 'Buy' | 'Sell'; + totalOpenFee: string; + deliveryFee: string; + totalCloseFee: string; + qty: string; + closeTime: number; + avgExitPrice: string; + deliveryPrice: string; + openTime: number; + avgEntryPrice: string; + totalPnl: string; +} + +================ +File: src/types/websockets/ws-general.ts +================ +import { AxiosRequestConfig } from 'axios'; +import type { ClientRequestArgs } from 'http'; +import WebSocket from 'isomorphic-ws'; ⋮---- -type InstrumentInfoV5Mapping = { - linear: LinearInverseInstrumentInfoV5[]; - inverse: LinearInverseInstrumentInfoV5[]; - option: OptionInstrumentInfoV5[]; - spot: SpotInstrumentInfoV5[]; -}; +import { APIRegion, RestClientOptions, WS_KEY_MAP } from '../../util'; ⋮---- -export type InstrumentInfoResponseV5 = - CategoryCursorListV5; +/** For spot markets, spotV3 is recommended */ +export type APIMarket = 'v5'; ⋮---- -// Account Instruments Info (includes RPI permissions) -export interface AccountSpotInstrumentInfoV5 extends SpotInstrumentInfoV5 { - isPublicRpi: boolean; - myRpiPermission: boolean; -} +// Same as inverse futures +export type WsPublicInverseTopic = + | 'orderBookL2_25' + | 'orderBookL2_200' + | 'trade' + | 'insurance' + | 'instrument_info' + | 'klineV2'; ⋮---- -export interface AccountLinearInverseInstrumentInfoV5 - extends LinearInverseInstrumentInfoV5 { - isPublicRpi: boolean; - myRpiPermission: boolean; +export type WsPublicUSDTPerpTopic = + | 'orderBookL2_25' + | 'orderBookL2_200' + | 'trade' + | 'insurance' + | 'instrument_info' + | 'kline'; +⋮---- +export type WsPublicSpotV1Topic = + | 'trade' + | 'realtimes' + | 'kline' + | 'depth' + | 'mergedDepth' + | 'diffDepth'; +⋮---- +export type WsPublicSpotV2Topic = + | 'depth' + | 'kline' + | 'trade' + | 'bookTicker' + | 'realtimes'; +⋮---- +export type WsPublicTopics = + | WsPublicInverseTopic + | WsPublicUSDTPerpTopic + | WsPublicSpotV1Topic + | WsPublicSpotV2Topic + | string; +⋮---- +// Same as inverse futures +export type WsPrivateInverseTopic = + | 'position' + | 'execution' + | 'order' + | 'stop_order'; +⋮---- +export type WsPrivateUSDTPerpTopic = + | 'position' + | 'execution' + | 'order' + | 'stop_order' + | 'wallet'; +⋮---- +export type WsPrivateSpotTopic = + | 'outboundAccountInfo' + | 'executionReport' + | 'ticketInfo'; +⋮---- +export type WsPrivateTopic = + | WsPrivateInverseTopic + | WsPrivateUSDTPerpTopic + | WsPrivateSpotTopic + | string; +⋮---- +export type WsTopic = WsPublicTopics | WsPrivateTopic; +⋮---- +/** This is used to differentiate between each of the available websocket streams (as bybit has multiple websockets) */ +export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP]; +export type WsMarket = 'all'; +⋮---- +export interface WSClientConfigurableOptions { + /** Your API key */ + key?: string; + + /** Your API secret */ + secret?: string; + + /** + * Set to `true` to connect to Bybit's testnet environment. + * + * Notes: + * + * - If demo trading, `testnet` should be set to false! + * - If testing a strategy, use demo trading instead. Testnet market data is very different from real market conditions. + */ + testnet?: boolean; + + /** + * Set to `true` to connect to Bybit's V5 demo trading: https://bybit-exchange.github.io/docs/v5/demo + * + * Only the "V5" "market" is supported here. + */ + demoTrading?: boolean; + + /** + * The API group this client should connect to. The V5 market is currently used by default. + * + * Only the "V5" "market" is supported here. + */ + market?: APIMarket; + + /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ + recvWindow?: number; + + /** How often to check if the connection is alive */ + pingInterval?: number; + + /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ + pongTimeout?: number; + + /** Delay in milliseconds before respawning the connection */ + reconnectTimeout?: number; + + /** + * Select WebSocket routing with the same region values as REST. Uses a + * dedicated mainnet stream when Bybit documents one for that region. + * Top-level `apiRegion` takes precedence over `restOptions.apiRegion`. + */ + apiRegion?: APIRegion; + + /** + * Site ID sent as `x-site-id` during the Node.js WebSocket handshake. + * Brazil and Argentina internal accounts now use `stream.bybit.com` without this header. + * Keep passing it only if a remaining site still requires `x-site-id`. + */ + siteId?: string; + + /** + * REST options reused for WebSocket routing. + * Regional and site ID values are retained as fallbacks; prefer the matching + * top-level `apiRegion` and `siteId` options. + */ + restOptions?: RestClientOptions; + requestOptions?: AxiosRequestConfig; + + wsOptions?: { + protocols?: string[]; + agent?: any; + } & ( + | Omit, 'agent'> + | Omit, 'agent'> + ); + + wsUrl?: string; + + /** + * Default: false. + * + * When enabled, any calls to the subscribe method will return a promise. + * Note: internally, subscription requests are sent in batches. This may not behave as expected when + * subscribing to a large number of topics, especially if you are not yet connected when subscribing. + */ + promiseSubscribeRequests?: boolean; + + /** + * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method + * + * Look in the examples folder for a demonstration on using node's createHmac instead. + */ + customSignMessageFn?: (message: string, secret: string) => Promise; } ⋮---- -type AccountInstrumentInfoV5Mapping = { - linear: AccountLinearInverseInstrumentInfoV5[]; - inverse: AccountLinearInverseInstrumentInfoV5[]; - spot: AccountSpotInstrumentInfoV5[]; -}; +/** Your API key */ ⋮---- -export type AccountInstrumentInfoResponseV5< - C extends 'spot' | 'linear' | 'inverse', -> = CategoryCursorListV5; +/** Your API secret */ ⋮---- /** - * [price, size] - */ -export type OrderbookLevelV5 = [string, string]; + * Set to `true` to connect to Bybit's testnet environment. + * + * Notes: + * + * - If demo trading, `testnet` should be set to false! + * - If testing a strategy, use demo trading instead. Testnet market data is very different from real market conditions. + */ ⋮---- -export interface OrderbookResponseV5 { - s: string; - b: OrderbookLevelV5[]; - a: OrderbookLevelV5[]; - ts: number; - u: number; - seq: number; - cts: number; -} +/** + * Set to `true` to connect to Bybit's V5 demo trading: https://bybit-exchange.github.io/docs/v5/demo + * + * Only the "V5" "market" is supported here. + */ ⋮---- /** - * RPI Orderbook level: [price, nonRpiSize, rpiSize] - */ -export type RPIOrderbookLevelV5 = [string, string, string]; + * The API group this client should connect to. The V5 market is currently used by default. + * + * Only the "V5" "market" is supported here. + */ ⋮---- -export interface RPIOrderbookResponseV5 { - s: string; // Symbol name - b: RPIOrderbookLevelV5[]; // Bids. Sorted by price in descending order - a: RPIOrderbookLevelV5[]; // Asks. Sorted by price in ascending order - ts: number; // The timestamp (ms) that the system generates the data - u: number; // Update ID, is always in sequence corresponds to u in the 50-level WebSocket RPI orderbook stream - seq: number; // Cross sequence - cts: number; // The timestamp from the matching engine when this orderbook data is produced -} +/** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ ⋮---- -s: string; // Symbol name -b: RPIOrderbookLevelV5[]; // Bids. Sorted by price in descending order -a: RPIOrderbookLevelV5[]; // Asks. Sorted by price in ascending order -ts: number; // The timestamp (ms) that the system generates the data -u: number; // Update ID, is always in sequence corresponds to u in the 50-level WebSocket RPI orderbook stream -seq: number; // Cross sequence -cts: number; // The timestamp from the matching engine when this orderbook data is produced +/** How often to check if the connection is alive */ ⋮---- -export interface TickerLinearInverseV5 { - symbol: string; - lastPrice: string; - indexPrice: string; - markPrice: string; - prevPrice24h: string; - price24hPcnt: string; - highPrice24h: string; - lowPrice24h: string; - prevPrice1h: string; - openInterest: string; - openInterestValue: string; - singleOpenInterest?: string; - singleOpenInterestValue?: string; - turnover24h: string; - volume24h: string; - fundingRate: string; - nextFundingTime: string; - predictedDeliveryPrice: string; - basisRate: string; - basisRateYear: string; - fundingIntervalHour: string; - fundingCap: string; - deliveryFeeRate: string; - deliveryTime: string; - ask1Size: string; - bid1Price: string; - ask1Price: string; - bid1Size: string; - preOpenPrice: string; - preQty: string; - curPreListingPhase: string; - basis: string; -} -⋮---- -export interface TickerOptionV5 { - symbol: string; - bid1Price: string; - bid1Size: string; - bid1Iv: string; - ask1Price: string; - ask1Size: string; - ask1Iv: string; - lastPrice: string; - highPrice24h: string; - lowPrice24h: string; - markPrice: string; - indexPrice: string; - markIv: string; - underlyingPrice: string; - openInterest: string; - turnover24h: string; - volume24h: string; - totalVolume: string; - totalTurnover: string; - delta: string; - gamma: string; - vega: string; - theta: string; - predictedDeliveryPrice: string; - change24h: string; -} +/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ ⋮---- -export interface TickerSpotV5 { - symbol: string; - bid1Price: string; - bid1Size: string; - ask1Price: string; - ask1Size: string; - lastPrice: string; - prevPrice24h: string; - price24hPcnt: string; - highPrice24h: string; - lowPrice24h: string; - turnover24h: string; - volume24h: string; - usdIndexPrice: string; -} +/** Delay in milliseconds before respawning the connection */ ⋮---- -export interface FundingRateHistoryResponseV5 { - symbol: string; - fundingRate: string; - fundingRateTimestamp: string; -} +/** + * Select WebSocket routing with the same region values as REST. Uses a + * dedicated mainnet stream when Bybit documents one for that region. + * Top-level `apiRegion` takes precedence over `restOptions.apiRegion`. + */ ⋮---- -export interface PublicTradeV5 { - execId: string; - symbol: string; - price: string; - size: string; - side: OrderSideV5; - time: string; - isBlockTrade: boolean; - isRPITrade: boolean; - mP?: string; - iP?: string; - mIv?: string; - iv?: string; - seq?: string; -} +/** + * Site ID sent as `x-site-id` during the Node.js WebSocket handshake. + * Brazil and Argentina internal accounts now use `stream.bybit.com` without this header. + * Keep passing it only if a remaining site still requires `x-site-id`. + */ ⋮---- /** - * - * - openInterest string Open interest - * - timestamp string The timestamp (ms) - */ -export type OpenInterestV5 = { - openInterest: string; - singleOpenInterest?: string; - timestamp: string; -}; + * REST options reused for WebSocket routing. + * Regional and site ID values are retained as fallbacks; prefer the matching + * top-level `apiRegion` and `siteId` options. + */ ⋮---- -export interface OpenInterestResponseV5 { - category: 'linear' | 'inverse'; - symbol: string; - list: OpenInterestV5[]; - nextPageCursor?: string; -} +/** + * Default: false. + * + * When enabled, any calls to the subscribe method will return a promise. + * Note: internally, subscription requests are sent in batches. This may not behave as expected when + * subscribing to a large number of topics, especially if you are not yet connected when subscribing. + */ ⋮---- -export interface HistoricalVolatilityV5 { - period: number; - value: string; - time: string; -} +/** + * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method + * + * Look in the examples folder for a demonstration on using node's createHmac instead. + */ ⋮---- -export interface InsuranceDataV5 { - coin: string; - symbols: string; - balance: string; - value: string; +/** + * WS configuration that's always defined, regardless of user configuration + * (usually comes from defaults if there's no user-provided values) + */ +export interface WebsocketClientOptions extends WSClientConfigurableOptions { + market: APIMarket; + pongTimeout: number; + pingInterval: number; + reconnectTimeout: number; + recvWindow: number; + + /** + * If true, require a "receipt" that the connection is ready for use (e.g. a specific event type) + */ + requireConnectionReadyConfirmation: boolean; + authPrivateConnectionsOnConnect: boolean; + authPrivateRequests: boolean; + reauthWSAPIOnReconnect: boolean; + + /** + * Whether to use native WebSocket ping/pong frames for heartbeats + */ + useNativeHeartbeats: boolean; } ⋮---- -export interface InsuranceResponseV5 { - updatedTime: string; - list: InsuranceDataV5[]; -} +/** + * If true, require a "receipt" that the connection is ready for use (e.g. a specific event type) + */ ⋮---- -export interface RiskLimitV5 { - id: number; - symbol: string; - riskLimitValue: string; - maintenanceMargin: number; - initialMargin: number; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - section: any; - isLowestRisk: 0 | 1; - maxLeverage: string; - mmDeduction: string; - nextPageCursor?: string; -} +/** + * Whether to use native WebSocket ping/pong frames for heartbeats + */ ⋮---- -// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type WsEventInternalSrc = 'event' | 'function' | 'frame'; + +================ +File: src/websocket-client.ts +================ +/* eslint-disable @typescript-eslint/no-unused-vars */ ⋮---- -/** @deprecated use DeliveryPriceV5 instead */ -export interface OptionDeliveryPriceV5 { - symbol: string; - deliveryPrice: string; - deliveryTime: string; -} +import { + MessageEventLike, + WSCategoryV5, + WSClientConfigurableOptions, + WsKey, + WsMarket, + WsTopic, +} from './types'; +import { + Exact, + WSAPIOperation, + WsAPIOperationResponseMap, + WSAPIRequest, + WsAPITopicRequestParamMap, + WsAPIWsKeyTopicMap, + WsOperation, + WsRequestOperationBybit, +} from './types/websockets/ws-api'; +import { + APIID, + DefaultLogger, + getMaxTopicsPerSubscribeEvent, + getNormalisedTopicRequests, + getPromiseRefForWSAPIRequest, + getTopicsPerWSKey, + getWsKeyForTopic, + getWsUrl, + isPrivateWsTopic, + isTopicSubscriptionConfirmation, + isTopicSubscriptionSuccess, + isWSAPIResponse, + isWsPong, + neverGuard, + WS_AUTH_ON_CONNECT_KEYS, + WS_KEY_MAP, + WSConnectedResult, + WsTopicRequest, +} from './util'; +import { + BaseWebsocketClient, + EmittableEvent, + MidflightWsRequestEvent, +} from './util/BaseWSClient'; +import { SignAlgorithm, signMessage } from './util/webCryptoAPI'; ⋮---- -export interface DeliveryPriceV5 { - symbol: string; - deliveryPrice: string; - deliveryTime: string; +export interface WSAPIRequestFlags { + /** If true, will skip auth requirement for WS API connection */ + authIsOptional?: boolean | undefined; } ⋮---- -export interface LongShortRatioV5 { - symbol: string; - buyRatio: string; - sellRatio: string; - timestamp: string; -} +/** If true, will skip auth requirement for WS API connection */ ⋮---- -export interface OrderPriceLimitV5 { - symbol: string; - buyLmt: string; - sellLmt: string; - ts: string; -} +export class WebsocketClient extends BaseWebsocketClient< ⋮---- -export interface IndexPriceComponentV5 { - exchange: string; // Name of the exchange - spotPair: string; // Spot trading pair on the exchange (e.g., BTCUSDT) - equivalentPrice: string; // Equivalent price - multiplier: string; // Multiplier used for the component price - price: string; // Actual price - weight: string; // Weight in the index calculation -} +constructor(options?: WSClientConfigurableOptions, logger?: DefaultLogger) ⋮---- -exchange: string; // Name of the exchange -spotPair: string; // Spot trading pair on the exchange (e.g., BTCUSDT) -equivalentPrice: string; // Equivalent price -multiplier: string; // Multiplier used for the component price -price: string; // Actual price -weight: string; // Weight in the index calculation +/** + * Request connection of all dependent (public & private) websockets, instead of waiting + * for automatic connection by SDK. + */ +public connectAll(): Promise[] ⋮---- -export interface IndexPriceComponentsResponseV5 { - indexName: string; // Name of the index (e.g., BTCUSDT) - lastPrice: string; // Last price of the index - updateTime: string; // Timestamp of the last update in milliseconds - components: IndexPriceComponentV5[]; // List of components contributing to the index price -} +/** + * Ensures the WS API connection is active and ready. + * + * You do not need to call this, but if you call this before making any WS API requests, + * it can accelerate the first request (by preparing the connection in advance). + */ +public connectWSAPI(): Promise ⋮---- -indexName: string; // Name of the index (e.g., BTCUSDT) -lastPrice: string; // Last price of the index -updateTime: string; // Timestamp of the last update in milliseconds -components: IndexPriceComponentV5[]; // List of components contributing to the index price +/** This call automatically ensures the connection is active AND authenticated before resolving */ ⋮---- -export interface ADLAlertItemV5 { - coin: string; // Token of the insurance pool - symbol: string; // Trading pair name - balance: string; // Balance of the insurance fund. Used to determine if ADL is triggered - maxBalance: string; // Maximum balance of the insurance pool in the last 8 hours - insurancePnlRatio: string; // PnL ratio threshold for triggering contract PnL drawdown ADL - pnlRatio: string; // Symbol's PnL drawdown ratio in the last 8 hours. Used to determine whether ADL is triggered or stopped - adlTriggerThreshold: string; // Trigger threshold for contract PnL drawdown ADL - adlStopRatio: string; // Stop ratio threshold for contract PnL drawdown ADL -} +public connectPublic(): Promise[] ⋮---- -coin: string; // Token of the insurance pool -symbol: string; // Trading pair name -balance: string; // Balance of the insurance fund. Used to determine if ADL is triggered -maxBalance: string; // Maximum balance of the insurance pool in the last 8 hours -insurancePnlRatio: string; // PnL ratio threshold for triggering contract PnL drawdown ADL -pnlRatio: string; // Symbol's PnL drawdown ratio in the last 8 hours. Used to determine whether ADL is triggered or stopped -adlTriggerThreshold: string; // Trigger threshold for contract PnL drawdown ADL -adlStopRatio: string; // Stop ratio threshold for contract PnL drawdown ADL +public connectPrivate(): Promise ⋮---- -export interface ADLAlertResponseV5 { - updateTime: string; // Latest data update timestamp (ms) - list: ADLAlertItemV5[]; // List of ADL alert items -} +/** + * Subscribe to V5 topics & track/persist them. + * @param wsTopics - topic or list of topics + * @param category - the API category this topic is for (e.g. "linear", or "event" for Event Contract public topics). + * The value is only important when connecting to public topics and will be ignored for private topics. + * @param isPrivateTopic - optional - the library will try to detect private topics, you can use this + * to mark a topic as private (if the topic isn't recognised yet) + */ +public subscribeV5( + wsTopics: WsTopic[] | WsTopic, + category: WSCategoryV5, + isPrivateTopic?: boolean, +): Promise[] ⋮---- -updateTime: string; // Latest data update timestamp (ms) -list: ADLAlertItemV5[]; // List of ADL alert items +// Sort into per-WsKey batches, in case there is a mix of topics here ⋮---- -export interface FeeGroupLevelV5 { - level: string; // Pro level name or Market Maker level name - takerFeeRate: string; // Taker fee rate - makerFeeRate: string; // Maker fee rate - makerRebate: string; // Maker rebate fee rate - rpiMakerRebate?: string; -} +// Prevent duplicate requests to the same topic ⋮---- -level: string; // Pro level name or Market Maker level name -takerFeeRate: string; // Taker fee rate -makerFeeRate: string; // Maker fee rate -makerRebate: string; // Maker rebate fee rate +// Batch sub topics per ws key ⋮---- -export interface FeeGroupRatesV5 { - pro: FeeGroupLevelV5[]; // Pro-level fee structures - marketMaker: FeeGroupLevelV5[]; // Market Maker-level fee structures -} +// Return promise to resolve midflight WS request (only works if already connected before request) ⋮---- -pro: FeeGroupLevelV5[]; // Pro-level fee structures -marketMaker: FeeGroupLevelV5[]; // Market Maker-level fee structures +/** + * Unsubscribe from V5 topics & remove them from memory. They won't be re-subscribed to if the + * connection reconnects. + * + * @param wsTopics - topic or list of topics + * @param category - the API category this topic is for (e.g. "linear", or "event" for Event Contract public topics). The value is only + * important when connecting to public topics and will be ignored for private topics. + * @param isPrivateTopic - optional - the library will try to detect private topics, you can + * use this to mark a topic as private (if the topic isn't recognised yet) + */ +public unsubscribeV5( + wsTopics: WsTopic[] | WsTopic, + category: WSCategoryV5, + isPrivateTopic?: boolean, +): Promise[] ⋮---- -export interface FeeGroupItemV5 { - groupName: string; // Fee group name - weightingFactor: number; // Group weighting factor - symbolsNumbers: number; // Symbols number - symbols: string[]; // Symbol names - feeRates: FeeGroupRatesV5; // Fee rate details for different categories - updateTime: string; // Latest data update timestamp (ms) -} +// Sort into per-WsKey batches, in case there is a mix of topics here ⋮---- -groupName: string; // Fee group name -weightingFactor: number; // Group weighting factor -symbolsNumbers: number; // Symbols number -symbols: string[]; // Symbol names -feeRates: FeeGroupRatesV5; // Fee rate details for different categories -updateTime: string; // Latest data update timestamp (ms) +// Batch sub topics per ws key ⋮---- -export interface FeeGroupStructureResponseV5 { - list: FeeGroupItemV5[]; // List of fee group objects -} +// Return promise to resolve midflight WS request (only works if already connected before request) ⋮---- -list: FeeGroupItemV5[]; // List of fee group objects +/** + * Note: subscribeV5() might be simpler to use. The end result is the same. + * + * Request subscription to one or more topics. Pass topics as either an array of strings, + * or array of objects (if the topic has parameters). + * + * Objects should be formatted as {topic: string, params: object, category: WSCategoryV5}. + * + * - Subscriptions are automatically routed to the correct websocket connection. + * - Authentication/connection is automatic. + * - Resubscribe after network issues is automatic. + * + * Call `unsubscribe(topics)` to remove topics + */ +public subscribe( + requests: + | (WsTopicRequest | WsTopic) + | (WsTopicRequest | WsTopic)[], + requestedWsKey?: WsKey, +) ⋮---- -export interface OptionBaseCoinV5 { - baseCoin: string; - quoteCoin: string; - settleCoin: string; - optionShowName: string; - /** UTC milliseconds. 0 when the option is not scheduled. */ - optionOnlineTime: number; - /** 1 when tradable option symbols exist, otherwise 0 */ - hasSymbol: 0 | 1; - /** 0 crypto, 1 commodity, 2 stock, 3 forex, 4 oil */ - underlyingType: 0 | 1 | 2 | 3 | 4; -} +// Batch sub topics per ws key ⋮---- -/** UTC milliseconds. 0 when the option is not scheduled. */ +/** + * Note: unsubscribe() might be simpler to use. The end result is the same. + * Unsubscribe from one or more topics. Similar to subscribe() but in reverse. + * + * - Requests are automatically routed to the correct websocket connection. + * - These topics will be removed from the topic cache, so they won't be subscribed to again. + */ +public unsubscribe( + requests: + | (WsTopicRequest | WsTopic) + | (WsTopicRequest | WsTopic)[], + wsKey?: WsKey, +) ⋮---- -/** 1 when tradable option symbols exist, otherwise 0 */ +// Batch sub topics per ws key ⋮---- -/** 0 crypto, 1 commodity, 2 stock, 3 forex, 4 oil */ +/** + * + * + * + * WS API Methods - similar to the REST API, but via WebSockets + * https://bybit-exchange.github.io/docs/v5/websocket/trade/guideline + * + * + * + */ ⋮---- -export interface OptionBaseCoinsResultV5 { - list: OptionBaseCoinV5[]; -} - -================ -File: src/types/response/v5-position.ts -================ -import { - CategoryV5, - ExecTypeV5, - OrderSideV5, - OrderTypeV5, - PositionIdx, - PositionSideV5, - PositionStatusV5, - StopOrderTypeV5, - TPSLModeV5, - TradeModeV5, -} from '../shared-v5'; +/** + * Send a Websocket API command/request on a connection. Returns a promise that resolves on reply. + * + * WS API Documentation for list of operations and parameters: + * https://bybit-exchange.github.io/docs/v5/websocket/trade/guideline + * + * Returned promise is rejected if: + * - an exception is detected in the reply, OR + * - the connection disconnects for any reason (even if automatic reconnect will happen). + * + * Authentication is automatic. If you didn't request authentication yourself, there might + * be a small delay after your first request, while the SDK automatically authenticates. + * + * @param wsKey - The connection this event is for. Currently only "v5PrivateTrade" is supported + * for Bybit, since that is the dedicated WS API connection. + * @param operation - The command being sent, e.g. "order.create" to submit a new order. + * @param params - Any request parameters for the command. E.g. `OrderParamsV5` to submit a new + * order. Only send parameters for the request body. Everything else is automatically handled. + * @returns Promise - tries to resolve with async WS API response. Rejects if disconnected or exception is seen in async WS API response + */ ⋮---- -export interface FuturesLeverageItemV5 { - symbol: string; - leverage: string; - side: OrderSideV5 | ''; - positionIdx: PositionIdx; -} +// This overload allows the caller to omit the 3rd param, if it isn't required +sendWSAPIRequest< + TWSKey extends keyof WsAPIWsKeyTopicMap, + TWSOperation extends WsAPIWsKeyTopicMap[TWSKey], + TWSParams extends Exact, + >( + wsKey: TWSKey, + operation: TWSOperation, + params?: TWSParams extends void | never ? undefined : TWSParams, + requestFlags?: WSAPIRequestFlags, + ): Promise; ⋮---- -export interface FuturesLeverageResultV5 { - category: 'linear' | 'inverse'; - list: FuturesLeverageItemV5[]; -} +// These overloads give stricter types than mapped generics, since generic constraints +// do not trigger excess property checks +// Without these overloads, TypeScript won't complain if you include an +// unexpected property with your request (if it doesn't clash with an existing property) +sendWSAPIRequest( + wsKey: typeof WS_KEY_MAP.v5PrivateTrade, + operation: TWSOperation, + params: WsAPITopicRequestParamMap[TWSOperation], + requestFlags?: WSAPIRequestFlags, + ): Promise; ⋮---- -export interface PositionV5 { - positionIdx: PositionIdx; - riskId: number; - riskLimitValue: string; - symbol: string; - side: PositionSideV5; - size: string; - avgPrice: string; - positionValue: string; - tradeMode: TradeModeV5; - autoAddMargin?: number; - positionStatus: PositionStatusV5; - leverage?: string; - breakEvenPrice?: string; // Break even price, only for linear & inverse - markPrice: string; - liqPrice: string | ''; - bustPrice?: string; - positionIM?: string; - positionMM?: string; - positionBalance?: string; - tpslMode?: TPSLModeV5; - takeProfit?: string; - stopLoss?: string; - trailingStop?: string; - sessionAvgPrice: string | ''; - delta?: string; - gamma?: string; - vega?: string; - theta?: string; - unrealisedPnl: string; - curRealisedPnl: string; - cumRealisedPnl: string; - adlRankIndicator: number; - isReduceOnly: boolean; - mmrSysUpdatedTime: string | ''; - leverageSysUpdatedTime: string | ''; - createdTime: string; - updatedTime: string; - /** Position open timestamp (ms). Default `0` when not set. */ - openTime: number; - positionIMByMp: string; - positionMMByMp: string; - seq: number; - netDeltaRatio?: string; -} +sendWSAPIRequest( + wsKey: typeof WS_KEY_MAP.v5PrivateTrade, + operation: TWSOperation, + params: WsAPITopicRequestParamMap[TWSOperation], + requestFlags?: WSAPIRequestFlags, + ): Promise; ⋮---- -breakEvenPrice?: string; // Break even price, only for linear & inverse +sendWSAPIRequest( + wsKey: typeof WS_KEY_MAP.v5PrivateTrade, + operation: TWSOperation, + params: WsAPITopicRequestParamMap[TWSOperation], + requestFlags?: WSAPIRequestFlags, + ): Promise; ⋮---- -/** Position open timestamp (ms). Default `0` when not set. */ +async sendWSAPIRequest< + TWSKey extends keyof WsAPIWsKeyTopicMap, + TWSOperation extends WsAPIWsKeyTopicMap[TWSKey], + TWSParams extends Exact, + TWSAPIResponse extends + WsAPIOperationResponseMap[TWSOperation] = WsAPIOperationResponseMap[TWSOperation], + >( + wsKey: WsKey = WS_KEY_MAP.v5PrivateTrade, + operation: TWSOperation, + params: TWSParams, + requestFlags?: WSAPIRequestFlags, +): Promise ⋮---- -export interface SetRiskLimitResultV5 { - category: CategoryV5; - riskId: number; - riskLimitValue: string; -} +// Some commands don't require authentication. ⋮---- -export interface AddOrReduceMarginResultV5 { - category: CategoryV5; - symbol: string; - positionIdx: PositionIdx; - riskId: number; - riskLimitValue: string; - size: string; - avgPrice: string; - liqPrice: string; - bustPrice: string; - markPrice: string; - positionValue: string; - leverage: string; - autoAddMargin: 0 | 1; - positionStatus: PositionStatusV5; - positionIM: string; - positionMM: string; - takeProfit: string; - stopLoss: string; - trailingStop: string; - unrealisedPnl: string; - cumRealisedPnl: string; - createdTime: string; - updatedTime: string; -} +// Sign, if needed ⋮---- -export interface ExecutionV5 { - symbol: string; - orderId: string; - orderLinkId: string; - side: OrderSideV5; - orderPrice: string; - orderQty: string; - leavesQty: string; - orderType: OrderTypeV5; - stopOrderType?: StopOrderTypeV5; - execFee: string; - execFeeV2: string; - feeCurrency: string; // Trading fee currency - execId: string; - execPrice: string; - execQty: string; - execType: ExecTypeV5; - execValue: string; - execTime: string; - isMaker: boolean; - feeRate: string; - tradeIv?: string; - markIv?: string; - markPrice: string; - indexPrice: string; - underlyingPrice?: string; - blockTradeId?: string; - closedSize?: string; - seq: number; - extraFees: string; -} +// Store deferred promise, resolved within the "resolveEmittableEvents" method while parsing incoming events ⋮---- -feeCurrency: string; // Trading fee currency +// eslint-disable-next-line @typescript-eslint/no-explicit-any ⋮---- -export interface ClosedPnLV5 { - symbol: string; - orderId: string; - side: string; - qty: string; - orderPrice: string; - orderType: OrderTypeV5; - execType: ExecTypeV5; - closedSize: string; - openFee: string; - closeFee: string; - cumEntryValue: string; - avgEntryPrice: string; - cumExitValue: string; - avgExitPrice: string; - closedPnl: string; - fillCount: string; - leverage: string; - createdTime: string; - updatedTime: string; -} +// Enrich returned promise with request context for easier debugging ⋮---- -export interface MovePositionResultV5 { - blockTradeId: string; - status: 'Processing' | 'Rejected'; - rejectParty: '' | 'Taker' | 'Maker' | 'bybit'; -} +// throw e; ⋮---- -export interface MovePositionHistoryV5 { - blockTradeId: string; - category: 'linear' | 'spot' | 'option'; - orderId: string; - userId: number; - symbol: string; - side: 'Buy' | 'Sell'; - price: string; - qty: string; - execFee: string; - status: 'Processing' | 'Filled' | 'Rejected'; - execId: string; - resultCode: number; - resultMessage: string; - createdAt: number; - updatedAt: number; - rejectParty: '' | 'Taker' | 'Maker' | 'bybit'; -} +// Send event ⋮---- -export interface ClosedOptionsPositionV5 { - symbol: string; - side: 'Buy' | 'Sell'; - totalOpenFee: string; - deliveryFee: string; - totalCloseFee: string; - qty: string; - closeTime: number; - avgExitPrice: string; - deliveryPrice: string; - openTime: number; - avgEntryPrice: string; - totalPnl: string; -} - -================ -File: .gitignore -================ -!.gitkeep -.DS_STORE -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json -pids -*.pid -*.seed -*.pid.lock -node_modules/ -.npm -.eslintcache -.node_repl_history -*.tgz -.yarn-integrity -.env -.env.test -.cache -lib -dist -doc -bundleReport.html -.history/ -rawReq.ts -localtest.sh -localtest.ts -privaterepotracker -restClientRegex.ts -repomix.sh - -examples/ignored -examples/ts-testnet-private.ts -examples/ts-testnet-trade.ts -examples/ts-testnet.ts -*.pem -.issue* -docs/research -tmp - -================ -File: src/types/request/index.ts -================ - - -================ -File: src/types/response/index.ts -================ - - -================ -File: src/types/response/v5-user.ts -================ -import { PermissionsV5 } from '../shared-v5'; +// Return deferred promise, so caller can await this call ⋮---- -export interface CreateSubMemberResultV5 { - uid: string; - username: string; - memberType: number; - status: number; - remark: string; -} +/** + * + * + * Internal methods - not intended for public use + * + * + */ ⋮---- -export interface CreateSubApiKeyResultV5 { - id: string; - note: string; - apiKey: string; - readOnly: number; - secret: string; - permissions: PermissionsV5; -} +/** + * Note: implementing this method will wipe the WsStore state for this WsKey, once this method returns + */ +protected isCustomReconnectionNeeded(): boolean ⋮---- -export interface SubMemberV5 { - uid: string; - username: string; - memberType: number; - status: number; - accountMode: number; - remark: string; -} -export type ApiKeyType = 1 | 2; +protected async triggerCustomReconnectionWorkflow(): Promise ⋮---- -export interface ApiKeyPermissionsV5 { - ContractTrade: string[]; - Spot: string[]; - Wallet: string[]; - Options: string[]; - Derivatives: string[]; - CopyTrading: string[]; - BlockTrade: string[]; - Exchange: string[]; - NFT: string[]; - Affiliate: string[]; - Earn?: string[]; - FiatP2P?: string[]; - FiatBitPay?: string[]; - FiatConvertBroker?: string[]; - /** @deprecated */ - FiatGlobalPay?: string[]; - BitCard?: string[]; - ByXPost?: string[]; -} +/** + * @returns The WS URL to connect to for this WS key + */ +protected async getWsUrl(wsKey: WsKey): Promise ⋮---- -/** @deprecated */ +// If auth is needed for this wsKey URL, this returns a suffix ⋮---- -export interface ApiKeyInfoV5 { - id: string; - note: string; - apiKey: string; - readOnly: 0 | 1; - secret: string; - permissions: ApiKeyPermissionsV5; - ips: string[]; - type: 1 | 2; // 1: personal, 2: connected to third-party app - deadlineDay: number; - expiredAt: string; - createdAt: string; - /** @deprecated */ - unified: number; - uta: 0 | 1; // 0: regular account, 1: unified trade account - userID: number; - inviterID: number; - vipLevel: string; - mktMakerLevel: string; - affiliateID: number; - rsaPublicKey: string; - isMaster: boolean; - parentUid: string; - kycLevel: 'LEVEL_DEFAULT' | 'LEVEL_1' | 'LEVEL_2'; - kycRegion: string; - isFixApi?: boolean; -} +/** + * Return params required to make authorized request + */ +private async getWsAuthURLSuffix(): Promise ⋮---- -type: 1 | 2; // 1: personal, 2: connected to third-party app +private async signMessage( + paramsStr: string, + secret: string, + method?: 'hex' | 'base64', + algorithm: SignAlgorithm = 'SHA-256', +): Promise ⋮---- -/** @deprecated */ +protected async getWsAuthRequestEvent( + wsKey: WsKey, +): Promise> ⋮---- -uta: 0 | 1; // 0: regular account, 1: unified trade account +private async getWsAuthSignature( + wsKey: WsKey, +): Promise< ⋮---- -export interface UpdateApiKeyResultV5 { - id: string; - note: string; - apiKey: string; - readOnly: 0 | 1; - secret: string; - permissions: PermissionsV5; - ips: string[]; -} +undefined, // Let the function automatically determine encoding based on key type ⋮---- -export interface SubAccountAllApiKeysResultV5 { - result: { - id: string; - ips?: string[]; - apiKey: string; - note: string; - status: number; - expiredAt?: string; - createdAt: string; - type: ApiKeyType; - permissions: PermissionsV5; - secret: string; - readOnly: 0 | 1; - deadlineDay?: number; - flag: string; - }[]; - nextPageCursor: string; -} +private async signWSAPIRequest( + requestEvent: WSAPIRequest, +): Promise> ⋮---- -export interface AffiliateUserListItemV5 { - userId: string; - registerTime: string; - source: string; - remarks: string; - isKyc: boolean; - takerVol30Day: string; - makerVol30Day: string; - tradeVol30Day: string; - depositAmount30Day: string; - takerVol365Day: string; - makerVol365Day: string; - tradeVol365Day: string; - depositAmount365Day: string; - takerVol: string; - makerVol: string; - tradeVol: string; - startDate: string; - endDate: string; - /** tradfi trade volume in [startDate, endDate] when startDate/endDate in params */ - tradfiTradeVol?: string; - /** tradfi trade volume in last 30 days. 0 when startDate/endDate in params */ - tradfiTradeVol30Day?: string; - /** tradfi trade volume in past year. 0 when startDate/endDate in params */ - tradfiTradeVol365Day?: string; - /** Commission between startDate and endDate when startDate/endDate in params. Coin -> amount */ - commissionsVol?: Record; - /** Commission in last 30 days. Coin -> amount */ - commissions30Day?: Record; - /** Commission in past year. Coin -> amount */ - commissions365Day?: Record; -} +// Not needed for Bybit. Auth happens only on connection open, automatically. ⋮---- -/** tradfi trade volume in [startDate, endDate] when startDate/endDate in params */ +protected sendPingEvent(wsKey: WsKey) ⋮---- -/** tradfi trade volume in last 30 days. 0 when startDate/endDate in params */ +protected sendPongEvent(wsKey: WsKey) ⋮---- -/** tradfi trade volume in past year. 0 when startDate/endDate in params */ +/** Force subscription requests to be sent in smaller batches, if a number is returned */ +protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null ⋮---- -/** Commission between startDate and endDate when startDate/endDate in params. Coin -> amount */ +protected authPrivateConnectionsOnConnect(_wsKey: WsKey): boolean ⋮---- -/** Commission in last 30 days. Coin -> amount */ +/** + * @returns one or more correctly structured request events for performing a operations over WS. This can vary per exchange spec. + */ +protected async getWsRequestEvents( + market: WsMarket, + operation: WsOperation, + requests: WsTopicRequest[], + // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars + _wsKey: WsKey, +): Promise>[]> ⋮---- -/** Commission in past year. Coin -> amount */ +// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars ⋮---- -export interface AffiliateUserInfoV5 { - uid: string; - vipLevel: string; - takerVol30Day: string; - makerVol30Day: string; - tradeVol30Day: string; - depositAmount30Day: string; - takerVol365Day: string; - makerVol365Day: string; - tradeVol365Day: string; - depositAmount365Day: string; - totalWalletBalance: '1' | '2' | '3' | '4'; - depositUpdateTime: string; - volUpdateTime: string; - KycLevel: 0 | 1 | 2; - /** tradfi trade volume in last 30 days (USDT) */ - tradfiTradeVol30Day?: string; - /** tradfi trade volume in past year (USDT) */ - tradfiTradeVol365Day?: string; - /** tradfi commissions in last 30 days. Coin -> amount */ - commissions30Day?: Record; - /** tradfi commissions in past year. Coin -> amount */ - commissions365Day?: Record; - /** Payment amount in the last 30 days */ - paySendAmount30Day: string; - /** Pay first transaction amount */ - payFtt: string; - /** Card first-time transaction amount */ - cardFtt: string; -} +// Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values ⋮---- -/** tradfi trade volume in last 30 days (USDT) */ +protected getPrivateWSKeys(): WsKey[] ⋮---- -/** tradfi trade volume in past year (USDT) */ +protected isAuthOnConnectWsKey(wsKey: WsKey): boolean ⋮---- -/** tradfi commissions in last 30 days. Coin -> amount */ +/** + * Determines if a topic is for a private channel, using a hardcoded list of strings + */ +protected isPrivateTopicRequest(request: WsTopicRequest): boolean ⋮---- -/** tradfi commissions in past year. Coin -> amount */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +protected isWsPing(msg: any): boolean ⋮---- -/** Payment amount in the last 30 days */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +protected isWsPong(msg: any): boolean ⋮---- -/** Pay first transaction amount */ +// public ws connections ⋮---- -/** Card first-time transaction amount */ +// private ws connections ⋮---- -export interface AffiliateSubAffiliateListItemV5 { - subAffId: string; - userId: string; - name: string; - email: string; - /** Commission per currency (BTC, ETH, MNT, USDC, USDT) for the queried date range */ - commissionsVol: Record; - commissionsForUsdt: string; - becameAffTime: string; - startDate: string; - endDate: string; -} +/** + * Abstraction called to sort ws events into emittable event types (response to a request, data update, etc) + */ +protected resolveEmittableEvents( + wsKey: WsKey, + event: MessageEventLike, +): EmittableEvent[] ⋮---- -/** Commission per currency (BTC, ETH, MNT, USDC, USDT) for the queried date range */ +// this.logger.trace('resolveEmittableEvents', { +// ...WS_LOGGER_CATEGORY, +// wsKey, +// parsed: JSON.stringify(parsed), +// }); ⋮---- -export interface AffiliateSubAffiliateListResultV5 { - list: AffiliateSubAffiliateListItemV5[]; - nextPageCursor: string; -} +// Only applies to the V5 WS topics ⋮---- -export interface FriendReferralRecordV5 { - id: string; - inviteeUid: string; - status: number; - createdAt: string; - updatedAt: string; -} +// WS API response ⋮---- -export interface ReferralCodeItemV5 { - referralCode: string; - referralLink: string; - scene: number; -} +// eslint-disable-next-line max-len ⋮---- -export interface ReferralCodesResultV5 { - referralCodes: ReferralCodeItemV5[]; -} +// WS API Exception +⋮---- +// WS API Success +⋮---- +// Messages for a subscribed topic all include the "topic" property +⋮---- +// Messages that are a "reply" to a request/command (e.g. subscribe to these topics) typically include the "op" property +⋮---- +// Failed request +⋮---- +// These are r equest/reply pattern events (e.g. after subscribing to topics or authenticating) +⋮---- +// Request/reply pattern for authentication success +⋮---- +// In case of catastrophic failure, fallback to noisy emit update ================ -File: src/types/websockets/ws-events.ts +File: .gitignore ================ -import WebSocket from 'isomorphic-ws'; +!.gitkeep +.DS_STORE +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json +pids +*.pid +*.seed +*.pid.lock +node_modules/ +.npm +.eslintcache +.node_repl_history +*.tgz +.yarn-integrity +.env +.env.test +.cache +lib +dist +doc +bundleReport.html +.history/ +rawReq.ts +localtest.sh +localtest.ts +privaterepotracker +restClientRegex.ts +repomix.sh + +examples/ignored +examples/ts-testnet-private.ts +examples/ts-testnet-trade.ts +examples/ts-testnet.ts +*.pem +.issue* +docs/research +tmp + +================ +File: examples/Rest/rest-v5-custom-url.ts +================ +import { RestClientV5 } from '../../src/index'; ⋮---- -import { - RFQItemV5, - RFQPublicTradeV5, - RFQQuoteItemV5, - RFQTradeV5, -} from '../response/v5-rfq'; +// or +// import { RestClientV5 } from 'bybit-api'; +⋮---- +/** + * The first parameter of the REST client allows you to pass any configuration parameters supported by the SDK. + * + * These include API keys, if you wish to use private endpoints, but also expose other features such as + * setting a custom base URL (e.g. for Turkish users). + * + * Refer to the API documentation for a complete list of domains: https://bybit-exchange.github.io/docs/v5/guide#authentication + */ +⋮---- +/** + * You can pass a completely custom base URL, + * e.g. if you're trying to use a domain that hasn't been added yet (please let us know) + */ +// baseUrl: 'https://api5.bybit.com', +// +// +/** + * + * Predefined API regions are available through the `apiRegion` property. + * Choose the region where your Bybit account is registered: + * + */ +// +// +// default: routes to api.bybit.com +// apiRegion: 'default', +// +// +// bytick: routes to api.bytick.com +// apiRegion: 'bytick', +// +// +// NL: Bybit removed api.bybit.nl from Integration Guidance on 2026-09-22. apiRegion no longer includes NL. +// +// +// TK: routes to api.bybit.tr (for Turkey users) +// apiRegion: 'TK', +// +// +// KZ: routes to api.bybit.kz (for Kazakhstan users) +// apiRegion: 'KZ', +// +// +// HK: routes to api.spark-fintech.com and adds x-refer-site-id: HKG +// Testnet routes to api-testnet.spark-fintech.com +// apiRegion: 'HK', +// +// +// GE: routes to api.bybitgeorgia.ge (for Georgia users) +// apiRegion: 'GE', +// +// +// UAE: routes to api.bybit.ae (for United Arab Emirates users) +// apiRegion: 'UAE', +// +// +// EU: routes to api.bybit.eu (for EU and EEA users) +// apiRegion: 'EU', +// +// +// ID: routes to api.bybit.id (for Indonesian users) +// apiRegion: 'ID', +// +// +// JP: routes to api.manepa.jp (for Japan users) +// Testnet routes to api-testnet.manepa.jp +// apiRegion: 'JP', +// +// +/** + * Brazil and Argentina international accounts use the global API domain + * with an x-site-id header. Choose the site ID for your account: + */ +// siteId: 'BRA_BTL', +// siteId: 'ARG_BTL', + +================ +File: src/types/request/v5-market.ts +================ +import { KlineIntervalV3 } from '../shared'; import { CategoryV5, - ExecTypeV5, - OCOTriggerTypeV5, - OrderCancelTypeV5, - OrderCreateTypeV5, - OrderRejectReasonV5, - OrderSideV5, - OrderSMPTypeV5, - OrderStatusV5, - OrderTimeInForceV5, - OrderTriggerByV5, - OrderTypeV5, - PositionIdx, - PositionSideV5, - PositionStatusV5, - StopOrderTypeV5, - SystemStatusItemV5, - TPSLModeV5, - TradeModeV5, + InstrumentStatusV5, + InstrumentSymbolTypeV5, + OptionTypeV5, } from '../shared-v5'; -import { WsKey } from './ws-general'; ⋮---- -export interface MessageEventLike { - target: WebSocket; - type: 'message'; - data: string; +export interface GetKlineParamsV5 { + category: 'spot' | 'linear' | 'inverse'; + symbol: string; + interval: KlineIntervalV3; + start?: number; + end?: number; + limit?: number; } ⋮---- -export function isMessageEvent(msg: unknown): msg is MessageEventLike -⋮---- -export interface WSPublicTopicEventV5 { - id?: string; - topic: TTopic; - type: TType; - /** Cross sequence */ - cs?: number; - /** Event timestamp */ - ts: number; - data: TData; +export interface GetMarkPriceKlineParamsV5 { /** - * matching engine timestamp (correlated with T from public trade channel) + * linear (default if omitted), inverse, or option. */ - cts: number; + category?: 'linear' | 'inverse' | 'option'; + symbol: string; + interval: KlineIntervalV3; + start?: number; + end?: number; /** - * Internal reference, can be used to determine if this is spot/linear/inverse/etc + * Futures: [1, 1000], default 200. Options: [1, 500], default 200. */ - wsKey: WsKey; + limit?: number; } ⋮---- -/** Cross sequence */ -⋮---- -/** Event timestamp */ -⋮---- /** - * matching engine timestamp (correlated with T from public trade channel) + * linear (default if omitted), inverse, or option. */ ⋮---- /** - * Internal reference, can be used to determine if this is spot/linear/inverse/etc + * Futures: [1, 1000], default 200. Options: [1, 500], default 200. */ ⋮---- -export interface WSPrivateTopicEventV5 { - id?: string; - topic: TTopic; - creationTime: number; - data: TData; - wsKey: WsKey; +export interface GetIndexPriceKlineParamsV5 { + category: 'linear' | 'inverse'; + symbol: string; + interval: KlineIntervalV3; + start?: number; + end?: number; + limit?: number; } ⋮---- -export interface WSOrderbookV5 { - /** Symbol */ - s: string; - /** [price, qty][] */ - b: [string, string][]; - /** [price, qty][] */ - a: [string, string][]; - /** Update ID */ - u: number; - /** Cross sequence */ - seq: number; +export interface GetPremiumIndexPriceKlineParamsV5 { + category: 'linear'; + symbol: string; + interval: KlineIntervalV3; + start?: number; + end?: number; + limit?: number; } ⋮---- -/** Symbol */ +export interface GetInstrumentsInfoParamsV5 { + category: CategoryV5; + symbol?: string; + /** Filter by instrument `symbolType` (e.g. `commodity`, `stock`, `forex` for linear). */ + symbolType?: InstrumentSymbolTypeV5; + status?: InstrumentStatusV5; + /** For `category=option`, pass `All` to return all option symbols. */ + baseCoin?: string; + limit?: number; + cursor?: string; +} ⋮---- -/** [price, qty][] */ +/** Filter by instrument `symbolType` (e.g. `commodity`, `stock`, `forex` for linear). */ ⋮---- -/** [price, qty][] */ +/** For `category=option`, pass `All` to return all option symbols. */ ⋮---- -/** Update ID */ +export interface GetOrderbookParamsV5 { + category: CategoryV5; + symbol: string; + limit?: number; +} ⋮---- -/** Cross sequence */ +export interface GetRPIOrderbookParamsV5 { + category?: 'spot' | 'linear' | 'inverse'; + symbol: string; + limit: number; // Required for RPI orderbook, [1, 50] +} ⋮---- -export type WSOrderbookEventV5 = WSPublicTopicEventV5< - string, - 'delta' | 'snapshot', - WSOrderbookV5 ->; +limit: number; // Required for RPI orderbook, [1, 50] ⋮---- -export interface WSTradeV5 { - T: number; - s: string; - S: OrderSideV5; - v: string; - p: string; - L?: string; - i: string; - BT: boolean; - RPI?: boolean; - mP?: string; - iP?: string; - mIv?: string; - iv?: string; +export interface GetIndexPriceComponentsParamsV5 { + indexName: string; // Index name, like BTCUSDT } ⋮---- -export type WSTradeEventV5 = WSPublicTopicEventV5< - string, - 'snapshot', - WSTradeV5[] ->; +indexName: string; // Index name, like BTCUSDT ⋮---- -export interface WSEventOrderbookV5 { - s: string; - r: [string, string][]; - u: number; - seq: number; +export interface GetADLAlertParamsV5 { + symbol?: string; // Contract name, e.g. BTCUSDT. Uppercase only } ⋮---- -export type WSEventOrderbookEventV5 = WSPublicTopicEventV5< - string, - 'delta' | 'snapshot', - WSEventOrderbookV5 ->; +symbol?: string; // Contract name, e.g. BTCUSDT. Uppercase only ⋮---- -export interface WSEventPublicTradeV5 { - T: number; - s: string; - r: string; - a: string; - i: string; - seq: number; +export interface GetFeeGroupStructureParamsV5 { + productType: string; // Product type. contract only for now + groupId?: string; // Group ID. 1, 2, 3, 4, 5, 6, 7 } ⋮---- -export type WSEventPublicTradeEventV5 = WSPublicTopicEventV5< - string, - 'snapshot', - WSEventPublicTradeV5[] ->; +productType: string; // Product type. contract only for now +groupId?: string; // Group ID. 1, 2, 3, 4, 5, 6, 7 ⋮---- -/** - * WSTickerV5 is the data structure for the "linear" ticker channel - * */ -export interface WSTickerV5 { - symbol: string; - tickDirection: string; - price24hPcnt: string; - lastPrice: string; - prevPrice24h: string; - highPrice24h: string; - lowPrice24h: string; - prevPrice1h: string; - markPrice: string; - indexPrice: string; - openInterest: string; - openInterestValue: string; - singleOpenInterest?: string; - singleOpenInterestValue?: string; - turnover24h: string; - volume24h: string; - nextFundingTime: string; - fundingRate: string; - bid1Price: string; - bid1Size: string; - ask1Price: string; - ask1Size: string; - deliveryTime?: string; - basisRate?: string; - deliveryFeeRate?: string; - predictedDeliveryPrice?: string; - preOpenPrice?: string; - preQty?: string; - curPreListingPhase?: string; - fundingIntervalHour?: string; - fundingCap?: string; - basisRateYear?: string; +export interface GetTickersParamsV5 { + category: TCategory; + symbol?: string; + baseCoin?: string; + expDate?: string; } ⋮---- -export interface WSTickerOptionV5 { +export interface GetFundingRateHistoryParamsV5 { + category: 'linear' | 'inverse'; symbol: string; - bidPrice: string; - bidSize: string; - bidIv: string; - askPrice: string; - askSize: string; - askIv: string; - lastPrice: string; - highPrice24h: string; - lowPrice24h: string; - markPrice: string; - indexPrice: string; - markPriceIv: string; - underlyingPrice: string; - openInterest: string; - turnover24h: string; - volume24h: string; - totalVolume: string; - totalTurnover: string; - delta: string; - gamma: string; - vega: string; - theta: string; - predictedDeliveryPrice: string; - change24h: string; + startTime?: number; + endTime?: number; + limit?: number; } ⋮---- -export interface WSTickerSpotV5 { +export interface GetPublicTradingHistoryParamsV5 { + category: CategoryV5; symbol: string; - lastPrice: string; - highPrice24h: string; - lowPrice24h: string; - prevPrice24h: string; - volume24h: string; - turnover24h: string; - price24hPcnt: string; - usdIndexPrice: string; + baseCoin?: string; + optionType?: OptionTypeV5; + limit?: number; } ⋮---- -export type WSTickerEventV5 = WSPublicTopicEventV5< - string, - 'snapshot' | 'delta', - WSTickerV5 | WSTickerOptionV5 | WSTickerSpotV5 ->; +export type OpenInterestIntervalV5 = + | '5min' + | '15min' + | '30min' + | '1h' + | '4h' + | '1d'; ⋮---- -export interface WSKlineV5 { - start: number; - end: number; - interval: string; - open: string; - close: string; - high: string; - low: string; - volume: string; - turnover: string; - confirm: boolean; - timestamp: number; +export interface GetOpenInterestParamsV5 { + category: 'linear' | 'inverse'; + symbol: string; + intervalTime: OpenInterestIntervalV5; + startTime?: number; + endTime?: number; + limit?: number; + cursor?: string; } ⋮---- -export type WSKlineEventV5 = WSPublicTopicEventV5< - string, - 'snapshot', - WSKlineV5[] ->; +export interface GetHistoricalVolatilityParamsV5 { + category: 'option'; + baseCoin?: string; + period?: 7 | 14 | 21 | 30 | 60 | 90 | 180 | 270; + startTime?: number; + endTime?: number; +} ⋮---- -export interface WSLiquidationV5 { - T: number; - s: string; - S: OrderSideV5; - v: string; - p: string; +export interface GetInsuranceParamsV5 { + coin?: string; } ⋮---- -export type WSLiquidationEventV5 = WSPublicTopicEventV5< - string, - 'snapshot', - WSLiquidationV5[] ->; -⋮---- -export interface WSPositionV5 { - category: string; - symbol: string; - side: PositionSideV5; - size: string; - positionIdx: PositionIdx; - tradeMode: TradeModeV5; - positionValue: string; - riskId: number; - riskLimitValue: string; - entryPrice: string; - markPrice: string; - leverage: string; - breakEvenPrice?: string; // Break even price, only for linear & inverse - positionBalance: string; - autoAddMargin: number; - positionMM: string; - positionIM: string; - positionIMByMp: string; - positionMMByMp: string; - liqPrice: string; - bustPrice: string; - tpslMode: string; - takeProfit: string; - stopLoss: string; - trailingStop: string; - unrealisedPnl: string; - curRealisedPnl: string; - sessionAvgPrice: string; - delta: string; - gamma: string; - vega: string; - theta: string; - cumRealisedPnl: string; - positionStatus: PositionStatusV5; - adlRankIndicator: number; - isReduceOnly: boolean; - mmrSysUpdatedTime: string; - leverageSysUpdatedTime: string; - createdTime: string; - updatedTime: string; - /** Position open timestamp (ms). Default `0` when not set. */ - openTime: number; - seq: number; - netDeltaRatio?: string; +export interface GetRiskLimitParamsV5 { + category?: 'linear' | 'inverse'; + symbol?: string; + cursor?: string; } ⋮---- -breakEvenPrice?: string; // Break even price, only for linear & inverse -⋮---- -/** Position open timestamp (ms). Default `0` when not set. */ +export interface GetOptionDeliveryPriceParamsV5 { + category: 'option'; + symbol?: string; + baseCoin?: string; + limit?: number; + cursor?: string; +} ⋮---- -export type WSPositionEventV5 = WSPrivateTopicEventV5< - 'position', - WSPositionV5[] ->; +export interface GetDeliveryPriceParamsV5 { + category: 'linear' | 'inverse' | 'option'; + symbol?: string; + baseCoin?: string; + settleCoin?: string; + limit?: number; + cursor?: string; +} ⋮---- -export interface WSEventPositionV5 { +export interface GetLongShortRatioParamsV5 { + category: 'linear' | 'inverse'; symbol: string; - baseCoin: string; - settleCoin: string; - side: string; - ecContractType: string; - ecDirection: string; - avgPayoutRatio: string; - positionValue: string; - ecSettleTime: string; - cumClosedPnl: string; - createdTime: string; - updatedTime: string; - seq: number; + period: OpenInterestIntervalV5; + startTime?: string; + endTime?: string; + limit?: number; + cursor?: string; } ⋮---- -export type WSEventPositionEventV5 = WSPrivateTopicEventV5< - 'position.event', - WSEventPositionV5[] ->; -⋮---- -export interface WSAccountOrderV5 { - category: CategoryV5; - orderId: string; - orderLinkId: string; - parentOrderLinkId?: string; // Linked parent order for attached TP/SL orders (futures & options) - isLeverage: string; - blockTradeId: string; +export interface GetFullDepthOrderbookParamsV5 { + category: 'spot' | 'linear' | 'inverse'; symbol: string; - price: string; - qty: string; - side: OrderSideV5; - positionIdx: PositionIdx; - orderStatus: OrderStatusV5; - createType: OrderCreateTypeV5; - cancelType: OrderCancelTypeV5; - rejectReason?: OrderRejectReasonV5; - avgPrice?: string; - leavesQty?: string; - leavesValue?: string; - cumExecQty: string; - cumExecValue: string; - cumExecFee: string; - closedPnl: string; - feeCurrency: string; - timeInForce: OrderTimeInForceV5; - orderType: OrderTypeV5; - stopOrderType: StopOrderTypeV5; - ocoTriggerType?: OCOTriggerTypeV5; - orderIv: string; - marketUnit?: 'baseCoin' | 'quoteCoin'; - triggerPrice: string; - takeProfit: string; - stopLoss: string; - tpslMode?: TPSLModeV5; - tpLimitPrice?: string; - slLimitPrice?: string; - tpTriggerBy: string; - slTriggerBy: string; - triggerDirection: number; - triggerBy: OrderTriggerByV5; - lastPriceOnCreated: string; - reduceOnly: boolean; - closeOnTrigger: boolean; - placeType: string; - smpType: OrderSMPTypeV5; - smpGroup: string; - smpOrderId: string; - createdTime: string; - updatedTime: string; - cumFeeDetail?: Record; // Cumulative trading fee details instead of cumExecFee and feeCurrency - rpiTakerAccess?: boolean; - rpiMatchedQty?: string; } ⋮---- -parentOrderLinkId?: string; // Linked parent order for attached TP/SL orders (futures & options) -⋮---- -cumFeeDetail?: Record; // Cumulative trading fee details instead of cumExecFee and feeCurrency +export interface GetOptionBaseCoinsParamsV5 { + /** + * Comma-separated underlying types. + * 0 crypto, 1 commodity, 2 stock, 3 forex, 4 oil. Omit to return all types. + */ + underlyingType?: string; +} ⋮---- -export type WSAccountOrderEventV5 = WSPrivateTopicEventV5< - 'order', - WSAccountOrderV5[] ->; +/** + * Comma-separated underlying types. + * 0 crypto, 1 commodity, 2 stock, 3 forex, 4 oil. Omit to return all types. + */ + +================ +File: src/types/response/v5-earn.ts +================ +export interface EarnInterestCardV5 { + awardId: number; + specCode: string; + coin: string; + apy: string; + duration: number; + claimedAt: number; + expireAt: number; + usedAt: number; + status: 'InUse' | 'NotUse' | 'Expired' | 'AlreadyUsed' | string; + currentPnl: string; + limitPnl: string; + positionEffectiveAmount: string; + productId: number; + category: 'FlexibleSaving' | 'DualAssets' | string; +} ⋮---- -export interface WSEventOrderV5 { - category: 'event' | string; - orderId: string; - orderLinkId: string; - symbol: string; - symbolId: number; - side: string; +export interface EarnAwardCardV5 { + awardId: number; + specCode: string; + claimedAt: number; + usedAt: number; + expireAt: number; + status: 'InUse' | 'NotUse' | 'Expired' | 'AlreadyUsed' | string; + amount: string; + limitPnlPercentage: string; baseCoin: string; quoteCoin: string; - settleCoin: string; - orderStatus: string; - ecContractType: string; - ecDirection: string; - ecDurationWindow: number; - ecTargetPrice: string; - ecLowerBound: string; - ecUpperBound: string; - ecOrderValue: string; - ecIndexPrice: string; - ecSettleTime: string; - payoutRatio: string; - orderAvgPayoutRatio: string; - cumExecValue: string; - cumExecFee: string; - leavesValue: string; - cumPayout: string; - createType: number; - cancelType: string; - rejectReason: string; - extraFees: unknown[]; - transTime: string; - createdTime: string; - updatedTime: string; + direction: 1 | 2; + category: 'FlexibleSaving' | 'DualAssets' | string; } ⋮---- -export type WSEventOrderEventV5 = WSPrivateTopicEventV5< - 'order' | 'order.event', - WSEventOrderV5[] ->; +export interface EarnCouponListResultV5 { + interestCards: EarnInterestCardV5[]; + awardCards: EarnAwardCardV5[]; +} ⋮---- -export interface WSExecutionV5 { - category: CategoryV5; - symbol: string; - isLeverage: string; - orderId: string; - orderLinkId: string; - side: OrderSideV5; - orderPrice: string; - orderQty: string; - leavesQty: string; - createType: OrderCreateTypeV5; - orderType: OrderTypeV5; - stopOrderType: StopOrderTypeV5; - execFee: string; - feeCurrency: string; // Trading fee currency - execId: string; - execPrice: string; - execQty: string; - execPnl: string; - execType: ExecTypeV5; - execValue: string; - execTime: string; - isMaker: boolean; - feeRate: string; - tradeIv: string; - markIv: string; - markPrice: string; - indexPrice: string; - underlyingPrice: string; - blockTradeId: string; - closedSize: string; - extraFees: string; - seq: number; - marketUnit: string; +export interface FlexibleSavingAutoSavingsCoinV5 { + coin: string; + isSelected: boolean; + maxStakingAmount: string; + apr: string; } ⋮---- -feeCurrency: string; // Trading fee currency +export interface FlexibleSavingAutoSavingsV5 { + selectedAll: boolean; + coins: FlexibleSavingAutoSavingsCoinV5[]; +} ⋮---- -export type WSExecutionEventV5 = WSPrivateTopicEventV5< - 'execution', - WSExecutionV5[] ->; +export interface EarnProductV5 { + category: string; + estimateApr: string; + coin: string; + minStakeAmount: string; + maxStakeAmount: string; + precision: string; + productId: string; + status: 'Available' | 'NotAvailable'; +} ⋮---- -export interface WSEventExecutionV5 { - category: 'event' | string; - transId: string; - execId: string; +export interface EarnOrderHistoryV5 { + coin: string; + orderValue: string; + orderType: 'Redeem' | 'Stake'; orderId: string; orderLinkId: string; - symbol: string; - symbolId: number; - baseCoin: string; - quoteCoin: string; - settleCoin: string; - side: string; - feeCoin: string; - execType: string; - execPrice: string; - execValue: string; - execFee: string; - execFeeRate: string; - orderPrice: string; - ecContractType: number | string; - ecDirection: number | string; - ecDurationWindow: number; - ecTargetPrice: string; - ecLowerBound: string; - ecUpperBound: string; - ecOrderValue: string; - ecIndexPrice?: string; - ecPayout: string; - entryPrice: string; - settlePrice: string; - grossPayoutRatio: string; - sessionRpl: string; - transTime: string; - settleTimeMs: string; - crossSeq: string; - timeInForce: string; - extraFees: unknown[]; + status: 'Success' | 'Fail' | 'Pending'; + createdAt: string; + productId: string; + updatedAt: string; + swapOrderValue: string; + estimateRedeemTime: string; + estimateStakeTime: string; } ⋮---- -export type WSEventExecutionEventV5 = WSPrivateTopicEventV5< - 'execution' | 'execution.event', - WSEventExecutionV5[] ->; +export interface EarnPositionFreezeDetailV5 { + amount: string; + description: string; +} ⋮---- -export interface WSExecutionFastV5 { - category: CategoryV5; - symbol: string; - execId: string; - execPrice: string; - execQty: string; - orderId: string; - isMaker: boolean; - orderLinkId: string; - side: OrderSideV5; - execTime: string; - seq: number; - liquidity?: string; +export interface EarnPositionV5 { + coin: string; + productId: string; + amount: string; + totalPnl: string; + claimableYield: string; + id?: string; + status?: string; + orderId?: string; + estimateRedeemTime?: string; + estimateStakeTime?: string; + estimateInterestCalculationTime?: string; + settlementTime?: string; + autoReinvest?: string; + /** Redeemable amount */ + availableAmount: string; + freezeDetails: EarnPositionFreezeDetailV5[]; } ⋮---- -export type WSExecutionFastEventV5 = WSPrivateTopicEventV5< - 'execution.fast', - WSExecutionFastV5[] ->; +/** Redeemable amount */ ⋮---- -export interface WSCoinV5 { +export interface EarnYieldHistoryV5 { + productId: string; coin: string; - equity: string; - usdValue: string; - walletBalance: string; - free?: string; - locked: string; - spotHedgingQty: string; - borrowAmount: string; - availableToBorrow: string; - availableToWithdraw: string; - accruedInterest: string; - totalOrderIM: string; - totalPositionIM: string; - totalPositionMM: string; - unrealisedPnl: string; - cumRealisedPnl: string; - bonus: string; - collateralSwitch: boolean; - marginCollateral: boolean; - spotBorrow: string; - colRes?: string; + id: string; + amount: string; + yieldType: string; + distributionMode: string; + effectiveStakingAmount: string; + orderId: string; + status: 'Pending' | 'Success' | 'Fail'; + createdAt: string; } ⋮---- -export interface WSWalletV5 { - accountType: string; - accountLTV: string; - accountIMRate: string; - accountMMRate: string; - accountIMRateByMp: string; - accountMMRateByMp: string; - totalInitialMarginByMp: string; - totalMaintenanceMarginByMp: string; - totalEquity: string; - totalWalletBalance: string; - totalMarginBalance: string; - totalAvailableBalance: string; - totalPerpUPL: string; - totalInitialMargin: string; - totalMaintenanceMargin: string; - coin: WSCoinV5[]; +export interface EarnHourlyYieldHistoryV5 { + productId: string; + coin: string; + id: string; + amount: string; + effectiveStakingAmount: string; + status: 'Pending' | 'Success' | 'Fail'; + hourlyDate: string; + createdAt: string; } ⋮---- -export type WSWalletEventV5 = WSPrivateTopicEventV5<'wallet', WSWalletV5[]>; +export interface EarnAprHistoryPointV5 { + timestamp: string; + apr: string; +} ⋮---- -export interface WSGreeksV5 { +/** + * Advanced Earn — Dual Asset product (GET /v5/earn/advance/product). + */ +export interface AdvanceEarnDualAssetProductV5 { + category: string; + productId: string; baseCoin: string; - totalDelta: string; - totalGamma: string; - totalVega: string; - totalTheta: string; + quoteCoin: string; + expectReceiveAt: string; + duration: string; + status: 'Available' | 'NotAvailable'; + isVipProduct: boolean; + subscribeStartAt: string; + subscribeEndAt: string; + applyStartAt: string; + settlementTime: string; + minPurchaseQuoteAmount: string; + minPurchaseBaseAmount: string; + remainingAmountQuote: string; + remainingAmountBase: string; + orderPrecisionDigitalQuote: number; + orderPrecisionDigitalBase: number; } ⋮---- -export type WSGreeksEventV5 = WSPrivateTopicEventV5<'greeks', WSGreeksV5[]>; -⋮---- -export interface WSSpreadOrderV5 { - category: 'combination' | 'spot_leg' | 'future_leg'; - symbol: string; - parentOrderId: string; - orderId: string; - orderLinkId: string; - side: OrderSideV5; - orderStatus: OrderStatusV5; - cancelType: OrderCancelTypeV5; - rejectReason: OrderRejectReasonV5; - timeInForce: OrderTimeInForceV5; - price: string; - qty: string; - avgPrice: string; - leavesQty: string; - leavesValue: string; - cumExecQty: string; - cumExecValue: string; - cumExecFee: string; - orderType: OrderTypeV5; - isLeverage: string; - createdTime: string; - updatedTime: string; - feeCurrency: string; - createType: OrderCreateTypeV5; - closedPnl: string; - cumFeeDetail?: Record; // Cumulative trading fee details instead of cumExecFee and feeCurrency +export interface AdvanceEarnDualAssetProductInfoV5 { + category: string; + list: AdvanceEarnDualAssetProductV5[]; } ⋮---- -cumFeeDetail?: Record; // Cumulative trading fee details instead of cumExecFee and feeCurrency -⋮---- -export type WSSpreadOrderEventV5 = WSPrivateTopicEventV5< - 'spread.order', - WSSpreadOrderV5[] ->; -⋮---- -export interface WSSpreadExecutionV5 { - category: 'combination' | 'spot_leg' | 'future_leg'; - symbol: string; - isLeverage: string; - orderId: string; - orderLinkId: string; - side: OrderSideV5; - orderPrice: string; - orderQty: string; - leavesQty: string; - createType: OrderCreateTypeV5; - orderType: OrderTypeV5; - execFee: string; - execFeeV2: string; - feeCurrency: string; // Trading fee currency - parentExecId: string; - execId: string; - execPrice: string; - execQty: string; - execPnl: string; - execType: ExecTypeV5; - execValue: string; - execTime: string; - isMaker: boolean; - feeRate: string; - markPrice: string; - closedSize: string; - seq: number; +/** + * Advanced Earn — Double Win (GET /v5/earn/advance/product?category=DoubleWin). + */ +export interface AdvanceEarnDoubleWinProductV5 { + category: string; + productId: string; + investCoin: string; + underlyingAsset: string; + duration: string; + subscribeStartAt: string; + subscribeEndAt: string; + settlementTime: string; + expectReceiveAt: string; + minPurchaseAmount: string; + orderPrecisionDigital: number; + isRfqProduct: boolean; + lowerPriceBuffer: string; + upperPriceBuffer: string; + minDeviationRatio: string; + maxDeviationRatio: string; + priceTickSize: string; } ⋮---- -feeCurrency: string; // Trading fee currency -⋮---- -export type WSSpreadExecutionEventV5 = WSPrivateTopicEventV5< - 'spread.execution', - WSSpreadExecutionV5[] ->; +/** + * Advanced Earn — Smart Leverage (GET /v5/earn/advance/product?category=SmartLeverage). + */ +export interface AdvanceEarnSmartLeverageProductV5 { + category: string; + productId: string; + investCoin: string; + underlyingAsset: string; + direction: 'Long' | 'Short'; + leverage: string; + duration: string; + subscribeStartAt: string; + subscribeEndAt: string; + settlementTime: string; + expectReceiveAt: string; + minPurchaseAmount: string; + remainingAmount: string; + orderPrecisionDigital: number; +} ⋮---- -export interface WSInsuranceV5 { +/** + * Advanced Earn — Discount Buy (GET /v5/earn/advance/product?category=DiscountBuy). + */ +export interface AdvanceEarnDiscountBuyProductV5 { + category: string; + productId: string; coin: string; - symbols: string; - balance: string; - updateTime: string; + underlyingAsset: string; + settlementTime: string; + duration: string; + isVipProduct: boolean; + subscribeStartAt: string; + subscribeEndAt: string; + minPurchaseAmount: string; + remainingAmount: string; + orderPrecisionDigital: number; + expectReceiveAt: string; } ⋮---- -export type WSInsuranceEventV5 = WSPublicTopicEventV5< - 'insurance.USDT' | 'insurance.USDC' | 'insurance.inverse', - 'snapshot' | 'delta', - WSInsuranceV5[] ->; +export type AdvanceEarnAdvanceProductListItemV5 = + | AdvanceEarnDualAssetProductV5 + | AdvanceEarnDoubleWinProductV5 + | AdvanceEarnSmartLeverageProductV5 + | AdvanceEarnDiscountBuyProductV5; ⋮---- -export interface WSPriceLimitV5 { - symbol: string; - buyLmt: string; - sellLmt: string; +export interface AdvanceEarnAdvanceProductInfoV5 { + category: string; + list: AdvanceEarnAdvanceProductListItemV5[]; } ⋮---- -export type WSPriceLimitEventV5 = WSPublicTopicEventV5< - string, - 'snapshot', - WSPriceLimitV5 ->; +/** GET /v5/earn/hold-to-earn/product — Hold to Earn airdrop products */ +export type HoldToEarnAirdropProductStatusV5 = + | 'NotStarted' + | 'Online' + | 'Ended'; ⋮---- -export interface WSADLAlertV5 { - c: string; // Token of the insurance pool - s: string; // Trading pair name - b: string; // Balance of the insurance fund. For shared insurance pool, follows T+1 refresh (updated daily at 00:00 UTC) - mb: string; // Deprecated: always returns empty string. Previously: Maximum balance of the insurance pool in the last 8 hours - i_pr: string; // PnL ratio threshold for triggering contract PnL drawdown ADL - pr: string; // Symbol's PnL drawdown ratio in the last 8 hours. Used to determine whether ADL is triggered or stopped - adl_tt: string; // Trigger threshold for contract PnL drawdown ADL - adl_sr: string; // Stop ratio threshold for contract PnL drawdown ADL +export interface HoldToEarnAirdropProductYieldV5 { + coinName: string; + /** Yesterday's APR for display, e.g. "10%", "0%" */ + apy: string; + personalApy?: string; + multiplier?: string; } ⋮---- -c: string; // Token of the insurance pool -s: string; // Trading pair name -b: string; // Balance of the insurance fund. For shared insurance pool, follows T+1 refresh (updated daily at 00:00 UTC) -mb: string; // Deprecated: always returns empty string. Previously: Maximum balance of the insurance pool in the last 8 hours -i_pr: string; // PnL ratio threshold for triggering contract PnL drawdown ADL -pr: string; // Symbol's PnL drawdown ratio in the last 8 hours. Used to determine whether ADL is triggered or stopped -adl_tt: string; // Trigger threshold for contract PnL drawdown ADL -adl_sr: string; // Stop ratio threshold for contract PnL drawdown ADL +/** Yesterday's APR for display, e.g. "10%", "0%" */ ⋮---- -export type WSADLAlertEventV5 = WSPublicTopicEventV5< - 'adlAlert.USDT' | 'adlAlert.USDC' | 'adlAlert.inverse', - 'snapshot', - WSADLAlertV5[] ->; +export interface HoldToEarnAirdropProductV5 { + coinName: string; + yields: HoldToEarnAirdropProductYieldV5[]; + status: HoldToEarnAirdropProductStatusV5; + announcementUrl: string; + /** Yesterday's avg APR across yield coins */ + apy: string; + personalApy?: string; +} ⋮---- -export type WSSystemStatusEventV5 = WSPublicTopicEventV5< - 'system.status', - 'snapshot', - SystemStatusItemV5[] ->; +/** Yesterday's avg APR across yield coins */ ⋮---- -/** - * RFQ WebSocket Events - */ +export interface HoldToEarnAirdropProductsResultV5 { + products: HoldToEarnAirdropProductV5[]; +} ⋮---- -/** - * RFQ Inquiry Channel - * Private push for RFQ inquiries sent or received by the user - * Topics: rfq.open.rfqs, rfq.site.rfqs - */ -export type WSRFQInquiryEventV5 = WSPrivateTopicEventV5< - 'rfq.open.rfqs' | 'rfq.site.rfqs', - RFQItemV5[] ->; +/** GET /v5/earn/hold-to-earn/yield-history */ +export interface HoldToEarnAirdropDailyPnlV5 { + coinName: string; + yieldCoinName: string; + effectiveAmount: string; + pnl: string; + apy: string; + createdAt: number; +} ⋮---- -/** - * RFQ Quote Channel - * Private push for quotes sent or received by the user - * Topics: rfq.open.quotes, rfq.site.quotes - */ -export type WSRFQQuoteEventV5 = WSPrivateTopicEventV5< - 'rfq.open.quotes' | 'rfq.site.quotes', - RFQQuoteItemV5[] ->; +export interface HoldToEarnAirdropYieldHistoryResultV5 { + nextCursor: string; + airdropDailyPnls: HoldToEarnAirdropDailyPnlV5[]; +} + +================ +File: src/types/response/v5-market.ts +================ +import { + CategoryCursorListV5, + CategoryV5, + ContractTypeV5, + CopyTradingV5, + InstrumentStatusV5, + InstrumentSymbolTypeV5, + MarginTradingV5, + OptionTypeV5, + OrderSideV5, +} from '../shared-v5'; ⋮---- /** - * RFQ Trade Channel - * Private push for block trades executed by the user - * Topics: rfq.open.trades, rfq.site.trades + * OHLCVT candle used by v5 APIs + * + * - list[0]: startTime string Start time of the candle (ms) + * - list[1]: openPrice string Open price + * - list[2]: highPrice string Highest price + * - list[3]: lowPrice string Lowest price + * - list[4]: closePrice string Close price. Is the last traded price when the candle is not closed + * - list[5]: volume string Trade volume. Unit of contract: pieces of contract. Unit of spot: quantity of coins + * - list[6]: turnover string Turnover. Unit of figure: quantity of quota coin */ -export type WSRFQTradeEventV5 = WSPrivateTopicEventV5< - 'rfq.open.trades' | 'rfq.site.trades', - RFQTradeV5[] ->; +export type OHLCVKlineV5 = [ + string, + string, + string, + string, + string, + string, + string, +]; ⋮---- /** - * RFQ Public Trade Channel - * Public push for all block trades - * Topics: rfq.open.public.trades, rfq.site.public.trades + * OHLC candle used by v5 APIs + * + * - list[0]: startTime string Start time of the candle (ms) + * - list[1]: openPrice string Open price + * - list[2]: highPrice string Highest price + * - list[3]: lowPrice string Lowest price + * - list[4]: closePrice string Close price. Is the last traded price when the candle is not closed */ -export type WSRFQPublicTradeEventV5 = WSPublicTopicEventV5< - 'rfq.open.public.trades' | 'rfq.site.public.trades', - 'snapshot', - RFQPublicTradeV5[] ->; - -================ -File: src/types/shared-v5.ts -================ -export type CategoryV5 = 'spot' | 'linear' | 'inverse' | 'option'; -/** Public WS subscribe/routing category. Event Contract uses `'event'`; REST `CategoryV5` does not. */ -export type WSCategoryV5 = CategoryV5 | 'event'; -export type ContractTypeV5 = - | 'InversePerpetual' - | 'LinearPerpetual' - | 'InverseFutures'; -export type CopyTradingV5 = 'none' | 'both' | 'utaOnly' | 'normalOnly'; +export type OHLCKlineV5 = [string, string, string, string, string]; ⋮---- -export type InstrumentStatusV5 = - | 'PreLaunch' - | 'PendingOpen' - | 'Trading' - | 'Settling' - | 'Delivering' - | 'Closed'; +export interface LinearInverseInstrumentInfoV5 { + /** The ID of the symbol name. */ + symbolId: number; + symbol: string; + contractType: ContractTypeV5; + status: InstrumentStatusV5; + baseCoin: string; + quoteCoin: string; + /** Region / product class for the pair (`stock`, `forex`, `commodity`, `xstocks`, etc.). */ + symbolType: InstrumentSymbolTypeV5; + launchTime: string; + deliveryTime?: string; + deliveryFeeRate?: string; + priceScale: string; + leverageFilter: { + minLeverage: string; + maxLeverage: string; + leverageStep: string; + }; + priceFilter: { + minPrice: string; + maxPrice: string; + tickSize: string; + }; + lotSizeFilter: { + maxOrderQty: string; + maxMktOrderQty: string; + minOrderQty: string; + qtyStep: string; + postOnlyMaxOrderQty?: string; + minNotionalValue?: string; + }; + unifiedMarginTrade: boolean; + fundingInterval: number; + settleCoin: string; + copyTrading: CopyTradingV5; + upperFundingRate: string; + lowerFundingRate: string; + riskParameters: { + priceLimitRatioX: string; + priceLimitRatioY: string; + }; + isPreListing: boolean; + preListingInfo: { + curAuctionPhase: string; + phases: { + phase: string; + startTime: string; + endTime: string; + }[]; + auctionFeeInfo: { + auctionFeeRate: string; + takerFeeRate: string; + makerFeeRate: string; + }; + } | null; + skipCallAuction?: boolean; // For USDT pre-market contract + displayName: string; + fullName?: string; + marketRegion?: string; + underlyingTicker?: string; + /** Symbol tags such as `ST`. Linear and inverse only. */ + tags?: string[]; +} ⋮---- -/** - * Region / product class returned as `symbolType` on instruments-info (and account instruments-info). - * For `category=linear`, includes e.g. `stock`, `forex`, `commodity`, `xstocks`. Spot may return `''`. - */ -export type InstrumentSymbolTypeV5 = - | '' - | 'stock' - | 'forex' - | 'commodity' - | 'xstocks'; +/** The ID of the symbol name. */ ⋮---- -export type MarginTradingV5 = 'none' | 'both' | 'utaOnly' | 'normalSpotOnly'; +/** Region / product class for the pair (`stock`, `forex`, `commodity`, `xstocks`, etc.). */ ⋮---- -/** Product type for strategy APIs (create / list). */ -export type StrategyCategoryV5 = - | 'UTA_USDT' - | 'UTA_USDC' - | 'UTA_USDC_FUTURE' - | 'UTA_SPOT' - | 'UTA_INVERSE' - | 'UTA_INVERSE_FUTURE' - | 'UTA_USDT_FUTURE'; +skipCallAuction?: boolean; // For USDT pre-market contract ⋮---- -export type StrategyTypeV5 = 'twap' | 'chaseOrder' | 'iceberg' | 'pov'; +/** Symbol tags such as `ST`. Linear and inverse only. */ ⋮---- -export type StrategyPreferV5 = - | 'limit' - | 'priceSpeedBalance' - | 'fastestExecution' - | 'quickExecution'; +export interface OptionInstrumentInfoV5 { + /** The ID of the symbol name. */ + symbolId: number; + symbol: string; + optionsType: OptionTypeV5; + status: InstrumentStatusV5; + baseCoin: string; + quoteCoin: string; + settleCoin: string; + symbolType: InstrumentSymbolTypeV5; + launchTime: string; + deliveryTime: string; + deliveryFeeRate: string; + priceFilter: { + minPrice: string; + maxPrice: string; + tickSize: string; + }; + lotSizeFilter: { + maxOrderQty: string; + minOrderQty: string; + qtyStep: string; + }; + displayName: string; +} ⋮---- -/** POV strategy execution mode */ -export type PovModeV5 = - | 'TradedVolume' - | 'OppositeSideLiquidity' - | 'SameSideLiquidity'; +/** The ID of the symbol name. */ ⋮---- -export type OrderFilterV5 = 'Order' | 'tpslOrder' | 'StopOrder'; -export type OrderSideV5 = 'Buy' | 'Sell'; -export type OrderTypeV5 = 'Market' | 'Limit'; -export type OrderTimeInForceV5 = 'GTC' | 'IOC' | 'FOK' | 'PostOnly' | 'RPI'; -export type OrderTriggerByV5 = 'LastPrice' | 'IndexPrice' | 'MarkPrice'; -export type OCOTriggerTypeV5 = - | 'OcoTriggerByUnknown' - | 'OcoTriggerTp' - | 'OcoTriggerBySl'; +export interface SpotInstrumentInfoV5 { + /** The ID of the symbol name. */ + symbolId: number; + symbol: string; + baseCoin: string; + quoteCoin: string; + /** + * Xstock multiplier for `symbolType` = xstocks pairs. `stock_price = token_price / multiplier`, + * `stock_qty = token_qty * multiplier`. Default `"1"`. + */ + xstockMultiplier?: string; + symbolType: InstrumentSymbolTypeV5; + innovation: '0' | '1'; // Deprecated, always 0 + status: InstrumentStatusV5; + marginTrading: MarginTradingV5; + stTag: '0' | '1'; + lotSizeFilter: { + basePrecision: string; + quotePrecision: string; + minOrderQty: string; + maxOrderQty: string; + minOrderAmt: string; + maxOrderAmt: string; + maxLimitOrderQty: string; + maxMarketOrderQty: string; + postOnlyMaxLimitOrderSize: string; + }; + priceFilter: { + tickSize: string; + }; + riskParameters: { + priceLimitRatioX: string; + priceLimitRatioY: string; + }; + forbidUplWithdrawal: boolean; +} ⋮---- -export type OrderSMPTypeV5 = - | 'None' - | 'CancelMaker' - | 'CancelTaker' - | 'CancelBoth'; +/** The ID of the symbol name. */ ⋮---- -export type OrderStatusV5 = - | 'Created' - | 'New' - | 'Rejected' - | 'PartiallyFilled' - | 'PartiallyFilledCanceled' - | 'Filled' - | 'Cancelled' - | 'Untriggered' - | 'Triggered' - | 'Deactivated' - | 'Active'; +/** + * Xstock multiplier for `symbolType` = xstocks pairs. `stock_price = token_price / multiplier`, + * `stock_qty = token_qty * multiplier`. Default `"1"`. + */ +⋮---- +innovation: '0' | '1'; // Deprecated, always 0 +⋮---- +type InstrumentInfoV5Mapping = { + linear: LinearInverseInstrumentInfoV5[]; + inverse: LinearInverseInstrumentInfoV5[]; + option: OptionInstrumentInfoV5[]; + spot: SpotInstrumentInfoV5[]; +}; +⋮---- +export type InstrumentInfoResponseV5 = + CategoryCursorListV5; +⋮---- +// Account Instruments Info (includes RPI permissions) +export interface AccountSpotInstrumentInfoV5 extends SpotInstrumentInfoV5 { + isPublicRpi: boolean; + myRpiPermission: boolean; +} +⋮---- +export interface AccountLinearInverseInstrumentInfoV5 + extends LinearInverseInstrumentInfoV5 { + isPublicRpi: boolean; + myRpiPermission: boolean; +} +⋮---- +type AccountInstrumentInfoV5Mapping = { + linear: AccountLinearInverseInstrumentInfoV5[]; + inverse: AccountLinearInverseInstrumentInfoV5[]; + spot: AccountSpotInstrumentInfoV5[]; +}; +⋮---- +export type AccountInstrumentInfoResponseV5< + C extends 'spot' | 'linear' | 'inverse', +> = CategoryCursorListV5; ⋮---- /** - * Defines the types of order creation mechanisms. + * [price, size] */ -export type OrderCreateTypeV5 = - /** Represents an order created by a user. */ - | 'CreateByUser' - /** Represents an order created by an admin closing. */ - | 'CreateByAdminClosing' - /** Futures conditional order. */ - | 'CreateByStopOrder' - /** Futures take profit order. */ - | 'CreateByTakeProfit' - /** Futures partial take profit order. */ - | 'CreateByPartialTakeProfit' - /** Futures stop loss order. */ - | 'CreateByStopLoss' - /** Futures partial stop loss order. */ - | 'CreateByPartialStopLoss' - /** Futures trailing stop order. */ - | 'CreateByTrailingStop' - /** Laddered liquidation to reduce the required maintenance margin. */ - | 'CreateByLiq' - /** - * If the position is still subject to liquidation (i.e., does not meet the required maintenance margin level), - * the position shall be taken over by the liquidation engine and closed at the bankruptcy price. - */ - | 'CreateByTakeOver_PassThrough' - /** Auto-Deleveraging(ADL) */ - | 'CreateByAdl_PassThrough' - /** Order placed via Paradigm. */ - | 'CreateByBlock_PassThrough' - /** Order created by move position. */ - | 'CreateByBlockTradeMovePosition_PassThrough' - /** The close order placed via web or app position area - web/app. */ - | 'CreateByClosing' - /** Order created via grid bot - web/app. */ - | 'CreateByFGridBot' - /** Order closed via grid bot - web/app. */ - | 'CloseByFGridBot' - /** Order created by TWAP - web/app. */ - | 'CreateByTWAP' - /** Order created by TV webhook - web/app. */ - | 'CreateByTVSignal' - /** Order created by Mm rate close function - web/app. */ - | 'CreateByMmRateClose' - /** Order created by Martingale bot - web/app. */ - | 'CreateByMartingaleBot' - /** Order closed by Martingale bot - web/app. */ - | 'CloseByMartingaleBot' - /** Order created by Ice berg strategy - web/app. */ - | 'CreateByIceBerg' - /** Order created by arbitrage - web/app. */ - | 'CreateByArbitrage' - /** Option dynamic delta hedge order - web/app */ - | 'CreateByDdh' - /** BBO Order - Best Bid/Offer order */ - | 'CreateByBboOrder'; +export type OrderbookLevelV5 = [string, string]; ⋮---- -/** Represents an order created by a user. */ +export interface OrderbookResponseV5 { + s: string; + b: OrderbookLevelV5[]; + a: OrderbookLevelV5[]; + ts: number; + u: number; + seq: number; + cts: number; +} ⋮---- -/** Represents an order created by an admin closing. */ +/** + * RPI Orderbook level: [price, nonRpiSize, rpiSize] + */ +export type RPIOrderbookLevelV5 = [string, string, string]; ⋮---- -/** Futures conditional order. */ +export interface RPIOrderbookResponseV5 { + s: string; // Symbol name + b: RPIOrderbookLevelV5[]; // Bids. Sorted by price in descending order + a: RPIOrderbookLevelV5[]; // Asks. Sorted by price in ascending order + ts: number; // The timestamp (ms) that the system generates the data + u: number; // Update ID, is always in sequence corresponds to u in the 50-level WebSocket RPI orderbook stream + seq: number; // Cross sequence + cts: number; // The timestamp from the matching engine when this orderbook data is produced +} ⋮---- -/** Futures take profit order. */ +s: string; // Symbol name +b: RPIOrderbookLevelV5[]; // Bids. Sorted by price in descending order +a: RPIOrderbookLevelV5[]; // Asks. Sorted by price in ascending order +ts: number; // The timestamp (ms) that the system generates the data +u: number; // Update ID, is always in sequence corresponds to u in the 50-level WebSocket RPI orderbook stream +seq: number; // Cross sequence +cts: number; // The timestamp from the matching engine when this orderbook data is produced ⋮---- -/** Futures partial take profit order. */ +export interface TickerLinearInverseV5 { + symbol: string; + lastPrice: string; + indexPrice: string; + markPrice: string; + prevPrice24h: string; + price24hPcnt: string; + highPrice24h: string; + lowPrice24h: string; + prevPrice1h: string; + openInterest: string; + openInterestValue: string; + singleOpenInterest?: string; + singleOpenInterestValue?: string; + turnover24h: string; + volume24h: string; + fundingRate: string; + nextFundingTime: string; + predictedDeliveryPrice: string; + basisRate: string; + basisRateYear: string; + fundingIntervalHour: string; + fundingCap: string; + deliveryFeeRate: string; + deliveryTime: string; + ask1Size: string; + bid1Price: string; + ask1Price: string; + bid1Size: string; + preOpenPrice: string; + preQty: string; + curPreListingPhase: string; + basis: string; +} ⋮---- -/** Futures stop loss order. */ +export interface TickerOptionV5 { + symbol: string; + bid1Price: string; + bid1Size: string; + bid1Iv: string; + ask1Price: string; + ask1Size: string; + ask1Iv: string; + lastPrice: string; + highPrice24h: string; + lowPrice24h: string; + markPrice: string; + indexPrice: string; + markIv: string; + underlyingPrice: string; + openInterest: string; + turnover24h: string; + volume24h: string; + totalVolume: string; + totalTurnover: string; + delta: string; + gamma: string; + vega: string; + theta: string; + predictedDeliveryPrice: string; + change24h: string; +} ⋮---- -/** Futures partial stop loss order. */ +export interface TickerSpotV5 { + symbol: string; + bid1Price: string; + bid1Size: string; + ask1Price: string; + ask1Size: string; + lastPrice: string; + prevPrice24h: string; + price24hPcnt: string; + highPrice24h: string; + lowPrice24h: string; + turnover24h: string; + volume24h: string; + usdIndexPrice: string; +} ⋮---- -/** Futures trailing stop order. */ +export interface FundingRateHistoryResponseV5 { + symbol: string; + fundingRate: string; + fundingRateTimestamp: string; +} ⋮---- -/** Laddered liquidation to reduce the required maintenance margin. */ +export interface PublicTradeV5 { + execId: string; + symbol: string; + price: string; + size: string; + side: OrderSideV5; + time: string; + isBlockTrade: boolean; + isRPITrade: boolean; + mP?: string; + iP?: string; + mIv?: string; + iv?: string; + seq?: string; +} ⋮---- /** - * If the position is still subject to liquidation (i.e., does not meet the required maintenance margin level), - * the position shall be taken over by the liquidation engine and closed at the bankruptcy price. - */ + * + * - openInterest string Open interest + * - timestamp string The timestamp (ms) + */ +export type OpenInterestV5 = { + openInterest: string; + singleOpenInterest?: string; + timestamp: string; +}; ⋮---- -/** Auto-Deleveraging(ADL) */ +export interface OpenInterestResponseV5 { + category: 'linear' | 'inverse'; + symbol: string; + list: OpenInterestV5[]; + nextPageCursor?: string; +} ⋮---- -/** Order placed via Paradigm. */ +export interface HistoricalVolatilityV5 { + period: number; + value: string; + time: string; +} ⋮---- -/** Order created by move position. */ +export interface InsuranceDataV5 { + coin: string; + symbols: string; + balance: string; + value: string; +} ⋮---- -/** The close order placed via web or app position area - web/app. */ +export interface InsuranceResponseV5 { + updatedTime: string; + list: InsuranceDataV5[]; +} ⋮---- -/** Order created via grid bot - web/app. */ +export interface RiskLimitV5 { + id: number; + symbol: string; + riskLimitValue: string; + maintenanceMargin: number; + initialMargin: number; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + section: any; + isLowestRisk: 0 | 1; + maxLeverage: string; + mmDeduction: string; + nextPageCursor?: string; +} ⋮---- -/** Order closed via grid bot - web/app. */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any ⋮---- -/** Order created by TWAP - web/app. */ +/** @deprecated use DeliveryPriceV5 instead */ +export interface OptionDeliveryPriceV5 { + symbol: string; + deliveryPrice: string; + deliveryTime: string; +} ⋮---- -/** Order created by TV webhook - web/app. */ +export interface DeliveryPriceV5 { + symbol: string; + deliveryPrice: string; + deliveryTime: string; +} ⋮---- -/** Order created by Mm rate close function - web/app. */ +export interface LongShortRatioV5 { + symbol: string; + buyRatio: string; + sellRatio: string; + timestamp: string; +} ⋮---- -/** Order created by Martingale bot - web/app. */ +export interface OrderPriceLimitV5 { + symbol: string; + buyLmt: string; + sellLmt: string; + ts: string; +} ⋮---- -/** Order closed by Martingale bot - web/app. */ +export interface IndexPriceComponentV5 { + exchange: string; // Name of the exchange + spotPair: string; // Spot trading pair on the exchange (e.g., BTCUSDT) + equivalentPrice: string; // Equivalent price + multiplier: string; // Multiplier used for the component price + price: string; // Actual price + weight: string; // Weight in the index calculation +} ⋮---- -/** Order created by Ice berg strategy - web/app. */ +exchange: string; // Name of the exchange +spotPair: string; // Spot trading pair on the exchange (e.g., BTCUSDT) +equivalentPrice: string; // Equivalent price +multiplier: string; // Multiplier used for the component price +price: string; // Actual price +weight: string; // Weight in the index calculation ⋮---- -/** Order created by arbitrage - web/app. */ +export interface IndexPriceComponentsResponseV5 { + indexName: string; // Name of the index (e.g., BTCUSDT) + lastPrice: string; // Last price of the index + updateTime: string; // Timestamp of the last update in milliseconds + components: IndexPriceComponentV5[]; // List of components contributing to the index price +} ⋮---- -/** Option dynamic delta hedge order - web/app */ +indexName: string; // Name of the index (e.g., BTCUSDT) +lastPrice: string; // Last price of the index +updateTime: string; // Timestamp of the last update in milliseconds +components: IndexPriceComponentV5[]; // List of components contributing to the index price ⋮---- -/** BBO Order - Best Bid/Offer order */ +export interface ADLAlertItemV5 { + coin: string; // Token of the insurance pool + symbol: string; // Trading pair name + balance: string; // Balance of the insurance fund. Used to determine if ADL is triggered + maxBalance: string; // Maximum balance of the insurance pool in the last 8 hours + insurancePnlRatio: string; // PnL ratio threshold for triggering contract PnL drawdown ADL + pnlRatio: string; // Symbol's PnL drawdown ratio in the last 8 hours. Used to determine whether ADL is triggered or stopped + adlTriggerThreshold: string; // Trigger threshold for contract PnL drawdown ADL + adlStopRatio: string; // Stop ratio threshold for contract PnL drawdown ADL +} ⋮---- -export type OrderCancelTypeV5 = - | 'CancelByUser' - | 'CancelByReduceOnly' - | 'CancelByPrepareLiq' - | 'CancelAllBeforeLiq' - | 'CancelByPrepareAdl' - | 'CancelAllBeforeAdl' - | 'CancelByAdmin' - | 'CancelByTpSlTsClear' - | 'CancelByPzSideCh' - | 'UNKNOWN'; +coin: string; // Token of the insurance pool +symbol: string; // Trading pair name +balance: string; // Balance of the insurance fund. Used to determine if ADL is triggered +maxBalance: string; // Maximum balance of the insurance pool in the last 8 hours +insurancePnlRatio: string; // PnL ratio threshold for triggering contract PnL drawdown ADL +pnlRatio: string; // Symbol's PnL drawdown ratio in the last 8 hours. Used to determine whether ADL is triggered or stopped +adlTriggerThreshold: string; // Trigger threshold for contract PnL drawdown ADL +adlStopRatio: string; // Stop ratio threshold for contract PnL drawdown ADL ⋮---- -export type OrderRejectReasonV5 = - | 'EC_NoError' - | 'EC_Others' - | 'EC_UnknownMessageType' - | 'EC_MissingClOrdID' - | 'EC_MissingOrigClOrdID' - | 'EC_ClOrdIDOrigClOrdIDAreTheSame' - | 'EC_DuplicatedClOrdID' - | 'EC_OrigClOrdIDDoesNotExist' - | 'EC_TooLateToCancel' - | 'EC_UnknownOrderType' - | 'EC_UnknownSide' - | 'EC_UnknownTimeInForce' - | 'EC_WronglyRouted' - | 'EC_MarketOrderPriceIsNotZero' - | 'EC_LimitOrderInvalidPrice' - | 'EC_NoEnoughQtyToFill' - | 'EC_NoImmediateQtyToFill' - | 'EC_PerCancelRequest' - | 'EC_MarketOrderCannotBePostOnly' - | 'EC_PostOnlyWillTakeLiquidity' - | 'EC_CancelReplaceOrder' - | 'EC_InvalidSymbolStatus'; +export interface ADLAlertResponseV5 { + updateTime: string; // Latest data update timestamp (ms) + list: ADLAlertItemV5[]; // List of ADL alert items +} ⋮---- -export type StopOrderTypeV5 = - | 'TakeProfit' - | 'StopLoss' - | 'TrailingStop' - | 'Stop' - | 'PartialTakeProfit' - | 'PartialStopLoss' - | 'tpslOrder' - | 'OcoOrder' - | 'MmRateClose' - | 'BidirectionalTpslOrder'; +updateTime: string; // Latest data update timestamp (ms) +list: ADLAlertItemV5[]; // List of ADL alert items ⋮---- -/** - * Position index. Used to identify positions in different position modes. - * - * - 0 one-way mode position - * - 1 Buy side of hedge-mode position - * - 2 Sell side of hedge-mode position - */ -export type PositionIdx = 0 | 1 | 2; +export interface FeeGroupLevelV5 { + level: string; // Pro level name or Market Maker level name + takerFeeRate: string; // Taker fee rate + makerFeeRate: string; // Maker fee rate + makerRebate: string; // Maker rebate fee rate + rpiMakerRebate?: string; +} ⋮---- -/** - * Position status. - * - * - 'Normal' - * - 'Liq' in the liquidation progress - * - 'Adl' in the auto-deleverage progress - */ -export type PositionStatusV5 = 'Normal' | 'Liq' | 'Adl'; -export type PositionSideV5 = 'Buy' | 'Sell' | 'None' | ''; +level: string; // Pro level name or Market Maker level name +takerFeeRate: string; // Taker fee rate +makerFeeRate: string; // Maker fee rate +makerRebate: string; // Maker rebate fee rate ⋮---- -export type OptionTypeV5 = 'Call' | 'Put'; +export interface FeeGroupRatesV5 { + pro: FeeGroupLevelV5[]; // Pro-level fee structures + marketMaker: FeeGroupLevelV5[]; // Market Maker-level fee structures +} ⋮---- -/** - * Trade mode. - * - * - 0 cross-margin, - * - 1 isolated margin - */ -export type TradeModeV5 = 0 | 1; +pro: FeeGroupLevelV5[]; // Pro-level fee structures +marketMaker: FeeGroupLevelV5[]; // Market Maker-level fee structures ⋮---- -export type TPSLModeV5 = 'Full' | 'Partial'; -export type AccountMarginModeV5 = - | 'ISOLATED_MARGIN' - | 'REGULAR_MARGIN' - | 'PORTFOLIO_MARGIN'; -export type UnifiedUpdateStatusV5 = 'FAIL' | 'PROCESS' | 'SUCCESS'; +export interface FeeGroupItemV5 { + groupName: string; // Fee group name + weightingFactor: number; // Group weighting factor + symbolsNumbers: number; // Symbols number + symbols: string[]; // Symbol names + feeRates: FeeGroupRatesV5; // Fee rate details for different categories + updateTime: string; // Latest data update timestamp (ms) +} ⋮---- -export type AccountTypeV5 = - | 'CONTRACT' - | 'SPOT' - | 'INVESTMENT' - | 'OPTION' - | 'UNIFIED' - | 'FUND' - | 'EARN'; +groupName: string; // Fee group name +weightingFactor: number; // Group weighting factor +symbolsNumbers: number; // Symbols number +symbols: string[]; // Symbol names +feeRates: FeeGroupRatesV5; // Fee rate details for different categories +updateTime: string; // Latest data update timestamp (ms) ⋮---- -export type TransactionTypeV5 = - | 'TRANSFER_IN' - | 'TRANSFER_OUT' - | 'TRADE' - | 'SETTLEMENT' - | 'DELIVERY' - | 'LIQUIDATION' - | 'ADL' - | 'AIRDROP' - | 'BONUS_RECOLLECT' - | 'BONUS_RECOLLECT' - | 'FEE_REFUND' - | 'INTEREST' - | 'CURRENCY_BUY' - | 'CURRENCY_SELL' - | 'BORROWED_AMOUNT_INS_LOAN' - | 'PRINCIPLE_REPAYMENT_INS_LOAN' - | 'INTEREST_REPAYMENT_INS_LOAN' - | 'AUTO_SOLD_COLLATERAL_INS_LOAN' - | 'AUTO_BUY_LIABILITY_INS_LOAN' - | 'AUTO_PRINCIPLE_REPAYMENT_INS_LOAN' - | 'AUTO_INTEREST_REPAYMENT_INS_LOAN' - | 'TRANSFER_IN_INS_LOAN' - | 'TRANSFER_OUT_INS_LOAN' - | 'SPOT_REPAYMENT_SELL' - | 'SPOT_REPAYMENT_BUY' - | 'TOKENS_SUBSCRIPTION' - | 'TOKENS_REDEMPTION' - | 'AUTO_DEDUCTION' - | 'FLEXIBLE_STAKING_SUBSCRIPTION' - | 'FLEXIBLE_STAKING_REDEMPTION' - | 'FIXED_STAKING_SUBSCRIPTION' - | 'BORROWED_AMOUNT_INS_LOAN' - | 'PRINCIPLE_REPAYMENT_INS_LOAN' - | 'INTEREST_REPAYMENT_INS_LOAN' - | 'AUTO_SOLD_COLLATERAL_INS_LOAN' - | 'AUTO_BUY_LIABILITY_INS_LOAN' - | 'AUTO_PRINCIPLE_REPAYMENT_INS_LOAN' - | 'AUTO_INTEREST_REPAYMENT_INS_LOAN' - | 'TRANSFER_IN_INS_LOAN' - | 'TRANSFER_OUT_INS_LOAN' - | 'SPOT_REPAYMENT_SELL' - | 'SPOT_REPAYMENT_BUY' - | 'TOKENS_SUBSCRIPTION' - | 'TOKENS_REDEMPTION' - | 'AUTO_DEDUCTION' - | 'FLEXIBLE_STAKING_SUBSCRIPTION' - | 'FLEXIBLE_STAKING_REDEMPTION' - | 'FIXED_STAKING_SUBSCRIPTION' - | 'FLEXIBLE_STAKING_REFUND' - | 'FIXED_STAKING_REFUND' - | 'PREMARKET_TRANSFER_OUT' - | 'PREMARKET_DELIVERY_SELL_NEW_COIN' - | 'PREMARKET_DELIVERY_BUY_NEW_COIN' - | 'PREMARKET_DELIVERY_PLEDGE_PAY_SELLER' - | 'PREMARKET_DELIVERY_PLEDGE_BACK' - | 'PREMARKET_ROLLBACK_PLEDGE_BACK' - | 'PREMARKET_ROLLBACK_PLEDGE_PENALTY_TO_BUYER' - | 'CUSTODY_NETWORK_FEE' - | 'CUSTODY_SETTLE_FEE' - | 'CUSTODY_LOCK' - | 'CUSTODY_UNLOCK' - | 'CUSTODY_UNLOCK_REFUND' - | 'LOANS_BORROW_FUNDS' - | 'LOANS_PLEDGE_ASSET' - | 'BONUS_TRANSFER_IN' - | 'BONUS_TRANSFER_OUT' - | 'PEF_TRANSFER_IN' - | 'PEF_TRANSFER_OUT' - | 'PEF_PROFIT_SHARE' - | 'ONCHAINEARN_SUBSCRIPTION' - | 'ONCHAINEARN_REDEMPTION' - | 'ONCHAINEARN_REFUND' - | 'STRUCTURE_PRODUCT_SUBSCRIPTION' - | 'STRUCTURE_PRODUCT_REFUND' - | 'CLASSIC_WEALTH_MANAGEMENT_SUBSCRIPTION' - | 'PREMIMUM_WEALTH_MANAGEMENT_SUBSCRIPTION' - | 'PREMIMUM_WEALTH_MANAGEMENT_REFUND' - | 'LIQUIDITY_MINING_SUBSCRIPTION' - | 'LIQUIDITY_MINING_REFUND' - | 'PWM_SUBSCRIPTION' - | 'PWM_REFUND' - | 'DEFI_INVESTMENT_SUBSCRIPTION' - | 'DEFI_INVESTMENT_REFUND' - | 'DEFI_INVESTMENT_REDEMPTION' - | 'INSTITUTION_LOAN_IN' - | 'INSTITUTION_PAYBACK_PRINCIPAL_OUT' - | 'INSTITUTION_PAYBACK_INTEREST_OUT' - | 'INSTITUTION_EXCHANGE_SELL' - | 'INSTITUTION_EXCHANGE_BUY' - | 'INSTITUTION_LIQ_PRINCIPAL_OUT' - | 'INSTITUTION_LIQ_INTEREST_OUT' - | 'INSTITUTION_LOAN_TRANSFER_IN' - | 'INSTITUTION_LOAN_TRANSFER_OUT' - | 'INSTITUTION_LOAN_WITHOUT_WITHDRAW' - | 'INSTITUTION_LOAN_RESERVE_IN' - | 'INSTITUTION_LOAN_RESERVE_OUT' - | 'PLATFORM_TOKEN_MNT_LIQRECALLEDMMNT' - | 'PLATFORM_TOKEN_MNT_LIQRETURNEDMNT' - | 'DIVIDEND_SETTLEMENT' - | 'FORWARD_SPLIT_SETTLE' - | 'REVERSE_SPLIT_SETTLE'; +export interface FeeGroupStructureResponseV5 { + list: FeeGroupItemV5[]; // List of fee group objects +} ⋮---- -export type PermissionTypeV5 = - | 'ContractTrade' - | 'Spot' - | 'Wallet' - | 'Options' - | 'Derivatives' - | 'Exchange' - | 'NFT'; +list: FeeGroupItemV5[]; // List of fee group objects ⋮---- -/** - * Leveraged token status: - * - * - '1' LT can be purchased and redeemed - * - '2' LT can be purchased, but not redeemed - * - '3' LT can be redeemed, but not purchased - * - '4' LT cannot be purchased nor redeemed - * - '5' Adjusting position - */ -export type LeverageTokenStatusV5 = '1' | '2' | '3' | '4' | '5'; +export interface OptionBaseCoinV5 { + baseCoin: string; + quoteCoin: string; + settleCoin: string; + optionShowName: string; + /** UTC milliseconds. 0 when the option is not scheduled. */ + optionOnlineTime: number; + /** 1 when tradable option symbols exist, otherwise 0 */ + hasSymbol: 0 | 1; + /** 0 crypto, 1 commodity, 2 stock, 3 forex, 4 oil */ + underlyingType: 0 | 1 | 2 | 3 | 4; +} ⋮---- -/** - * Leveraged token order type: '1': purchase, '2': redeem - */ -export type LTOrderTypeV5 = '1' | '2'; +/** UTC milliseconds. 0 when the option is not scheduled. */ ⋮---- -/** - * Leveraged token order status: '1': completed, '2': in progress, '3': failed - */ -export type LTOrderStatusV5 = '1' | '2' | '3'; +/** 1 when tradable option symbols exist, otherwise 0 */ ⋮---- -export type ExecTypeV5 = - | 'Trade' - | 'AdlTrade' - | 'Funding' - | 'BustTrade' - | 'Settle' - | 'BlockTrade' - | 'MovePosition' - /** @deprecated Removed from Bybit execType; kept for older payloads. */ - | 'CorporateAction' - | 'ForwardSplitSettle' - | 'ReverseSplitSettle' - | 'Dividend' - | 'UNKNOWN'; +/** 0 crypto, 1 commodity, 2 stock, 3 forex, 4 oil */ ⋮---- -/** @deprecated Removed from Bybit execType; kept for older payloads. */ +export interface OptionBaseCoinsResultV5 { + list: OptionBaseCoinV5[]; +} + +================ +File: src/types/response/v5-user.ts +================ +import { PermissionsV5 } from '../shared-v5'; ⋮---- -/** - * Withdraw type. 0(default): on chain. 1: off chain. 2: all. - */ -export type WithdrawalTypeV5 = '0' | '1' | '2'; +export interface CreateSubMemberResultV5 { + uid: string; + username: string; + memberType: number; + status: number; + remark: string; +} ⋮---- -export interface PermissionsV5 { - ContractTrade?: string[]; - Spot?: string[]; - Wallet?: string[]; - Options?: string[]; - Derivatives?: string[]; - CopyTrading?: string[]; - BlockTrade?: string[]; - Exchange?: string[]; - /** @deprecated , always returns []*/ - NFT?: string[]; +export interface CreateSubApiKeyResultV5 { + id: string; + note: string; + apiKey: string; + readOnly: number; + secret: string; + permissions: PermissionsV5; +} +⋮---- +export interface SubMemberV5 { + uid: string; + username: string; + memberType: number; + status: number; + accountMode: number; + remark: string; +} +export type ApiKeyType = 1 | 2; +⋮---- +export interface ApiKeyPermissionsV5 { + ContractTrade: string[]; + Spot: string[]; + Wallet: string[]; + Options: string[]; + Derivatives: string[]; + CopyTrading: string[]; + BlockTrade: string[]; + Exchange: string[]; + NFT: string[]; + Affiliate: string[]; Earn?: string[]; - Affiliate?: string[]; FiatP2P?: string[]; - /** Bybit Pay (FaitPayOrder) */ FiatBitPay?: string[]; FiatConvertBroker?: string[]; + /** @deprecated */ + FiatGlobalPay?: string[]; BitCard?: string[]; ByXPost?: string[]; } ⋮---- -/** @deprecated , always returns []*/ -⋮---- -/** Bybit Pay (FaitPayOrder) */ +/** @deprecated */ ⋮---- -export interface CategoryCursorListV5< - T extends unknown[], - TCategory extends CategoryV5 = CategoryV5, -> { - category: TCategory; - list: T; - nextPageCursor?: string; +export interface ApiKeyInfoV5 { + id: string; + note: string; + apiKey: string; + readOnly: 0 | 1; + secret: string; + permissions: ApiKeyPermissionsV5; + ips: string[]; + type: 1 | 2; // 1: personal, 2: connected to third-party app + deadlineDay: number; + expiredAt: string; + createdAt: string; + /** @deprecated */ + unified: number; + uta: 0 | 1; // 0: regular account, 1: unified trade account + userID: number; + inviterID: number; + vipLevel: string; + mktMakerLevel: string; + affiliateID: number; + rsaPublicKey: string; + isMaster: boolean; + parentUid: string; + kycLevel: 'LEVEL_DEFAULT' | 'LEVEL_1' | 'LEVEL_2'; + kycRegion: string; + isFixApi?: boolean; } ⋮---- -/** - * Next page cursor does not exist for spot! - */ -export interface CursorListV5 { - nextPageCursor: string; - list: T; -} +type: 1 | 2; // 1: personal, 2: connected to third-party app ⋮---- -/** - * A wrapper type for any responses that have a "nextPageCursor" property, and a "rows" property with an array of elements - * - * ```{ nextPageCursor: "something", rows: someData[] }``` - */ -export interface CursorRowsV5 { - nextPageCursor: string; - rows: T; -} +/** @deprecated */ ⋮---- -export interface CategoryListV5< - T extends unknown[], - TCategory extends CategoryV5, -> { - category: TCategory; - list: T; -} +uta: 0 | 1; // 0: regular account, 1: unified trade account ⋮---- -export interface CategorySymbolListV5< - T extends unknown[], - TCategory extends CategoryV5, -> { - category: TCategory; - symbol: string; - list: T; +export interface UpdateApiKeyResultV5 { + id: string; + note: string; + apiKey: string; + readOnly: 0 | 1; + secret: string; + permissions: PermissionsV5; + ips: string[]; } ⋮---- -export interface GetSystemStatusParamsV5 { - id?: string; - state?: string; +export interface SubAccountAllApiKeysResultV5 { + result: { + id: string; + ips?: string[]; + apiKey: string; + note: string; + status: number; + expiredAt?: string; + createdAt: string; + type: ApiKeyType; + permissions: PermissionsV5; + secret: string; + readOnly: 0 | 1; + deadlineDay?: number; + flag: string; + }[]; + nextPageCursor: string; } ⋮---- -export interface SystemStatusItemV5 { - id: string; - title: string; - state: string; - begin: string; - end: string; - href: string; - serviceTypes: number[]; - product: number[]; - uidSuffix: number[]; - maintainType: string; - env: string; -} - -================ -File: src/types/response/v5-asset.ts -================ -import { AccountTypeV5, OrderSideV5, WithdrawalTypeV5 } from '../shared-v5'; -⋮---- -export interface CoinExchangeRecordV5 { - fromCoin: string; - fromAmount: string; - toCoin: string; - toAmount: string; - exchangeRate: string; - createdTime: string; - exchangeTxId: string; +export interface AffiliateUserListItemV5 { + userId: string; + registerTime: string; + source: string; + remarks: string; + isKyc: boolean; + takerVol30Day: string; + makerVol30Day: string; + tradeVol30Day: string; + depositAmount30Day: string; + takerVol365Day: string; + makerVol365Day: string; + tradeVol365Day: string; + depositAmount365Day: string; + takerVol: string; + makerVol: string; + tradeVol: string; + startDate: string; + endDate: string; + /** tradfi trade volume in [startDate, endDate] when startDate/endDate in params */ + tradfiTradeVol?: string; + /** tradfi trade volume in last 30 days. 0 when startDate/endDate in params */ + tradfiTradeVol30Day?: string; + /** tradfi trade volume in past year. 0 when startDate/endDate in params */ + tradfiTradeVol365Day?: string; + /** Commission between startDate and endDate when startDate/endDate in params. Coin -> amount */ + commissionsVol?: Record; + /** Commission in last 30 days. Coin -> amount */ + commissions30Day?: Record; + /** Commission in past year. Coin -> amount */ + commissions365Day?: Record; } ⋮---- -export interface DeliveryRecordV5 { - deliveryTime: number; - symbol: string; - side: OrderSideV5; - position: string; - deliveryPrice: string; - strike: string; - fee: string; - deliveryRpl: string; - entryPrice: string; -} +/** tradfi trade volume in [startDate, endDate] when startDate/endDate in params */ ⋮---- -export interface SettlementRecordV5 { - symbol: string; - side: string; - size: number; - sessionAvgPrice: string; - markPrice: string; - realisedPnl: string; - createdTime: string; -} +/** tradfi trade volume in last 30 days. 0 when startDate/endDate in params */ ⋮---- -export interface AssetInfoAssetV5 { - coin: string; - frozen: string; - free: string; - withdraw: string; -} +/** tradfi trade volume in past year. 0 when startDate/endDate in params */ ⋮---- -export interface AssetInfoV5 { - status: 'ACCOUNT_STATUS_NORMAL' | 'ACCOUNT_STATUS_UNSPECIFIED'; - assets: AssetInfoAssetV5[]; -} +/** Commission between startDate and endDate when startDate/endDate in params. Coin -> amount */ ⋮---- -export interface CoinBalanceV5 { - coin: string; - walletBalance: string; - transferBalance: string; - bonus?: string; -} +/** Commission in last 30 days. Coin -> amount */ ⋮---- -export interface AllCoinsBalanceV5 { - accountType: AccountTypeV5; - memberId?: string; - balance: CoinBalanceV5[]; -} +/** Commission in past year. Coin -> amount */ ⋮---- -export interface AccountCoinBalanceV5 { - accountType: AccountTypeV5; - bizType: number; - accountId: string; - memberId: string; - balance: { - coin: string; - walletBalance: string; - transferBalance: string; - bonus: string; - transferSafeAmount: string; - ltvTransferSafeAmount: string; - }; +export interface AffiliateUserInfoV5 { + uid: string; + vipLevel: string; + takerVol30Day: string; + makerVol30Day: string; + tradeVol30Day: string; + depositAmount30Day: string; + takerVol365Day: string; + makerVol365Day: string; + tradeVol365Day: string; + depositAmount365Day: string; + totalWalletBalance: '1' | '2' | '3' | '4'; + depositUpdateTime: string; + volUpdateTime: string; + KycLevel: 0 | 1 | 2; + /** tradfi trade volume in last 30 days (USDT) */ + tradfiTradeVol30Day?: string; + /** tradfi trade volume in past year (USDT) */ + tradfiTradeVol365Day?: string; + /** tradfi commissions in last 30 days. Coin -> amount */ + commissions30Day?: Record; + /** tradfi commissions in past year. Coin -> amount */ + commissions365Day?: Record; + /** Payment amount in the last 30 days */ + paySendAmount30Day: string; + /** Pay first transaction amount */ + payFtt: string; + /** Card first-time transaction amount */ + cardFtt: string; } ⋮---- -export interface InternalTransferRecordV5 { - transferId: string; - coin: string; - amount: string; - fromAccountType: AccountTypeV5; - toAccountType: AccountTypeV5; - timestamp: string; - status: string; -} +/** tradfi trade volume in last 30 days (USDT) */ ⋮---- -export interface UniversalTransferRecordV5 { - transferId: string; - coin: string; - amount: string; - fromMemberId: string; - toMemberId: string; - fromAccountType: AccountTypeV5; - toAccountType: AccountTypeV5; - timestamp: string; - status: string; - withdrawReqId?: string; - depositReqId?: string; -} +/** tradfi trade volume in past year (USDT) */ ⋮---- -export interface AllowedDepositCoinInfoV5 { - coin: string; - chain: string; - coinShowName: string; - chainType: string; - blockConfirmNumber: number; - minDepositAmount: string; -} +/** tradfi commissions in last 30 days. Coin -> amount */ ⋮---- -export interface DepositRecordV5 { - id: string; - coin: string; - chain: string; - amount: string; - txID: string; - status: number; - toAddress: string; - tag: string; - depositFee: string; - successAt: string; - confirmations: string; - txIndex: string; - blockHash: string; - batchReleaseLimit: string; - depositType: string; - fromAddress: string; - travelRuleStatus?: string; +/** tradfi commissions in past year. Coin -> amount */ +⋮---- +/** Payment amount in the last 30 days */ +⋮---- +/** Pay first transaction amount */ +⋮---- +/** Card first-time transaction amount */ +⋮---- +export interface AffiliateSubAffiliateListItemV5 { + subAffId: string; + userId: string; + name: string; + email: string; + /** Commission per currency (BTC, ETH, MNT, USDC, USDT) for the queried date range */ + commissionsVol: Record; + commissionsForUsdt: string; + becameAffTime: string; + startDate: string; + endDate: string; } ⋮---- -export interface SubmitDepositOriginatorInfoResultV5 { - travelRuleStatus: number; +/** Commission per currency (BTC, ETH, MNT, USDC, USDT) for the queried date range */ +⋮---- +export interface AffiliateSubAffiliateListResultV5 { + list: AffiliateSubAffiliateListItemV5[]; + nextPageCursor: string; } ⋮---- -export interface InternalDepositRecordV5 { +export interface FriendReferralRecordV5 { id: string; - type: 1; - coin: string; - amount: string; - status: 1 | 2 | 3; - address: string; - createdTime: string; - txID: string; - complianceStatus?: string; + inviteeUid: string; + status: number; + createdAt: string; + updatedAt: string; } ⋮---- -export interface DepositAddressChainV5 { - chainType: string; - addressDeposit: string; - tagDeposit: string; - chain: string; - batchReleaseLimit: string; - contractAddress: string; +export interface ReferralCodeItemV5 { + referralCode: string; + referralLink: string; + scene: number; } ⋮---- -export interface DepositAddressResultV5 { - coin: string; - chains: DepositAddressChainV5[]; +export interface ReferralCodesResultV5 { + referralCodes: ReferralCodeItemV5[]; } + +================ +File: src/types/websockets/ws-events.ts +================ +import WebSocket from 'isomorphic-ws'; ⋮---- -export interface CoinInfoV5 { - name: string; - coin: string; - /** @deprecated Use `chains[].withdrawMax` instead */ - remainAmount: string; - chains: { - chain: string; - chainType: string; - confirmation: string; - withdrawFee: string; - depositMin: string; - withdrawMin: string; - minAccuracy: string; - chainDeposit: string; - chainWithdraw: string; - withdrawPercentageFee: string; - contractAddress: string; - safeConfirmNumber: string; - /** Max withdraw amount per transaction per chain. `-1` means no limit */ - withdrawMax: string; - }[]; -} +import { + RFQItemV5, + RFQPublicTradeV5, + RFQQuoteItemV5, + RFQTradeV5, +} from '../response/v5-rfq'; +import { + CategoryV5, + ExecTypeV5, + OCOTriggerTypeV5, + OrderCancelTypeV5, + OrderCreateTypeV5, + OrderRejectReasonV5, + OrderSideV5, + OrderSMPTypeV5, + OrderStatusV5, + OrderTimeInForceV5, + OrderTriggerByV5, + OrderTypeV5, + PositionIdx, + PositionSideV5, + PositionStatusV5, + StopOrderTypeV5, + SystemStatusItemV5, + TPSLModeV5, + TradeModeV5, +} from '../shared-v5'; +import { WsKey } from './ws-general'; ⋮---- -/** @deprecated Use `chains[].withdrawMax` instead */ +export interface MessageEventLike { + target: WebSocket; + type: 'message'; + data: string; +} ⋮---- -/** Max withdraw amount per transaction per chain. `-1` means no limit */ +export function isMessageEvent(msg: unknown): msg is MessageEventLike ⋮---- -export interface WithdrawalRecordV5 { - withdrawId: string; - txID: string; - withdrawType: WithdrawalTypeV5; - coin: string; - chain: string; - amount: string; - withdrawFee: string; - status: string; - toAddress: string; - tag: string; - createTime: string; - updateTime: string; +export interface WSPublicTopicEventV5 { + id?: string; + topic: TTopic; + type: TType; + /** Cross sequence */ + cs?: number; + /** Event timestamp */ + ts: number; + data: TData; + /** + * matching engine timestamp (correlated with T from public trade channel) + */ + cts: number; + /** + * Internal reference, can be used to determine if this is spot/linear/inverse/etc + */ + wsKey: WsKey; } ⋮---- -export interface WithdrawalAddressV5 { - coin: string; - chain: string; - address: string; - tag: string; - remark: string; - status: number; - addressType: number; - verified: number; - createdAt: string; -} +/** Cross sequence */ ⋮---- -export interface WithdrawableAccountSliceV5 { - coin: string; - withdrawableAmount: string; - availableBalance: string; -} +/** Event timestamp */ ⋮---- /** - * GET /v5/asset/withdraw/withdrawable-amount. Only keys with data are returned - * (e.g. UTA, FUND, EARN; EARN when the coin can be withdrawn from Earn; SPOT if present). - */ -export interface WithdrawableAmountV5 { - limitAmountUsd: string; - withdrawableAmount: { - SPOT?: WithdrawableAccountSliceV5; - FUND?: WithdrawableAccountSliceV5; - UTA?: WithdrawableAccountSliceV5; - EARN?: WithdrawableAccountSliceV5; - }; -} + * matching engine timestamp (correlated with T from public trade channel) + */ ⋮---- -export interface VaspEntityV5 { - vaspEntityId: string; - vaspName: string; -} +/** + * Internal reference, can be used to determine if this is spot/linear/inverse/etc + */ ⋮---- -export interface ConvertCoinSpecV5 { - coin: string; - fullName: string; - icon: string; - iconNight: string; - accuracyLength: number; - coinType: string; - balance: string; - uBalance: string; - singleFromMinLimit: string; - singleFromMaxLimit: string; - disableFrom: boolean; - disableTo: boolean; - timePeriod: number; - singleToMinLimit: string; - singleToMaxLimit: string; - dailyFromMinLimit: string; - dailyFromMaxLimit: string; - dailyToMinLimit: string; - dailyToMaxLimit: string; +export interface WSPrivateTopicEventV5 { + id?: string; + topic: TTopic; + creationTime: number; + data: TData; + wsKey: WsKey; } ⋮---- -export interface ConvertQuoteV5 { - quoteTxId: string; - exchangeRate: string; - fromCoin: string; - fromCoinType: string; - toCoin: string; - toCoinType: string; - fromAmount: string; - toAmount: string; - expiredTime: string; - requestId: string; - extTaxAndFee: string[]; +export interface WSOrderbookV5 { + /** Symbol */ + s: string; + /** [price, qty][] */ + b: [string, string][]; + /** [price, qty][] */ + a: [string, string][]; + /** Update ID */ + u: number; + /** Cross sequence */ + seq: number; } ⋮---- -export interface ConvertStatusV5 { - accountType: string; - exchangeTxId: string; - userId: string; - fromCoin: string; - fromCoinType: string; - toCoin: string; - toCoinType: string; - fromAmount: string; - toAmount: string; - exchangeStatus: 'init' | 'processing' | 'success' | 'failure'; - extInfo: { paramType: string; paramValue: string }; - convertRate: string; - createdAt: string; -} +/** Symbol */ ⋮---- -export interface ConvertHistoryRecordV5 { - accountType: string; - exchangeTxId: string; - userId: string; - fromCoin: string; - fromCoinType: string; - toCoin: string; - toCoinType: string; - fromAmount: string; - toAmount: string; - exchangeStatus: 'init' | 'processing' | 'success' | 'failure'; - extInfo: { paramType: string; paramValue: string }; - convertRate: string; - createdAt: string; -} +/** [price, qty][] */ ⋮---- -export interface SmallBalanceCoinV5 { - fromCoin: string; // Source currency - supportConvert: 1 | 2; // 1: support, 2: not supported - availableBalance: string; // Available balance - baseValue: string; // USDT equivalent value - toAmount: string; // Reserved field - exchangeRate: string; // Reserved field - feeInfo: null; // Reserved field - taxFeeInfo: null; // Reserved field -} +/** [price, qty][] */ ⋮---- -fromCoin: string; // Source currency -supportConvert: 1 | 2; // 1: support, 2: not supported -availableBalance: string; // Available balance -baseValue: string; // USDT equivalent value -toAmount: string; // Reserved field -exchangeRate: string; // Reserved field -feeInfo: null; // Reserved field -taxFeeInfo: null; // Reserved field +/** Update ID */ ⋮---- -export interface SmallBalanceListV5 { - smallAssetCoins: SmallBalanceCoinV5[]; // Small balance info - supportToCoins: string[]; // Supported target coins (e.g., ["MNT","USDT","USDC"]) -} +/** Cross sequence */ ⋮---- -smallAssetCoins: SmallBalanceCoinV5[]; // Small balance info -supportToCoins: string[]; // Supported target coins (e.g., ["MNT","USDT","USDC"]) +export type WSOrderbookEventV5 = WSPublicTopicEventV5< + string, + 'delta' | 'snapshot', + WSOrderbookV5 +>; ⋮---- -export interface FiatCoinInfoV5 { - coin: string; // Fiat coin code - fullName: string; // Fiat full coin name - icon: string; // Coin icon url - iconNight: string; // Coin icon url (dark mode) - precision: number; // Fiat precision - disable: boolean; // true: the coin is disabled, false: the coin is allowed - singleFromMinLimit: string; // For buy side, minimum amount of fiatCoin per transaction - singleFromMaxLimit: string; // For buy side, maximum amount of fiatCoin per transaction +export interface WSTradeV5 { + T: number; + s: string; + S: OrderSideV5; + v: string; + p: string; + L?: string; + i: string; + BT: boolean; + RPI?: boolean; + mP?: string; + iP?: string; + mIv?: string; + iv?: string; } ⋮---- -coin: string; // Fiat coin code -fullName: string; // Fiat full coin name -icon: string; // Coin icon url -iconNight: string; // Coin icon url (dark mode) -precision: number; // Fiat precision -disable: boolean; // true: the coin is disabled, false: the coin is allowed -singleFromMinLimit: string; // For buy side, minimum amount of fiatCoin per transaction -singleFromMaxLimit: string; // For buy side, maximum amount of fiatCoin per transaction +export type WSTradeEventV5 = WSPublicTopicEventV5< + string, + 'snapshot', + WSTradeV5[] +>; ⋮---- -export interface CryptoCoinInfoV5 { - coin: string; // Crypto coin code - fullName: string; // Crypto full coin name - icon: string; // Coin icon url - iconNight: string; // Coin icon url (dark mode) - precision: number; // Crypto precision - disable: boolean; // true: the coin is disabled, false: the coin is allowed - singleFromMinLimit: string; // For sell side, minimum amount of cryptoCoin per transaction - singleFromMaxLimit: string; // For sell side, maximum amount of cryptoCoin per transaction +export interface WSEventOrderbookV5 { + s: string; + r: [string, string][]; + u: number; + seq: number; } ⋮---- -coin: string; // Crypto coin code -fullName: string; // Crypto full coin name -icon: string; // Coin icon url -iconNight: string; // Coin icon url (dark mode) -precision: number; // Crypto precision -disable: boolean; // true: the coin is disabled, false: the coin is allowed -singleFromMinLimit: string; // For sell side, minimum amount of cryptoCoin per transaction -singleFromMaxLimit: string; // For sell side, maximum amount of cryptoCoin per transaction +export type WSEventOrderbookEventV5 = WSPublicTopicEventV5< + string, + 'delta' | 'snapshot', + WSEventOrderbookV5 +>; ⋮---- -export interface FiatTradingPairListV5 { - fiats: FiatCoinInfoV5[]; // Fiat coin list - cryptos: CryptoCoinInfoV5[]; // Crypto coin list +export interface WSEventPublicTradeV5 { + T: number; + s: string; + r: string; + a: string; + i: string; + seq: number; } ⋮---- -fiats: FiatCoinInfoV5[]; // Fiat coin list -cryptos: CryptoCoinInfoV5[]; // Crypto coin list +export type WSEventPublicTradeEventV5 = WSPublicTopicEventV5< + string, + 'snapshot', + WSEventPublicTradeV5[] +>; ⋮---- -export interface FundingAccountTransactionRecordV5 { - memberId: string; - currency: string; - ioDirection: string; - txnAmt: string; - afterAmt: string; - createTime: string; - showBusiType: string; - showBusiTypeEn: string; - description: string; - descriptionEn: string; - currcCursor?: string; +/** + * WSTickerV5 is the data structure for the "linear" ticker channel + * */ +export interface WSTickerV5 { + symbol: string; + tickDirection: string; + price24hPcnt: string; + lastPrice: string; + prevPrice24h: string; + highPrice24h: string; + lowPrice24h: string; + prevPrice1h: string; + markPrice: string; + indexPrice: string; + openInterest: string; + openInterestValue: string; + singleOpenInterest?: string; + singleOpenInterestValue?: string; + turnover24h: string; + volume24h: string; + nextFundingTime: string; + fundingRate: string; + bid1Price: string; + bid1Size: string; + ask1Price: string; + ask1Size: string; + deliveryTime?: string; + basisRate?: string; + deliveryFeeRate?: string; + predictedDeliveryPrice?: string; + preOpenPrice?: string; + preQty?: string; + curPreListingPhase?: string; + fundingIntervalHour?: string; + fundingCap?: string; + basisRateYear?: string; } ⋮---- -/** When accountType=Alpha and category is farm, under `coinDetail` in sub-categories. */ -export interface AssetOverviewCoinExtMapV5 { - priceUpper?: string; - priceLower?: string; - equityUnit?: string; +export interface WSTickerOptionV5 { + symbol: string; + bidPrice: string; + bidSize: string; + bidIv: string; + askPrice: string; + askSize: string; + askIv: string; + lastPrice: string; + highPrice24h: string; + lowPrice24h: string; + markPrice: string; + indexPrice: string; + markPriceIv: string; + underlyingPrice: string; + openInterest: string; + turnover24h: string; + volume24h: string; + totalVolume: string; + totalTurnover: string; + delta: string; + gamma: string; + vega: string; + theta: string; + predictedDeliveryPrice: string; + change24h: string; } ⋮---- -export interface AssetOverviewCoinDetailV5 { - coin: string; - equity: string; - extMap?: AssetOverviewCoinExtMapV5; +export interface WSTickerSpotV5 { + symbol: string; + lastPrice: string; + highPrice24h: string; + lowPrice24h: string; + prevPrice24h: string; + volume24h: string; + turnover24h: string; + price24hPcnt: string; + usdIndexPrice: string; } ⋮---- -export interface AssetOverviewCategoryV5 { - category: string; - equity: string; - coinDetail: AssetOverviewCoinDetailV5[]; -} +export type WSTickerEventV5 = WSPublicTopicEventV5< + string, + 'snapshot' | 'delta', + WSTickerV5 | WSTickerOptionV5 | WSTickerSpotV5 +>; ⋮---- -export interface AssetOverviewAccountItemV5 { - accountType: string; - totalEquity: string; - valuationCurrency: string; - snapshotTime: string; - coinDetail?: AssetOverviewCoinDetailV5[]; - categories?: AssetOverviewCategoryV5[]; +export interface WSKlineV5 { + start: number; + end: number; + interval: string; + open: string; + close: string; + high: string; + low: string; + volume: string; + turnover: string; + confirm: boolean; + timestamp: number; } ⋮---- -export interface AssetOverviewResultV5 { - totalEquity: string; - list: AssetOverviewAccountItemV5[]; +export type WSKlineEventV5 = WSPublicTopicEventV5< + string, + 'snapshot', + WSKlineV5[] +>; +⋮---- +export interface WSLiquidationV5 { + T: number; + s: string; + S: OrderSideV5; + v: string; + p: string; } ⋮---- -// --- GET /v5/asset/portfolio-margin (portfolio margin P&L ranges) --- +export type WSLiquidationEventV5 = WSPublicTopicEventV5< + string, + 'snapshot', + WSLiquidationV5[] +>; ⋮---- -export interface PortfolioMarginWalletV5 { - equity: string; - cashBalance: string; - marginBalance: string; - availableBalance: string; - accountIM: string; - accountMM: string; - accountMMRate: string; - accountIMRate: string; +export interface WSPositionV5 { + category: string; + symbol: string; + side: PositionSideV5; + size: string; + positionIdx: PositionIdx; + tradeMode: TradeModeV5; + positionValue: string; + riskId: number; + riskLimitValue: string; + entryPrice: string; + markPrice: string; + leverage: string; + breakEvenPrice?: string; // Break even price, only for linear & inverse + positionBalance: string; + autoAddMargin: number; + positionMM: string; + positionIM: string; + positionIMByMp: string; + positionMMByMp: string; + liqPrice: string; + bustPrice: string; + tpslMode: string; + takeProfit: string; + stopLoss: string; + trailingStop: string; + unrealisedPnl: string; + curRealisedPnl: string; + sessionAvgPrice: string; + delta: string; + gamma: string; + vega: string; + theta: string; + cumRealisedPnl: string; + positionStatus: PositionStatusV5; + adlRankIndicator: number; + isReduceOnly: boolean; + mmrSysUpdatedTime: string; + leverageSysUpdatedTime: string; + createdTime: string; + updatedTime: string; + /** Position open timestamp (ms). Default `0` when not set. */ + openTime: number; + seq: number; + netDeltaRatio?: string; } ⋮---- -export interface PortfolioMarginPnlRangePointV5 { - priceScale: string; - pnls: string[]; -} +breakEvenPrice?: string; // Break even price, only for linear & inverse ⋮---- -export interface PortfolioMarginContractBucketPnlV5 { - pnlRanges: PortfolioMarginPnlRangePointV5[]; -} +/** Position open timestamp (ms). Default `0` when not set. */ ⋮---- -export interface PortfolioMarginTotalPnlRangesV5 { - ALL?: PortfolioMarginContractBucketPnlV5; - PERPETUAL?: PortfolioMarginContractBucketPnlV5; - OPTION?: PortfolioMarginContractBucketPnlV5; -} +export type WSPositionEventV5 = WSPrivateTopicEventV5< + 'position', + WSPositionV5[] +>; ⋮---- -export interface PortfolioMarginPerpPositionPnlV5 { - symbolName: string; - position: string; - pnlRanges: PortfolioMarginPnlRangePointV5[]; - sessionAvgPrice: string; - markPrice: string; - orderSize: string; - contractType: number; +export interface WSEventPositionV5 { + symbol: string; + baseCoin: string; settleCoin: string; - symbolAlias?: string; + side: string; + ecContractType: string; + ecDirection: string; + avgPayoutRatio: string; + positionValue: string; + ecSettleTime: string; + cumClosedPnl: string; + createdTime: string; + updatedTime: string; + seq: number; } ⋮---- -export interface PortfolioMarginOptionPositionPnlV5 { - symbolName: string; - position: string; - pnlRanges: PortfolioMarginPnlRangePointV5[]; - sessionAvgPrice: string; - markPrice: string; - orderSize: string; - contractType: number; - settleCoin: string; -} +export type WSEventPositionEventV5 = WSPrivateTopicEventV5< + 'position.event', + WSEventPositionV5[] +>; ⋮---- -export interface PortfolioMarginOptionExpiryPnlV5 { - expiryDateRepresentation: string; - pnlRanges: PortfolioMarginPnlRangePointV5[]; - optionPositionPnlRanges: PortfolioMarginOptionPositionPnlV5[]; +export interface WSAccountOrderV5 { + category: CategoryV5; + orderId: string; + orderLinkId: string; + parentOrderLinkId?: string; // Linked parent order for attached TP/SL orders (futures & options) + isLeverage: string; + blockTradeId: string; + symbol: string; + price: string; + qty: string; + side: OrderSideV5; + positionIdx: PositionIdx; + orderStatus: OrderStatusV5; + createType: OrderCreateTypeV5; + cancelType: OrderCancelTypeV5; + rejectReason?: OrderRejectReasonV5; + avgPrice?: string; + leavesQty?: string; + leavesValue?: string; + cumExecQty: string; + cumExecValue: string; + cumExecFee: string; + closedPnl: string; + feeCurrency: string; + timeInForce: OrderTimeInForceV5; + orderType: OrderTypeV5; + stopOrderType: StopOrderTypeV5; + ocoTriggerType?: OCOTriggerTypeV5; + orderIv: string; + marketUnit?: 'baseCoin' | 'quoteCoin'; + triggerPrice: string; + takeProfit: string; + stopLoss: string; + tpslMode?: TPSLModeV5; + tpLimitPrice?: string; + slLimitPrice?: string; + tpTriggerBy: string; + slTriggerBy: string; + triggerDirection: number; + triggerBy: OrderTriggerByV5; + lastPriceOnCreated: string; + reduceOnly: boolean; + closeOnTrigger: boolean; + placeType: string; + smpType: OrderSMPTypeV5; + smpGroup: string; + smpOrderId: string; + createdTime: string; + updatedTime: string; + cumFeeDetail?: Record; // Cumulative trading fee details instead of cumExecFee and feeCurrency + rpiTakerAccess?: boolean; + rpiMatchedQty?: string; } ⋮---- -export interface PortfolioMarginContingencyV5 { - optionContingency: string; - futureDeltaContingency: string; - optionVegaContingency: string; - contingencyComponents: string; - usdtUsdcContingency: string; - futureContingency: string; -} +parentOrderLinkId?: string; // Linked parent order for attached TP/SL orders (futures & options) ⋮---- -export interface PortfolioMarginAssetBlockV5 { - coin: string; - assetIM: string; - assetMM: string; -} +cumFeeDetail?: Record; // Cumulative trading fee details instead of cumExecFee and feeCurrency ⋮---- -export interface PortfolioMarginSpotHedgeInfoV5 { - hedgeSpotSize: string; - walletBalance: string; - usdIndexPrice: string; - pnlRanges: PortfolioMarginPnlRangePointV5[]; -} +export type WSAccountOrderEventV5 = WSPrivateTopicEventV5< + 'order', + WSAccountOrderV5[] +>; ⋮---- -export interface PortfolioMarginByBaseCoinV5 { +export interface WSEventOrderV5 { + category: 'event' | string; + orderId: string; + orderLinkId: string; + symbol: string; + symbolId: number; + side: string; baseCoin: string; - totalPnlRanges: PortfolioMarginTotalPnlRangesV5; - perpPositionPnlRanges: PortfolioMarginPerpPositionPnlV5[]; - optionExpiryDatePnlRanges: PortfolioMarginOptionExpiryPnlV5[]; - contingency: PortfolioMarginContingencyV5; - asset: PortfolioMarginAssetBlockV5; - maxLossPriceMove: string; - maxLossIvShock: string; - totalClosePzFee: string; - spotHedgeInfo: PortfolioMarginSpotHedgeInfoV5; - maxLossIvShockList: string[]; -} -⋮---- -export interface PortfolioMarginInfoResultV5 { - wallet: PortfolioMarginWalletV5; - assetPnlRange: PortfolioMarginByBaseCoinV5[]; -} -⋮---- -// --- GET /v5/asset/total-members-assets --- -⋮---- -export interface TotalMembersAccountBreakdownItemV5 { - type: string; - origb: string; - quoteb: string; - stat: number; + quoteCoin: string; + settleCoin: string; + orderStatus: string; + ecContractType: string; + ecDirection: string; + ecDurationWindow: number; + ecTargetPrice: string; + ecLowerBound: string; + ecUpperBound: string; + ecOrderValue: string; + ecIndexPrice: string; + ecSettleTime: string; + payoutRatio: string; + orderAvgPayoutRatio: string; + cumExecValue: string; + cumExecFee: string; + leavesValue: string; + cumPayout: string; + createType: number; + cancelType: string; + rejectReason: string; + extraFees: unknown[]; + transTime: string; + createdTime: string; + updatedTime: string; } ⋮---- -export interface TotalMembersMemberEntryV5 { - uid: number; - isM?: boolean; - type?: number; - stat: number; - origb: string; - quoteb?: string; - items: TotalMembersAccountBreakdownItemV5[]; -} +export type WSEventOrderEventV5 = WSPrivateTopicEventV5< + 'order' | 'order.event', + WSEventOrderV5[] +>; ⋮---- -export interface TotalMembersAssetsResultV5 { - total: string; - quoteTotal: string; - stat: number; - list: TotalMembersMemberEntryV5[]; +export interface WSExecutionV5 { + category: CategoryV5; + symbol: string; + isLeverage: string; + orderId: string; + orderLinkId: string; + side: OrderSideV5; + orderPrice: string; + orderQty: string; + leavesQty: string; + createType: OrderCreateTypeV5; + orderType: OrderTypeV5; + stopOrderType: StopOrderTypeV5; + execFee: string; + feeCurrency: string; // Trading fee currency + execId: string; + execPrice: string; + execQty: string; + execPnl: string; + execType: ExecTypeV5; + execValue: string; + execTime: string; + isMaker: boolean; + feeRate: string; + tradeIv: string; + markIv: string; + markPrice: string; + indexPrice: string; + underlyingPrice: string; + blockTradeId: string; + closedSize: string; + extraFees: string; + seq: number; + marketUnit: string; } - -================ -File: src/types/websockets/ws-general.ts -================ -import { AxiosRequestConfig } from 'axios'; -import type { ClientRequestArgs } from 'http'; -import WebSocket from 'isomorphic-ws'; ⋮---- -import { APIRegion, RestClientOptions, WS_KEY_MAP } from '../../util'; +feeCurrency: string; // Trading fee currency ⋮---- -/** For spot markets, spotV3 is recommended */ -export type APIMarket = 'v5'; +export type WSExecutionEventV5 = WSPrivateTopicEventV5< + 'execution', + WSExecutionV5[] +>; ⋮---- -// Same as inverse futures -export type WsPublicInverseTopic = - | 'orderBookL2_25' - | 'orderBookL2_200' - | 'trade' - | 'insurance' - | 'instrument_info' - | 'klineV2'; +export interface WSEventExecutionV5 { + category: 'event' | string; + transId: string; + execId: string; + orderId: string; + orderLinkId: string; + symbol: string; + symbolId: number; + baseCoin: string; + quoteCoin: string; + settleCoin: string; + side: string; + feeCoin: string; + execType: string; + execPrice: string; + execValue: string; + execFee: string; + execFeeRate: string; + orderPrice: string; + ecContractType: number | string; + ecDirection: number | string; + ecDurationWindow: number; + ecTargetPrice: string; + ecLowerBound: string; + ecUpperBound: string; + ecOrderValue: string; + ecIndexPrice?: string; + ecPayout: string; + entryPrice: string; + settlePrice: string; + grossPayoutRatio: string; + sessionRpl: string; + transTime: string; + settleTimeMs: string; + crossSeq: string; + timeInForce: string; + extraFees: unknown[]; +} ⋮---- -export type WsPublicUSDTPerpTopic = - | 'orderBookL2_25' - | 'orderBookL2_200' - | 'trade' - | 'insurance' - | 'instrument_info' - | 'kline'; +export type WSEventExecutionEventV5 = WSPrivateTopicEventV5< + 'execution' | 'execution.event', + WSEventExecutionV5[] +>; ⋮---- -export type WsPublicSpotV1Topic = - | 'trade' - | 'realtimes' - | 'kline' - | 'depth' - | 'mergedDepth' - | 'diffDepth'; +export interface WSExecutionFastV5 { + category: CategoryV5; + symbol: string; + execId: string; + execPrice: string; + execQty: string; + orderId: string; + isMaker: boolean; + orderLinkId: string; + side: OrderSideV5; + execTime: string; + seq: number; + liquidity?: string; +} ⋮---- -export type WsPublicSpotV2Topic = - | 'depth' - | 'kline' - | 'trade' - | 'bookTicker' - | 'realtimes'; +export type WSExecutionFastEventV5 = WSPrivateTopicEventV5< + 'execution.fast', + WSExecutionFastV5[] +>; ⋮---- -export type WsPublicTopics = - | WsPublicInverseTopic - | WsPublicUSDTPerpTopic - | WsPublicSpotV1Topic - | WsPublicSpotV2Topic - | string; +export interface WSCoinV5 { + coin: string; + equity: string; + usdValue: string; + walletBalance: string; + free?: string; + locked: string; + spotHedgingQty: string; + borrowAmount: string; + availableToBorrow: string; + availableToWithdraw: string; + accruedInterest: string; + totalOrderIM: string; + totalPositionIM: string; + totalPositionMM: string; + unrealisedPnl: string; + cumRealisedPnl: string; + bonus: string; + collateralSwitch: boolean; + marginCollateral: boolean; + spotBorrow: string; + colRes?: string; +} ⋮---- -// Same as inverse futures -export type WsPrivateInverseTopic = - | 'position' - | 'execution' - | 'order' - | 'stop_order'; +export interface WSWalletV5 { + accountType: string; + accountLTV: string; + accountIMRate: string; + accountMMRate: string; + accountIMRateByMp: string; + accountMMRateByMp: string; + totalInitialMarginByMp: string; + totalMaintenanceMarginByMp: string; + totalEquity: string; + totalWalletBalance: string; + totalMarginBalance: string; + totalAvailableBalance: string; + totalPerpUPL: string; + totalInitialMargin: string; + totalMaintenanceMargin: string; + coin: WSCoinV5[]; +} ⋮---- -export type WsPrivateUSDTPerpTopic = - | 'position' - | 'execution' - | 'order' - | 'stop_order' - | 'wallet'; +export type WSWalletEventV5 = WSPrivateTopicEventV5<'wallet', WSWalletV5[]>; ⋮---- -export type WsPrivateSpotTopic = - | 'outboundAccountInfo' - | 'executionReport' - | 'ticketInfo'; +export interface WSGreeksV5 { + baseCoin: string; + totalDelta: string; + totalGamma: string; + totalVega: string; + totalTheta: string; +} ⋮---- -export type WsPrivateTopic = - | WsPrivateInverseTopic - | WsPrivateUSDTPerpTopic - | WsPrivateSpotTopic - | string; +export type WSGreeksEventV5 = WSPrivateTopicEventV5<'greeks', WSGreeksV5[]>; ⋮---- -export type WsTopic = WsPublicTopics | WsPrivateTopic; +export interface WSSpreadOrderV5 { + category: 'combination' | 'spot_leg' | 'future_leg'; + symbol: string; + parentOrderId: string; + orderId: string; + orderLinkId: string; + side: OrderSideV5; + orderStatus: OrderStatusV5; + cancelType: OrderCancelTypeV5; + rejectReason: OrderRejectReasonV5; + timeInForce: OrderTimeInForceV5; + price: string; + qty: string; + avgPrice: string; + leavesQty: string; + leavesValue: string; + cumExecQty: string; + cumExecValue: string; + cumExecFee: string; + orderType: OrderTypeV5; + isLeverage: string; + createdTime: string; + updatedTime: string; + feeCurrency: string; + createType: OrderCreateTypeV5; + closedPnl: string; + cumFeeDetail?: Record; // Cumulative trading fee details instead of cumExecFee and feeCurrency +} ⋮---- -/** This is used to differentiate between each of the available websocket streams (as bybit has multiple websockets) */ -export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP]; -export type WsMarket = 'all'; +cumFeeDetail?: Record; // Cumulative trading fee details instead of cumExecFee and feeCurrency ⋮---- -export interface WSClientConfigurableOptions { - /** Your API key */ - key?: string; - - /** Your API secret */ - secret?: string; - - /** - * Set to `true` to connect to Bybit's testnet environment. - * - * Notes: - * - * - If demo trading, `testnet` should be set to false! - * - If testing a strategy, use demo trading instead. Testnet market data is very different from real market conditions. - */ - testnet?: boolean; - - /** - * Set to `true` to connect to Bybit's V5 demo trading: https://bybit-exchange.github.io/docs/v5/demo - * - * Only the "V5" "market" is supported here. - */ - demoTrading?: boolean; - - /** - * The API group this client should connect to. The V5 market is currently used by default. - * - * Only the "V5" "market" is supported here. - */ - market?: APIMarket; - - /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ - recvWindow?: number; - - /** How often to check if the connection is alive */ - pingInterval?: number; - - /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ - pongTimeout?: number; - - /** Delay in milliseconds before respawning the connection */ - reconnectTimeout?: number; - - /** - * Select WebSocket routing with the same region values as REST. Uses a - * dedicated mainnet stream when Bybit documents one for that region. - * Top-level `apiRegion` takes precedence over `restOptions.apiRegion`. - */ - apiRegion?: APIRegion; - - /** - * Site ID sent as `x-site-id` during the Node.js WebSocket handshake. - * Brazil and Argentina internal accounts now use `stream.bybit.com` without this header. - * Keep passing it only if a remaining site still requires `x-site-id`. - */ - siteId?: string; - - /** - * REST options reused for WebSocket routing. - * Regional and site ID values are retained as fallbacks; prefer the matching - * top-level `apiRegion` and `siteId` options. - */ - restOptions?: RestClientOptions; - requestOptions?: AxiosRequestConfig; - - wsOptions?: { - protocols?: string[]; - agent?: any; - } & ( - | Omit, 'agent'> - | Omit, 'agent'> - ); - - wsUrl?: string; - - /** - * Default: false. - * - * When enabled, any calls to the subscribe method will return a promise. - * Note: internally, subscription requests are sent in batches. This may not behave as expected when - * subscribing to a large number of topics, especially if you are not yet connected when subscribing. - */ - promiseSubscribeRequests?: boolean; - - /** - * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method - * - * Look in the examples folder for a demonstration on using node's createHmac instead. - */ - customSignMessageFn?: (message: string, secret: string) => Promise; +export type WSSpreadOrderEventV5 = WSPrivateTopicEventV5< + 'spread.order', + WSSpreadOrderV5[] +>; +⋮---- +export interface WSSpreadExecutionV5 { + category: 'combination' | 'spot_leg' | 'future_leg'; + symbol: string; + isLeverage: string; + orderId: string; + orderLinkId: string; + side: OrderSideV5; + orderPrice: string; + orderQty: string; + leavesQty: string; + createType: OrderCreateTypeV5; + orderType: OrderTypeV5; + execFee: string; + execFeeV2: string; + feeCurrency: string; // Trading fee currency + parentExecId: string; + execId: string; + execPrice: string; + execQty: string; + execPnl: string; + execType: ExecTypeV5; + execValue: string; + execTime: string; + isMaker: boolean; + feeRate: string; + markPrice: string; + closedSize: string; + seq: number; } ⋮---- -/** Your API key */ +feeCurrency: string; // Trading fee currency ⋮---- -/** Your API secret */ +export type WSSpreadExecutionEventV5 = WSPrivateTopicEventV5< + 'spread.execution', + WSSpreadExecutionV5[] +>; ⋮---- -/** - * Set to `true` to connect to Bybit's testnet environment. - * - * Notes: - * - * - If demo trading, `testnet` should be set to false! - * - If testing a strategy, use demo trading instead. Testnet market data is very different from real market conditions. - */ +export interface WSInsuranceV5 { + coin: string; + symbols: string; + balance: string; + updateTime: string; +} ⋮---- -/** - * Set to `true` to connect to Bybit's V5 demo trading: https://bybit-exchange.github.io/docs/v5/demo - * - * Only the "V5" "market" is supported here. - */ +export type WSInsuranceEventV5 = WSPublicTopicEventV5< + 'insurance.USDT' | 'insurance.USDC' | 'insurance.inverse', + 'snapshot' | 'delta', + WSInsuranceV5[] +>; ⋮---- -/** - * The API group this client should connect to. The V5 market is currently used by default. - * - * Only the "V5" "market" is supported here. - */ +export interface WSPriceLimitV5 { + symbol: string; + buyLmt: string; + sellLmt: string; +} ⋮---- -/** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ +export type WSPriceLimitEventV5 = WSPublicTopicEventV5< + string, + 'snapshot', + WSPriceLimitV5 +>; ⋮---- -/** How often to check if the connection is alive */ +export interface WSADLAlertV5 { + c: string; // Token of the insurance pool + s: string; // Trading pair name + b: string; // Balance of the insurance fund. For shared insurance pool, follows T+1 refresh (updated daily at 00:00 UTC) + mb: string; // Deprecated: always returns empty string. Previously: Maximum balance of the insurance pool in the last 8 hours + i_pr: string; // PnL ratio threshold for triggering contract PnL drawdown ADL + pr: string; // Symbol's PnL drawdown ratio in the last 8 hours. Used to determine whether ADL is triggered or stopped + adl_tt: string; // Trigger threshold for contract PnL drawdown ADL + adl_sr: string; // Stop ratio threshold for contract PnL drawdown ADL +} ⋮---- -/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ +c: string; // Token of the insurance pool +s: string; // Trading pair name +b: string; // Balance of the insurance fund. For shared insurance pool, follows T+1 refresh (updated daily at 00:00 UTC) +mb: string; // Deprecated: always returns empty string. Previously: Maximum balance of the insurance pool in the last 8 hours +i_pr: string; // PnL ratio threshold for triggering contract PnL drawdown ADL +pr: string; // Symbol's PnL drawdown ratio in the last 8 hours. Used to determine whether ADL is triggered or stopped +adl_tt: string; // Trigger threshold for contract PnL drawdown ADL +adl_sr: string; // Stop ratio threshold for contract PnL drawdown ADL ⋮---- -/** Delay in milliseconds before respawning the connection */ +export type WSADLAlertEventV5 = WSPublicTopicEventV5< + 'adlAlert.USDT' | 'adlAlert.USDC' | 'adlAlert.inverse', + 'snapshot', + WSADLAlertV5[] +>; ⋮---- -/** - * Select WebSocket routing with the same region values as REST. Uses a - * dedicated mainnet stream when Bybit documents one for that region. - * Top-level `apiRegion` takes precedence over `restOptions.apiRegion`. - */ +export type WSSystemStatusEventV5 = WSPublicTopicEventV5< + 'system.status', + 'snapshot', + SystemStatusItemV5[] +>; ⋮---- /** - * Site ID sent as `x-site-id` during the Node.js WebSocket handshake. - * Brazil and Argentina internal accounts now use `stream.bybit.com` without this header. - * Keep passing it only if a remaining site still requires `x-site-id`. - */ + * RFQ WebSocket Events + */ ⋮---- /** - * REST options reused for WebSocket routing. - * Regional and site ID values are retained as fallbacks; prefer the matching - * top-level `apiRegion` and `siteId` options. - */ + * RFQ Inquiry Channel + * Private push for RFQ inquiries sent or received by the user + * Topics: rfq.open.rfqs, rfq.site.rfqs + */ +export type WSRFQInquiryEventV5 = WSPrivateTopicEventV5< + 'rfq.open.rfqs' | 'rfq.site.rfqs', + RFQItemV5[] +>; ⋮---- /** - * Default: false. - * - * When enabled, any calls to the subscribe method will return a promise. - * Note: internally, subscription requests are sent in batches. This may not behave as expected when - * subscribing to a large number of topics, especially if you are not yet connected when subscribing. - */ + * RFQ Quote Channel + * Private push for quotes sent or received by the user + * Topics: rfq.open.quotes, rfq.site.quotes + */ +export type WSRFQQuoteEventV5 = WSPrivateTopicEventV5< + 'rfq.open.quotes' | 'rfq.site.quotes', + RFQQuoteItemV5[] +>; ⋮---- /** - * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method - * - * Look in the examples folder for a demonstration on using node's createHmac instead. - */ + * RFQ Trade Channel + * Private push for block trades executed by the user + * Topics: rfq.open.trades, rfq.site.trades + */ +export type WSRFQTradeEventV5 = WSPrivateTopicEventV5< + 'rfq.open.trades' | 'rfq.site.trades', + RFQTradeV5[] +>; ⋮---- /** - * WS configuration that's always defined, regardless of user configuration - * (usually comes from defaults if there's no user-provided values) + * RFQ Public Trade Channel + * Public push for all block trades + * Topics: rfq.open.public.trades, rfq.site.public.trades */ -export interface WebsocketClientOptions extends WSClientConfigurableOptions { - market: APIMarket; - pongTimeout: number; - pingInterval: number; - reconnectTimeout: number; - recvWindow: number; - - /** - * If true, require a "receipt" that the connection is ready for use (e.g. a specific event type) - */ - requireConnectionReadyConfirmation: boolean; - authPrivateConnectionsOnConnect: boolean; - authPrivateRequests: boolean; - reauthWSAPIOnReconnect: boolean; +export type WSRFQPublicTradeEventV5 = WSPublicTopicEventV5< + 'rfq.open.public.trades' | 'rfq.site.public.trades', + 'snapshot', + RFQPublicTradeV5[] +>; - /** - * Whether to use native WebSocket ping/pong frames for heartbeats - */ - useNativeHeartbeats: boolean; -} +================ +File: src/types/shared-v5.ts +================ +export type CategoryV5 = 'spot' | 'linear' | 'inverse' | 'option'; +/** Public WS subscribe/routing category. Event Contract uses `'event'`; REST `CategoryV5` does not. */ +export type WSCategoryV5 = CategoryV5 | 'event'; +export type ContractTypeV5 = + | 'InversePerpetual' + | 'LinearPerpetual' + | 'InverseFutures'; +export type CopyTradingV5 = 'none' | 'both' | 'utaOnly' | 'normalOnly'; ⋮---- -/** - * If true, require a "receipt" that the connection is ready for use (e.g. a specific event type) - */ +export type InstrumentStatusV5 = + | 'PreLaunch' + | 'PendingOpen' + | 'Trading' + | 'Settling' + | 'Delivering' + | 'Closed'; ⋮---- /** - * Whether to use native WebSocket ping/pong frames for heartbeats - */ + * Region / product class returned as `symbolType` on instruments-info (and account instruments-info). + * For `category=linear`, includes e.g. `stock`, `forex`, `commodity`, `xstocks`. Spot may return `''`. + */ +export type InstrumentSymbolTypeV5 = + | '' + | 'stock' + | 'forex' + | 'commodity' + | 'xstocks'; ⋮---- -export type WsEventInternalSrc = 'event' | 'function' | 'frame'; - -================ -File: src/rest-client-v5.ts -================ -/* eslint-disable max-len */ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import { - AcceptNonLPQuoteParamsV5, - AcceptNonLPQuoteResultV5, - AccountBorrowCollateralLimitV5, - AccountCoinBalanceV5, - AccountInfoV5, - AccountInstrumentInfoResponseV5, - AccountMarginModeV5, - AccountOrderV5, - AccountTypeV5, - AddOrReduceMarginParamsV5, - AddOrReduceMarginResultV5, - AdjustCollateralAmountParamsV5, - AdjustCollateralAmountV5, - ADLAlertResponseV5, - AdvanceEarnAdvanceProductInfoV5, - AdvanceEarnOrderListV5, - AdvanceEarnPlaceOrderResultV5, - AdvanceEarnPositionListV5, - AdvanceEarnProductExtraInfoV5, - AffiliateSubAffiliateListResultV5, - AffiliateUserInfoV5, - AffiliateUserListItemV5, - AllCoinsBalanceV5, - AllowedDepositCoinInfoV5, - AlphaAssetDetailResultV5, - AlphaAssetListResultV5, - AlphaBizTokenDetailsV5, - AlphaBizTokenPriceListResultV5, - AlphaBizTokenV5, - AlphaLPOrderListResultV5, - AlphaLPPayTokenListResultV5, - AlphaLPPayTokenPriceResultV5, - AlphaLPPoolInfoV5, - AlphaLPPoolListResultV5, - AlphaLPPositionListResultV5, - AlphaPayTokenV5, - AlphaPredictionEngineStatusV5, - AlphaPredictionEventDetailV5, - AlphaPredictionOrderBookV5, - AlphaPredictionOrderEstimateV5, - AlphaPredictionOrderListResultV5, - AlphaPredictionPayTokenV5, - AlphaPredictionPortfolioSummaryV5, - AlphaPredictionPositionHistoryResultV5, - AlphaPredictionPositionListResultV5, - AlphaPredictionPriceHistoryV5, - AlphaPredictionSideMarketListResultV5, - AlphaPredictionSportsGroupStageDetailV5, - AlphaPredictionSportsMatchListResultV5, - AlphaPredictionSportsTimelineStagesV5, - AlphaPredictionTokenPriceV5, - AlphaTradeOrderListResultV5, - AlphaTradeQuoteResultV5, - AmendOrderParamsV5, - AmendSpreadOrderParamsV5, - ApiKeyInfoV5, - APIP2PChatResponse, - APIP2PResponse, - APIRateLimit, - APIResponseV3, - APIResponseV3WithTime, - AssetInfoV5, - AssetOverviewResultV5, - AutoRepayModeResultV5, - AvailableAmountToRepayV5, - BatchAmendOrderParamsV5, - BatchAmendOrderResultV5, - BatchCancelOrderParamsV5, - BatchCancelOrderResultV5, - BatchCreateOrderResultV5, - BatchOrderParamsV5, - BatchOrdersRetExtInfoV5, - BorrowableCoinV5, - BorrowContractInfoFixedV5, - BorrowCryptoLoanParamsV5, - BorrowFlexibleParamsV5, - BorrowFlexibleV5, - BorrowHistoryFlexibleV5, - BorrowHistoryRecordV5, - BorrowOrderInfoFixedV5, - BorrowOrderQuoteFixedV5, - BrokerIssuedVoucherV5, - BrokerRateLimitAllItemV5, - BrokerRateLimitCapItemV5, - BrokerRateLimitSetResultItemV5, - BrokerVoucherSpecV5, - CancelAllOrdersParamsV5, - CancelAllRFQResultV5, - CancelBorrowOrderFixedParamsV5, - CancelEventQuoteParamsV5, - CancelOrderParamsV5, - CancelRFQParamsV5, - CancelRFQQuoteItemV5, - CancelRFQQuoteParamsV5, - CancelRFQQuoteResultV5, - CancelRFQResultV5, - CancelSupplyOrderFixedParamsV5, - CardAssetRecordsResultV5, - CardMallItemListResultV5, - CardPointBalanceV5, - CardPointCashbackDetailV5, - CardPointRecordsResultV5, - CardPointTierInfoV5, - CategoryCursorListV5, - CategoryListV5, - CategorySymbolListV5, - CategoryV5, - ClaimPwmWithdrawableFundsParamsV5, - ClaimPwmWithdrawableFundsResultV5, - ClosedOptionsPositionV5, - ClosedPnLV5, - CoinExchangeRecordV5, - CoinGreeksV5, - CoinInfoV5, - CoinStateV5, - CollateralAdjustmentHistoryV5, - CollateralDataV5, - CollateralInfoV5, - CompletedLoanOrderV5, - ConfirmNewRiskLimitParamsV5, - ConvertCoinsParamsV5, - ConvertCoinSpecV5, - ConvertHistoryRecordV5, - ConvertQuoteV5, - ConvertStatusV5, - CreateBorrowOrderFixedParamsV5, - CreateBorrowOrderFixedV5, - CreateP2PAdParamsV5, - CreatePwmAssetManagerInvestmentPlanParamsV5, - CreatePwmAssetManagerInvestmentPlanResultV5, - CreatePwmCustomizeInvestmentPlanParamsV5, - CreatePwmCustomizeInvestmentPlanResultV5, - CreatePwmFundParamsV5, - CreatePwmFundResultV5, - CreatePwmFundSubAccountParamsV5, - CreatePwmFundSubAccountResultV5, - CreateRFQParamsV5, - CreateRFQQuoteParamsV5, - CreateRFQQuoteResultV5, - CreateRFQResultV5, - CreateStrategyOrderParamsV5, - CreateStrategyOrderResultV5, - CreateSubApiKeyParamsV5, - CreateSubApiKeyResultV5, - CreateSubMemberParamsV5, - CreateSubMemberResultV5, - CreateSupplyOrderFixedParamsV5, - CreateSupplyOrderFixedV5, - CreateTaxBatchExportParamsV5, - CryptoLoanPositionV5, - CurrencyPositionTiersV5, - CursorListV5, - CursorRowsV5, - DCPInfoV5, - DeleteSubMemberParamsV5, - DeliveryPriceV5, - DeliveryRecordV5, - DepositAddressChainV5, - DepositRecordV5, - EarnAprHistoryPointV5, - EarnCouponListResultV5, - EarnHourlyYieldHistoryV5, - EarnOrderHistoryV5, - EarnPositionV5, - EarnProductV5, - EarnTokenDailyYieldRecordV5, - EarnTokenHistoryAprPointV5, - EarnTokenHourlyYieldRecordV5, - EarnTokenOrderV5, - EarnTokenPositionV5, - EarnTokenProductV5, - EarnYieldHistoryV5, - EventActiveOrdersResultV5, - EventInstrumentInfoResultV5, - EventOrderbookV5, - EventOrderHistoryResultV5, - EventPositionInfoResultV5, - EventQuoteResultV5, - EventSettlementRecordsResultV5, - EventTradeHistoryResultV5, - ExchangeBrokerAccountInfoV5, - ExchangeBrokerEarningResultV5, - ExchangeBrokerSubAccountDepositRecordV5, - ExecuteAlphaLPRedeemParamsV5, - ExecuteAlphaLPRedeemResultV5, - ExecuteAlphaLPStakeParamsV5, - ExecuteAlphaLPStakeResultV5, - ExecuteAlphaPredictionBuyParamsV5, - ExecuteAlphaPredictionOrderResultV5, - ExecuteAlphaPredictionSellParamsV5, - ExecuteAlphaTradeParamsV5, - ExecuteAlphaTradeResultV5, - ExecuteRFQQuoteParamsV5, - ExecuteRFQQuoteResultV5, - ExecutionV5, - FeeGroupStructureResponseV5, - FeeRateV5, - FiatTradingPairListV5, - FixedLoanAvailableInventoryV5, - FixedRateAvailableInventoryV5, - FixedRateBorrowContractInfoV5, - FixedRateBorrowOrderInfoV5, - FixedRateBorrowParamsV5, - FixedRateBorrowQuoteV5, - FixedRateBorrowResultV5, - FixedTermEarnOrderListV5, - FixedTermEarnPlaceOrderResultV5, - FixedTermEarnPositionListV5, - FixedTermEarnProductListV5, - FlexibleAvailableInventoryV5, - FlexibleLoanAvailableInventoryV5, - FlexibleSavingAutoSavingsV5, - FriendReferralRecordV5, - FundingAccountTransactionRecordV5, - FundingRateHistoryResponseV5, - FuturesLeverageResultV5, - GetAccountCoinBalanceParamsV5, - GetAccountHistoricOrdersParamsV5, - GetAccountInstrumentsInfoParamsV5, - GetAccountOrdersParamsV5, - GetADLAlertParamsV5, - GetAdvanceEarnOrderListParamsV5, - GetAdvanceEarnPositionListParamsV5, - GetAdvanceEarnProductExtraInfoParamsV5, - GetAdvanceEarnProductParamsV5, - GetAffiliateSubAffiliateListParamsV5, - GetAffiliateUserInfoParamsV5, - GetAffiliateUserListParamsV5, - GetAllBrokerRateLimitsParamsV5, - GetAllCoinsBalanceParamsV5, - GetAllowedDepositCoinInfoParamsV5, - GetAlphaAssetDetailParamsV5, - GetAlphaBizTokenDetailsParamsV5, - GetAlphaBizTokenListParamsV5, - GetAlphaBizTokenPriceListParamsV5, - GetAlphaLPOrderListParamsV5, - GetAlphaLPPayTokenListParamsV5, - GetAlphaLPPayTokenPriceParamsV5, - GetAlphaLPPoolInfoParamsV5, - GetAlphaLPPoolListParamsV5, - GetAlphaPayTokenListParamsV5, - GetAlphaPredictionEventDetailParamsV5, - GetAlphaPredictionOrderBookParamsV5, - GetAlphaPredictionOrderEstimateParamsV5, - GetAlphaPredictionOrderListParamsV5, - GetAlphaPredictionPortfolioSummaryParamsV5, - GetAlphaPredictionPositionHistoryParamsV5, - GetAlphaPredictionPositionListParamsV5, - GetAlphaPredictionPriceHistoryParamsV5, - GetAlphaPredictionSideMarketListParamsV5, - GetAlphaPredictionSportsGroupStageDetailParamsV5, - GetAlphaPredictionSportsMatchListParamsV5, - GetAlphaPredictionSportsTimelineStagesParamsV5, - GetAlphaPredictionTokenPriceParamsV5, - GetAlphaTradeOrderListParamsV5, - GetAlphaTradeQuoteParamsV5, - GetAssetInfoParamsV5, - GetAssetOverviewParamsV5, - GetAutoRepayModeParamsV5, - GetAvailableAmountToRepayParamsV5, - GetBorrowableCoinsParamsV5, - GetBorrowContractInfoFixedParamsV5, - GetBorrowHistoryFlexibleParamsV5, - GetBorrowHistoryParamsV5, - GetBorrowOrderInfoFixedParamsV5, - GetBorrowOrderQuoteFixedParamsV5, - GetBrokerIssuedVoucherParamsV5, - GetBrokerSubAccountDepositsV5, - GetClassicTransactionLogsParamsV5, - GetClosedOptionsPositionsParamsV5, - GetClosedPnLParamsV5, - GetCoinDeltaAmountParamsV5, - GetCoinExchangeRecordParamsV5, - GetCoinStateParamsV5, - GetCollateralAdjustmentHistoryParamsV5, - GetCollateralCoinsParamsV5, - GetCompletedLoanOrderHistoryParamsV5, - GetConvertHistoryParamsV5, - GetDeliveryPriceParamsV5, - GetDeliveryRecordParamsV5, - GetDepositRecordParamsV5, - GetEarnAprHistoryParamsV5, - GetEarnCouponListParamsV5, - GetEarnHourlyYieldHistoryParamsV5, - GetEarnOrderHistoryParamsV5, - GetEarnPositionParamsV5, - GetEarnTokenDailyYieldParamsV5, - GetEarnTokenHistoryAprParamsV5, - GetEarnTokenHourlyYieldParamsV5, - GetEarnTokenOrderListParamsV5, - GetEarnTokenPositionParamsV5, - GetEarnTokenProductParamsV5, - GetEarnYieldHistoryParamsV5, - GetEventActiveOrdersParamsV5, - GetEventInstrumentsInfoParamsV5, - GetEventOrderbookParamsV5, - GetEventOrderHistoryParamsV5, - GetEventPositionInfoParamsV5, - GetEventSettlementRecordsParamsV5, - GetEventTradeHistoryParamsV5, - GetExchangeBrokerEarningsParamsV5, - GetExecutionListParamsV5, - GetFeeGroupStructureParamsV5, - GetFeeRateParamsV5, - GetFiatTradingPairListParamsV5, - GetFixedLoanAvailableInventoryParamsV5, - GetFixedRateAvailableInventoryParamsV5, - GetFixedRateBorrowContractInfoParamsV5, - GetFixedRateBorrowOrderInfoParamsV5, - GetFixedRateBorrowOrderQuoteParamsV5, - GetFixedTermEarnOrderListParamsV5, - GetFixedTermEarnPositionParamsV5, - GetFixedTermEarnProductParamsV5, - GetFlexibleAvailableInventoryParamsV5, - GetFlexibleLoanAvailableInventoryParamsV5, - GetFlexibleSavingAutoSavingsParamsV5, - GetFriendReferralsParamsV5, - GetFullDepthOrderbookParamsV5, - GetFundingAccountTransactionHistoryParamsV5, - GetFundingRateHistoryParamsV5, - GetFuturesLeverageParamsV5, - GetHistoricalVolatilityParamsV5, - GetHoldToEarnAirdropYieldHistoryParamsV5, - GetIndexPriceComponentsParamsV5, - GetIndexPriceKlineParamsV5, - GetInstrumentsInfoParamsV5, - GetInsuranceParamsV5, - GetInternalDepositRecordParamsV5, - GetInternalTransferParamsV5, - GetKlineParamsV5, - GetLaunchpoolProjectListParamsV5, - GetLaunchpoolUserActivityLogParamsV5, - GetLaunchpoolUserHistoryParamsV5, - GetLiquidityMiningProductParamsV5, - GetLoanLTVAdjustmentHistoryParamsV5, - GetLongShortRatioParamsV5, - GetMarkPriceKlineParamsV5, - GetMaxBorrowableAmountParamsV5, - GetMaxCollateralAmountParamsV5, - GetMaxLoanAmountParamsV5, - GetMovePositionHistoryParamsV5, - GetOngoingFlexibleLoansParamsV5, - GetOpenInterestParamsV5, - GetOptionBaseCoinsParamsV5, - GetOptionDeliveryPriceParamsV5, - GetOrderbookParamsV5, - GetP2PAccountCoinsBalanceParamsV5, - GetP2PChatMessagesParamsV5, - GetP2PChatSessionIdParamsV5, - GetP2PChatSessionsParamsV5, - GetP2PCounterpartyUserInfoParamsV5, - GetP2POnlineAdsParamsV5, - GetP2POrderMessagesParamsV5, - GetP2POrdersParamsV5, - GetP2PPendingOrdersParamsV5, - GetP2PPersonalAdsParamsV5, - GetPayInfoParamsV5, - GetPortfolioMarginInfoParamsV5, - GetPositionTiersParamsV5, - GetPremiumIndexPriceKlineParamsV5, - GetPreUpgradeClosedPnlParamsV5, - GetPreUpgradeOptionDeliveryRecordParamsV5, - GetPreUpgradeOrderHistoryParamsV5, - GetPreUpgradeTradeHistoryParamsV5, - GetPreUpgradeTransactionLogParamsV5, - GetPreUpgradeUSDCSessionParamsV5, - GetPublicTradingHistoryParamsV5, - GetPuzzleProjectListParamsV5, - GetPwmAllFundOrdersParamsV5, - GetPwmAllFundsParamsV5, - GetPwmAssetManagerInvestmentPlansParamsV5, - GetPwmFundHistoricalNavParamsV5, - GetPwmFundTransferRecordsParamsV5, - GetPwmInvestmentPlanAssetTrendParamsV5, - GetPwmInvestmentPlanDetailParamsV5, - GetPwmInvestmentPlanOrdersParamsV5, - GetPwmPendingInvestmentPlanDetailParamsV5, - GetRenewOrderInfoFixedParamsV5, - GetRepaymentHistoryFixedParamsV5, - GetRepaymentHistoryFlexibleParamsV5, - GetRepaymentHistoryParamsV5, - GetRFQDetailsParamsV5, - GetRFQHistoryParamsV5, - GetRFQListParamsV5, - GetRFQPublicTradesParamsV5, - GetRFQQuoteRealtimeParamsV5, - GetRFQRealtimeParamsV5, - GetRFQRealtimeResultV5, - GetRFQTradeListParamsV5, - GetRiskLimitParamsV5, - GetRPIOrderbookParamsV5, - GetRWANavChartParamsV5, - GetRWAOrderListParamsV5, - GetRWAProductListParamsV5, - GetSettlementRecordParamsV5, - GetSmallBalanceListParamsV5, - GetSpotMarginCurrencyDataParamsV5, - GetSpotMarginLiabilityInfoParamsV5, - GetSpreadInstrumentsInfoParamsV5, - GetSpreadMaxQtyParamsV5, - GetSpreadOpenOrdersParamsV5, - GetSpreadOrderHistoryParamsV5, - GetSpreadTradeHistoryParamsV5, - GetStrategyListParamsV5, - GetStrategyOrderListParamsV5, - GetSubAccountAllApiKeysParamsV5, - GetSubAccountDepositRecordParamsV5, - GetSupplyContractInfoFixedParamsV5, - GetSupplyOrderInfoFixedParamsV5, - GetSupplyOrderQuoteFixedParamsV5, - GetSystemStatusParamsV5, - GetTaxBatchExportParamsV5, - GetTickersParamsV5, - GetTokenSplashProjectListParamsV5, - GetTokenSplashUserActivityParamsV5, - GetTotalMembersAssetsParamsV5, - GetTradeInfoForAnalysisParamsV5, - GetTransactionLogParamsV5, - GetUniversalTransferRecordsParamsV5, - GetUnpaidLoanOrdersParamsV5, - GetVIPMarginDataParamsV5, - GetWalletBalanceParamsV5, - GetWithdrawalAddressListParamsV5, - GetWithdrawalRecordsParamsV5, - HistoricalVolatilityV5, - HoldToEarnAirdropProductsResultV5, - HoldToEarnAirdropYieldHistoryResultV5, - IndexPriceComponentsResponseV5, - InstitutionalLendingCoinDeltaAmountV5, - InstitutionalLendingDelayLiquidationStatusV5, - InstitutionalLendingProductInfoV5, - InstitutionalLoanLTVV5, - InstrumentInfoResponseV5, - InsuranceResponseV5, - InternalDepositRecordV5, - InternalTransferRecordV5, - InvestMorePwmInvestmentPlanParamsV5, - InvestMorePwmInvestmentPlanResultV5, - IssueVoucherParamsV5, - LaunchpoolActivityLogResultV5, - LaunchpoolCurrentStakingResultV5, - LaunchpoolProjectListResultV5, - LaunchpoolUserHistoryResultV5, - LiquidityMiningProductResultV5, - LoanLTVAdjustmentHistoryV5, - LongShortRatioV5, - ManagePwmAssetManagerInvestmentPlanParamsV5, - ManagePwmAssetManagerInvestmentPlanResultV5, - ManagePwmFundOrderParamsV5, - ManagePwmFundOrderResultV5, - ManualBorrowParamsV5, - ManualBorrowResultV5, - ManualRepayParamsV5, - ManualRepayResultV5, - ManualRepayWithoutConversionParamsV5, - ManualRepayWithoutConversionResultV5, - MarkP2POrderAsPaidParamsV5, - MaxBorrowableAmountV5, - MaxLoanAmountV5, - MMPModifyParamsV5, - MMPStateV5, - ModifyEarnPositionParamsV5, - MovePositionHistoryV5, - MovePositionParamsV5, - MovePositionResultV5, - OHLCKlineV5, - OHLCVKlineV5, - OngoingFlexibleLoanV5, - OpenInterestResponseV5, - OptionAssetInfoNestedResultV5, - OptionBaseCoinsResultV5, - OptionDeliveryPriceV5, - OrderbookResponseV5, - OrderParamsV5, - OrderPriceLimitV5, - OrderResultV5, - OrderSideV5, - P2PAccountCoinsBalanceV5, - P2PAdDetailV5, - P2PChatMessagesResponseV5, - P2PChatSessionsResponseV5, - P2PCounterpartyUserInfoV5, - P2PCreateAdResponseV5, - P2POnlineAdsResponseV5, - P2POrderDetailV5, - P2POrderMessageV5, - P2POrdersResponseV5, - P2PPersonalAdsResponseV5, - P2PUserInfoV5, - P2PUserPaymentV5, - PayInfoResultV5, - PlaceEarnTokenOrderParamsV5, - PlaceEarnTokenOrderResultV5, - PlaceRWAOrderParamsV5, - PlaceRWAOrderResultV5, - PortfolioMarginInfoResultV5, - PositionInfoParamsV5, - PositionV5, - PreCheckOrderResultV5, - PreUpgradeOptionsDelivery, - PreUpgradeTransaction, - PreUpgradeUSDCSessionSettlement, - PublicTradeV5, - PuzzleProjectListResultV5, - PwmAllFundOrdersResultV5, - PwmAllFundsResultV5, - PwmAssetManagerInvestmentPlansResultV5, - PwmFundHistoricalNavResultV5, - PwmFundTransferParamsV5, - PwmFundTransferRecordV5, - PwmFundTransferResultV5, - PwmInvestmentPlanAssetTrendResultV5, - PwmInvestmentPlanDetailV5, - PwmInvestmentPlanListResultV5, - PwmInvestmentPlanOrdersResultV5, - PwmPendingInvestmentPlanDetailV5, - PwmSubscribableProductInfoResultV5, - QueryCardAssetRecordsParamsV5, - QueryCardMallItemListParamsV5, - QueryCardPointCashbackDetailParamsV5, - QueryCardPointRecordsParamsV5, - RedeemFixedTermEarnParamsV5, - RedeemFixedTermEarnResultV5, - RedeemPwmInvestmentPlanParamsV5, - RedeemPwmInvestmentPlanResultV5, - ReferralCodesResultV5, - ReinvestLiquidityMiningParamsV5, - ReinvestLiquidityMiningResultV5, - RenewBorrowOrderFixedParamsV5, - RenewBorrowOrderFixedV5, - RenewFixedRateBorrowParamsV5, - RenewOrderInfoFixedV5, - RepayCollateralFixedParamsV5, - RepayCollateralFlexibleParamsV5, - RepayFixedParamsV5, - RepayFixedV5, - RepayFlexibleParamsV5, - RepayFlexibleV5, - RepayInstitutionalLoanParamsV5, - RepayInstitutionalLoanResultV5, - RepayLiabilityParamsV5, - RepayLiabilityResultV5, - RepaymentHistoryFixedV5, - RepaymentHistoryFlexibleV5, - RepaymentHistoryV5, - RequestConvertQuoteParamsV5, - RFQConfigV5, - RFQDetailItemV5, - RFQHistory, - RFQPublicTradeV5, - RFQQuoteItemV5, - RFQTradeV5, - RiskLimitV5, - RPIOrderbookResponseV5, - RWANavChartResultV5, - RWAOrderListResultV5, - RWAPositionListResultV5, - RWAProductListResultV5, - SendP2PChatMessageParamsV5, - SendP2POrderMessageParamsV5, - SetAutoAddMarginParamsV5, - SetAutoRepayModeParamsV5, - SetBrokerRateLimitParamsV5, - SetCollateralCoinParamsV5, - SetDeltaNeutralModeParamsV5, - SetFixedTermEarnAutoInvestParamsV5, - SetFlexibleSavingAutoSavingsParamsV5, - SetLeverageParamsV5, - SetLimitPriceActionParamsV5, - SetRiskLimitParamsV5, - SetRiskLimitResultV5, - SetSpotMarginLeverageParamsV5, - SettlementRecordV5, - SettlePwmFundProfitParamsV5, - SettlePwmFundProfitResultV5, - SetTPSLModeParamsV5, - SetTradingStopParamsV5, - SignAgreementParamsV5, - SmallBalanceListV5, - SpotBorrowCheckResultV5, - SpotMarginCurrencyDataV5, - SpotMarginLiabilityInfoV5, - SpotMarginStateV5, - SpreadInstrumentInfoV5, - SpreadMaxQtyResultV5, - SpreadOpenOrderV5, - SpreadOrderbookResponseV5, - SpreadOrderHistoryV5, - SpreadRecentTradeV5, - SpreadTickerV5, - SpreadTradeV5, - StopStrategyParamsV5, - StopStrategyResultV5, - StrategyListResultV5, - StrategyOrderListResultV5, - SubMemberV5, - SubmitAdvanceEarnPlaceOrderParamsV5, - SubmitDepositOriginatorInfoParamsV5, - SubmitDepositOriginatorInfoResultV5, - SubmitEventQuoteParamsV5, - SubmitFixedTermEarnOrderParamsV5, - SubmitSpreadOrderParamsV5, - SubmitStakeRedeemParamsV5, - SubscribePwmInvestmentPlanParamsV5, - SubscribePwmInvestmentPlanResultV5, - SupplyContractInfoFixedV5, - SupplyOrderInfoFixedV5, - SupplyOrderQuoteFixedV5, - SwitchIsolatedMarginParamsV5, - SwitchPositionModeParamsV5, - SystemStatusItemV5, - TaxBatchExportResultV5, - TaxBatchExportStatusV5, - TickerLinearInverseV5, - TickerOptionV5, - TickerSpotV5, - TokenSplashProjectListResultV5, - TokenSplashUserActivityResultV5, - TotalMembersAssetsResultV5, - TPSLModeV5, - TradeInfoForAnalysisResultV5, - TransactionLogV5, - UnifiedAccountUpgradeResultV5, - UniversalTransferParamsV5, - UniversalTransferRecordV5, - UnpaidLoanOrderV5, - UpdateApiKeyParamsV5, - UpdateApiKeyResultV5, - UpdateP2PAdParamsV5, - UserSettingConfigV5, - VaspEntityV5, - VipBorrowableCoinsV5, - VipCollateralCoinsV5, - VIPMarginDataV5, - WalletBalanceV5, - WithdrawableAmountV5, - WithdrawalAddressV5, - WithdrawalRecordV5, - WithdrawParamsV5, -} from './types'; -import { REST_CLIENT_TYPE_ENUM } from './util'; -import BaseRestClient from './util/BaseRestClient'; +export type MarginTradingV5 = 'none' | 'both' | 'utaOnly' | 'normalSpotOnly'; +⋮---- +/** Product type for strategy APIs (create / list). */ +export type StrategyCategoryV5 = + | 'UTA_USDT' + | 'UTA_USDC' + | 'UTA_USDC_FUTURE' + | 'UTA_SPOT' + | 'UTA_INVERSE' + | 'UTA_INVERSE_FUTURE' + | 'UTA_USDT_FUTURE'; +⋮---- +export type StrategyTypeV5 = 'twap' | 'chaseOrder' | 'iceberg' | 'pov'; +⋮---- +export type StrategyPreferV5 = + | 'limit' + | 'priceSpeedBalance' + | 'fastestExecution' + | 'quickExecution'; +⋮---- +/** POV strategy execution mode */ +export type PovModeV5 = + | 'TradedVolume' + | 'OppositeSideLiquidity' + | 'SameSideLiquidity'; +⋮---- +export type OrderFilterV5 = 'Order' | 'tpslOrder' | 'StopOrder'; +export type OrderSideV5 = 'Buy' | 'Sell'; +export type OrderTypeV5 = 'Market' | 'Limit'; +export type OrderTimeInForceV5 = 'GTC' | 'IOC' | 'FOK' | 'PostOnly' | 'RPI'; +export type OrderTriggerByV5 = 'LastPrice' | 'IndexPrice' | 'MarkPrice'; +export type OCOTriggerTypeV5 = + | 'OcoTriggerByUnknown' + | 'OcoTriggerTp' + | 'OcoTriggerBySl'; +⋮---- +export type OrderSMPTypeV5 = + | 'None' + | 'CancelMaker' + | 'CancelTaker' + | 'CancelBoth'; +⋮---- +export type OrderStatusV5 = + | 'Created' + | 'New' + | 'Rejected' + | 'PartiallyFilled' + | 'PartiallyFilledCanceled' + | 'Filled' + | 'Cancelled' + | 'Untriggered' + | 'Triggered' + | 'Deactivated' + | 'Active'; +⋮---- +/** + * Defines the types of order creation mechanisms. + */ +export type OrderCreateTypeV5 = + /** Represents an order created by a user. */ + | 'CreateByUser' + /** Represents an order created by an admin closing. */ + | 'CreateByAdminClosing' + /** Futures conditional order. */ + | 'CreateByStopOrder' + /** Futures take profit order. */ + | 'CreateByTakeProfit' + /** Futures partial take profit order. */ + | 'CreateByPartialTakeProfit' + /** Futures stop loss order. */ + | 'CreateByStopLoss' + /** Futures partial stop loss order. */ + | 'CreateByPartialStopLoss' + /** Futures trailing stop order. */ + | 'CreateByTrailingStop' + /** Laddered liquidation to reduce the required maintenance margin. */ + | 'CreateByLiq' + /** + * If the position is still subject to liquidation (i.e., does not meet the required maintenance margin level), + * the position shall be taken over by the liquidation engine and closed at the bankruptcy price. + */ + | 'CreateByTakeOver_PassThrough' + /** Auto-Deleveraging(ADL) */ + | 'CreateByAdl_PassThrough' + /** Order placed via Paradigm. */ + | 'CreateByBlock_PassThrough' + /** Order created by move position. */ + | 'CreateByBlockTradeMovePosition_PassThrough' + /** The close order placed via web or app position area - web/app. */ + | 'CreateByClosing' + /** Order created via grid bot - web/app. */ + | 'CreateByFGridBot' + /** Order closed via grid bot - web/app. */ + | 'CloseByFGridBot' + /** Order created by TWAP - web/app. */ + | 'CreateByTWAP' + /** Order created by TV webhook - web/app. */ + | 'CreateByTVSignal' + /** Order created by Mm rate close function - web/app. */ + | 'CreateByMmRateClose' + /** Order created by Martingale bot - web/app. */ + | 'CreateByMartingaleBot' + /** Order closed by Martingale bot - web/app. */ + | 'CloseByMartingaleBot' + /** Order created by Ice berg strategy - web/app. */ + | 'CreateByIceBerg' + /** Order created by arbitrage - web/app. */ + | 'CreateByArbitrage' + /** Option dynamic delta hedge order - web/app */ + | 'CreateByDdh' + /** BBO Order - Best Bid/Offer order */ + | 'CreateByBboOrder'; +⋮---- +/** Represents an order created by a user. */ +⋮---- +/** Represents an order created by an admin closing. */ +⋮---- +/** Futures conditional order. */ +⋮---- +/** Futures take profit order. */ +⋮---- +/** Futures partial take profit order. */ +⋮---- +/** Futures stop loss order. */ +⋮---- +/** Futures partial stop loss order. */ +⋮---- +/** Futures trailing stop order. */ +⋮---- +/** Laddered liquidation to reduce the required maintenance margin. */ +⋮---- +/** + * If the position is still subject to liquidation (i.e., does not meet the required maintenance margin level), + * the position shall be taken over by the liquidation engine and closed at the bankruptcy price. + */ +⋮---- +/** Auto-Deleveraging(ADL) */ +⋮---- +/** Order placed via Paradigm. */ +⋮---- +/** Order created by move position. */ +⋮---- +/** The close order placed via web or app position area - web/app. */ +⋮---- +/** Order created via grid bot - web/app. */ +⋮---- +/** Order closed via grid bot - web/app. */ +⋮---- +/** Order created by TWAP - web/app. */ +⋮---- +/** Order created by TV webhook - web/app. */ +⋮---- +/** Order created by Mm rate close function - web/app. */ +⋮---- +/** Order created by Martingale bot - web/app. */ +⋮---- +/** Order closed by Martingale bot - web/app. */ +⋮---- +/** Order created by Ice berg strategy - web/app. */ +⋮---- +/** Order created by arbitrage - web/app. */ +⋮---- +/** Option dynamic delta hedge order - web/app */ +⋮---- +/** BBO Order - Best Bid/Offer order */ +⋮---- +export type OrderCancelTypeV5 = + | 'CancelByUser' + | 'CancelByReduceOnly' + | 'CancelByPrepareLiq' + | 'CancelAllBeforeLiq' + | 'CancelByPrepareAdl' + | 'CancelAllBeforeAdl' + | 'CancelByAdmin' + | 'CancelByTpSlTsClear' + | 'CancelByPzSideCh' + | 'UNKNOWN'; +⋮---- +export type OrderRejectReasonV5 = + | 'EC_NoError' + | 'EC_Others' + | 'EC_UnknownMessageType' + | 'EC_MissingClOrdID' + | 'EC_MissingOrigClOrdID' + | 'EC_ClOrdIDOrigClOrdIDAreTheSame' + | 'EC_DuplicatedClOrdID' + | 'EC_OrigClOrdIDDoesNotExist' + | 'EC_TooLateToCancel' + | 'EC_UnknownOrderType' + | 'EC_UnknownSide' + | 'EC_UnknownTimeInForce' + | 'EC_WronglyRouted' + | 'EC_MarketOrderPriceIsNotZero' + | 'EC_LimitOrderInvalidPrice' + | 'EC_NoEnoughQtyToFill' + | 'EC_NoImmediateQtyToFill' + | 'EC_PerCancelRequest' + | 'EC_MarketOrderCannotBePostOnly' + | 'EC_PostOnlyWillTakeLiquidity' + | 'EC_CancelReplaceOrder' + | 'EC_InvalidSymbolStatus'; +⋮---- +export type StopOrderTypeV5 = + | 'TakeProfit' + | 'StopLoss' + | 'TrailingStop' + | 'Stop' + | 'PartialTakeProfit' + | 'PartialStopLoss' + | 'tpslOrder' + | 'OcoOrder' + | 'MmRateClose' + | 'BidirectionalTpslOrder'; +⋮---- +/** + * Position index. Used to identify positions in different position modes. + * + * - 0 one-way mode position + * - 1 Buy side of hedge-mode position + * - 2 Sell side of hedge-mode position + */ +export type PositionIdx = 0 | 1 | 2; +⋮---- +/** + * Position status. + * + * - 'Normal' + * - 'Liq' in the liquidation progress + * - 'Adl' in the auto-deleverage progress + */ +export type PositionStatusV5 = 'Normal' | 'Liq' | 'Adl'; +export type PositionSideV5 = 'Buy' | 'Sell' | 'None' | ''; +⋮---- +export type OptionTypeV5 = 'Call' | 'Put'; +⋮---- +/** + * Trade mode. + * + * - 0 cross-margin, + * - 1 isolated margin + */ +export type TradeModeV5 = 0 | 1; +⋮---- +export type TPSLModeV5 = 'Full' | 'Partial'; +export type AccountMarginModeV5 = + | 'ISOLATED_MARGIN' + | 'REGULAR_MARGIN' + | 'PORTFOLIO_MARGIN'; +export type UnifiedUpdateStatusV5 = 'FAIL' | 'PROCESS' | 'SUCCESS'; +⋮---- +export type AccountTypeV5 = + | 'CONTRACT' + | 'SPOT' + | 'INVESTMENT' + | 'OPTION' + | 'UNIFIED' + | 'FUND' + | 'EARN'; +⋮---- +export type TransactionTypeV5 = + | 'TRANSFER_IN' + | 'TRANSFER_OUT' + | 'TRADE' + | 'SETTLEMENT' + | 'DELIVERY' + | 'LIQUIDATION' + | 'ADL' + | 'AIRDROP' + | 'BONUS_RECOLLECT' + | 'BONUS_RECOLLECT' + | 'FEE_REFUND' + | 'INTEREST' + | 'CURRENCY_BUY' + | 'CURRENCY_SELL' + | 'BORROWED_AMOUNT_INS_LOAN' + | 'PRINCIPLE_REPAYMENT_INS_LOAN' + | 'INTEREST_REPAYMENT_INS_LOAN' + | 'AUTO_SOLD_COLLATERAL_INS_LOAN' + | 'AUTO_BUY_LIABILITY_INS_LOAN' + | 'AUTO_PRINCIPLE_REPAYMENT_INS_LOAN' + | 'AUTO_INTEREST_REPAYMENT_INS_LOAN' + | 'TRANSFER_IN_INS_LOAN' + | 'TRANSFER_OUT_INS_LOAN' + | 'SPOT_REPAYMENT_SELL' + | 'SPOT_REPAYMENT_BUY' + | 'TOKENS_SUBSCRIPTION' + | 'TOKENS_REDEMPTION' + | 'AUTO_DEDUCTION' + | 'FLEXIBLE_STAKING_SUBSCRIPTION' + | 'FLEXIBLE_STAKING_REDEMPTION' + | 'FIXED_STAKING_SUBSCRIPTION' + | 'BORROWED_AMOUNT_INS_LOAN' + | 'PRINCIPLE_REPAYMENT_INS_LOAN' + | 'INTEREST_REPAYMENT_INS_LOAN' + | 'AUTO_SOLD_COLLATERAL_INS_LOAN' + | 'AUTO_BUY_LIABILITY_INS_LOAN' + | 'AUTO_PRINCIPLE_REPAYMENT_INS_LOAN' + | 'AUTO_INTEREST_REPAYMENT_INS_LOAN' + | 'TRANSFER_IN_INS_LOAN' + | 'TRANSFER_OUT_INS_LOAN' + | 'SPOT_REPAYMENT_SELL' + | 'SPOT_REPAYMENT_BUY' + | 'TOKENS_SUBSCRIPTION' + | 'TOKENS_REDEMPTION' + | 'AUTO_DEDUCTION' + | 'FLEXIBLE_STAKING_SUBSCRIPTION' + | 'FLEXIBLE_STAKING_REDEMPTION' + | 'FIXED_STAKING_SUBSCRIPTION' + | 'FLEXIBLE_STAKING_REFUND' + | 'FIXED_STAKING_REFUND' + | 'PREMARKET_TRANSFER_OUT' + | 'PREMARKET_DELIVERY_SELL_NEW_COIN' + | 'PREMARKET_DELIVERY_BUY_NEW_COIN' + | 'PREMARKET_DELIVERY_PLEDGE_PAY_SELLER' + | 'PREMARKET_DELIVERY_PLEDGE_BACK' + | 'PREMARKET_ROLLBACK_PLEDGE_BACK' + | 'PREMARKET_ROLLBACK_PLEDGE_PENALTY_TO_BUYER' + | 'CUSTODY_NETWORK_FEE' + | 'CUSTODY_SETTLE_FEE' + | 'CUSTODY_LOCK' + | 'CUSTODY_UNLOCK' + | 'CUSTODY_UNLOCK_REFUND' + | 'LOANS_BORROW_FUNDS' + | 'LOANS_PLEDGE_ASSET' + | 'BONUS_TRANSFER_IN' + | 'BONUS_TRANSFER_OUT' + | 'PEF_TRANSFER_IN' + | 'PEF_TRANSFER_OUT' + | 'PEF_PROFIT_SHARE' + | 'ONCHAINEARN_SUBSCRIPTION' + | 'ONCHAINEARN_REDEMPTION' + | 'ONCHAINEARN_REFUND' + | 'STRUCTURE_PRODUCT_SUBSCRIPTION' + | 'STRUCTURE_PRODUCT_REFUND' + | 'CLASSIC_WEALTH_MANAGEMENT_SUBSCRIPTION' + | 'PREMIMUM_WEALTH_MANAGEMENT_SUBSCRIPTION' + | 'PREMIMUM_WEALTH_MANAGEMENT_REFUND' + | 'LIQUIDITY_MINING_SUBSCRIPTION' + | 'LIQUIDITY_MINING_REFUND' + | 'PWM_SUBSCRIPTION' + | 'PWM_REFUND' + | 'DEFI_INVESTMENT_SUBSCRIPTION' + | 'DEFI_INVESTMENT_REFUND' + | 'DEFI_INVESTMENT_REDEMPTION' + | 'INSTITUTION_LOAN_IN' + | 'INSTITUTION_PAYBACK_PRINCIPAL_OUT' + | 'INSTITUTION_PAYBACK_INTEREST_OUT' + | 'INSTITUTION_EXCHANGE_SELL' + | 'INSTITUTION_EXCHANGE_BUY' + | 'INSTITUTION_LIQ_PRINCIPAL_OUT' + | 'INSTITUTION_LIQ_INTEREST_OUT' + | 'INSTITUTION_LOAN_TRANSFER_IN' + | 'INSTITUTION_LOAN_TRANSFER_OUT' + | 'INSTITUTION_LOAN_WITHOUT_WITHDRAW' + | 'INSTITUTION_LOAN_RESERVE_IN' + | 'INSTITUTION_LOAN_RESERVE_OUT' + | 'PLATFORM_TOKEN_MNT_LIQRECALLEDMMNT' + | 'PLATFORM_TOKEN_MNT_LIQRETURNEDMNT' + | 'DIVIDEND_SETTLEMENT' + | 'FORWARD_SPLIT_SETTLE' + | 'REVERSE_SPLIT_SETTLE'; +⋮---- +export type PermissionTypeV5 = + | 'ContractTrade' + | 'Spot' + | 'Wallet' + | 'Options' + | 'Derivatives' + | 'Exchange' + | 'NFT'; +⋮---- +/** + * Leveraged token status: + * + * - '1' LT can be purchased and redeemed + * - '2' LT can be purchased, but not redeemed + * - '3' LT can be redeemed, but not purchased + * - '4' LT cannot be purchased nor redeemed + * - '5' Adjusting position + */ +export type LeverageTokenStatusV5 = '1' | '2' | '3' | '4' | '5'; +⋮---- +/** + * Leveraged token order type: '1': purchase, '2': redeem + */ +export type LTOrderTypeV5 = '1' | '2'; +⋮---- +/** + * Leveraged token order status: '1': completed, '2': in progress, '3': failed + */ +export type LTOrderStatusV5 = '1' | '2' | '3'; +⋮---- +export type ExecTypeV5 = + | 'Trade' + | 'AdlTrade' + | 'Funding' + | 'BustTrade' + | 'Settle' + | 'BlockTrade' + | 'MovePosition' + /** @deprecated Removed from Bybit execType; kept for older payloads. */ + | 'CorporateAction' + | 'ForwardSplitSettle' + | 'ReverseSplitSettle' + | 'Dividend' + | 'UNKNOWN'; +⋮---- +/** @deprecated Removed from Bybit execType; kept for older payloads. */ +⋮---- +/** + * Withdraw type. 0(default): on chain. 1: off chain. 2: all. + */ +export type WithdrawalTypeV5 = '0' | '1' | '2'; +⋮---- +export interface PermissionsV5 { + ContractTrade?: string[]; + Spot?: string[]; + Wallet?: string[]; + Options?: string[]; + Derivatives?: string[]; + CopyTrading?: string[]; + BlockTrade?: string[]; + Exchange?: string[]; + /** @deprecated , always returns []*/ + NFT?: string[]; + Earn?: string[]; + Affiliate?: string[]; + FiatP2P?: string[]; + /** Bybit Pay (FaitPayOrder) */ + FiatBitPay?: string[]; + FiatConvertBroker?: string[]; + BitCard?: string[]; + ByXPost?: string[]; +} +⋮---- +/** @deprecated , always returns []*/ +⋮---- +/** Bybit Pay (FaitPayOrder) */ +⋮---- +export interface CategoryCursorListV5< + T extends unknown[], + TCategory extends CategoryV5 = CategoryV5, +> { + category: TCategory; + list: T; + nextPageCursor?: string; +} +⋮---- +/** + * Next page cursor does not exist for spot! + */ +export interface CursorListV5 { + nextPageCursor: string; + list: T; +} +⋮---- +/** + * A wrapper type for any responses that have a "nextPageCursor" property, and a "rows" property with an array of elements + * + * ```{ nextPageCursor: "something", rows: someData[] }``` + */ +export interface CursorRowsV5 { + nextPageCursor: string; + rows: T; +} +⋮---- +export interface CategoryListV5< + T extends unknown[], + TCategory extends CategoryV5, +> { + category: TCategory; + list: T; +} +⋮---- +export interface CategorySymbolListV5< + T extends unknown[], + TCategory extends CategoryV5, +> { + category: TCategory; + symbol: string; + list: T; +} ⋮---- -/** - * REST API client for V5 REST APIs - * - * https://bybit-exchange.github.io/docs/v5/intro - */ -export class RestClientV5 extends BaseRestClient +export interface GetSystemStatusParamsV5 { + id?: string; + state?: string; +} ⋮---- -/** - * - ****** Custom SDK APIs - * - */ +export interface SystemStatusItemV5 { + id: string; + title: string; + state: string; + begin: string; + end: string; + href: string; + serviceTypes: number[]; + product: number[]; + uidSuffix: number[]; + maintainType: string; + env: string; +} + +================ +File: src/types/request/index.ts +================ + + +================ +File: src/types/response/index.ts +================ + + +================ +File: src/types/response/v5-asset.ts +================ +import { AccountTypeV5, OrderSideV5, WithdrawalTypeV5 } from '../shared-v5'; ⋮---- -/** - * This method is used to get the latency and time sync between the client and the server. - * This is not official API endpoint and is only used for internal testing purposes. - * Use this method to check the latency and time sync between the client and the server. - * Final values might vary slightly, but it should be within few ms difference. - * If you have any suggestions or improvements to this measurement, please create an issue or pull request on GitHub. - */ -async fetchLatencySummary(): Promise +export interface CoinExchangeRecordV5 { + fromCoin: string; + fromAmount: string; + toCoin: string; + toAmount: string; + exchangeRate: string; + createdTime: string; + exchangeTxId: string; +} ⋮---- -// Adjust server time by adding estimated one-way latency +export interface DeliveryRecordV5 { + deliveryTime: number; + symbol: string; + side: OrderSideV5; + position: string; + deliveryPrice: string; + strike: string; + fee: string; + deliveryRpl: string; + entryPrice: string; +} +⋮---- +export interface SettlementRecordV5 { + symbol: string; + side: string; + size: number; + sessionAvgPrice: string; + markPrice: string; + realisedPnl: string; + createdTime: string; +} +⋮---- +export interface AssetInfoAssetV5 { + coin: string; + frozen: string; + free: string; + withdraw: string; +} +⋮---- +export interface AssetInfoV5 { + status: 'ACCOUNT_STATUS_NORMAL' | 'ACCOUNT_STATUS_UNSPECIFIED'; + assets: AssetInfoAssetV5[]; +} +⋮---- +export interface CoinBalanceV5 { + coin: string; + walletBalance: string; + transferBalance: string; + bonus?: string; +} +⋮---- +export interface AllCoinsBalanceV5 { + accountType: AccountTypeV5; + memberId?: string; + balance: CoinBalanceV5[]; +} +⋮---- +export interface AccountCoinBalanceV5 { + accountType: AccountTypeV5; + bizType: number; + accountId: string; + memberId: string; + balance: { + coin: string; + walletBalance: string; + transferBalance: string; + bonus: string; + transferSafeAmount: string; + ltvTransferSafeAmount: string; + }; +} +⋮---- +export interface InternalTransferRecordV5 { + transferId: string; + coin: string; + amount: string; + fromAccountType: AccountTypeV5; + toAccountType: AccountTypeV5; + timestamp: string; + status: string; +} +⋮---- +export interface UniversalTransferRecordV5 { + transferId: string; + coin: string; + amount: string; + fromMemberId: string; + toMemberId: string; + fromAccountType: AccountTypeV5; + toAccountType: AccountTypeV5; + timestamp: string; + status: string; + withdrawReqId?: string; + depositReqId?: string; +} +⋮---- +export interface AllowedDepositCoinInfoV5 { + coin: string; + chain: string; + coinShowName: string; + chainType: string; + blockConfirmNumber: number; + minDepositAmount: string; +} +⋮---- +export interface DepositRecordV5 { + id: string; + coin: string; + chain: string; + amount: string; + txID: string; + status: number; + toAddress: string; + tag: string; + depositFee: string; + successAt: string; + confirmations: string; + txIndex: string; + blockHash: string; + batchReleaseLimit: string; + depositType: string; + fromAddress: string; + travelRuleStatus?: string; +} +⋮---- +export interface SubmitDepositOriginatorInfoResultV5 { + travelRuleStatus: number; +} +⋮---- +export interface InternalDepositRecordV5 { + id: string; + type: 1; + coin: string; + amount: string; + status: 1 | 2 | 3; + address: string; + createdTime: string; + txID: string; + complianceStatus?: string; +} +⋮---- +export interface DepositAddressChainV5 { + chainType: string; + addressDeposit: string; + tagDeposit: string; + chain: string; + batchReleaseLimit: string; + contractAddress: string; +} +⋮---- +export interface DepositAddressResultV5 { + coin: string; + chains: DepositAddressChainV5[]; +} +⋮---- +export interface CoinInfoV5 { + name: string; + coin: string; + /** @deprecated Use `chains[].withdrawMax` instead */ + remainAmount: string; + chains: { + chain: string; + chainType: string; + confirmation: string; + withdrawFee: string; + depositMin: string; + withdrawMin: string; + minAccuracy: string; + chainDeposit: string; + chainWithdraw: string; + withdrawPercentageFee: string; + contractAddress: string; + safeConfirmNumber: string; + /** Max withdraw amount per transaction per chain. `-1` means no limit */ + withdrawMax: string; + }[]; +} +⋮---- +/** @deprecated Use `chains[].withdrawMax` instead */ +⋮---- +/** Max withdraw amount per transaction per chain. `-1` means no limit */ +⋮---- +export interface WithdrawalRecordV5 { + withdrawId: string; + txID: string; + withdrawType: WithdrawalTypeV5; + coin: string; + chain: string; + amount: string; + withdrawFee: string; + status: string; + toAddress: string; + tag: string; + createTime: string; + updateTime: string; +} +⋮---- +export interface WithdrawalAddressV5 { + coin: string; + chain: string; + address: string; + tag: string; + remark: string; + status: number; + addressType: number; + verified: number; + createdAt: string; +} ⋮---- -// Calculate time difference between adjusted server time and local time +export interface WithdrawableAccountSliceV5 { + coin: string; + withdrawableAmount: string; + availableBalance: string; +} ⋮---- /** - * - ****** Misc Bybit APIs - * - */ + * GET /v5/asset/withdraw/withdrawable-amount. Only keys with data are returned + * (e.g. UTA, FUND, EARN; EARN when the coin can be withdrawn from Earn; SPOT if present). + */ +export interface WithdrawableAmountV5 { + limitAmountUsd: string; + withdrawableAmount: { + SPOT?: WithdrawableAccountSliceV5; + FUND?: WithdrawableAccountSliceV5; + UTA?: WithdrawableAccountSliceV5; + EARN?: WithdrawableAccountSliceV5; + }; +} ⋮---- -getSystemStatus(params?: GetSystemStatusParamsV5): Promise< - APIResponseV3WithTime<{ - list: SystemStatusItemV5[]; - }> - > { - return this.getPrivate('/v5/system/status', params); +export interface VaspEntityV5 { + vaspEntityId: string; + vaspName: string; +} ⋮---- -getClientType() +export interface ConvertCoinSpecV5 { + coin: string; + fullName: string; + icon: string; + iconNight: string; + accuracyLength: number; + coinType: string; + balance: string; + uBalance: string; + singleFromMinLimit: string; + singleFromMaxLimit: string; + disableFrom: boolean; + disableTo: boolean; + timePeriod: number; + singleToMinLimit: string; + singleToMaxLimit: string; + dailyFromMinLimit: string; + dailyFromMaxLimit: string; + dailyToMinLimit: string; + dailyToMaxLimit: string; +} ⋮---- -async fetchServerTime(): Promise +export interface ConvertQuoteV5 { + quoteTxId: string; + exchangeRate: string; + fromCoin: string; + fromCoinType: string; + toCoin: string; + toCoinType: string; + fromAmount: string; + toAmount: string; + expiredTime: string; + requestId: string; + extTaxAndFee: string[]; +} ⋮---- -getServerTime(): Promise< - APIResponseV3WithTime<{ timeSecond: string; timeNano: string }> - > { - return this.get('/v5/market/time'); +export interface ConvertStatusV5 { + accountType: string; + exchangeTxId: string; + userId: string; + fromCoin: string; + fromCoinType: string; + toCoin: string; + toCoinType: string; + fromAmount: string; + toAmount: string; + exchangeStatus: 'init' | 'processing' | 'success' | 'failure'; + extInfo: { paramType: string; paramValue: string }; + convertRate: string; + createdAt: string; +} ⋮---- -/** - * - ****** Demo Account APIs - * - */ +export interface ConvertHistoryRecordV5 { + accountType: string; + exchangeTxId: string; + userId: string; + fromCoin: string; + fromCoinType: string; + toCoin: string; + toCoinType: string; + fromAmount: string; + toAmount: string; + exchangeStatus: 'init' | 'processing' | 'success' | 'failure'; + extInfo: { paramType: string; paramValue: string }; + convertRate: string; + createdAt: string; +} ⋮---- -requestDemoTradingFunds(params?: { - adjustType?: 0 | 1; - utaDemoApplyMoney?: Array<{ - coin: string; - amountStr: string; - }>; -}): Promise - > { - return this.get('/v5/spread/instrument', params); +smallAssetCoins: SmallBalanceCoinV5[]; // Small balance info +supportToCoins: string[]; // Supported target coins (e.g., ["MNT","USDT","USDC"]) ⋮---- -/** - * Get Spread Orderbook - */ -getSpreadOrderbook(params: { - symbol: string; - limit?: number; -}): Promise> +export interface FiatCoinInfoV5 { + coin: string; // Fiat coin code + fullName: string; // Fiat full coin name + icon: string; // Coin icon url + iconNight: string; // Coin icon url (dark mode) + precision: number; // Fiat precision + disable: boolean; // true: the coin is disabled, false: the coin is allowed + singleFromMinLimit: string; // For buy side, minimum amount of fiatCoin per transaction + singleFromMaxLimit: string; // For buy side, maximum amount of fiatCoin per transaction +} ⋮---- -/** - * Get Spread Tickers - */ -getSpreadTickers(params: { symbol: string }): Promise< - APIResponseV3WithTime<{ - list: SpreadTickerV5[]; - }> - > { - return this.get('/v5/spread/tickers', params); +coin: string; // Fiat coin code +fullName: string; // Fiat full coin name +icon: string; // Coin icon url +iconNight: string; // Coin icon url (dark mode) +precision: number; // Fiat precision +disable: boolean; // true: the coin is disabled, false: the coin is allowed +singleFromMinLimit: string; // For buy side, minimum amount of fiatCoin per transaction +singleFromMaxLimit: string; // For buy side, maximum amount of fiatCoin per transaction ⋮---- -/** - * Get Spread Public Recent Trades - */ -getSpreadRecentTrades(params: { symbol: string; limit?: number }): Promise< - APIResponseV3WithTime<{ - list: SpreadRecentTradeV5[]; - }> - > { - return this.get('/v5/spread/recent-trade', params); +export interface CryptoCoinInfoV5 { + coin: string; // Crypto coin code + fullName: string; // Crypto full coin name + icon: string; // Coin icon url + iconNight: string; // Coin icon url (dark mode) + precision: number; // Crypto precision + disable: boolean; // true: the coin is disabled, false: the coin is allowed + singleFromMinLimit: string; // For sell side, minimum amount of cryptoCoin per transaction + singleFromMaxLimit: string; // For sell side, maximum amount of cryptoCoin per transaction +} ⋮---- -/** - * Get Spread Max Qty - * Max order quantity (available balance) for a spread order at a given side and price. - */ -getSpreadMaxQty( - params: GetSpreadMaxQtyParamsV5, -): Promise> +coin: string; // Crypto coin code +fullName: string; // Crypto full coin name +icon: string; // Coin icon url +iconNight: string; // Coin icon url (dark mode) +precision: number; // Crypto precision +disable: boolean; // true: the coin is disabled, false: the coin is allowed +singleFromMinLimit: string; // For sell side, minimum amount of cryptoCoin per transaction +singleFromMaxLimit: string; // For sell side, maximum amount of cryptoCoin per transaction ⋮---- -/** - * Create Spread Order - */ -submitSpreadOrder(params: SubmitSpreadOrderParamsV5): Promise< - APIResponseV3WithTime<{ - orderId: string; - orderLinkId: string; - }> - > { - return this.postPrivate('/v5/spread/order/create', params); +export interface FiatTradingPairListV5 { + fiats: FiatCoinInfoV5[]; // Fiat coin list + cryptos: CryptoCoinInfoV5[]; // Crypto coin list +} ⋮---- -/** - * Amend Spread Order - * You can only modify unfilled or partially filled orders. - */ -amendSpreadOrder(params: AmendSpreadOrderParamsV5): Promise< - APIResponseV3WithTime<{ - orderId: string; - orderLinkId: string; - }> - > { - return this.postPrivate('/v5/spread/order/amend', params); +fiats: FiatCoinInfoV5[]; // Fiat coin list +cryptos: CryptoCoinInfoV5[]; // Crypto coin list ⋮---- -/** - * Cancel Spread Order - */ -cancelSpreadOrder(params: { - orderId?: string; - orderLinkId?: string; - }): Promise< - APIResponseV3WithTime<{ - orderId: string; - orderLinkId: string; - }> - > { - return this.postPrivate('/v5/spread/order/cancel', params); +export interface FundingAccountTransactionRecordV5 { + memberId: string; + currency: string; + ioDirection: string; + txnAmt: string; + afterAmt: string; + createTime: string; + showBusiType: string; + showBusiTypeEn: string; + description: string; + descriptionEn: string; + currcCursor?: string; +} ⋮---- -/** - * Cancel All Spread Orders - * - * When a symbol is specified, all orders for that symbol will be canceled regardless of the cancelAll field. - * When symbol is not specified and cancelAll=true, all orders, regardless of the symbol, will be canceled. - */ -cancelAllSpreadOrders(params?: { - symbol?: string; - cancelAll?: boolean; - }): Promise< - APIResponseV3WithTime<{ - list: { - orderId: string; - orderLinkId: string; - }[]; - success: string; - }> - > { - return this.postPrivate('/v5/spread/order/cancel-all', params); +/** When accountType=Alpha and category is farm, under `coinDetail` in sub-categories. */ +export interface AssetOverviewCoinExtMapV5 { + priceUpper?: string; + priceLower?: string; + equityUnit?: string; +} ⋮---- -/** - * Get Spread Open Orders - * Query unfilled or partially filled orders in real-time. - */ -getSpreadOpenOrders(params?: GetSpreadOpenOrdersParamsV5): Promise< - APIResponseV3WithTime<{ - list: SpreadOpenOrderV5[]; - nextPageCursor: string; - }> - > { - return this.getPrivate('/v5/spread/order/realtime', params); +export interface AssetOverviewCoinDetailV5 { + coin: string; + equity: string; + extMap?: AssetOverviewCoinExtMapV5; +} ⋮---- -/** - * Get Spread Order History - * - * Note: - * - orderId & orderLinkId has a higher priority than startTime & endTime - * - Fully canceled orders are stored for up to 24 hours - * - Single leg orders can also be found with "createType"=CreateByFutureSpread via Get Order History - */ -getSpreadOrderHistory(params?: GetSpreadOrderHistoryParamsV5): Promise< - APIResponseV3WithTime<{ - list: SpreadOrderHistoryV5[]; - nextPageCursor: string; - }> - > { - return this.getPrivate('/v5/spread/order/history', params); +export interface AssetOverviewCategoryV5 { + category: string; + equity: string; + coinDetail: AssetOverviewCoinDetailV5[]; +} ⋮---- -/** - * Get Spread Trade History - * - * Note: - * - In self-trade cases, both the maker and taker single-leg trades will be returned in the same request - * - Single leg executions can also be found with "execType"=FutureSpread via Get Trade History - */ -getSpreadTradeHistory(params?: GetSpreadTradeHistoryParamsV5): Promise< - APIResponseV3WithTime<{ - list: SpreadTradeV5[]; - nextPageCursor: string; - }> - > { - return this.getPrivate('/v5/spread/execution/list', params); +export interface AssetOverviewAccountItemV5 { + accountType: string; + totalEquity: string; + valuationCurrency: string; + snapshotTime: string; + coinDetail?: AssetOverviewCoinDetailV5[]; + categories?: AssetOverviewCategoryV5[]; +} ⋮---- -/** - * - ****** Market APIs - * - */ +export interface AssetOverviewResultV5 { + totalEquity: string; + list: AssetOverviewAccountItemV5[]; +} ⋮---- -/** - * Query the kline data. Charts are returned in groups based on the requested interval. - * - * Covers: Spot / Linear contract / Inverse contract - */ -getKline( - params: GetKlineParamsV5, - ): Promise< - APIResponseV3WithTime< - CategorySymbolListV5 - > - > { - return this.get('/v5/market/kline', params); +// --- GET /v5/asset/portfolio-margin (portfolio margin P&L ranges) --- ⋮---- -/** - * Query the mark price kline data. Charts are returned in groups based on the requested interval. - * - * Covers: USDT contract / USDC contract / Inverse contract / Options - * - * `category` defaults to linear if omitted. For options, `limit` max is 500; futures max is 1000. - */ -getMarkPriceKline( - params: GetMarkPriceKlineParamsV5, - ): Promise< - APIResponseV3WithTime< - CategorySymbolListV5 - > - > { - return this.get('/v5/market/mark-price-kline', params); +export interface PortfolioMarginWalletV5 { + equity: string; + cashBalance: string; + marginBalance: string; + availableBalance: string; + accountIM: string; + accountMM: string; + accountMMRate: string; + accountIMRate: string; +} ⋮---- -/** - * Query the index price kline data. Charts are returned in groups based on the requested interval. - * - * Covers: Linear contract / Inverse contract - */ -getIndexPriceKline( - params: GetIndexPriceKlineParamsV5, - ): Promise< - APIResponseV3WithTime< - CategorySymbolListV5 - > - > { - return this.get('/v5/market/index-price-kline', params); +export interface PortfolioMarginPnlRangePointV5 { + priceScale: string; + pnls: string[]; +} ⋮---- -/** - * Retrieve the premium index price kline data. Charts are returned in groups based on the requested interval. - * - * Covers: Linear contract - */ -getPremiumIndexPriceKline( - params: GetPremiumIndexPriceKlineParamsV5, - ): Promise< - APIResponseV3WithTime> - > { - return this.get('/v5/market/premium-index-price-kline', params); +export interface PortfolioMarginContractBucketPnlV5 { + pnlRanges: PortfolioMarginPnlRangePointV5[]; +} ⋮---- -/** - * Query a list of instruments of online trading pair. - * - * Covers: Spot / Linear contract / Inverse contract / Option - * - * Note: Spot does not support pagination, so limit & cursor are invalid. - * Note: e.g. `symbolType: 'commodity'`, and for linear also `stock`, `forex` (see Bybit Get Instruments Info). - */ -getInstrumentsInfo( - params: GetInstrumentsInfoParamsV5 & { category: C }, -): Promise>> +export interface PortfolioMarginTotalPnlRangesV5 { + ALL?: PortfolioMarginContractBucketPnlV5; + PERPETUAL?: PortfolioMarginContractBucketPnlV5; + OPTION?: PortfolioMarginContractBucketPnlV5; +} ⋮---- -/** - * Query orderbook data - * - * Covers: Spot / Linear contract / Inverse contract / Option - */ -getOrderbook( - params: GetOrderbookParamsV5, -): Promise> +export interface PortfolioMarginPerpPositionPnlV5 { + symbolName: string; + position: string; + pnlRanges: PortfolioMarginPnlRangePointV5[]; + sessionAvgPrice: string; + markPrice: string; + orderSize: string; + contractType: number; + settleCoin: string; + symbolAlias?: string; +} ⋮---- -getFullDepthOrderbook( - params: GetFullDepthOrderbookParamsV5, -): Promise> +export interface PortfolioMarginOptionPositionPnlV5 { + symbolName: string; + position: string; + pnlRanges: PortfolioMarginPnlRangePointV5[]; + sessionAvgPrice: string; + markPrice: string; + orderSize: string; + contractType: number; + settleCoin: string; +} ⋮---- -/** - * Get RPI Orderbook - * Query for orderbook depth data with RPI (Retail Price Improvement) information. - * - * Covers: Spot / USDT contract / USDC contract / Inverse contract - * Contract: 50-level of RPI orderbook data - * Spot: 50-level of RPI orderbook data - */ -getRPIOrderbook( - params: GetRPIOrderbookParamsV5, -): Promise> +export interface PortfolioMarginOptionExpiryPnlV5 { + expiryDateRepresentation: string; + pnlRanges: PortfolioMarginPnlRangePointV5[]; + optionPositionPnlRanges: PortfolioMarginOptionPositionPnlV5[]; +} ⋮---- -getTickers( +export interface PortfolioMarginContingencyV5 { + optionContingency: string; + futureDeltaContingency: string; + optionVegaContingency: string; + contingencyComponents: string; + usdtUsdcContingency: string; + futureContingency: string; +} ⋮---- -getTickers( - params: GetTickersParamsV5<'option'>, - ): Promise>>; +export interface PortfolioMarginAssetBlockV5 { + coin: string; + assetIM: string; + assetMM: string; +} ⋮---- -getTickers( - params: GetTickersParamsV5<'spot'>, - ): Promise>>; +export interface PortfolioMarginSpotHedgeInfoV5 { + hedgeSpotSize: string; + walletBalance: string; + usdIndexPrice: string; + pnlRanges: PortfolioMarginPnlRangePointV5[]; +} ⋮---- -/** - * Query the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours. - * - * Covers: Spot / Linear contract / Inverse contract / Option - */ -getTickers( - params: GetTickersParamsV5, - ): Promise< - APIResponseV3WithTime< - | CategoryListV5 - | CategoryListV5 - | CategoryListV5 - > - > { - return this.get('/v5/market/tickers', params); +export interface PortfolioMarginByBaseCoinV5 { + baseCoin: string; + totalPnlRanges: PortfolioMarginTotalPnlRangesV5; + perpPositionPnlRanges: PortfolioMarginPerpPositionPnlV5[]; + optionExpiryDatePnlRanges: PortfolioMarginOptionExpiryPnlV5[]; + contingency: PortfolioMarginContingencyV5; + asset: PortfolioMarginAssetBlockV5; + maxLossPriceMove: string; + maxLossIvShock: string; + totalClosePzFee: string; + spotHedgeInfo: PortfolioMarginSpotHedgeInfoV5; + maxLossIvShockList: string[]; +} ⋮---- -/** - * Query historical funding rate. Each symbol has a different funding interval. - * - * Covers: Linear contract / Inverse perpetual - */ -getFundingRateHistory( - params: GetFundingRateHistoryParamsV5, - ): Promise< - APIResponseV3WithTime< - CategoryListV5 - > - > { - return this.get('/v5/market/funding/history', params); +export interface PortfolioMarginInfoResultV5 { + wallet: PortfolioMarginWalletV5; + assetPnlRange: PortfolioMarginByBaseCoinV5[]; +} ⋮---- -/** - * Query recent public trading data in Bybit. - * - * Covers: Spot / Linear contract / Inverse contract / Option - */ -getPublicTradingHistory( - params: GetPublicTradingHistoryParamsV5, - ): Promise< - APIResponseV3WithTime> - > { - return this.get('/v5/market/recent-trade', params); +// --- GET /v5/asset/total-members-assets --- ⋮---- -/** - * Get open interest of each symbol. - * - * Covers: Linear contract / Inverse contract - */ -getOpenInterest( - params: GetOpenInterestParamsV5, -): Promise> +export interface TotalMembersAccountBreakdownItemV5 { + type: string; + origb: string; + quoteb: string; + stat: number; +} ⋮---- -/** - * Query option historical volatility - * Covers: Option - */ -getHistoricalVolatility( - params: GetHistoricalVolatilityParamsV5, - ): Promise< - APIResponseV3WithTime> - > { - return this.get('/v5/market/historical-volatility', params); +export interface TotalMembersMemberEntryV5 { + uid: number; + isM?: boolean; + type?: number; + stat: number; + origb: string; + quoteb?: string; + items: TotalMembersAccountBreakdownItemV5[]; +} ⋮---- -/** - * Query Bybit insurance pool data (BTC/USDT/USDC etc). The data is updated every 24 hours. - */ -getInsurance( - params?: GetInsuranceParamsV5, -): Promise> +export interface TotalMembersAssetsResultV5 { + total: string; + quoteTotal: string; + stat: number; + list: TotalMembersMemberEntryV5[]; +} + +================ +File: src/rest-client-v5.ts +================ +/* eslint-disable max-len */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { + AcceptNonLPQuoteParamsV5, + AcceptNonLPQuoteResultV5, + AccountBorrowCollateralLimitV5, + AccountCoinBalanceV5, + AccountInfoV5, + AccountInstrumentInfoResponseV5, + AccountMarginModeV5, + AccountOrderV5, + AccountTypeV5, + AddOrReduceMarginParamsV5, + AddOrReduceMarginResultV5, + AdjustCollateralAmountParamsV5, + AdjustCollateralAmountV5, + ADLAlertResponseV5, + AdvanceEarnAdvanceProductInfoV5, + AdvanceEarnOrderListV5, + AdvanceEarnPlaceOrderResultV5, + AdvanceEarnPositionListV5, + AdvanceEarnProductExtraInfoV5, + AffiliateSubAffiliateListResultV5, + AffiliateUserInfoV5, + AffiliateUserListItemV5, + AllCoinsBalanceV5, + AllowedDepositCoinInfoV5, + AlphaAssetDetailResultV5, + AlphaAssetListResultV5, + AlphaBizTokenDetailsV5, + AlphaBizTokenPriceListResultV5, + AlphaBizTokenV5, + AlphaLPOrderListResultV5, + AlphaLPPayTokenListResultV5, + AlphaLPPayTokenPriceResultV5, + AlphaLPPoolInfoV5, + AlphaLPPoolListResultV5, + AlphaLPPositionListResultV5, + AlphaPayTokenV5, + AlphaPredictionEngineStatusV5, + AlphaPredictionEventDetailV5, + AlphaPredictionOrderBookV5, + AlphaPredictionOrderEstimateV5, + AlphaPredictionOrderListResultV5, + AlphaPredictionPayTokenV5, + AlphaPredictionPortfolioSummaryV5, + AlphaPredictionPositionHistoryResultV5, + AlphaPredictionPositionListResultV5, + AlphaPredictionPriceHistoryV5, + AlphaPredictionSideMarketListResultV5, + AlphaPredictionSportsGroupStageDetailV5, + AlphaPredictionSportsMatchListResultV5, + AlphaPredictionSportsTimelineStagesV5, + AlphaPredictionTokenPriceV5, + AlphaTradeOrderListResultV5, + AlphaTradeQuoteResultV5, + AmendOrderParamsV5, + AmendSpreadOrderParamsV5, + ApiKeyInfoV5, + APIP2PChatResponse, + APIP2PResponse, + APIRateLimit, + APIResponseV3, + APIResponseV3WithTime, + AssetInfoV5, + AssetOverviewResultV5, + AutoRepayModeResultV5, + AvailableAmountToRepayV5, + BatchAmendOrderParamsV5, + BatchAmendOrderResultV5, + BatchCancelOrderParamsV5, + BatchCancelOrderResultV5, + BatchCreateOrderResultV5, + BatchOrderParamsV5, + BatchOrdersRetExtInfoV5, + BorrowableCoinV5, + BorrowContractInfoFixedV5, + BorrowCryptoLoanParamsV5, + BorrowFlexibleParamsV5, + BorrowFlexibleV5, + BorrowHistoryFlexibleV5, + BorrowHistoryRecordV5, + BorrowOrderInfoFixedV5, + BorrowOrderQuoteFixedV5, + BrokerIssuedVoucherV5, + BrokerRateLimitAllItemV5, + BrokerRateLimitCapItemV5, + BrokerRateLimitSetResultItemV5, + BrokerVoucherSpecV5, + CancelAllOrdersParamsV5, + CancelAllRFQResultV5, + CancelBorrowOrderFixedParamsV5, + CancelEventQuoteParamsV5, + CancelOrderParamsV5, + CancelRFQParamsV5, + CancelRFQQuoteItemV5, + CancelRFQQuoteParamsV5, + CancelRFQQuoteResultV5, + CancelRFQResultV5, + CancelSupplyOrderFixedParamsV5, + CardAssetRecordsResultV5, + CardMallItemListResultV5, + CardPointBalanceV5, + CardPointCashbackDetailV5, + CardPointRecordsResultV5, + CardPointTierInfoV5, + CategoryCursorListV5, + CategoryListV5, + CategorySymbolListV5, + CategoryV5, + ClaimPwmWithdrawableFundsParamsV5, + ClaimPwmWithdrawableFundsResultV5, + ClosedOptionsPositionV5, + ClosedPnLV5, + CoinExchangeRecordV5, + CoinGreeksV5, + CoinInfoV5, + CoinStateV5, + CollateralAdjustmentHistoryV5, + CollateralDataV5, + CollateralInfoV5, + CompletedLoanOrderV5, + ConfirmNewRiskLimitParamsV5, + ConvertCoinsParamsV5, + ConvertCoinSpecV5, + ConvertHistoryRecordV5, + ConvertQuoteV5, + ConvertStatusV5, + CreateBorrowOrderFixedParamsV5, + CreateBorrowOrderFixedV5, + CreateP2PAdParamsV5, + CreatePwmAssetManagerInvestmentPlanParamsV5, + CreatePwmAssetManagerInvestmentPlanResultV5, + CreatePwmCustomizeInvestmentPlanParamsV5, + CreatePwmCustomizeInvestmentPlanResultV5, + CreatePwmFundParamsV5, + CreatePwmFundResultV5, + CreatePwmFundSubAccountParamsV5, + CreatePwmFundSubAccountResultV5, + CreateRFQParamsV5, + CreateRFQQuoteParamsV5, + CreateRFQQuoteResultV5, + CreateRFQResultV5, + CreateStrategyOrderParamsV5, + CreateStrategyOrderResultV5, + CreateSubApiKeyParamsV5, + CreateSubApiKeyResultV5, + CreateSubMemberParamsV5, + CreateSubMemberResultV5, + CreateSupplyOrderFixedParamsV5, + CreateSupplyOrderFixedV5, + CreateTaxBatchExportParamsV5, + CryptoLoanPositionV5, + CurrencyPositionTiersV5, + CursorListV5, + CursorRowsV5, + DCPInfoV5, + DeleteSubMemberParamsV5, + DeliveryPriceV5, + DeliveryRecordV5, + DepositAddressChainV5, + DepositRecordV5, + EarnAprHistoryPointV5, + EarnCouponListResultV5, + EarnHourlyYieldHistoryV5, + EarnOrderHistoryV5, + EarnPositionV5, + EarnProductV5, + EarnTokenDailyYieldRecordV5, + EarnTokenHistoryAprPointV5, + EarnTokenHourlyYieldRecordV5, + EarnTokenOrderV5, + EarnTokenPositionV5, + EarnTokenProductV5, + EarnYieldHistoryV5, + EventActiveOrdersResultV5, + EventInstrumentInfoResultV5, + EventOrderbookV5, + EventOrderHistoryResultV5, + EventPositionInfoResultV5, + EventQuoteResultV5, + EventSettlementRecordsResultV5, + EventTradeHistoryResultV5, + ExchangeBrokerAccountInfoV5, + ExchangeBrokerEarningResultV5, + ExchangeBrokerSubAccountDepositRecordV5, + ExecuteAlphaLPRedeemParamsV5, + ExecuteAlphaLPRedeemResultV5, + ExecuteAlphaLPStakeParamsV5, + ExecuteAlphaLPStakeResultV5, + ExecuteAlphaPredictionBuyParamsV5, + ExecuteAlphaPredictionOrderResultV5, + ExecuteAlphaPredictionSellParamsV5, + ExecuteAlphaTradeParamsV5, + ExecuteAlphaTradeResultV5, + ExecuteRFQQuoteParamsV5, + ExecuteRFQQuoteResultV5, + ExecutionV5, + FeeGroupStructureResponseV5, + FeeRateV5, + FiatTradingPairListV5, + FixedLoanAvailableInventoryV5, + FixedRateAvailableInventoryV5, + FixedRateBorrowContractInfoV5, + FixedRateBorrowOrderInfoV5, + FixedRateBorrowParamsV5, + FixedRateBorrowQuoteV5, + FixedRateBorrowResultV5, + FixedTermEarnOrderListV5, + FixedTermEarnPlaceOrderResultV5, + FixedTermEarnPositionListV5, + FixedTermEarnProductListV5, + FlexibleAvailableInventoryV5, + FlexibleLoanAvailableInventoryV5, + FlexibleSavingAutoSavingsV5, + FriendReferralRecordV5, + FundingAccountTransactionRecordV5, + FundingRateHistoryResponseV5, + FuturesLeverageResultV5, + GetAccountCoinBalanceParamsV5, + GetAccountHistoricOrdersParamsV5, + GetAccountInstrumentsInfoParamsV5, + GetAccountOrdersParamsV5, + GetADLAlertParamsV5, + GetAdvanceEarnOrderListParamsV5, + GetAdvanceEarnPositionListParamsV5, + GetAdvanceEarnProductExtraInfoParamsV5, + GetAdvanceEarnProductParamsV5, + GetAffiliateSubAffiliateListParamsV5, + GetAffiliateUserInfoParamsV5, + GetAffiliateUserListParamsV5, + GetAllBrokerRateLimitsParamsV5, + GetAllCoinsBalanceParamsV5, + GetAllowedDepositCoinInfoParamsV5, + GetAlphaAssetDetailParamsV5, + GetAlphaBizTokenDetailsParamsV5, + GetAlphaBizTokenListParamsV5, + GetAlphaBizTokenPriceListParamsV5, + GetAlphaLPOrderListParamsV5, + GetAlphaLPPayTokenListParamsV5, + GetAlphaLPPayTokenPriceParamsV5, + GetAlphaLPPoolInfoParamsV5, + GetAlphaLPPoolListParamsV5, + GetAlphaPayTokenListParamsV5, + GetAlphaPredictionEventDetailParamsV5, + GetAlphaPredictionOrderBookParamsV5, + GetAlphaPredictionOrderEstimateParamsV5, + GetAlphaPredictionOrderListParamsV5, + GetAlphaPredictionPortfolioSummaryParamsV5, + GetAlphaPredictionPositionHistoryParamsV5, + GetAlphaPredictionPositionListParamsV5, + GetAlphaPredictionPriceHistoryParamsV5, + GetAlphaPredictionSideMarketListParamsV5, + GetAlphaPredictionSportsGroupStageDetailParamsV5, + GetAlphaPredictionSportsMatchListParamsV5, + GetAlphaPredictionSportsTimelineStagesParamsV5, + GetAlphaPredictionTokenPriceParamsV5, + GetAlphaTradeOrderListParamsV5, + GetAlphaTradeQuoteParamsV5, + GetAssetInfoParamsV5, + GetAssetOverviewParamsV5, + GetAutoRepayModeParamsV5, + GetAvailableAmountToRepayParamsV5, + GetBorrowableCoinsParamsV5, + GetBorrowContractInfoFixedParamsV5, + GetBorrowHistoryFlexibleParamsV5, + GetBorrowHistoryParamsV5, + GetBorrowOrderInfoFixedParamsV5, + GetBorrowOrderQuoteFixedParamsV5, + GetBrokerIssuedVoucherParamsV5, + GetBrokerSubAccountDepositsV5, + GetClassicTransactionLogsParamsV5, + GetClosedOptionsPositionsParamsV5, + GetClosedPnLParamsV5, + GetCoinDeltaAmountParamsV5, + GetCoinExchangeRecordParamsV5, + GetCoinStateParamsV5, + GetCollateralAdjustmentHistoryParamsV5, + GetCollateralCoinsParamsV5, + GetCompletedLoanOrderHistoryParamsV5, + GetConvertHistoryParamsV5, + GetDeliveryPriceParamsV5, + GetDeliveryRecordParamsV5, + GetDepositRecordParamsV5, + GetEarnAprHistoryParamsV5, + GetEarnCouponListParamsV5, + GetEarnHourlyYieldHistoryParamsV5, + GetEarnOrderHistoryParamsV5, + GetEarnPositionParamsV5, + GetEarnTokenDailyYieldParamsV5, + GetEarnTokenHistoryAprParamsV5, + GetEarnTokenHourlyYieldParamsV5, + GetEarnTokenOrderListParamsV5, + GetEarnTokenPositionParamsV5, + GetEarnTokenProductParamsV5, + GetEarnYieldHistoryParamsV5, + GetEventActiveOrdersParamsV5, + GetEventInstrumentsInfoParamsV5, + GetEventOrderbookParamsV5, + GetEventOrderHistoryParamsV5, + GetEventPositionInfoParamsV5, + GetEventSettlementRecordsParamsV5, + GetEventTradeHistoryParamsV5, + GetExchangeBrokerEarningsParamsV5, + GetExecutionListParamsV5, + GetFeeGroupStructureParamsV5, + GetFeeRateParamsV5, + GetFiatTradingPairListParamsV5, + GetFixedLoanAvailableInventoryParamsV5, + GetFixedRateAvailableInventoryParamsV5, + GetFixedRateBorrowContractInfoParamsV5, + GetFixedRateBorrowOrderInfoParamsV5, + GetFixedRateBorrowOrderQuoteParamsV5, + GetFixedTermEarnOrderListParamsV5, + GetFixedTermEarnPositionParamsV5, + GetFixedTermEarnProductParamsV5, + GetFlexibleAvailableInventoryParamsV5, + GetFlexibleLoanAvailableInventoryParamsV5, + GetFlexibleSavingAutoSavingsParamsV5, + GetFriendReferralsParamsV5, + GetFullDepthOrderbookParamsV5, + GetFundingAccountTransactionHistoryParamsV5, + GetFundingRateHistoryParamsV5, + GetFuturesLeverageParamsV5, + GetHistoricalVolatilityParamsV5, + GetHoldToEarnAirdropYieldHistoryParamsV5, + GetIndexPriceComponentsParamsV5, + GetIndexPriceKlineParamsV5, + GetInstrumentsInfoParamsV5, + GetInsuranceParamsV5, + GetInternalDepositRecordParamsV5, + GetInternalTransferParamsV5, + GetKlineParamsV5, + GetLaunchpoolProjectListParamsV5, + GetLaunchpoolUserActivityLogParamsV5, + GetLaunchpoolUserHistoryParamsV5, + GetLiquidityMiningProductParamsV5, + GetLoanLTVAdjustmentHistoryParamsV5, + GetLongShortRatioParamsV5, + GetMarkPriceKlineParamsV5, + GetMaxBorrowableAmountParamsV5, + GetMaxCollateralAmountParamsV5, + GetMaxLoanAmountParamsV5, + GetMovePositionHistoryParamsV5, + GetOngoingFlexibleLoansParamsV5, + GetOpenInterestParamsV5, + GetOptionBaseCoinsParamsV5, + GetOptionDeliveryPriceParamsV5, + GetOrderbookParamsV5, + GetP2PAccountCoinsBalanceParamsV5, + GetP2PChatMessagesParamsV5, + GetP2PChatSessionIdParamsV5, + GetP2PChatSessionsParamsV5, + GetP2PCounterpartyUserInfoParamsV5, + GetP2POnlineAdsParamsV5, + GetP2POrderMessagesParamsV5, + GetP2POrdersParamsV5, + GetP2PPendingOrdersParamsV5, + GetP2PPersonalAdsParamsV5, + GetPayInfoParamsV5, + GetPortfolioMarginInfoParamsV5, + GetPositionTiersParamsV5, + GetPremiumIndexPriceKlineParamsV5, + GetPreUpgradeClosedPnlParamsV5, + GetPreUpgradeOptionDeliveryRecordParamsV5, + GetPreUpgradeOrderHistoryParamsV5, + GetPreUpgradeTradeHistoryParamsV5, + GetPreUpgradeTransactionLogParamsV5, + GetPreUpgradeUSDCSessionParamsV5, + GetPublicTradingHistoryParamsV5, + GetPuzzleProjectListParamsV5, + GetPwmAllFundOrdersParamsV5, + GetPwmAllFundsParamsV5, + GetPwmAssetManagerInvestmentPlansParamsV5, + GetPwmFundHistoricalNavParamsV5, + GetPwmFundTransferRecordsParamsV5, + GetPwmInvestmentPlanAssetTrendParamsV5, + GetPwmInvestmentPlanDetailParamsV5, + GetPwmInvestmentPlanOrdersParamsV5, + GetPwmPendingInvestmentPlanDetailParamsV5, + GetRenewOrderInfoFixedParamsV5, + GetRepaymentHistoryFixedParamsV5, + GetRepaymentHistoryFlexibleParamsV5, + GetRepaymentHistoryParamsV5, + GetRFQDetailsParamsV5, + GetRFQHistoryParamsV5, + GetRFQListParamsV5, + GetRFQPublicTradesParamsV5, + GetRFQQuoteRealtimeParamsV5, + GetRFQRealtimeParamsV5, + GetRFQRealtimeResultV5, + GetRFQTradeListParamsV5, + GetRiskLimitParamsV5, + GetRPIOrderbookParamsV5, + GetRWANavChartParamsV5, + GetRWAOrderListParamsV5, + GetRWAProductListParamsV5, + GetSettlementRecordParamsV5, + GetSmallBalanceListParamsV5, + GetSpotMarginCurrencyDataParamsV5, + GetSpotMarginLiabilityInfoParamsV5, + GetSpreadInstrumentsInfoParamsV5, + GetSpreadMaxQtyParamsV5, + GetSpreadOpenOrdersParamsV5, + GetSpreadOrderHistoryParamsV5, + GetSpreadTradeHistoryParamsV5, + GetStrategyListParamsV5, + GetStrategyOrderListParamsV5, + GetSubAccountAllApiKeysParamsV5, + GetSubAccountDepositRecordParamsV5, + GetSupplyContractInfoFixedParamsV5, + GetSupplyOrderInfoFixedParamsV5, + GetSupplyOrderQuoteFixedParamsV5, + GetSystemStatusParamsV5, + GetTaxBatchExportParamsV5, + GetTickersParamsV5, + GetTokenSplashProjectListParamsV5, + GetTokenSplashUserActivityParamsV5, + GetTotalMembersAssetsParamsV5, + GetTradeInfoForAnalysisParamsV5, + GetTransactionLogParamsV5, + GetUniversalTransferRecordsParamsV5, + GetUnpaidLoanOrdersParamsV5, + GetVIPMarginDataParamsV5, + GetWalletBalanceParamsV5, + GetWithdrawalAddressListParamsV5, + GetWithdrawalRecordsParamsV5, + HistoricalVolatilityV5, + HoldToEarnAirdropProductsResultV5, + HoldToEarnAirdropYieldHistoryResultV5, + IndexPriceComponentsResponseV5, + InstitutionalLendingCoinDeltaAmountV5, + InstitutionalLendingDelayLiquidationStatusV5, + InstitutionalLendingProductInfoV5, + InstitutionalLoanLTVV5, + InstrumentInfoResponseV5, + InsuranceResponseV5, + InternalDepositRecordV5, + InternalTransferRecordV5, + InvestMorePwmInvestmentPlanParamsV5, + InvestMorePwmInvestmentPlanResultV5, + IssueVoucherParamsV5, + LaunchpoolActivityLogResultV5, + LaunchpoolCurrentStakingResultV5, + LaunchpoolProjectListResultV5, + LaunchpoolUserHistoryResultV5, + LiquidityMiningProductResultV5, + LoanLTVAdjustmentHistoryV5, + LongShortRatioV5, + ManagePwmAssetManagerInvestmentPlanParamsV5, + ManagePwmAssetManagerInvestmentPlanResultV5, + ManagePwmFundOrderParamsV5, + ManagePwmFundOrderResultV5, + ManualBorrowParamsV5, + ManualBorrowResultV5, + ManualRepayParamsV5, + ManualRepayResultV5, + ManualRepayWithoutConversionParamsV5, + ManualRepayWithoutConversionResultV5, + MarkP2POrderAsPaidParamsV5, + MaxBorrowableAmountV5, + MaxLoanAmountV5, + MMPModifyParamsV5, + MMPStateV5, + ModifyEarnPositionParamsV5, + MovePositionHistoryV5, + MovePositionParamsV5, + MovePositionResultV5, + OHLCKlineV5, + OHLCVKlineV5, + OngoingFlexibleLoanV5, + OpenInterestResponseV5, + OptionAssetInfoNestedResultV5, + OptionBaseCoinsResultV5, + OptionDeliveryPriceV5, + OrderbookResponseV5, + OrderParamsV5, + OrderPriceLimitV5, + OrderResultV5, + OrderSideV5, + P2PAccountCoinsBalanceV5, + P2PAdDetailV5, + P2PChatMessagesResponseV5, + P2PChatSessionsResponseV5, + P2PCounterpartyUserInfoV5, + P2PCreateAdResponseV5, + P2POnlineAdsResponseV5, + P2POrderDetailV5, + P2POrderMessageV5, + P2POrdersResponseV5, + P2PPersonalAdsResponseV5, + P2PUserInfoV5, + P2PUserPaymentV5, + PayInfoResultV5, + PlaceEarnTokenOrderParamsV5, + PlaceEarnTokenOrderResultV5, + PlaceRWAOrderParamsV5, + PlaceRWAOrderResultV5, + PortfolioMarginInfoResultV5, + PositionInfoParamsV5, + PositionV5, + PreCheckOrderResultV5, + PreUpgradeOptionsDelivery, + PreUpgradeTransaction, + PreUpgradeUSDCSessionSettlement, + PublicTradeV5, + PuzzleProjectListResultV5, + PwmAllFundOrdersResultV5, + PwmAllFundsResultV5, + PwmAssetManagerInvestmentPlansResultV5, + PwmFundHistoricalNavResultV5, + PwmFundTransferParamsV5, + PwmFundTransferRecordV5, + PwmFundTransferResultV5, + PwmInvestmentPlanAssetTrendResultV5, + PwmInvestmentPlanDetailV5, + PwmInvestmentPlanListResultV5, + PwmInvestmentPlanOrdersResultV5, + PwmPendingInvestmentPlanDetailV5, + PwmSubscribableProductInfoResultV5, + QueryCardAssetRecordsParamsV5, + QueryCardMallItemListParamsV5, + QueryCardPointCashbackDetailParamsV5, + QueryCardPointRecordsParamsV5, + RedeemFixedTermEarnParamsV5, + RedeemFixedTermEarnResultV5, + RedeemPwmInvestmentPlanParamsV5, + RedeemPwmInvestmentPlanResultV5, + ReferralCodesResultV5, + ReinvestLiquidityMiningParamsV5, + ReinvestLiquidityMiningResultV5, + RenewBorrowOrderFixedParamsV5, + RenewBorrowOrderFixedV5, + RenewFixedRateBorrowParamsV5, + RenewOrderInfoFixedV5, + RepayCollateralFixedParamsV5, + RepayCollateralFlexibleParamsV5, + RepayFixedParamsV5, + RepayFixedV5, + RepayFlexibleParamsV5, + RepayFlexibleV5, + RepayInstitutionalLoanParamsV5, + RepayInstitutionalLoanResultV5, + RepayLiabilityParamsV5, + RepayLiabilityResultV5, + RepaymentHistoryFixedV5, + RepaymentHistoryFlexibleV5, + RepaymentHistoryV5, + RequestConvertQuoteParamsV5, + ReviewP2PSellerCancelOrderApplyParamsV5, + RFQConfigV5, + RFQDetailItemV5, + RFQHistory, + RFQPublicTradeV5, + RFQQuoteItemV5, + RFQTradeV5, + RiskLimitV5, + RPIOrderbookResponseV5, + RWANavChartResultV5, + RWAOrderListResultV5, + RWAPositionListResultV5, + RWAProductListResultV5, + SendP2PChatMessageParamsV5, + SendP2POrderMessageParamsV5, + SetAutoAddMarginParamsV5, + SetAutoRepayModeParamsV5, + SetBrokerRateLimitParamsV5, + SetCollateralCoinParamsV5, + SetDeltaNeutralModeParamsV5, + SetFixedTermEarnAutoInvestParamsV5, + SetFlexibleSavingAutoSavingsParamsV5, + SetLeverageParamsV5, + SetLimitPriceActionParamsV5, + SetRiskLimitParamsV5, + SetRiskLimitResultV5, + SetSpotMarginLeverageParamsV5, + SettlementRecordV5, + SettlePwmFundProfitParamsV5, + SettlePwmFundProfitResultV5, + SetTPSLModeParamsV5, + SetTradingStopParamsV5, + SignAgreementParamsV5, + SmallBalanceListV5, + SpotBorrowCheckResultV5, + SpotMarginCurrencyDataV5, + SpotMarginLiabilityInfoV5, + SpotMarginStateV5, + SpreadInstrumentInfoV5, + SpreadMaxQtyResultV5, + SpreadOpenOrderV5, + SpreadOrderbookResponseV5, + SpreadOrderHistoryV5, + SpreadRecentTradeV5, + SpreadTickerV5, + SpreadTradeV5, + StopStrategyParamsV5, + StopStrategyResultV5, + StrategyListResultV5, + StrategyOrderListResultV5, + SubMemberV5, + SubmitAdvanceEarnPlaceOrderParamsV5, + SubmitDepositOriginatorInfoParamsV5, + SubmitDepositOriginatorInfoResultV5, + SubmitEventQuoteParamsV5, + SubmitFixedTermEarnOrderParamsV5, + SubmitSpreadOrderParamsV5, + SubmitStakeRedeemParamsV5, + SubscribePwmInvestmentPlanParamsV5, + SubscribePwmInvestmentPlanResultV5, + SupplyContractInfoFixedV5, + SupplyOrderInfoFixedV5, + SupplyOrderQuoteFixedV5, + SwitchIsolatedMarginParamsV5, + SwitchPositionModeParamsV5, + SystemStatusItemV5, + TaxBatchExportResultV5, + TaxBatchExportStatusV5, + TickerLinearInverseV5, + TickerOptionV5, + TickerSpotV5, + TokenSplashProjectListResultV5, + TokenSplashUserActivityResultV5, + TotalMembersAssetsResultV5, + TPSLModeV5, + TradeInfoForAnalysisResultV5, + TransactionLogV5, + UnifiedAccountUpgradeResultV5, + UniversalTransferParamsV5, + UniversalTransferRecordV5, + UnpaidLoanOrderV5, + UpdateApiKeyParamsV5, + UpdateApiKeyResultV5, + UpdateP2PAdParamsV5, + UserSettingConfigV5, + VaspEntityV5, + VipBorrowableCoinsV5, + VipCollateralCoinsV5, + VIPMarginDataV5, + WalletBalanceV5, + WithdrawableAmountV5, + WithdrawalAddressV5, + WithdrawalRecordV5, + WithdrawParamsV5, +} from './types'; +import { REST_CLIENT_TYPE_ENUM } from './util'; +import BaseRestClient from './util/BaseRestClient'; ⋮---- /** - * Query risk limit of futures - * - * Covers: Linear contract / Inverse contract - */ -getRiskLimit( - params?: GetRiskLimitParamsV5, - ): Promise< - APIResponseV3WithTime> - > { - return this.get('/v5/market/risk-limit', params); + * REST API client for V5 REST APIs + * + * https://bybit-exchange.github.io/docs/v5/intro + */ +export class RestClientV5 extends BaseRestClient ⋮---- /** - * Get the delivery price for option * - * Covers: Option + ****** Custom SDK APIs * - * @deprecated use getDeliveryPrice() instead */ -getOptionDeliveryPrice( - params: GetOptionDeliveryPriceParamsV5, - ): Promise< - APIResponseV3WithTime> - > { - return this.get('/v5/market/delivery-price', params); ⋮---- /** - * Get the delivery price of Inverse futures, USDC futures and Options - * - * Covers: USDC futures / Inverse futures / Option + * This method is used to get the latency and time sync between the client and the server. + * This is not official API endpoint and is only used for internal testing purposes. + * Use this method to check the latency and time sync between the client and the server. + * Final values might vary slightly, but it should be within few ms difference. + * If you have any suggestions or improvements to this measurement, please create an issue or pull request on GitHub. */ -getDeliveryPrice( - params: GetDeliveryPriceParamsV5, -): Promise>> +async fetchLatencySummary(): Promise +⋮---- +// Adjust server time by adding estimated one-way latency +⋮---- +// Calculate time difference between adjusted server time and local time ⋮---- /** - * Get New Delivery Price - * Get historical option delivery prices. * - * Covers: Option + ****** Misc Bybit APIs * - * INFO - * - It is recommended to query this endpoint 1 minute after settlement is completed, because the data returned by this endpoint may be delayed by 1 minute. - * - By default, the most recent 50 records are returned in reverse order of "deliveryTime". */ -getNewDeliveryPrice(params: { - category: 'option'; - baseCoin: string; - settleCoin?: string; - }): Promise< +⋮---- +getSystemStatus(params?: GetSystemStatusParamsV5): Promise< APIResponseV3WithTime<{ - category: string; - list: { - deliveryPrice: string; - deliveryTime: string; - }[]; + list: SystemStatusItemV5[]; }> > { - return this.get('/v5/market/new-delivery-price', params); + return this.getPrivate('/v5/system/status', params); ⋮---- -getLongShortRatio( - params: GetLongShortRatioParamsV5, -): Promise>> +getClientType() ⋮---- -/** - * Get Index Price Components - * Query for index price components that contribute to the calculation of an index price. - */ -getIndexPriceComponents( - params: GetIndexPriceComponentsParamsV5, -): Promise> +async fetchServerTime(): Promise ⋮---- -getOrderPriceLimit(params: { - symbol: string; - category: 'spot' | 'linear' | 'inverse'; -}): Promise> +getServerTime(): Promise< + APIResponseV3WithTime<{ timeSecond: string; timeNano: string }> + > { + return this.get('/v5/market/time'); ⋮---- /** - * Get ADL Alert - * Query for ADL (auto-deleveraging mechanism) alerts and insurance pool information. * - * Covers: USDT Perpetual / USDT Delivery / USDC Perpetual / USDC Delivery / Inverse Contracts - * Data update frequency: every 1 minute - */ -getADLAlert( - params?: GetADLAlertParamsV5, -): Promise> -⋮---- -/** - * Get Fee Group Structure - * Query for the group fee structure and fee rates. + ****** Demo Account APIs * - * The new grouped fee structure only applies to Pro-level and Market Maker clients. - * Covers: USDT Perpetual / USDT Delivery / USDC Perpetual / USDC Delivery / Inverse Contracts */ -getFeeGroupStructure( - params: GetFeeGroupStructureParamsV5, -): Promise> +⋮---- +requestDemoTradingFunds(params?: { + adjustType?: 0 | 1; + utaDemoApplyMoney?: Array<{ + coin: string; + amountStr: string; + }>; +}): Promise> +createDemoAccount(): Promise> -⋮---- -amendOrder( - params: AmendOrderParamsV5, -): Promise> -⋮---- -cancelOrder( - params: CancelOrderParamsV5, -): Promise> -⋮---- /** - * Query unfilled or partially filled orders in real-time. To query older order records, please use the order history interface. + * Get Spread Instruments Info */ -getActiveOrders( - params: GetAccountOrdersParamsV5, -): Promise>> -⋮---- -cancelAllOrders( - params: CancelAllOrdersParamsV5, - ): Promise< - APIResponseV3WithTime<{ list: OrderResultV5[]; success: string }> +getSpreadInstrumentsInfo(params?: GetSpreadInstrumentsInfoParamsV5): Promise< + APIResponseV3WithTime<{ + list: SpreadInstrumentInfoV5[]; + nextPageCursor: string; + }> > { - return this.postPrivate('/v5/order/cancel-all', params); + return this.get('/v5/spread/instrument', params); ⋮---- /** - * Query order history. As order creation/cancellation is asynchronous, the data returned from this endpoint may delay. - * - * If you want to get real-time order information, you could query this endpoint or rely on the websocket stream (recommended). + * Get Spread Orderbook */ -getHistoricOrders( - params: GetAccountHistoricOrdersParamsV5, -): Promise>> +getSpreadOrderbook(params: { + symbol: string; + limit?: number; +}): Promise> ⋮---- /** - * Query users' execution records, sorted by execTime in descending order - * - * Unified account covers: Spot / Linear contract / Options - * Normal account covers: USDT perpetual / Inverse perpetual / Inverse futures + * Get Spread Tickers */ -getExecutionList( - params: GetExecutionListParamsV5, -): Promise>> +getSpreadTickers(params: { symbol: string }): Promise< + APIResponseV3WithTime<{ + list: SpreadTickerV5[]; + }> + > { + return this.get('/v5/spread/tickers', params); ⋮---- /** - * This endpoint allows you to place more than one order in a single request. - * Covers: Option (UTA, UTA Pro) / USDT Perpetual, UDSC Perpetual, USDC Futures (UTA Pro) - * - * Make sure you have sufficient funds in your account when placing an order. - * Once an order is placed, according to the funds required by the order, - * the funds in your account will be frozen by the corresponding amount during the life cycle of the order. - * - * A maximum of 20 orders can be placed per request. The returned data list is divided into two lists. - * The first list indicates whether or not the order creation was successful and the second list details the created order information. - * The structure of the two lists are completely consistent. + * Get Spread Public Recent Trades */ -batchSubmitOrders( - category: 'spot' | 'option' | 'linear' | 'inverse', - orders: BatchOrderParamsV5[], - ): Promise< - APIResponseV3WithTime< - { - list: BatchCreateOrderResultV5[]; - }, - BatchOrdersRetExtInfoV5 - > +getSpreadRecentTrades(params: { symbol: string; limit?: number }): Promise< + APIResponseV3WithTime<{ + list: SpreadRecentTradeV5[]; + }> > { - return this.postPrivate('/v5/order/create-batch', { - category, - request: orders, - }); + return this.get('/v5/spread/recent-trade', params); ⋮---- /** - * This endpoint allows you to amend more than one open order in a single request. - * Covers: Option (UTA, UTA Pro) / USDT Perpetual, UDSC Perpetual, USDC Futures (UTA Pro) - * - * You can modify unfilled or partially filled orders. Conditional orders are not supported. - * - * A maximum of 20 orders can be amended per request. + * Get Spread Max Qty + * Max order quantity (available balance) for a spread order at a given side and price. */ -batchAmendOrders( - category: 'spot' | 'option' | 'linear' | 'inverse', - orders: BatchAmendOrderParamsV5[], - ): Promise< - APIResponseV3WithTime< - { - list: BatchAmendOrderResultV5[]; - }, - BatchOrdersRetExtInfoV5 - > - > { - return this.postPrivate('/v5/order/amend-batch', { - category, - request: orders, - }); +getSpreadMaxQty( + params: GetSpreadMaxQtyParamsV5, +): Promise> ⋮---- /** - * This endpoint allows you to cancel more than one open order in a single request. - * Covers: Option (UTA, UTA Pro) / USDT Perpetual, UDSC Perpetual, USDC Futures (UTA Pro) - * - * You must specify orderId or orderLinkId. If orderId and orderLinkId is not matched, the system will process orderId first. - * - * You can cancel unfilled or partially filled orders. A maximum of 20 orders can be cancelled per request. + * Create Spread Order */ -batchCancelOrders( - category: 'spot' | 'option' | 'linear' | 'inverse', - orders: BatchCancelOrderParamsV5[], - ): Promise< - APIResponseV3WithTime< - { - list: BatchCancelOrderResultV5[]; - }, - BatchOrdersRetExtInfoV5 - > +submitSpreadOrder(params: SubmitSpreadOrderParamsV5): Promise< + APIResponseV3WithTime<{ + orderId: string; + orderLinkId: string; + }> + > { + return this.postPrivate('/v5/spread/order/create', params); +⋮---- +/** + * Amend Spread Order + * You can only modify unfilled or partially filled orders. + */ +amendSpreadOrder(params: AmendSpreadOrderParamsV5): Promise< + APIResponseV3WithTime<{ + orderId: string; + orderLinkId: string; + }> > { - return this.postPrivate('/v5/order/cancel-batch', { - category, - request: orders, - }); + return this.postPrivate('/v5/spread/order/amend', params); ⋮---- /** - * Query the qty and amount of borrowable coins in spot account. - * - * Covers: Spot (Unified Account) + * Cancel Spread Order */ -getSpotBorrowCheck( - symbol: string, - side: OrderSideV5, -): Promise> +cancelSpreadOrder(params: { + orderId?: string; + orderLinkId?: string; + }): Promise< + APIResponseV3WithTime<{ + orderId: string; + orderLinkId: string; + }> + > { + return this.postPrivate('/v5/spread/order/cancel', params); ⋮---- /** - * This endpoint allows you to set the disconnection protect time window. Covers: option (unified account). - * - * If you need to turn it on/off, you can contact your client manager for consultation and application. - * The default time window is 10 seconds. - * - * Only for institutional clients! + * Cancel All Spread Orders * - * If it doesn't work, use v2! + * When a symbol is specified, all orders for that symbol will be canceled regardless of the cancelAll field. + * When symbol is not specified and cancelAll=true, all orders, regardless of the symbol, will be canceled. */ -setDisconnectCancelAllWindow( - category: 'option', - timeWindow: number, -): Promise> +cancelAllSpreadOrders(params?: { + symbol?: string; + cancelAll?: boolean; + }): Promise< + APIResponseV3WithTime<{ + list: { + orderId: string; + orderLinkId: string; + }[]; + success: string; + }> + > { + return this.postPrivate('/v5/spread/order/cancel-all', params); ⋮---- /** - * This endpoint allows you to set the disconnection protect time window. Covers: option (unified account). - * - * If you need to turn it on/off, you can contact your client manager for consultation and application. - * The default time window is 10 seconds. - * - * Only for institutional clients! + * Get Spread Open Orders + * Query unfilled or partially filled orders in real-time. */ -setDisconnectCancelAllWindowV2(params: { - product?: 'OPTION' | 'SPOT' | 'DERIVATIVES'; - timeWindow: number; -}): Promise> +getSpreadOpenOrders(params?: GetSpreadOpenOrdersParamsV5): Promise< + APIResponseV3WithTime<{ + list: SpreadOpenOrderV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/spread/order/realtime', params); ⋮---- /** - * Pre-check order to calculate changes in IMR and MMR before placing an order + * Get Spread Order History * - * This endpoint supports orders with category = inverse, linear, option. - * Only Cross Margin mode and Portfolio Margin mode are supported, isolated margin mode is not supported. - * category = inverse is not supported in Cross Margin mode. - * Conditional order is not supported. + * Note: + * - orderId & orderLinkId has a higher priority than startTime & endTime + * - Fully canceled orders are stored for up to 24 hours + * - Single leg orders can also be found with "createType"=CreateByFutureSpread via Get Order History */ -preCheckOrder( - params: OrderParamsV5, -): Promise> +getSpreadOrderHistory(params?: GetSpreadOrderHistoryParamsV5): Promise< + APIResponseV3WithTime<{ + list: SpreadOrderHistoryV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/spread/order/history', params); ⋮---- /** + * Get Spread Trade History * - ****** Strategy APIs - * + * Note: + * - In self-trade cases, both the maker and taker single-leg trades will be returned in the same request + * - Single leg executions can also be found with "execType"=FutureSpread via Get Trade History */ +getSpreadTradeHistory(params?: GetSpreadTradeHistoryParamsV5): Promise< + APIResponseV3WithTime<{ + list: SpreadTradeV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/spread/execution/list', params); ⋮---- /** - * Create Strategy Order * - * Supported strategy types: `twap`, `chaseOrder`, `iceberg`, `pov`. + ****** Market APIs + * */ -createStrategyOrder( - params: CreateStrategyOrderParamsV5, -): Promise> ⋮---- /** - * Get Strategy List + * Query the kline data. Charts are returned in groups based on the requested interval. * - * Query the strategy list. Supports filtering by strategy ID, symbol, status, category, and strategy type. + * Covers: Spot / Linear contract / Inverse contract */ -getStrategyList( - params?: GetStrategyListParamsV5, -): Promise> +getKline( + params: GetKlineParamsV5, + ): Promise< + APIResponseV3WithTime< + CategorySymbolListV5 + > + > { + return this.get('/v5/market/kline', params); ⋮---- /** - * Get Strategy Order List + * Query the mark price kline data. Charts are returned in groups based on the requested interval. * - * Query the individual orders generated by a specific strategy. + * Covers: USDT contract / USDC contract / Inverse contract / Options + * + * `category` defaults to linear if omitted. For options, `limit` max is 500; futures max is 1000. */ -getStrategyOrderList( - params: GetStrategyOrderListParamsV5, -): Promise> +getMarkPriceKline( + params: GetMarkPriceKlineParamsV5, + ): Promise< + APIResponseV3WithTime< + CategorySymbolListV5 + > + > { + return this.get('/v5/market/mark-price-kline', params); ⋮---- /** - * Stop Strategy + * Query the index price kline data. Charts are returned in groups based on the requested interval. * - * Stop a running strategy. Once stopped, the strategy cannot be resumed. + * Covers: Linear contract / Inverse contract */ -stopStrategy( - params: StopStrategyParamsV5, -): Promise> +getIndexPriceKline( + params: GetIndexPriceKlineParamsV5, + ): Promise< + APIResponseV3WithTime< + CategorySymbolListV5 + > + > { + return this.get('/v5/market/index-price-kline', params); ⋮---- /** + * Retrieve the premium index price kline data. Charts are returned in groups based on the requested interval. * - ****** Position APIs - * + * Covers: Linear contract */ +getPremiumIndexPriceKline( + params: GetPremiumIndexPriceKlineParamsV5, + ): Promise< + APIResponseV3WithTime> + > { + return this.get('/v5/market/premium-index-price-kline', params); ⋮---- /** - * Query real-time position data, such as position size, cumulative realizedPNL. - * - * 0: cross margin. 1: isolated margin - * - * Unified account covers: Linear contract / Options - * - * Normal account covers: USDT perpetual / Inverse perpetual / Inverse futures + * Query a list of instruments of online trading pair. * - * Note: this will give a 404 error if you query the `option` category if your account is not unified + * Covers: Spot / Linear contract / Inverse contract / Option * - * Response list items include `openTime` (position open timestamp in ms, default `0`). + * Note: Spot does not support pagination, so limit & cursor are invalid. + * Note: e.g. `symbolType: 'commodity'`, and for linear also `stock`, `forex` (see Bybit Get Instruments Info). */ -getPositionInfo( - params: PositionInfoParamsV5, -): Promise>> +getInstrumentsInfo( + params: GetInstrumentsInfoParamsV5 & { category: C }, +): Promise>> ⋮---- /** - * Get Futures Leverage - * Query isolated leverage settings without requiring an open position. + * Query orderbook data * - * Returns an error under Portfolio Margin mode. + * Covers: Spot / Linear contract / Inverse contract / Option */ -getFuturesLeverage( - params: GetFuturesLeverageParamsV5, -): Promise> +getOrderbook( + params: GetOrderbookParamsV5, +): Promise> +⋮---- +getFullDepthOrderbook( + params: GetFullDepthOrderbookParamsV5, +): Promise> ⋮---- /** - * Set the leverage - * - * Unified account covers: Linear contract - * - * Normal account covers: USDT perpetual / Inverse perpetual / Inverse futures + * Get RPI Orderbook + * Query for orderbook depth data with RPI (Retail Price Improvement) information. * - * Note: Under one-way mode, buyLeverage must be the same as sellLeverage + * Covers: Spot / USDT contract / USDC contract / Inverse contract + * Contract: 50-level of RPI orderbook data + * Spot: 50-level of RPI orderbook data */ -setLeverage(params: SetLeverageParamsV5): Promise> +⋮---- +getTickers( +⋮---- +getTickers( + params: GetTickersParamsV5<'option'>, + ): Promise>>; +⋮---- +getTickers( + params: GetTickersParamsV5<'spot'>, + ): Promise>>; ⋮---- /** - * Select cross margin mode or isolated margin mode. - * 0: cross margin. 1: isolated margin - * - * Covers: USDT perpetual (Normal account) / Inverse contract (Normal account). + * Query the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours. * - * Switching margin modes will cause orders in progress to be cancelled. - * Please make sure that there are no open orders before you switch margin modes. + * Covers: Spot / Linear contract / Inverse contract / Option */ -switchIsolatedMargin( - params: SwitchIsolatedMarginParamsV5, -): Promise + | CategoryListV5 + | CategoryListV5 + > + > { + return this.get('/v5/market/tickers', params); ⋮---- /** - * @deprecated - * This endpoint sets the take profit/stop loss (TP/SL) mode to full or partial. - * - * Unified account covers: Linear contract; normal account covers: USDT perpetual, inverse perpetual, inverse futures. + * Query historical funding rate. Each symbol has a different funding interval. * - * For partial TP/SL mode, you can set the TP/SL size smaller than position size. + * Covers: Linear contract / Inverse perpetual */ -setTPSLMode( - params: SetTPSLModeParamsV5, -): Promise + > + > { + return this.get('/v5/market/funding/history', params); ⋮---- /** - * Switches the position mode for USDT perpetual and Inverse futures. - * - * If you are in one-way Mode, you can only open one position on Buy or Sell side. - * - * If you are in hedge mode, you can open both Buy and Sell side positions simultaneously. + * Query recent public trading data in Bybit. * - * Position mode. 0: Merged Single. 3: Both Sides. + * Covers: Spot / Linear contract / Inverse contract / Option */ -switchPositionMode( - params: SwitchPositionModeParamsV5, -): Promise> + > { + return this.get('/v5/market/recent-trade', params); ⋮---- /** - * @deprecated - * The risk limit will limit the maximum position value you can hold under different margin requirements. - * If you want to hold a bigger position size, you need more margin. + * Get open interest of each symbol. * - * This interface can set the risk limit of a single position. - * If the order exceeds the current risk limit when placing an order, it will be rejected. + * Covers: Linear contract / Inverse contract */ -setRiskLimit( - params: SetRiskLimitParamsV5, -): Promise> +getOpenInterest( + params: GetOpenInterestParamsV5, +): Promise> ⋮---- /** - * This endpoint allows you to set the take profit, stop loss or trailing stop for a position. - * Passing these parameters will create conditional orders by the system internally. - * - * The system will cancel these orders if the position is closed, and adjust the qty according to the size of the open position. - * - * Unified account covers: Linear contract. - * Normal account covers: USDT perpetual / Inverse perpetual / Inverse futures. + * Query option historical volatility + * Covers: Option */ -setTradingStop( - params: SetTradingStopParamsV5, -): Promise> + > { + return this.get('/v5/market/historical-volatility', params); ⋮---- /** - * This endpoint allows you to turn on/off auto-add-margin for an isolated margin position. + * Query Bybit insurance pool data (BTC/USDT/USDC etc). The data is updated every 24 hours. + */ +getInsurance( + params?: GetInsuranceParamsV5, +): Promise> +⋮---- +/** + * Query risk limit of futures * - * Covers: USDT perpetual (Normal Account). + * Covers: Linear contract / Inverse contract */ -setAutoAddMargin( - params: SetAutoAddMarginParamsV5, -): Promise> + > { + return this.get('/v5/market/risk-limit', params); ⋮---- /** - * Manually add or reduce margin for isolated margin position + * Get the delivery price for option * - * Unified account covers: USDT perpetual / USDC perpetual / USDC futures / Inverse contract - * Normal account covers: USDT perpetual / Inverse contract + * Covers: Option + * + * @deprecated use getDeliveryPrice() instead */ -addOrReduceMargin( - params: AddOrReduceMarginParamsV5, -): Promise> +getOptionDeliveryPrice( + params: GetOptionDeliveryPriceParamsV5, + ): Promise< + APIResponseV3WithTime> + > { + return this.get('/v5/market/delivery-price', params); ⋮---- /** - * Query user's closed profit and loss records. The results are sorted by createdTime in descending order. + * Get the delivery price of Inverse futures, USDC futures and Options * - * Unified account covers: Linear contract - * Normal account covers: USDT perpetual / Inverse perpetual / Inverse futures + * Covers: USDC futures / Inverse futures / Option */ -getClosedPnL( - params: GetClosedPnLParamsV5, -): Promise>> +getDeliveryPrice( + params: GetDeliveryPriceParamsV5, +): Promise>> ⋮---- /** - * Get Closed Options Positions - * Query user's closed options positions, sorted by closeTime in descending order + * Get New Delivery Price + * Get historical option delivery prices. + * + * Covers: Option * * INFO - * Only supports users to query closed options positions in recently 6 months - * Fee and price retain 8 decimal places and do not omit the last 0 + * - It is recommended to query this endpoint 1 minute after settlement is completed, because the data returned by this endpoint may be delayed by 1 minute. + * - By default, the most recent 50 records are returned in reverse order of "deliveryTime". */ -getClosedOptionsPositions( - params?: GetClosedOptionsPositionsParamsV5, - ): Promise< +getNewDeliveryPrice(params: { + category: 'option'; + baseCoin: string; + settleCoin?: string; + }): Promise< APIResponseV3WithTime<{ - nextPageCursor: string; category: string; - list: ClosedOptionsPositionV5[]; + list: { + deliveryPrice: string; + deliveryTime: string; + }[]; }> > { - return this.getPrivate('/v5/position/get-closed-positions', params); + return this.get('/v5/market/new-delivery-price', params); +⋮---- +getLongShortRatio( + params: GetLongShortRatioParamsV5, +): Promise>> ⋮---- /** - * Move positions between sub-master, master-sub, or sub-sub UIDs. - * - * Unified account covers: USDT perpetual / USDC contract / Spot / Option - * - * INFO - * The endpoint can only be called by master UID api key - * UIDs must be the same master-sub account relationship - * The trades generated from move-position endpoint will not be displayed in the Recent Trade (Rest API & Websocket) - * There is no trading fee - * fromUid and toUid both should be Unified trading accounts, and they need to be one-way mode when moving the positions - * Please note that once executed, you will get execType=MovePosition entry from Get Trade History, Get Closed Pnl, and stream from Execution. + * Get Index Price Components + * Query for index price components that contribute to the calculation of an index price. */ -movePosition( - params: MovePositionParamsV5, -): Promise> +getIndexPriceComponents( + params: GetIndexPriceComponentsParamsV5, +): Promise> +⋮---- +getOrderPriceLimit(params: { + symbol: string; + category: 'spot' | 'linear' | 'inverse'; +}): Promise> ⋮---- /** - * Query moved position data by master UID api key. + * Get ADL Alert + * Query for ADL (auto-deleveraging mechanism) alerts and insurance pool information. * - * Unified account covers: USDT perpetual / USDC contract / Spot / Option + * Covers: USDT Perpetual / USDT Delivery / USDC Perpetual / USDC Delivery / Inverse Contracts + * Data update frequency: every 1 minute */ -getMovePositionHistory(params?: GetMovePositionHistoryParamsV5): Promise< - APIResponseV3WithTime<{ - list: MovePositionHistoryV5[]; - nextPageCursor: string; - }> - > { - return this.getPrivate('/v5/position/move-history', params); +getADLAlert( + params?: GetADLAlertParamsV5, +): Promise> ⋮---- /** - * Confirm new risk limit. - * - * It is only applicable when the user is marked as only reducing positions (please see the isReduceOnly field in the Get Position Info interface). - * After the user actively adjusts the risk level, this interface is called to try to calculate the adjusted risk level, and if it passes (retCode=0), - * the system will remove the position reduceOnly mark. You are recommended to call Get Position Info to check isReduceOnly field. + * Get Fee Group Structure + * Query for the group fee structure and fee rates. * - * Unified account covers: USDT perpetual / USDC contract / Inverse contract - * Classic account covers: USDT perpetual / Inverse contract + * The new grouped fee structure only applies to Pro-level and Market Maker clients. + * Covers: USDT Perpetual / USDT Delivery / USDC Perpetual / USDC Delivery / Inverse Contracts */ -confirmNewRiskLimit( - params: ConfirmNewRiskLimitParamsV5, -): Promise> ⋮---- /** - * - ****** Pre-upgrade APIs - * + * Query option base coins, display names, launch times, and tradable symbol availability. */ +getOptionBaseCoins( + params?: GetOptionBaseCoinsParamsV5, +): Promise> ⋮---- /** - * Get those orders which occurred before you upgrade the account to Unified account. * - * For now, it only supports to query USDT perpetual, USDC perpetual, Inverse perpetual and futures. + ****** Trade APIs * - * - can get all status in 7 days - * - can only get filled orders beyond 7 days */ -getPreUpgradeOrderHistory( - params: GetPreUpgradeOrderHistoryParamsV5, -): Promise>> +⋮---- +submitOrder( + params: OrderParamsV5, +): Promise> +⋮---- +amendOrder( + params: AmendOrderParamsV5, +): Promise> +⋮---- +cancelOrder( + params: CancelOrderParamsV5, +): Promise> ⋮---- /** - * Get users' execution records which occurred before you upgrade the account to Unified account, sorted by execTime in descending order - * - * For now, it only supports to query USDT perpetual, Inverse perpetual and futures. - * - * - You may have multiple executions in a single order. - * - You can query by symbol, baseCoin, orderId and orderLinkId, and if you pass multiple params, - * the system will process them according to this priority: orderId > orderLinkId > symbol > baseCoin. + * Query unfilled or partially filled orders in real-time. To query older order records, please use the order history interface. */ -getPreUpgradeTradeHistory( - params: GetPreUpgradeTradeHistoryParamsV5, -): Promise>> +getActiveOrders( + params: GetAccountOrdersParamsV5, +): Promise>> +⋮---- +cancelAllOrders( + params: CancelAllOrdersParamsV5, + ): Promise< + APIResponseV3WithTime<{ list: OrderResultV5[]; success: string }> + > { + return this.postPrivate('/v5/order/cancel-all', params); ⋮---- /** - * Query user's closed profit and loss records. The results are sorted by createdTime in descending order. + * Query order history. As order creation/cancellation is asynchronous, the data returned from this endpoint may delay. * - * For now, it only supports to query USDT perpetual, Inverse perpetual and futures. + * If you want to get real-time order information, you could query this endpoint or rely on the websocket stream (recommended). */ -getPreUpgradeClosedPnl( - params: GetPreUpgradeClosedPnlParamsV5, -): Promise>> +getHistoricOrders( + params: GetAccountHistoricOrdersParamsV5, +): Promise>> ⋮---- /** - * Query transaction logs which occurred in the USDC Derivatives wallet before the account was upgraded to a Unified account. - * - * You can get USDC Perpetual, Option records. + * Query users' execution records, sorted by execTime in descending order * - * INFO - * USDC Perpeual & Option support the recent 6 months data. Please download older data via GUI + * Unified account covers: Spot / Linear contract / Options + * Normal account covers: USDT perpetual / Inverse perpetual / Inverse futures */ -getPreUpgradeTransactions( - params: GetPreUpgradeTransactionLogParamsV5, - ): Promise< - APIResponseV3WithTime<{ - list: PreUpgradeTransaction[]; - nextPageCursor: string; - }> - > { - return this.getPrivate('/v5/pre-upgrade/account/transaction-log', params); +getExecutionList( + params: GetExecutionListParamsV5, +): Promise>> ⋮---- /** - * Query delivery records of Option before you upgraded the account to a Unified account, sorted by deliveryTime in descending order. + * This endpoint allows you to place more than one order in a single request. + * Covers: Option (UTA, UTA Pro) / USDT Perpetual, UDSC Perpetual, USDC Futures (UTA Pro) * - * INFO - * Supports the recent 6 months data. Please download older data via GUI + * Make sure you have sufficient funds in your account when placing an order. + * Once an order is placed, according to the funds required by the order, + * the funds in your account will be frozen by the corresponding amount during the life cycle of the order. + * + * A maximum of 20 orders can be placed per request. The returned data list is divided into two lists. + * The first list indicates whether or not the order creation was successful and the second list details the created order information. + * The structure of the two lists are completely consistent. */ -getPreUpgradeOptionDeliveryRecord( - params: GetPreUpgradeOptionDeliveryRecordParamsV5, +batchSubmitOrders( + category: 'spot' | 'option' | 'linear' | 'inverse', + orders: BatchOrderParamsV5[], ): Promise< - APIResponseV3WithTime> + APIResponseV3WithTime< + { + list: BatchCreateOrderResultV5[]; + }, + BatchOrdersRetExtInfoV5 + > > { - return this.getPrivate('/v5/pre-upgrade/asset/delivery-record', params); + return this.postPrivate('/v5/order/create-batch', { + category, + request: orders, + }); ⋮---- /** - * Query session settlement records of USDC perpetual before you upgrade the account to Unified account. + * This endpoint allows you to amend more than one open order in a single request. + * Covers: Option (UTA, UTA Pro) / USDT Perpetual, UDSC Perpetual, USDC Futures (UTA Pro) * - * INFO - * USDC Perpetual support the recent 6 months data. Please download older data via GUI + * You can modify unfilled or partially filled orders. Conditional orders are not supported. + * + * A maximum of 20 orders can be amended per request. */ -getPreUpgradeUSDCSessionSettlements( - params: GetPreUpgradeUSDCSessionParamsV5, +batchAmendOrders( + category: 'spot' | 'option' | 'linear' | 'inverse', + orders: BatchAmendOrderParamsV5[], ): Promise< APIResponseV3WithTime< - CategoryCursorListV5 + { + list: BatchAmendOrderResultV5[]; + }, + BatchOrdersRetExtInfoV5 > > { - return this.getPrivate('/v5/pre-upgrade/asset/settlement-record', params); + return this.postPrivate('/v5/order/amend-batch', { + category, + request: orders, + }); ⋮---- /** + * This endpoint allows you to cancel more than one open order in a single request. + * Covers: Option (UTA, UTA Pro) / USDT Perpetual, UDSC Perpetual, USDC Futures (UTA Pro) * - ****** Account APIs + * You must specify orderId or orderLinkId. If orderId and orderLinkId is not matched, the system will process orderId first. * + * You can cancel unfilled or partially filled orders. A maximum of 20 orders can be cancelled per request. */ +batchCancelOrders( + category: 'spot' | 'option' | 'linear' | 'inverse', + orders: BatchCancelOrderParamsV5[], + ): Promise< + APIResponseV3WithTime< + { + list: BatchCancelOrderResultV5[]; + }, + BatchOrdersRetExtInfoV5 + > + > { + return this.postPrivate('/v5/order/cancel-batch', { + category, + request: orders, + }); ⋮---- /** - * Obtain wallet balance, query asset information of each currency, and account risk rate information under unified margin mode. + * Query the qty and amount of borrowable coins in spot account. * - * By default, currency information with assets or liabilities of 0 is not returned. + * Covers: Spot (Unified Account) */ -getWalletBalance( - params: GetWalletBalanceParamsV5, -): Promise> ⋮---- /** - * Query the available amount to transfer of a specific coin in the Unified wallet. + * This endpoint allows you to set the disconnection protect time window. Covers: option (unified account). * - * @param coinName Coin name, uppercase only - */ -getTransferableAmount(params: { coinName: string }): Promise< - APIResponseV3WithTime<{ - availableWithdrawal: string; - }> - > { - return this.getPrivate('/v5/account/withdrawal', params); -⋮---- -/** - * Get Account Instruments Info - * Query for the instrument specification of online trading pairs that available to users. + * If you need to turn it on/off, you can contact your client manager for consultation and application. + * The default time window is 10 seconds. * - * Covers: SPOT / USDT contract / USDC contract / Inverse contract + * Only for institutional clients! * - * Includes RPI permission information (isPublicRpi, myRpiPermission) - * Note: e.g. `symbolType: 'commodity'`, and for linear also `stock`, `forex`. + * If it doesn't work, use v2! */ -getAccountInstrumentsInfo( - params: GetAccountInstrumentsInfoParamsV5 & { category: C }, -): Promise>> +setDisconnectCancelAllWindow( + category: 'option', + timeWindow: number, +): Promise> ⋮---- /** - * Upgrade to unified account. + * This endpoint allows you to set the disconnection protect time window. Covers: option (unified account). * - * Banned/OTC loan/Net asset unsatisfying/Express path users cannot upgrade the account to Unified Account for now. + * If you need to turn it on/off, you can contact your client manager for consultation and application. + * The default time window is 10 seconds. + * + * Only for institutional clients! */ -upgradeToUnifiedAccount(): Promise< - APIResponseV3WithTime - > { - return this.postPrivate('/v5/account/upgrade-to-uta'); +setDisconnectCancelAllWindowV2(params: { + product?: 'OPTION' | 'SPOT' | 'DERIVATIVES'; + timeWindow: number; +}): Promise> ⋮---- /** - * Get interest records, sorted in reverse order of creation time. + * Pre-check order to calculate changes in IMR and MMR before placing an order * - * Unified account + * This endpoint supports orders with category = inverse, linear, option. + * Only Cross Margin mode and Portfolio Margin mode are supported, isolated margin mode is not supported. + * category = inverse is not supported in Cross Margin mode. + * Conditional order is not supported. */ -getBorrowHistory( - params?: GetBorrowHistoryParamsV5, -): Promise>> +preCheckOrder( + params: OrderParamsV5, +): Promise> ⋮---- /** - * You can manually repay the liabilities of Unified account - * Applicable: Unified Account - * Permission: USDC Contracts * - * - Input the specific coin: repay the liability of this coin in particular - * - No coin specified: repay the liability of all coins + ****** Strategy APIs * - * Does not repay manual-borrow (spot margin manual borrow) liabilities — use `manualRepay` or - * `manualRepayWithoutConversion` instead (API error 182120 otherwise). - * From 2026-03-17 (full 2026-03-24), BYUSDT can be used for repayment. MNT is temporarily not used for - * this flow; MNT convert-repay is not supported (use `manualRepayWithoutConversion` with existing balance). - * From 2026-02-10 08:00 UTC, coin-conversion fees use the higher of collateral or debt fee rate, with a - * per-transaction coin-conversion cap of 300,000 USD equivalent. */ -repayLiability( - params?: RepayLiabilityParamsV5, -): Promise> +createStrategyOrder( + params: CreateStrategyOrderParamsV5, +): Promise> ⋮---- /** - * You can decide whether the assets in the Unified account needs to be collateral coins. + * Get Strategy List + * + * Query the strategy list. Supports filtering by strategy ID, symbol, status, category, and strategy type. */ -setCollateralCoin( - params: SetCollateralCoinParamsV5, -): Promise> ⋮---- /** - * Get the collateral information of the current unified margin account, including loan interest rate, - * loanable amount, collateral conversion rate, whether it can be mortgaged as margin, etc. + * Get Strategy Order List + * + * Query the individual orders generated by a specific strategy. */ -getCollateralInfo( - currency?: string, -): Promise> ⋮---- /** - * Get current account Greeks information + * Stop Strategy + * + * Stop a running strategy. Once stopped, the strategy cannot be resumed. */ -getCoinGreeks( - baseCoin?: string, -): Promise> ⋮---- /** - * Get the trading fee rate. - * Covers: Spot / USDT perpetual / Inverse perpetual / Inverse futures / Options + * + ****** Position APIs + * */ -getFeeRate( - params: GetFeeRateParamsV5, -): Promise>> ⋮---- /** - * Query the margin mode and the upgraded status of account + * Query real-time position data, such as position size, cumulative realizedPNL. + * + * 0: cross margin. 1: isolated margin + * + * Unified account covers: Linear contract / Options + * + * Normal account covers: USDT perpetual / Inverse perpetual / Inverse futures + * + * Note: this will give a 404 error if you query the `option` category if your account is not unified + * + * Response list items include `openTime` (position open timestamp in ms, default `0`). */ -getAccountInfo(): Promise> +getPositionInfo( + params: PositionInfoParamsV5, +): Promise>> ⋮---- /** - * Query the DCP configuration of the account's contracts (USDT perpetual, USDC perpetual and USDC Futures) / spot / options. - * - * Only the configured main / sub account can query information from this API. Calling this API by an account always returns empty. + * Get Futures Leverage + * Query isolated leverage settings without requiring an open position. * - * INFO - * support linear contract (USDT, USDC Perp & USDC Futures) / Spot / Options only - * Unified account only + * Returns an error under Portfolio Margin mode. */ -getDCPInfo(): Promise> ⋮---- /** - * Query transaction logs in Unified account. + * Set the leverage + * + * Unified account covers: Linear contract + * + * Normal account covers: USDT perpetual / Inverse perpetual / Inverse futures + * + * Note: Under one-way mode, buyLeverage must be the same as sellLeverage */ -getTransactionLog( - params?: GetTransactionLogParamsV5, -): Promise>> +setLeverage(params: SetLeverageParamsV5): Promise - > { - return this.getPrivate('/v5/account/contract-transaction-log', params); +switchIsolatedMargin( + params: SwitchIsolatedMarginParamsV5, +): Promise - > { - return this.getPrivate('/v5/account/smp-group'); +setTPSLMode( + params: SetTPSLModeParamsV5, +): Promise - > { - return this.postPrivate('/v5/account/set-margin-mode', { - setMarginMode: marginMode, - }); +switchPositionMode( + params: SwitchPositionModeParamsV5, +): Promise> ⋮---- /** - * Set Limit Price Behaviour - * You can configure how the system behaves when your limit order price exceeds the highest bid or lowest ask price. + * This endpoint allows you to set the take profit, stop loss or trailing stop for a position. + * Passing these parameters will create conditional orders by the system internally. * - * Spot: If the order price exceeds the boundary, the system rejects the request. - * Futures: If the order price exceeds the boundary, the system will automatically adjust the price to the nearest allowed boundary. + * The system will cancel these orders if the position is closed, and adjust the qty according to the size of the open position. + * + * Unified account covers: Linear contract. + * Normal account covers: USDT perpetual / Inverse perpetual / Inverse futures. */ -setLimitPriceAction( - params: SetLimitPriceActionParamsV5, +setTradingStop( + params: SetTradingStopParamsV5, ): Promise> +setAutoAddMargin( + params: SetAutoAddMarginParamsV5, +): Promise>> +addOrReduceMargin( + params: AddOrReduceMarginParamsV5, +): Promise> ⋮---- /** - * Configure Market Maker Protection (MMP) + * Query user's closed profit and loss records. The results are sorted by createdTime in descending order. + * + * Unified account covers: Linear contract + * Normal account covers: USDT perpetual / Inverse perpetual / Inverse futures */ -setMMP(params: MMPModifyParamsV5): Promise> +getClosedPnL( + params: GetClosedPnLParamsV5, +): Promise>> ⋮---- /** - * Once the mmp triggered, you can unfreeze the account via this endpoint + * Get Closed Options Positions + * Query user's closed options positions, sorted by closeTime in descending order + * + * INFO + * Only supports users to query closed options positions in recently 6 months + * Fee and price retain 8 decimal places and do not omit the last 0 */ -resetMMP(baseCoin: string): Promise> +getClosedOptionsPositions( + params?: GetClosedOptionsPositionsParamsV5, + ): Promise< + APIResponseV3WithTime<{ + nextPageCursor: string; + category: string; + list: ClosedOptionsPositionV5[]; + }> + > { + return this.getPrivate('/v5/position/get-closed-positions', params); ⋮---- /** - * Get MMP State + * Move positions between sub-master, master-sub, or sub-sub UIDs. + * + * Unified account covers: USDT perpetual / USDC contract / Spot / Option + * + * INFO + * The endpoint can only be called by master UID api key + * UIDs must be the same master-sub account relationship + * The trades generated from move-position endpoint will not be displayed in the Recent Trade (Rest API & Websocket) + * There is no trading fee + * fromUid and toUid both should be Unified trading accounts, and they need to be one-way mode when moving the positions + * Please note that once executed, you will get execType=MovePosition entry from Get Trade History, Get Closed Pnl, and stream from Execution. */ -getMMPState( - baseCoin: string, -): Promise> ⋮---- /** - * Get Option Asset Info - * P&L per coin for options: delta, RPL, UPL, margin. Result uses a nested `result` list. + * Query moved position data by master UID api key. + * + * Unified account covers: USDT perpetual / USDC contract / Spot / Option */ -getOptionAssetInfo(): Promise< - APIResponseV3WithTime +getMovePositionHistory(params?: GetMovePositionHistoryParamsV5): Promise< + APIResponseV3WithTime<{ + list: MovePositionHistoryV5[]; + nextPageCursor: string; + }> > { - return this.getPrivate('/v5/account/option-asset-info'); -⋮---- -/** - * Get Pay Info - * Repayment collateral snapshot before `manualRepay` or `repayLiability`. Optional `coin` for one liability; omit for total. - */ -getPayInfo( - params?: GetPayInfoParamsV5, -): Promise> + return this.getPrivate('/v5/position/move-history', params); ⋮---- /** - * Get Trade Info For Analysis - * Aggregated spot trade stats for a symbol, including daily breakdown when returned. + * Confirm new risk limit. + * + * It is only applicable when the user is marked as only reducing positions (please see the isReduceOnly field in the Get Position Info interface). + * After the user actively adjusts the risk level, this interface is called to try to calculate the adjusted risk level, and if it passes (retCode=0), + * the system will remove the position reduceOnly mark. You are recommended to call Get Position Info to check isReduceOnly field. + * + * Unified account covers: USDT perpetual / USDC contract / Inverse contract + * Classic account covers: USDT perpetual / Inverse contract */ -getTradeInfoForAnalysis( - params: GetTradeInfoForAnalysisParamsV5, -): Promise> +confirmNewRiskLimit( + params: ConfirmNewRiskLimitParamsV5, +): Promise> +getPreUpgradeOrderHistory( + params: GetPreUpgradeOrderHistoryParamsV5, +): Promise>> ⋮---- /** - * Get Portfolio Margin Info - * Wallet and per-base-coin P&L range (aligned with the portfolio margin page). + * Get users' execution records which occurred before you upgrade the account to Unified account, sorted by execTime in descending order + * + * For now, it only supports to query USDT perpetual, Inverse perpetual and futures. + * + * - You may have multiple executions in a single order. + * - You can query by symbol, baseCoin, orderId and orderLinkId, and if you pass multiple params, + * the system will process them according to this priority: orderId > orderLinkId > symbol > baseCoin. */ -getPortfolioMarginInfo( - params?: GetPortfolioMarginInfoParamsV5, -): Promise> +getPreUpgradeTradeHistory( + params: GetPreUpgradeTradeHistoryParamsV5, +): Promise>> ⋮---- /** - * Get Total Members Assets - * Master + sub-accounts; optional `coin` for valuation (default BTC). + * Query user's closed profit and loss records. The results are sorted by createdTime in descending order. + * + * For now, it only supports to query USDT perpetual, Inverse perpetual and futures. */ -getTotalMembersAssets( - params?: GetTotalMembersAssetsParamsV5, -): Promise> +getPreUpgradeClosedPnl( + params: GetPreUpgradeClosedPnlParamsV5, +): Promise>> ⋮---- /** - * Funding Account Transaction History - * Transaction log in Funding Account. Supports filtering by transaction type and time range. + * Query transaction logs which occurred in the USDC Derivatives wallet before the account was upgraded to a Unified account. * - * INFO: createTimeFrom and createTimeTo must be used together. Interval cannot exceed 7 days. If neither provided, defaults to last 7 days. + * You can get USDC Perpetual, Option records. + * + * INFO + * USDC Perpeual & Option support the recent 6 months data. Please download older data via GUI */ -getFundingAccountTransactionHistory( - params?: GetFundingAccountTransactionHistoryParamsV5, +getPreUpgradeTransactions( + params: GetPreUpgradeTransactionLogParamsV5, ): Promise< APIResponseV3WithTime<{ + list: PreUpgradeTransaction[]; nextPageCursor: string; - list: FundingAccountTransactionRecordV5[]; }> > { - return this.getPrivate('/v5/asset/fundinghistory', params); + return this.getPrivate('/v5/pre-upgrade/account/transaction-log', params); ⋮---- /** - * Query option delivery records, sorted by deliveryTime in descending order. + * Query delivery records of Option before you upgraded the account to a Unified account, sorted by deliveryTime in descending order. * - * Covers: Option + * INFO + * Supports the recent 6 months data. Please download older data via GUI */ -getDeliveryRecord( - params: GetDeliveryRecordParamsV5, -): Promise>> +getPreUpgradeOptionDeliveryRecord( + params: GetPreUpgradeOptionDeliveryRecordParamsV5, + ): Promise< + APIResponseV3WithTime> + > { + return this.getPrivate('/v5/pre-upgrade/asset/delivery-record', params); ⋮---- /** - * Query session settlement records of USDC perpetual + * Query session settlement records of USDC perpetual before you upgrade the account to Unified account. * - * Covers: Linear contract (USDC Perpetual only, Unified Account) + * INFO + * USDC Perpetual support the recent 6 months data. Please download older data via GUI */ -getSettlementRecords( - params: GetSettlementRecordParamsV5, +getPreUpgradeUSDCSessionSettlements( + params: GetPreUpgradeUSDCSessionParamsV5, ): Promise< - APIResponseV3WithTime> + APIResponseV3WithTime< + CategoryCursorListV5 + > > { - return this.getPrivate('/v5/asset/settlement-record', params); + return this.getPrivate('/v5/pre-upgrade/asset/settlement-record', params); ⋮---- /** - * Query the coin exchange records. * - * CAUTION: You may experience long delays with this endpoint. + ****** Account APIs + * */ -getCoinExchangeRecords(params?: GetCoinExchangeRecordParamsV5): Promise< - APIResponseV3WithTime<{ - orderBody: CoinExchangeRecordV5[]; - nextPageCursor?: string; - }> - > { - return this.getPrivate('/v5/asset/exchange/order-record', params); ⋮---- /** - * Query coin information, including chain information, withdraw and deposit status. + * Obtain wallet balance, query asset information of each currency, and account risk rate information under unified margin mode. * - * Per-chain `withdrawMax` is the max amount per withdrawal on that chain (`-1` = no limit). - * `remainAmount` is deprecated. + * By default, currency information with assets or liabilities of 0 is not returned. */ -getCoinInfo( - coin?: string, +getWalletBalance( + params: GetWalletBalanceParamsV5, ): Promise > { - return this.getPrivate('/v5/asset/transfer/query-sub-member-list'); + return this.getPrivate('/v5/account/withdrawal', params); ⋮---- /** - * Query asset information. + * Get Account Instruments Info + * Query for the instrument specification of online trading pairs that available to users. * - * INFO - * For now, it can query SPOT only. - */ -getAssetInfo( - params: GetAssetInfoParamsV5, -): Promise> +getAccountInstrumentsInfo( + params: GetAccountInstrumentsInfoParamsV5 & { category: C }, +): Promise>> ⋮---- /** - * Query the balance of a specific coin in a specific account type. Supports querying sub UID's balance. + * Upgrade to unified account. * - * CAUTION: Can query by the master UID's api key only. - */ -getCoinBalance( - params: GetAccountCoinBalanceParamsV5, -): Promise> -⋮---- -/** - * Query withdrawable amount (incl. risk-frozen `limitAmountUsd` and per-wallet slices). - * May include FUND, UTA, EARN, SPOT keys depending on the coin. EARN is present when the coin - * supports withdrawal from the Earn account. + * Banned/OTC loan/Net asset unsatisfying/Express path users cannot upgrade the account to Unified Account for now. */ -getWithdrawableAmount(params: { - coin: string; -}): Promise> +upgradeToUnifiedAccount(): Promise< + APIResponseV3WithTime + > { + return this.postPrivate('/v5/account/upgrade-to-uta'); ⋮---- /** - * Query the transferable coin list between each account type. + * Get interest records, sorted in reverse order of creation time. + * + * Unified account */ -getTransferableCoinList( - fromAccountType: AccountTypeV5, - toAccountType: AccountTypeV5, -): Promise>> ⋮---- /** - * Create the internal transfer between different account types under the same UID. - * Each account type has its own acceptable coins, e.g, you cannot transfer USDC from SPOT to CONTRACT. + * You can manually repay the liabilities of Unified account + * Applicable: Unified Account + * Permission: USDC Contracts * - * Please refer to the getTransferableCoinList() API to find out more. + * - Input the specific coin: repay the liability of this coin in particular + * - No coin specified: repay the liability of all coins + * + * Does not repay manual-borrow (spot margin manual borrow) liabilities — use `manualRepay` or + * `manualRepayWithoutConversion` instead (API error 182120 otherwise). + * From 2026-03-17 (full 2026-03-24), BYUSDT can be used for repayment. MNT is temporarily not used for + * this flow; MNT convert-repay is not supported (use `manualRepayWithoutConversion` with existing balance). + * From 2026-02-10 08:00 UTC, coin-conversion fees use the higher of collateral or debt fee rate, with a + * per-transaction coin-conversion cap of 300,000 USD equivalent. */ -createInternalTransfer( - transferId: string, - coin: string, - amount: string, - fromAccountType: AccountTypeV5, - toAccountType: AccountTypeV5, +repayLiability( + params?: RepayLiabilityParamsV5, ): Promise>> -⋮---- -/** - * Enable Universal Transfer for Sub UID + * Manual Repay * - * Use this endpoint to enable a subaccount to take part in a universal transfer. - * It is a one-time switch which, once thrown, enables a subaccount permanently. - * If not set, your subaccount cannot use universal transfers. + * If neither coin nor amount is passed, then repay all the liabilities. + * If coin is passed and amount is not, the coin will be repaid in full. * - * @deprecated - You no longer need to configure transferable sub UIDs. - * Now, all sub UIDs are automatically enabled for universal transfer. + * When repaying, the system will first use the spot available balance of the debt currency. + * If that's not enough, the remaining amount will be repaid by converting other assets. + * + * Repayment is prohibited between 04:00 and 05:30 per hour. * + * When `coin` and `amount` are both set, validation depends on `repaymentType` (e.g. amount must not + * exceed the matching liability pool). If neither `coin` nor `amount` is set, `repaymentType` must be + * ALL. Response timing: ALL and FIXED are asynchronous; FLEXIBLE is synchronous. + * For repay-without-convert (spot balance only), use `manualRepayWithoutConversion`. + * From 2026-03-17 (full 2026-03-24), BYUSDT can be used for repayment. MNT: not via convert-repay; + * use `manualRepayWithoutConversion` for MNT with existing balance. From 2026-02-10 08:00 UTC, + * coin-conversion cap 300,000 USD equivalent per transaction applies. */ -enableUniversalTransferForSubUIDs( - subMemberIds: string[], -): Promise> ⋮---- /** - * Transfer between sub-sub or main-sub. Please make sure you have enabled universal transfer on your sub UID in advance. + * You can decide whether the assets in the Unified account needs to be collateral coins. */ -createUniversalTransfer( - params: UniversalTransferParamsV5, +setCollateralCoin( + params: SetCollateralCoinParamsV5, ): Promise>> -⋮---- -/** - * Query allowed deposit coin information. - * To find out paired chain of coin, please refer to the coin info api. - */ -getAllowedDepositCoinInfo( - params?: GetAllowedDepositCoinInfoParamsV5, - ): Promise< - APIResponseV3WithTime<{ - configList: AllowedDepositCoinInfoV5[]; - nextPageCursor: string; - }> - > { - return this.getPrivate('/v5/asset/deposit/query-allowed-list', params); +batchSetCollateralCoin(params: { + request: SetCollateralCoinParamsV5[]; +}): Promise - > { - return this.postPrivate('/v5/asset/deposit/deposit-to-account', params); +getCollateralInfo( + currency?: string, +): Promise - > { - return this.getPrivate('/v5/asset/deposit/query-record', params); +getCoinGreeks( + baseCoin?: string, +): Promise - > { - return this.getPrivate('/v5/asset/deposit/query-sub-member-record', params); +getFeeRate( + params: GetFeeRateParamsV5, +): Promise>> ⋮---- /** - * Get Internal Deposit Records (across Bybit) - * Query deposit records through Bybit platform - * - * RULES - * The maximum difference between the start time and the end time is 30 days. - * Support to get deposit records by Master or Sub Member Api Key + * Query the margin mode and the upgraded status of account */ -getInternalDepositRecords(params?: GetInternalDepositRecordParamsV5): Promise< - APIResponseV3WithTime<{ - rows: InternalDepositRecordV5[]; - nextPageCursor: string; - }> - > { - return this.getPrivate('/v5/asset/deposit/query-internal-record', params); +getAccountInfo(): Promise> ⋮---- /** - * Query the deposit address information of MASTER account. + * Query the DCP configuration of the account's contracts (USDT perpetual, USDC perpetual and USDC Futures) / spot / options. + * + * Only the configured main / sub account can query information from this API. Calling this API by an account always returns empty. + * + * INFO + * support linear contract (USDT, USDC Perp & USDC Futures) / Spot / Options only + * Unified account only */ -getMasterDepositAddress( - coin: string, - chainType?: string, - ): Promise< - APIResponseV3WithTime<{ - coin: string; - chains: DepositAddressChainV5[]; - }> - > { - return this.getPrivate('/v5/asset/deposit/query-address', { - coin, - chainType, - }); +getDCPInfo(): Promise - > { - return this.getPrivate('/v5/asset/deposit/query-sub-member-address', { - coin, - chainType, - subMemberId, - }); +getTransactionLog( + params?: GetTransactionLogParamsV5, +): Promise>> ⋮---- /** - * @deprecated - duplicate function, use getSubDepositAddress() instead - * Query the deposit address information of SUB account. - * @deprecated Duplicate endpoint - Use getSubDepositAddress() instead + * Query transaction logs in the derivatives wallet (classic account), and inverse derivatives wallet (upgraded to UTA). * - * CAUTION - * Can use master UID's api key only + * API key permission: "Contract - Position" */ -querySubMemberAddress( - coin: string, - chainType: string, - subMemberId: string, +getClassicTransactionLogs( + params?: GetClassicTransactionLogsParamsV5, ): Promise< - APIResponseV3<{ - coin: string; - chains: DepositAddressChainV5; - }> + APIResponseV3WithTime<{ list: TransactionLogV5[]; nextPageCursor: string }> > { - return this.getPrivate('/v5/asset/deposit/query-sub-member-address', { - coin, - chainType, - subMemberId, - }); -⋮---- -/** - * Query withdrawal records. - */ -getWithdrawalRecords( - params?: GetWithdrawalRecordsParamsV5, -): Promise>> + return this.getPrivate('/v5/account/contract-transaction-log', params); ⋮---- /** - * Get Withdrawal Address List - * Query the withdrawal addresses in the address book. - * - * TIP: The API key for querying this endpoint must have withdrawal permissions. + * Query the SMP group ID of self match prevention. */ -getWithdrawalAddressList(params?: GetWithdrawalAddressListParamsV5): Promise< +getSMPGroup(): Promise< APIResponseV3WithTime<{ - rows: WithdrawalAddressV5[]; - nextPageCursor: string; + smpGroup: string; }> > { - return this.getPrivate('/v5/asset/withdraw/query-address', params); + return this.getPrivate('/v5/account/smp-group'); ⋮---- /** - * Get Exchange Entity List. + * Default is regular margin mode. * - * This endpoint is particularly used for kyc=KOR users. When withdraw funds, you need to fill entity id. + * This mode is valid for USDT Perp, USDC Perp and USDC Option. */ -getExchangeEntities(): Promise< - APIResponseV3WithTime<{ vasp: VaspEntityV5[] }> +setMarginMode( + marginMode: AccountMarginModeV5, + ): Promise< + APIResponseV3<{ reasons: { reasonCode: string; reasonMsg: string }[] }> > { - return this.getPrivate('/v5/asset/withdraw/vasp/list'); + return this.postPrivate('/v5/account/set-margin-mode', { + setMarginMode: marginMode, + }); ⋮---- /** - * Submit Deposit Originator Info - * Submit Travel Rule originator questionnaire when deposit `travel_rule_status` is pending (1). + * Turn on/off Spot hedging feature in Portfolio margin for Unified account. + * + * INFO + * Only unified account is applicable + * Only portfolio margin mode is applicable */ -submitDepositOriginatorInfo( - params: SubmitDepositOriginatorInfoParamsV5, -): Promise> +setSpotHedging(params: { + setHedgingMode: 'ON' | 'OFF'; +}): Promise> ⋮---- /** - * Query the coin list of convert from (to). + * Set Delta Neutral Mode + * 1: enable, 0: disable. Query current status via `getLimitPriceAction()`. */ -getConvertCoins(params: ConvertCoinsParamsV5): Promise< - APIResponseV3WithTime<{ - coins: ConvertCoinSpecV5[]; - }> - > { - return this.getPrivate('/v5/asset/exchange/query-coin-list', params); +setDeltaNeutralMode( + params: SetDeltaNeutralModeParamsV5, +): Promise>> ⋮---- /** - * Request a quote for converting coins. + * Configure Market Maker Protection (MMP) */ -requestConvertQuote( - params: RequestConvertQuoteParamsV5, -): Promise> +setMMP(params: MMPModifyParamsV5): Promise> ⋮---- /** - * Confirm a quote for converting coins. + * Once the mmp triggered, you can unfreeze the account via this endpoint */ -confirmConvertQuote(params: { quoteTxId: string }): Promise< - APIResponseV3WithTime<{ - quoteTxId: string; - exchangeStatus: 'init' | 'processing' | 'success' | 'failure'; - }> - > { - return this.postPrivate('/v5/asset/exchange/convert-execute', params); +resetMMP(baseCoin: string): Promise> ⋮---- /** - * Query the exchange result by sending quoteTxId. + * Get MMP State */ -getConvertStatus(params: { - quoteTxId: string; - accountType: - | 'eb_convert_funding' - | 'eb_convert_uta' - | 'eb_convert_spot' - | 'eb_convert_contract' - | 'eb_convert_inverse'; - }): Promise< - APIResponseV3WithTime<{ - result: ConvertStatusV5; - }> - > { - return this.getPrivate('/v5/asset/exchange/convert-result-query', params); +getMMPState( + baseCoin: string, +): Promise +getOptionAssetInfo(): Promise< + APIResponseV3WithTime > { - return this.getPrivate('/v5/asset/exchange/query-convert-history', params); + return this.getPrivate('/v5/account/option-asset-info'); ⋮---- /** - * Get Small Balance Coins - * Query small-balance coins with a USDT equivalent of less than 10 USDT. - * Ensure total amount for each conversion transaction is between 1.0e-8 and 200 USDT. - * - * INFO: - * - API key permission: Convert - * - API rate limit: 10 req/s + * Get Pay Info + * Repayment collateral snapshot before `manualRepay` or `repayLiability`. Optional `coin` for one liability; omit for total. */ -getSmallBalanceList( - params: GetSmallBalanceListParamsV5, -): Promise> +getPayInfo( + params?: GetPayInfoParamsV5, +): Promise> ⋮---- /** - * Get Fiat Trading Pair List - * Query for the list of coins you can convert to/from. - * - * INFO: - * - For buy side (side=0): buy crypto, sell fiat - * - For sell side (side=1): sell crypto, buy fiat + * Get Trade Info For Analysis + * Aggregated spot trade stats for a symbol, including daily breakdown when returned. */ -getFiatTradingPairList( - params?: GetFiatTradingPairListParamsV5, -): Promise> +getTradeInfoForAnalysis( + params: GetTradeInfoForAnalysisParamsV5, +): Promise> ⋮---- /** * - ****** User APIs - * - */ -⋮---- -/** - * Create a new sub user id. Use master user's api key only. + ****** Asset APIs * - * The API key must have one of the permissions to be allowed to call the following API endpoint. - * - master API key: "Account Transfer", "Subaccount Transfer", "Withdrawal" */ -createSubMember( - params: CreateSubMemberParamsV5, -): Promise> ⋮---- /** - * To create new API key for those newly created sub UID. Use master user's api key only. + * Asset Overview + * Query master account or subaccount's total assets and detailed asset holdings across different accounts and product categories. * - * TIP: The API key must have one of the permissions to be allowed to call the following API endpoint. - * - master API key: "Account Transfer", "Subaccount Transfer", "Withdrawal" + * INFO: For accountType=Alpha, on-chain assets are not included in the returned data in current version. + * `valuationCurrency` sets fiat for totals; `accountType` filters which account to return. For Alpha + farm, `extMap` may + * appear on `coinDetail` (price range and equity unit). */ -createSubUIDAPIKey( - params: CreateSubApiKeyParamsV5, -): Promise> +getAssetOverview( + params?: GetAssetOverviewParamsV5, +): Promise> ⋮---- /** - * This endpoint allows you to get a list of all sub UID of master account. At most 10k subaccounts. + * Get Portfolio Margin Info + * Wallet and per-base-coin P&L range (aligned with the portfolio margin page). */ -getSubUIDList(): Promise< - APIResponseV3WithTime<{ subMembers: SubMemberV5[] }> - > { - return this.getPrivate('/v5/user/query-sub-members'); +getPortfolioMarginInfo( + params?: GetPortfolioMarginInfoParamsV5, +): Promise> ⋮---- /** - * This endpoint allows you to get a list of all sub UID of master account. No limit on the number of subaccounts. + * Get Total Members Assets + * Master + sub-accounts; optional `coin` for valuation (default BTC). */ -getSubUIDListUnlimited(params?: { - pageSize?: string; - nextCursor?: string; - }): Promise< +getTotalMembersAssets( + params?: GetTotalMembersAssetsParamsV5, +): Promise> +⋮---- +/** + * Funding Account Transaction History + * Transaction log in Funding Account. Supports filtering by transaction type and time range. + * + * INFO: createTimeFrom and createTimeTo must be used together. Interval cannot exceed 7 days. If neither provided, defaults to last 7 days. + */ +getFundingAccountTransactionHistory( + params?: GetFundingAccountTransactionHistoryParamsV5, + ): Promise< APIResponseV3WithTime<{ - subMembers: SubMemberV5[]; - nextCursor: string; + nextPageCursor: string; + list: FundingAccountTransactionRecordV5[]; }> > { - return this.getPrivate('/v5/user/submembers', params); + return this.getPrivate('/v5/asset/fundinghistory', params); ⋮---- /** - * Froze sub uid. Use master user's api key only. + * Query option delivery records, sorted by deliveryTime in descending order. * - * TIP: The API key must have one of the permissions to be allowed to call the following API endpoint. - * - master API key: "Account Transfer", "Subaccount Transfer", "Withdrawal" + * Covers: Option */ -setSubUIDFrozenState( - subuid: number, - frozen: 0 | 1, -): Promise>> ⋮---- /** - * Get the information of the api key. Use the api key pending to be checked to call the endpoint. - * Both master and sub user's api key are applicable. - * - * TIP: Any permission can access this endpoint. + * Query session settlement records of USDC perpetual * - * Response `permissions` may include `FiatBitPay` (not `FiatBybitPay`). + * Covers: Linear contract (USDC Perpetual only, Unified Account) */ -getQueryApiKey(): Promise> +getSettlementRecords( + params: GetSettlementRecordParamsV5, + ): Promise< + APIResponseV3WithTime> + > { + return this.getPrivate('/v5/asset/settlement-record', params); ⋮---- /** - * Query all api keys information of a sub UID. + * Query the coin exchange records. + * + * CAUTION: You may experience long delays with this endpoint. */ -getSubAccountAllApiKeys(params: GetSubAccountAllApiKeysParamsV5): Promise< - APIResponseV3WithTime<{ - result: ApiKeyInfoV5[]; - nextPageCursor: string; - }> - > { - return this.getPrivate('/v5/user/sub-apikeys', params); -⋮---- -getUIDWalletType(params: { memberIds: string }): Promise< +getCoinExchangeRecords(params?: GetCoinExchangeRecordParamsV5): Promise< APIResponseV3WithTime<{ - accounts: { - uid: string; - accountType: string[]; - }[]; + orderBody: CoinExchangeRecordV5[]; + nextPageCursor?: string; }> > { - return this.getPrivate('/v5/user/get-member-type', params); + return this.getPrivate('/v5/asset/exchange/order-record', params); ⋮---- /** - * Modify the settings of a master API key. Use the API key pending to be modified to call the endpoint. Use master user's API key only. - * - * TIP: The API key must have one of the permissions to be allowed to call the following API endpoint. - * - master API key: "Account Transfer", "Subaccount Transfer", "Withdrawal" + * Query coin information, including chain information, withdraw and deposit status. * - * `permissions` may include `FiatBitPay` (not `FiatBybitPay`). + * Per-chain `withdrawMax` is the max amount per withdrawal on that chain (`-1` = no limit). + * `remainAmount` is deprecated. */ -updateMasterApiKey( - params: UpdateApiKeyParamsV5, -): Promise> +getCoinInfo( + coin?: string, +): Promise> +getSubUID(): Promise< + APIResponseV3WithTime<{ + subMemberIds: string[]; + transferableSubMemberIds: string[]; + }> + > { + return this.getPrivate('/v5/asset/transfer/query-sub-member-list'); ⋮---- /** - * Delete a sub UID. Before deleting the UID, please make sure there are no assets. + * Query asset information. * - * TIP: - * The API key must have one of the permissions to be allowed to call the following API endpoint. - * - master API key: "Account Transfer", "Subaccount Transfer", "Withdrawal" + * INFO + * For now, it can query SPOT only. */ -deleteSubMember( - params: DeleteSubMemberParamsV5, +getAssetInfo( + params: GetAssetInfoParamsV5, ): Promise> ⋮---- /** + * Query the balance of a specific coin in a specific account type. Supports querying sub UID's balance. * - ****** Tax - * + * CAUTION: Can query by the master UID's api key only. */ +getCoinBalance( + params: GetAccountCoinBalanceParamsV5, +): Promise> ⋮---- /** - * Export multiple tax report types in one batch. Returns a batchId for status polling. + * Query withdrawable amount (incl. risk-frozen `limitAmountUsd` and per-wallet slices). + * May include FUND, UTA, EARN, SPOT keys depending on the coin. EARN is present when the coin + * supports withdrawal from the Earn account. */ -createTaxBatchExport( - params: CreateTaxBatchExportParamsV5, -): Promise> +getWithdrawableAmount(params: { + coin: string; +}): Promise> ⋮---- /** - * Query tax batch export task status and download URLs by batchId. + * Query the transferable coin list between each account type. */ -getTaxBatchExport( - params: GetTaxBatchExportParamsV5, -): Promise> +getTransferableCoinList( + fromAccountType: AccountTypeV5, + toAccountType: AccountTypeV5, +): Promise - > { - return this.getPrivate('/v5/affiliate/aff-user-list', params); +getInternalTransferRecords( + params?: GetInternalTransferParamsV5, +): Promise>> ⋮---- /** - * Get Affiliate Sub-Affiliate List. + * Enable Universal Transfer for Sub UID * - * To use this endpoint, you should have an affiliate account and only tick "affiliate" permission while creating the API key. + * Use this endpoint to enable a subaccount to take part in a universal transfer. + * It is a one-time switch which, once thrown, enables a subaccount permanently. + * If not set, your subaccount cannot use universal transfers. + * + * @deprecated - You no longer need to configure transferable sub UIDs. + * Now, all sub UIDs are automatically enabled for universal transfer. * - * TIP: - * - Use master UID only - * - The api key can only have "Affiliate" permission */ -getAffiliateSubAffiliateList( - params?: GetAffiliateSubAffiliateListParamsV5, -): Promise> +enableUniversalTransferForSubUIDs( + subMemberIds: string[], +): Promise> +createUniversalTransfer( + params: UniversalTransferParamsV5, +): Promise>> +⋮---- +/** + * Query allowed deposit coin information. + * To find out paired chain of coin, please refer to the coin info api. + */ +getAllowedDepositCoinInfo( + params?: GetAllowedDepositCoinInfoParamsV5, + ): Promise< APIResponseV3WithTime<{ - nextCursor: string; - records: FriendReferralRecordV5[]; + configList: AllowedDepositCoinInfoV5[]; + nextPageCursor: string; }> > { - return this.getPrivate('/v5/user/invitation/referrals', params); -⋮---- -getReferralCode(): Promise> + return this.getPrivate('/v5/asset/deposit/query-allowed-list', params); ⋮---- /** - * Sign Agreement - * To trade commodity contracts (e.g. metals XAU/XAG perps, crude oil perps), complete the agreement signing first. - * Recommended to sign in advance via API so you can trade immediately when contracts go live. - * Send either `category` (legacy) or `categoryV2` (preferred; new agreement types are added to `categoryV2` only). - * - * INFO - * - Only the master account can sign. Subaccounts are not supported. - * - Once the master has signed, all subaccounts will be eligible to trade. - * - API key must have: Account Transfer, Subaccount Transfer, or Withdrawal. - * - Trading without signing returns code=110123, msg=You must agree to the Trading Terms. + * Set auto transfer account after deposit. The same function as the setting for Deposit on web GUI + * (UNIFIED, FUND, or EARN; if a coin is not in flexible saving, EARN may route to funding as per Bybit). */ -signAgreement( - params: SignAgreementParamsV5, -): Promise + > { + return this.postPrivate('/v5/asset/deposit/deposit-to-account', params); ⋮---- /** + * Query deposit records. * - ****** Alpha / Web3 (on-chain) trade APIs + * TIP + * endTime - startTime should be less than 30 days. Query last 30 days records by default. * + * Can use main or sub UID api key to query deposit records respectively. */ +getDepositRecords( + params?: GetDepositRecordParamsV5, + ): Promise< + APIResponseV3WithTime<{ rows: DepositRecordV5[]; nextPageCursor: string }> + > { + return this.getPrivate('/v5/asset/deposit/query-record', params); ⋮---- /** - * Get Trade Quote - * Get a price quote before a purchase or redeem. Required before `executeAlphaTradePurchase` or `executeAlphaTradeRedeem`. - * Pass `quoteData` and `correctingCode` from the response unchanged to the execute endpoints. - */ -getAlphaTradeQuote( - params: GetAlphaTradeQuoteParamsV5, -): Promise> -⋮---- -/** - * Execute Purchase - * Buy on-chain tokens with a payment token (e.g. USDT). Requires a valid quote; obtain user confirmation first. - * HTTP 200 is only an acknowledgment — poll `getAlphaTradeOrderList` for final status. Idempotent by `quoteDataId` in the quote. + * Query subaccount's deposit records by MAIN UID's API key. + * + * TIP: Query deposit records of SPOT only + * endTime - startTime should be less than 30 days. + * Queries for the last 30 days worth of records by default. */ -executeAlphaTradePurchase( - params: ExecuteAlphaTradeParamsV5, -): Promise> +getSubAccountDepositRecords( + params: GetSubAccountDepositRecordParamsV5, + ): Promise< + APIResponseV3WithTime<{ rows: DepositRecordV5[]; nextPageCursor: string }> + > { + return this.getPrivate('/v5/asset/deposit/query-sub-member-record', params); ⋮---- /** - * Execute Redeem - * Sell on-chain tokens for a payment token. Requires a valid quote; obtain user confirmation first. - * HTTP 200 is only an acknowledgment — poll `getAlphaTradeOrderList` for final status. Idempotent by `quoteDataId` in the quote. + * Get Internal Deposit Records (across Bybit) + * Query deposit records through Bybit platform + * + * RULES + * The maximum difference between the start time and the end time is 30 days. + * Support to get deposit records by Master or Sub Member Api Key */ -executeAlphaTradeRedeem( - params: ExecuteAlphaTradeParamsV5, -): Promise> +getInternalDepositRecords(params?: GetInternalDepositRecordParamsV5): Promise< + APIResponseV3WithTime<{ + rows: InternalDepositRecordV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/asset/deposit/query-internal-record', params); ⋮---- /** - * Get Payment Token List - * List payment tokens (e.g. USDT) and CEX token codes (e.g. CEX_1) for quote and execution. Each entry includes `supportChains`. + * Query the deposit address information of MASTER account. */ -getAlphaPayTokenList( - params: GetAlphaPayTokenListParamsV5, -): Promise> +getMasterDepositAddress( + coin: string, + chainType?: string, + ): Promise< + APIResponseV3WithTime<{ + coin: string; + chains: DepositAddressChainV5[]; + }> + > { + return this.getPrivate('/v5/asset/deposit/query-address', { + coin, + chainType, + }); ⋮---- /** - * Get Order List - * On-chain trade order history; filters for trade type, status, token, and time. Max 90 days. + * Query the deposit address information of SUB account. */ -getAlphaTradeOrderList( - params: GetAlphaTradeOrderListParamsV5, -): Promise> +getSubDepositAddress( + coin: string, + chainType: string, + subMemberId: string, + ): Promise< + APIResponseV3WithTime<{ + coin: string; + chains: DepositAddressChainV5; + }> + > { + return this.getPrivate('/v5/asset/deposit/query-sub-member-address', { + coin, + chainType, + subMemberId, + }); ⋮---- /** - * Get Biz Token List - * Tradable on-chain tokens (DEX_ prefix ids), risk flags, limits, and supported payment token codes. + * @deprecated - duplicate function, use getSubDepositAddress() instead + * Query the deposit address information of SUB account. + * @deprecated Duplicate endpoint - Use getSubDepositAddress() instead + * + * CAUTION + * Can use master UID's api key only */ -getAlphaBizTokenList( - params?: GetAlphaBizTokenListParamsV5, -): Promise> +querySubMemberAddress( + coin: string, + chainType: string, + subMemberId: string, + ): Promise< + APIResponseV3<{ + coin: string; + chains: DepositAddressChainV5; + }> + > { + return this.getPrivate('/v5/asset/deposit/query-sub-member-address', { + coin, + chainType, + subMemberId, + }); ⋮---- /** - * Get Token Price List - * Batch market data (up to 20 `chainCode` + `tokenAddress` pairs). Prices, 24h change, volume, market cap, etc. + * Query withdrawal records. */ -getAlphaBizTokenPriceList( - params: GetAlphaBizTokenPriceListParamsV5, -): Promise> +getWithdrawalRecords( + params?: GetWithdrawalRecordsParamsV5, +): Promise>> ⋮---- /** - * Get Token Details - * One token: description, links, `riskFlag`, and listing status. Use `chainCode` + `tokenAddress` from biz list or assets. + * Get Withdrawal Address List + * Query the withdrawal addresses in the address book. + * + * TIP: The API key for querying this endpoint must have withdrawal permissions. */ -getAlphaBizTokenDetails( - params: GetAlphaBizTokenDetailsParamsV5, -): Promise> +getWithdrawalAddressList(params?: GetWithdrawalAddressListParamsV5): Promise< + APIResponseV3WithTime<{ + rows: WithdrawalAddressV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/asset/withdraw/query-address', params); ⋮---- /** - * Get Asset List - * Portfolio of on-chain token holdings (non-zero only), sorted by USD value. + * Get Exchange Entity List. + * + * This endpoint is particularly used for kyc=KOR users. When withdraw funds, you need to fill entity id. */ -getAlphaAssetList(): Promise> +getExchangeEntities(): Promise< + APIResponseV3WithTime<{ vasp: VaspEntityV5[] }> + > { + return this.getPrivate('/v5/asset/withdraw/vasp/list'); ⋮---- /** - * Get Asset Detail - * Single-asset view; `result.assetList` has 0 or 1 item. + * Submit Deposit Originator Info + * Submit Travel Rule originator questionnaire when deposit `travel_rule_status` is pending (1). */ -getAlphaAssetDetail( - params: GetAlphaAssetDetailParamsV5, -): Promise> +submitDepositOriginatorInfo( + params: SubmitDepositOriginatorInfoParamsV5, +): Promise> ⋮---- /** + * Withdraw from Funding, Unified, and/or Earn (and combos such as FUND,UTA,EARN per API). * - ****** Alpha / Web3 prediction market APIs + * CAUTION: Make sure you have whitelisted your wallet address before calling this endpoint. + * + * You can make an off-chain transfer if the target wallet address is from Bybit. This means that no blockchain fee will be charged. * + * Bybit Turkey (TR) site: `transactionPurpose` is required on the request (see `WithdrawParamsV5`). */ +submitWithdrawal( + params: WithdrawParamsV5, +): Promise - > { - return this.getPrivate('/v5/alpha/prediction/engine-status'); +cancelWithdrawal( + id: string, +): Promise +getConvertCoins(params: ConvertCoinsParamsV5): Promise< + APIResponseV3WithTime<{ + coins: ConvertCoinSpecV5[]; + }> > { - return this.getPrivate('/v5/alpha/prediction/pay-token-list'); + return this.getPrivate('/v5/asset/exchange/query-coin-list', params); ⋮---- /** - * Get Event Detail - * Event metadata, outcome markets, and current prices. Obtain tokenId before trading. + * Request a quote for converting coins. */ -getAlphaPredictionEventDetail( - params: GetAlphaPredictionEventDetailParamsV5, -): Promise> +requestConvertQuote( + params: RequestConvertQuoteParamsV5, +): Promise> ⋮---- /** - * Get Order Estimate - * Preview buy/sell outcome before execution. Show estimate to user and confirm before Buy/Sell. + * Confirm a quote for converting coins. */ -getAlphaPredictionOrderEstimate( - params: GetAlphaPredictionOrderEstimateParamsV5, -): Promise> +confirmConvertQuote(params: { quoteTxId: string }): Promise< + APIResponseV3WithTime<{ + quoteTxId: string; + exchangeStatus: 'init' | 'processing' | 'success' | 'failure'; + }> + > { + return this.postPrivate('/v5/asset/exchange/convert-execute', params); ⋮---- /** - * Execute Buy - * Buy prediction outcome tokens with USDC. HTTP 200 is acknowledgment only — poll order list. + * Query the exchange result by sending quoteTxId. */ -executeAlphaPredictionBuy( - params: ExecuteAlphaPredictionBuyParamsV5, -): Promise> +getConvertStatus(params: { + quoteTxId: string; + accountType: + | 'eb_convert_funding' + | 'eb_convert_uta' + | 'eb_convert_spot' + | 'eb_convert_contract' + | 'eb_convert_inverse'; + }): Promise< + APIResponseV3WithTime<{ + result: ConvertStatusV5; + }> + > { + return this.getPrivate('/v5/asset/exchange/convert-result-query', params); ⋮---- /** - * Execute Sell - * Sell prediction outcome token shares for USDC. HTTP 200 is acknowledgment only — poll order list. + * Query the conversion history. */ -executeAlphaPredictionSell( - params: ExecuteAlphaPredictionSellParamsV5, -): Promise> +getConvertHistory(params?: GetConvertHistoryParamsV5): Promise< + APIResponseV3WithTime<{ + list: ConvertHistoryRecordV5[]; + }> + > { + return this.getPrivate('/v5/asset/exchange/query-convert-history', params); ⋮---- /** - * Get Order List - * Prediction market order history for the authenticated user. + * Get Small Balance Coins + * Query small-balance coins with a USDT equivalent of less than 10 USDT. + * Ensure total amount for each conversion transaction is between 1.0e-8 and 200 USDT. + * + * INFO: + * - API key permission: Convert + * - API rate limit: 10 req/s */ -getAlphaPredictionOrderList( - params: GetAlphaPredictionOrderListParamsV5, -): Promise> +getSmallBalanceList( + params: GetSmallBalanceListParamsV5, +): Promise> ⋮---- /** - * Get Order Book - * Full bid/ask depth snapshot for up to 20 outcome tokens. + * Get Fiat Trading Pair List + * Query for the list of coins you can convert to/from. + * + * INFO: + * - For buy side (side=0): buy crypto, sell fiat + * - For sell side (side=1): sell crypto, buy fiat */ -getAlphaPredictionOrderBook( - params: GetAlphaPredictionOrderBookParamsV5, -): Promise> +getFiatTradingPairList( + params?: GetFiatTradingPairListParamsV5, +): Promise> ⋮---- /** - * Get Token Price - * Best bid/ask and last price for up to 20 outcome tokens. + * + ****** User APIs + * */ -getAlphaPredictionTokenPrice( - params: GetAlphaPredictionTokenPriceParamsV5, -): Promise> ⋮---- /** - * Get Price History - * OHLC candlestick history for an outcome token. + * Create a new sub user id. Use master user's api key only. + * + * The API key must have one of the permissions to be allowed to call the following API endpoint. + * - master API key: "Account Transfer", "Subaccount Transfer", "Withdrawal" */ -getAlphaPredictionPriceHistory( - params: GetAlphaPredictionPriceHistoryParamsV5, -): Promise> +createSubMember( + params: CreateSubMemberParamsV5, +): Promise> ⋮---- /** - * Get Position List - * Active prediction market positions. Confirm before placing sell orders. + * To create new API key for those newly created sub UID. Use master user's api key only. + * + * TIP: The API key must have one of the permissions to be allowed to call the following API endpoint. + * - master API key: "Account Transfer", "Subaccount Transfer", "Withdrawal" */ -getAlphaPredictionPositionList( - params?: GetAlphaPredictionPositionListParamsV5, -): Promise> +createSubUIDAPIKey( + params: CreateSubApiKeyParamsV5, +): Promise> ⋮---- /** - * Get Position History - * Closed prediction market positions including settlement results. + * This endpoint allows you to get a list of all sub UID of master account. At most 10k subaccounts. */ -getAlphaPredictionPositionHistory( - params?: GetAlphaPredictionPositionHistoryParamsV5, -): Promise> +getSubUIDList(): Promise< + APIResponseV3WithTime<{ subMembers: SubMemberV5[] }> + > { + return this.getPrivate('/v5/user/query-sub-members'); ⋮---- /** - * Get Portfolio Summary - * Overall prediction market portfolio P&L and win rate. + * This endpoint allows you to get a list of all sub UID of master account. No limit on the number of subaccounts. */ -getAlphaPredictionPortfolioSummary( - params?: GetAlphaPredictionPortfolioSummaryParamsV5, -): Promise> +getSubUIDListUnlimited(params?: { + pageSize?: string; + nextCursor?: string; + }): Promise< + APIResponseV3WithTime<{ + subMembers: SubMemberV5[]; + nextCursor: string; + }> + > { + return this.getPrivate('/v5/user/submembers', params); ⋮---- /** - * Get Side Market List - * Outcome markets for an event with prices, liquidity, and status. + * Froze sub uid. Use master user's api key only. + * + * TIP: The API key must have one of the permissions to be allowed to call the following API endpoint. + * - master API key: "Account Transfer", "Subaccount Transfer", "Withdrawal" */ -getAlphaPredictionSideMarketList( - params: GetAlphaPredictionSideMarketListParamsV5, -): Promise> +setSubUIDFrozenState( + subuid: number, + frozen: 0 | 1, +): Promise> +getQueryApiKey(): Promise> ⋮---- /** - * Get Sports Timeline Stages - * Tournament stage timeline with status and match counts. + * Query all api keys information of a sub UID. */ -getAlphaPredictionSportsTimelineStages( - params: GetAlphaPredictionSportsTimelineStagesParamsV5, -): Promise> +getSubAccountAllApiKeys(params: GetSubAccountAllApiKeysParamsV5): Promise< + APIResponseV3WithTime<{ + result: ApiKeyInfoV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/user/sub-apikeys', params); +⋮---- +getUIDWalletType(params: { memberIds: string }): Promise< + APIResponseV3WithTime<{ + accounts: { + uid: string; + accountType: string[]; + }[]; + }> + > { + return this.getPrivate('/v5/user/get-member-type', params); ⋮---- /** - * Get Sports Group Stage Detail - * Group stage standings and match schedule for a sports prediction event. + * Modify the settings of a master API key. Use the API key pending to be modified to call the endpoint. Use master user's API key only. + * + * TIP: The API key must have one of the permissions to be allowed to call the following API endpoint. + * - master API key: "Account Transfer", "Subaccount Transfer", "Withdrawal" + * + * `permissions` may include `FiatBitPay` (not `FiatBybitPay`). */ -getAlphaPredictionSportsGroupStageDetail( - params: GetAlphaPredictionSportsGroupStageDetailParamsV5, -): Promise> +updateMasterApiKey( + params: UpdateApiKeyParamsV5, +): Promise> ⋮---- /** + * This endpoint modifies the settings of a sub API key. + * Use the API key pending to be modified to call the endpoint or use master account api key to manage its sub account api key. + * The API key must have one of the below permissions in order to call this endpoint * - ****** Alpha / Web3 LP APIs - * + * - sub API key: "Account Transfer", "Sub Member Transfer" + * - master API Key: "Account Transfer", "Sub Member Transfer", "Withdrawal" */ +updateSubApiKey( + params: UpdateApiKeyParamsV5, +): Promise> ⋮---- /** - * Get LP Pool List - * Available liquidity pools, optionally filtered by token symbol. + * Delete a sub UID. Before deleting the UID, please make sure there are no assets. + * + * TIP: + * The API key must have one of the permissions to be allowed to call the following API endpoint. + * - master API key: "Account Transfer", "Subaccount Transfer", "Withdrawal" */ -getAlphaLPPoolList( - params?: GetAlphaLPPoolListParamsV5, -): Promise> +deleteSubMember( + params: DeleteSubMemberParamsV5, +): Promise> +deleteMasterApiKey(): Promise> +deleteSubApiKey(params?: { + apikey?: string; +}): Promise> ⋮---- /** - * Get LP Order List - * LP stake/redeem order history. + * Export multiple tax report types in one batch. Returns a batchId for status polling. */ -getAlphaLPOrderList( - params?: GetAlphaLPOrderListParamsV5, -): Promise> +createTaxBatchExport( + params: CreateTaxBatchExportParamsV5, +): Promise> ⋮---- /** - * Get LP Pay Token List - * Supported payment tokens and available balances for LP staking. + * Query tax batch export task status and download URLs by batchId. */ -getAlphaLPPayTokenList( - params?: GetAlphaLPPayTokenListParamsV5, -): Promise> +getTaxBatchExport( + params: GetTaxBatchExportParamsV5, +): Promise> ⋮---- /** - * Get LP Pay Token Price - * Batch USD prices for up to 50 payment token codes. + * + ****** Affiliate APIs + * */ -getAlphaLPPayTokenPrice( - params: GetAlphaLPPayTokenPriceParamsV5, -): Promise> ⋮---- /** - * Get LP Position List - * User LP positions with valuation, rewards, and APY. + * Get Affiliate User List. + * To use this endpoint, you should have an affiliate account and only tick "affiliate" permission while creating the API key. + * + * TIP: + * - Use master UID only + * - The api key can only have "Affiliate" permission */ -getAlphaLPPositionList(): Promise< - APIResponseV3WithTime +getAffiliateUserList(params?: GetAffiliateUserListParamsV5): Promise< + APIResponseV3WithTime<{ + list: AffiliateUserListItemV5[]; + nextPageCursor: string; + }> > { -return this.postPrivate('/v5/alpha/lp/position-list', + return this.getPrivate('/v5/affiliate/aff-user-list', params); ⋮---- /** + * Get Affiliate Sub-Affiliate List. * - ****** Spot Margin Trade APIs (UTA) + * To use this endpoint, you should have an affiliate account and only tick "affiliate" permission while creating the API key. * + * TIP: + * - Use master UID only + * - The api key can only have "Affiliate" permission */ +getAffiliateSubAffiliateList( + params?: GetAffiliateSubAffiliateListParamsV5, +): Promise> ⋮---- /** - * Get VIP Margin Data. + * Get Affiliate User Info. * - * This margin data is for Unified account in particular. + * This API is used for affiliate to get their users information. * - * INFO - * Do not need authentication + * TIP + * Use master UID only + * The api key can only have "Affiliate" permission + * The transaction volume and deposit amount are the total amount of the user done on Bybit, and have nothing to do with commission settlement. Any transaction volume data related to commission settlement is subject to the Affiliate Portal. */ -getVIPMarginData( - params?: GetVIPMarginDataParamsV5, -): Promise> +getAffiliateUserInfo( + params: GetAffiliateUserInfoParamsV5, +): Promise> ⋮---- /** - * Get Historical Interest Rate - * You can query up to six months borrowing interest rate of Margin trading. - * INFO: Need authentication, the api key needs "Spot" permission. Only supports Unified account. + * Get Friend Referrals + * Query the friend's invitee data. + * + * TIP: Any permission can access this endpoint. */ -getHistoricalInterestRate(params: { - currency: string; - vipLevel?: string; - startTime?: number; - endTime?: number; - }): Promise< +getFriendReferrals(params?: GetFriendReferralsParamsV5): Promise< APIResponseV3WithTime<{ - list: { - timestamp: number; - currency: string; - hourlyBorrowRate: string; - vipLevel: string; - }[]; + nextCursor: string; + records: FriendReferralRecordV5[]; }> > { - return this.getPrivate( - '/v5/spot-margin-trade/interest-rate-history', - params, - ); + return this.getPrivate('/v5/user/invitation/referrals', params); +⋮---- +getReferralCode(): Promise> ⋮---- /** - * Get Currency Data - * Borrowing currency data: flexible/fixed manual borrow, min qty, precision, interest rate range. + * Sign Agreement + * To trade commodity contracts (e.g. metals XAU/XAG perps, crude oil perps), complete the agreement signing first. + * Recommended to sign in advance via API so you can trade immediately when contracts go live. + * Send either `category` (legacy) or `categoryV2` (preferred; new agreement types are added to `categoryV2` only). + * + * INFO + * - Only the master account can sign. Subaccounts are not supported. + * - Once the master has signed, all subaccounts will be eligible to trade. + * - API key must have: Account Transfer, Subaccount Transfer, or Withdrawal. + * - Trading without signing returns code=110123, msg=You must agree to the Trading Terms. */ -getSpotMarginCurrencyData( - params?: GetSpotMarginCurrencyDataParamsV5, +signAgreement( + params: SignAgreementParamsV5, ): Promise> ⋮---- /** - * Set the user's maximum leverage in spot cross margin. - * CAUTION: Your account needs to enable spot margin first; i.e., you must have finished the quiz on web / app. + * Execute Purchase + * Buy on-chain tokens with a payment token (e.g. USDT). Requires a valid quote; obtain user confirmation first. + * HTTP 200 is only an acknowledgment — poll `getAlphaTradeOrderList` for final status. Idempotent by `quoteDataId` in the quote. */ -setSpotMarginLeverageV2( - params: SetSpotMarginLeverageParamsV5, -): Promise> ⋮---- /** - * Query the Spot margin status and leverage of Unified account. - * - * Covers: Margin trade (Unified Account) + * Execute Redeem + * Sell on-chain tokens for a payment token. Requires a valid quote; obtain user confirmation first. + * HTTP 200 is only an acknowledgment — poll `getAlphaTradeOrderList` for final status. Idempotent by `quoteDataId` in the quote. */ -getSpotMarginState(): Promise> +executeAlphaTradeRedeem( + params: ExecuteAlphaTradeParamsV5, +): Promise> ⋮---- /** - * Manual borrow for UTA + * Get Payment Token List + * List payment tokens (e.g. USDT) and CEX token codes (e.g. CEX_1) for quote and execution. Each entry includes `supportChains`. */ -manualBorrow( - params: ManualBorrowParamsV5, -): Promise> +getAlphaPayTokenList( + params: GetAlphaPayTokenListParamsV5, +): Promise> ⋮---- /** - * Get max borrowable amount + * Get Order List + * On-chain trade order history; filters for trade type, status, token, and time. Max 90 days. */ -getMaxBorrowableAmount( - params: GetMaxBorrowableAmountParamsV5, -): Promise> +getAlphaTradeOrderList( + params: GetAlphaTradeOrderListParamsV5, +): Promise> ⋮---- /** - * Get loan position risk information (position tiers) + * Get Biz Token List + * Tradable on-chain tokens (DEX_ prefix ids), risk flags, limits, and supported payment token codes. */ -getPositionTiers(params?: GetPositionTiersParamsV5): Promise< - APIResponseV3WithTime<{ - list: CurrencyPositionTiersV5[]; - }> - > { - return this.getPrivate('/v5/spot-margin-trade/position-tiers', params); +getAlphaBizTokenList( + params?: GetAlphaBizTokenListParamsV5, +): Promise> ⋮---- /** - * Get currency leverage information (coin state) + * Get Token Price List + * Batch market data (up to 20 `chainCode` + `tokenAddress` pairs). Prices, 24h change, volume, market cap, etc. */ -getCoinState(params?: GetCoinStateParamsV5): Promise< - APIResponseV3WithTime<{ - list: CoinStateV5[]; - }> - > { - return this.getPrivate('/v5/spot-margin-trade/coinstate', params); +getAlphaBizTokenPriceList( + params: GetAlphaBizTokenPriceListParamsV5, +): Promise> ⋮---- /** - * Get available amount to repay + * Get Token Details + * One token: description, links, `riskFlag`, and listing status. Use `chainCode` + `tokenAddress` from biz list or assets. */ -getAvailableAmountToRepay( - params: GetAvailableAmountToRepayParamsV5, -): Promise> +getAlphaBizTokenDetails( + params: GetAlphaBizTokenDetailsParamsV5, +): Promise> +⋮---- +/** + * Get Asset List + * Portfolio of on-chain token holdings (non-zero only), sorted by USD value. + */ +getAlphaAssetList(): Promise> +⋮---- +/** + * Get Asset Detail + * Single-asset view; `result.assetList` has 0 or 1 item. + */ +getAlphaAssetDetail( + params: GetAlphaAssetDetailParamsV5, +): Promise> ⋮---- /** - * Manual repay without asset conversion * - * IMPORTANT: Repayment is prohibited between 04:00 and 05:30 per hour. - * When repaying, system will only use the spot available balance of the debt currency. + ****** Alpha / Web3 prediction market APIs * - * Use `getAvailableAmountToRepay` to check spot available amount. Response timing: ALL and FIXED - * asynchronous; FLEXIBLE synchronous. From 2026-03-17 (full 2026-03-24), BYUSDT can be used for - * repayment, including MNT using existing spot balance. */ -manualRepayWithoutConversion( - params: ManualRepayWithoutConversionParamsV5, -): Promise> ⋮---- /** - * Get Auto Repay Mode - * Get spot automatic repayment mode. - * - * INFO: - * - If currency is not passed, automatic repay mode for all currencies will be returned + * Get Engine Status + * Query prediction market matching engine availability before placing buy/sell orders. + */ +getAlphaPredictionEngineStatus(): Promise< + APIResponseV3WithTime + > { + return this.getPrivate('/v5/alpha/prediction/engine-status'); +⋮---- +/** + * Get Payment Token List + * Available payment tokens for prediction market trading (Phase 1: USDC). + */ +getAlphaPredictionPayTokenList(): Promise< + APIResponseV3WithTime + > { + return this.getPrivate('/v5/alpha/prediction/pay-token-list'); +⋮---- +/** + * Get Event Detail + * Event metadata, outcome markets, and current prices. Obtain tokenId before trading. + */ +getAlphaPredictionEventDetail( + params: GetAlphaPredictionEventDetailParamsV5, +): Promise> +⋮---- +/** + * Get Order Estimate + * Preview buy/sell outcome before execution. Show estimate to user and confirm before Buy/Sell. */ -getAutoRepayMode( - params?: GetAutoRepayModeParamsV5, -): Promise> +getAlphaPredictionOrderEstimate( + params: GetAlphaPredictionOrderEstimateParamsV5, +): Promise> ⋮---- /** - * Set Auto Repay Mode - * Set spot automatic repayment mode. - * - * INFO: - * - If currency is not passed, spot automatic repayment will be enabled for all currencies - * - If autoRepayMode of a currency is set to 1, the system will automatically make repayments - * without asset conversion to that currency at 0 and 30 minutes every hour - * - The amount of repayments is the minimum of available spot balance and liability + * Execute Buy + * Buy prediction outcome tokens with USDC. HTTP 200 is acknowledgment only — poll order list. */ -setAutoRepayMode( - params: SetAutoRepayModeParamsV5, -): Promise> +executeAlphaPredictionBuy( + params: ExecuteAlphaPredictionBuyParamsV5, +): Promise> ⋮---- /** - * Get Liability Info (spot margin UTA): fixed vs floating, spot vs derivatives borrow split. + * Execute Sell + * Sell prediction outcome token shares for USDC. HTTP 200 is acknowledgment only — poll order list. */ -getSpotMarginLiability( - params: GetSpotMarginLiabilityInfoParamsV5, -): Promise> +executeAlphaPredictionSell( + params: ExecuteAlphaPredictionSellParamsV5, +): Promise> ⋮---- /** - * Fixed-rate borrow (place order). + * Get Order List + * Prediction market order history for the authenticated user. */ -submitFixedRateBorrow( - params: FixedRateBorrowParamsV5, -): Promise> +getAlphaPredictionOrderList( + params: GetAlphaPredictionOrderListParamsV5, +): Promise> ⋮---- /** - * Fixed-rate borrow order history (descending by order time). + * Get Order Book + * Full bid/ask depth snapshot for up to 20 outcome tokens. */ -getFixedRateBorrowOrderInfo( - params?: GetFixedRateBorrowOrderInfoParamsV5, - ): Promise< - APIResponseV3WithTime<{ - list: FixedRateBorrowOrderInfoV5[]; - nextPageCursor: string; - }> - > { - return this.getPrivate( - '/v5/spot-margin-trade/fixedborrow-order-info', - params, - ); +getAlphaPredictionOrderBook( + params: GetAlphaPredictionOrderBookParamsV5, +): Promise> ⋮---- /** - * Fixed-rate borrow contract list (descending by borrow time). + * Get Token Price + * Best bid/ask and last price for up to 20 outcome tokens. */ -getFixedRateBorrowContractInfo( - params?: GetFixedRateBorrowContractInfoParamsV5, - ): Promise< - APIResponseV3WithTime<{ - list: FixedRateBorrowContractInfoV5[]; - nextPageCursor: string; - }> - > { - return this.getPrivate( - '/v5/spot-margin-trade/fixedborrow-contract-info', - params, - ); +getAlphaPredictionTokenPrice( + params: GetAlphaPredictionTokenPriceParamsV5, +): Promise> ⋮---- /** - * Fixed-rate borrow order book quotes (sort by apy, term, or quantity). + * Get Price History + * OHLC candlestick history for an outcome token. */ -getFixedRateBorrowOrderQuote( - params: GetFixedRateBorrowOrderQuoteParamsV5, -): Promise> ⋮---- /** - * Renew a fixed-rate loan contract (full remaining amount if `qty` omitted). + * Get Position List + * Active prediction market positions. Confirm before placing sell orders. */ -renewFixedRateBorrow( - params: RenewFixedRateBorrowParamsV5, -): Promise> +getAlphaPredictionPositionList( + params?: GetAlphaPredictionPositionListParamsV5, +): Promise> ⋮---- -getFlexibleAvailableInventory( - params: GetFlexibleAvailableInventoryParamsV5, -): Promise> +/** + * Get Position History + * Closed prediction market positions including settlement results. + */ +getAlphaPredictionPositionHistory( + params?: GetAlphaPredictionPositionHistoryParamsV5, +): Promise> ⋮---- -getFixedRateAvailableInventory( - params: GetFixedRateAvailableInventoryParamsV5, -): Promise> +/** + * Get Portfolio Summary + * Overall prediction market portfolio P&L and win rate. + */ +getAlphaPredictionPortfolioSummary( + params?: GetAlphaPredictionPortfolioSummaryParamsV5, +): Promise> ⋮---- /** - * - ****** Spot Margin Trade APIs (Normal) - * + * Get Side Market List + * Outcome markets for an event with prices, liquidity, and status. */ +getAlphaPredictionSideMarketList( + params: GetAlphaPredictionSideMarketListParamsV5, +): Promise> ⋮---- /** - * Get Margin Coin Info + * Get Sports Match List + * Sports matches available in prediction markets (Phase 1: FIFA 2026). */ -getSpotMarginCoinInfo(coin?: string): Promise< - APIResponseV3WithTime<{ - list: { - coin: string; - conversionRate: string; - liquidationOrder: number; - }[]; - }> - > { - return this.getPrivate('/v5/spot-cross-margin-trade/pledge-token', { - coin, - }); +getAlphaPredictionSportsMatchList( + params: GetAlphaPredictionSportsMatchListParamsV5, +): Promise> ⋮---- /** - * Get Borrowable Coin Info + * Get Sports Timeline Stages + * Tournament stage timeline with status and match counts. */ -getSpotMarginBorrowableCoinInfo(coin?: string): Promise< - APIResponseV3WithTime<{ - list: { - coin: string; - borrowingPrecision: number; - repaymentPrecision: number; - }[]; - }> - > { - return this.getPrivate('/v5/spot-cross-margin-trade/borrow-token', { - coin, - }); +getAlphaPredictionSportsTimelineStages( + params: GetAlphaPredictionSportsTimelineStagesParamsV5, +): Promise> ⋮---- /** - * Get Interest & Quota + * Get Sports Group Stage Detail + * Group stage standings and match schedule for a sports prediction event. */ -getSpotMarginInterestAndQuota(coin: string): Promise< - APIResponseV3WithTime<{ - list: { - coin: string; - interestRate: string; - loanAbleAmount: string; - maxLoanAmount: string; - }[]; - }> - > { - return this.getPrivate('/v5/spot-cross-margin-trade/loan-info', { - coin, - }); +getAlphaPredictionSportsGroupStageDetail( + params: GetAlphaPredictionSportsGroupStageDetailParamsV5, +): Promise> ⋮---- /** - * Get Loan Account Info + * + ****** Alpha / Web3 LP APIs + * */ -getSpotMarginLoanAccountInfo(): Promise< - APIResponseV3WithTime<{ - acctBalanceSum: string; - debtBalanceSum: string; - loanAccountList: { - free: string; - interest: string; - loan: string; - remainAmount: string; - locked: string; - tokenId: string; - total: string; - }[]; - riskRate: string; - status: number; - switchStatus: number; - }> - > { - return this.getPrivate('/v5/spot-cross-margin-trade/account'); ⋮---- /** - * Borrow + * Get LP Pool List + * Available liquidity pools, optionally filtered by token symbol. */ -spotMarginBorrow(params: { coin: string; qty: string }): Promise< - APIResponseV3WithTime<{ - transactId: string; - }> - > { - return this.postPrivate('/v5/spot-cross-margin-trade/loan', params); +getAlphaLPPoolList( + params?: GetAlphaLPPoolListParamsV5, +): Promise> ⋮---- /** - * Repay + * Get LP Pool Info + * Detailed pool data including APY, reserves, and price range. */ -spotMarginRepay(params: { - coin: string; - qty?: string; - completeRepayment: 0 | 1; - }): Promise< - APIResponseV3WithTime<{ - repayId: string; - }> - > { - return this.postPrivate('/v5/spot-cross-margin-trade/repay', params); +getAlphaLPPoolInfo( + params: GetAlphaLPPoolInfoParamsV5, +): Promise> ⋮---- /** - * Get Borrow Order Detail + * Execute LP Stake + * Stake tokens into a liquidity pool. HTTP 200 is ACK only — poll order list for status. */ -getSpotMarginBorrowOrderDetail(params?: { - startTime?: number; - endTime?: number; - coin?: string; - status?: 0 | 1 | 2; - limit?: number; - }): Promise< - APIResponseV3WithTime<{ - list: { - accountId: string; - coin: string; - createdTime: number; - id: string; - interestAmount: string; - interestBalance: string; - loanAmount: string; - loanBalance: string; - remainAmount: string; - status: string; - type: string; - }[]; - }> - > { - return this.getPrivate('/v5/spot-cross-margin-trade/orders', params); +executeAlphaLPStake( + params: ExecuteAlphaLPStakeParamsV5, +): Promise> ⋮---- /** - * Get Repayment Order Detail + * Execute LP Redeem + * Redeem liquidity from a pool position. HTTP 200 is ACK only — poll order list for status. */ -getSpotMarginRepaymentOrderDetail(params?: { - startTime?: number; - endTime?: number; - coin?: string; - limit?: number; - }): Promise< - APIResponseV3WithTime<{ - list: { - accountId: string; - coin: string; - repaidAmount: string; - repayId: string; - repayMarginOrderId: string; - repayTime: string; - transactIds: { - repaidInterest: string; - repaidPrincipal: string; - repaidSerialNumber: string; - transactId: string; - }[]; - }[]; - }> - > { - return this.getPrivate('/v5/spot-cross-margin-trade/repay-history', params); +executeAlphaLPRedeem( + params: ExecuteAlphaLPRedeemParamsV5, +): Promise> ⋮---- /** - * Turn spot margin trade on / off in your NORMAL account. + * Get LP Order List + * LP stake/redeem order history. */ -toggleSpotCrossMarginTrade(params: { - switch: 1 | 0; -}): Promise> ⋮---- /** - * - ****** Crypto Loan - Legacy - * - * @deprecated - Use "Crypto Loan - New" Endpoints instead - * + * Get LP Pay Token List + * Supported payment tokens and available balances for LP staking. */ +getAlphaLPPayTokenList( + params?: GetAlphaLPPayTokenListParamsV5, +): Promise> ⋮---- /** - * Get Collateral Coins - * - * INFO: Do not need authentication - * @deprecated - Use "Crypto Loan - New" Endpoints instead + * Get LP Pay Token Price + * Batch USD prices for up to 50 payment token codes. */ -getCollateralCoins(params?: { - vipLevel?: string; - currency?: string; - }): Promise< - APIResponseV3WithTime<{ - vipCoinList: VipCollateralCoinsV5[]; - }> - > { - return this.get('/v5/crypto-loan/collateral-data', params); +getAlphaLPPayTokenPrice( + params: GetAlphaLPPayTokenPriceParamsV5, +): Promise> ⋮---- /** - * Get Borrowable Coins - * - * INFO: Do not need authentication - * @deprecated - Use "Crypto Loan - New" Endpoints instead + * Get LP Position List + * User LP positions with valuation, rewards, and APY. */ -getBorrowableCoins(params?: { - vipLevel?: string; - currency?: string; - }): Promise< - APIResponseV3WithTime<{ - vipCoinList: VipBorrowableCoinsV5[]; - }> +getAlphaLPPositionList(): Promise< + APIResponseV3WithTime > { - return this.get('/v5/crypto-loan/loanable-data', params); +return this.postPrivate('/v5/alpha/lp/position-list', ⋮---- /** - * Get Account Borrow/Collateral Limit - * Query the account borrowable/collateral limit * - * Permission: "Spot trade" - * @deprecated - Use "Crypto Loan - New" Endpoints instead + ****** Spot Margin Trade APIs (UTA) + * */ -getAccountBorrowCollateralLimit(params: { - loanCurrency: string; - collateralCurrency: string; -}): Promise> ⋮---- /** - * Borrow Crypto Loan - * @deprecated - Use "Crypto Loan - New" Endpoints instead + * Get VIP Margin Data. * - * Permission: "Spot trade" + * This margin data is for Unified account in particular. * - * INFO: - * The loan funds are released to the Funding account - * The collateral funds are deducted from the Funding account, so make sure you have enough collateral amount in the funding wallet + * INFO + * Do not need authentication */ -borrowCryptoLoan(params: BorrowCryptoLoanParamsV5): Promise< - APIResponseV3WithTime<{ - orderId: string; - }> - > { - return this.postPrivate('/v5/crypto-loan/borrow', params); +getVIPMarginData( + params?: GetVIPMarginDataParamsV5, +): Promise> ⋮---- /** - * Repay Crypto Loan - * - * @deprecated - Use "Crypto Loan - New" Endpoints instead - * - * You can repay partial loan. If there is interest occurred, interest will be repaid in priority - * - * Permission: "Spot trade" - * - * INFO: - * The repaid amount will be deducted from Funding account - * The collateral amount will not be auto returned when you don't fully repay the debt, but you can also adjust collateral amount + * Get Historical Interest Rate + * You can query up to six months borrowing interest rate of Margin trading. + * INFO: Need authentication, the api key needs "Spot" permission. Only supports Unified account. */ -repayCryptoLoan(params: { orderId: string; amount: string }): Promise< +getHistoricalInterestRate(params: { + currency: string; + vipLevel?: string; + startTime?: number; + endTime?: number; + }): Promise< APIResponseV3WithTime<{ - repayId: string; + list: { + timestamp: number; + currency: string; + hourlyBorrowRate: string; + vipLevel: string; + }[]; }> > { - return this.postPrivate('/v5/crypto-loan/repay', params); + return this.getPrivate( + '/v5/spot-margin-trade/interest-rate-history', + params, + ); ⋮---- /** - * Get Unpaid Loan Orders - * Query the ongoing loan orders, which are not fully repaid - * - * @deprecated - Use "Crypto Loan - New" Endpoints instead - * - * Permission: "Spot trade" + * Get Currency Data + * Borrowing currency data: flexible/fixed manual borrow, min qty, precision, interest rate range. */ -getUnpaidLoanOrders(params?: GetUnpaidLoanOrdersParamsV5): Promise< - APIResponseV3WithTime<{ - list: UnpaidLoanOrderV5[]; - nextPageCursor: string; - }> - > { - return this.getPrivate('/v5/crypto-loan/ongoing-orders', params); +getSpotMarginCurrencyData( + params?: GetSpotMarginCurrencyDataParamsV5, +): Promise - > { - return this.getPrivate('/v5/crypto-loan/repayment-history', params); +toggleSpotMarginTrade( + spotMarginMode: '1' | '0', +): Promise - > { - return this.getPrivate('/v5/crypto-loan/borrow-history', params); +setSpotMarginLeverage(leverage: string): Promise - > { - return this.getPrivate('/v5/crypto-loan/max-collateral-amount', params); +setSpotMarginLeverageV2( + params: SetSpotMarginLeverageParamsV5, +): Promise> +⋮---- +/** + * Manual borrow for UTA + */ +manualBorrow( + params: ManualBorrowParamsV5, +): Promise> +⋮---- +/** + * Get max borrowable amount + */ +getMaxBorrowableAmount( + params: GetMaxBorrowableAmountParamsV5, +): Promise> +⋮---- +/** + * Get loan position risk information (position tiers) + */ +getPositionTiers(params?: GetPositionTiersParamsV5): Promise< APIResponseV3WithTime<{ - adjustId: string; + list: CurrencyPositionTiersV5[]; }> > { - return this.postPrivate('/v5/crypto-loan/adjust-ltv', params); + return this.getPrivate('/v5/spot-margin-trade/position-tiers', params); ⋮---- /** - * Get Loan LTV Adjustment History - * Query the transaction history of collateral amount adjustment - * - * @deprecated - Use "Crypto Loan - New" Endpoints instead - * - * Permission: "Spot trade" - * - * INFO: - * Support querying last 6 months adjustment transactions - * Only the ltv adjustment transactions launched by the user can be queried + * Get currency leverage information (coin state) */ -getLoanLTVAdjustmentHistory( - params?: GetLoanLTVAdjustmentHistoryParamsV5, - ): Promise< +getCoinState(params?: GetCoinStateParamsV5): Promise< APIResponseV3WithTime<{ - list: LoanLTVAdjustmentHistoryV5[]; - nextPageCursor: string; + list: CoinStateV5[]; }> > { - return this.getPrivate('/v5/crypto-loan/adjustment-history', params); + return this.getPrivate('/v5/spot-margin-trade/coinstate', params); +⋮---- +/** + * Get available amount to repay + */ +getAvailableAmountToRepay( + params: GetAvailableAmountToRepayParamsV5, +): Promise> ⋮---- /** + * Manual repay without asset conversion * - ****** Crypto Loan New + * IMPORTANT: Repayment is prohibited between 04:00 and 05:30 per hour. + * When repaying, system will only use the spot available balance of the debt currency. * + * Use `getAvailableAmountToRepay` to check spot available amount. Response timing: ALL and FIXED + * asynchronous; FLEXIBLE synchronous. From 2026-03-17 (full 2026-03-24), BYUSDT can be used for + * repayment, including MNT using existing spot balance. */ +manualRepayWithoutConversion( + params: ManualRepayWithoutConversionParamsV5, +): Promise> ⋮---- /** - * Get Borrowable Coins New + * Get Auto Repay Mode + * Get spot automatic repayment mode. * + * INFO: + * - If currency is not passed, automatic repay mode for all currencies will be returned */ -getLoanBorrowableCoins(params?: GetBorrowableCoinsParamsV5): Promise< - APIResponseV3WithTime<{ - list: BorrowableCoinV5[]; - }> - > { - return this.get('/v5/crypto-loan-common/loanable-data', params); +getAutoRepayMode( + params?: GetAutoRepayModeParamsV5, +): Promise> ⋮---- /** - * Get Collateral Coins New + * Set Auto Repay Mode + * Set spot automatic repayment mode. * + * INFO: + * - If currency is not passed, spot automatic repayment will be enabled for all currencies + * - If autoRepayMode of a currency is set to 1, the system will automatically make repayments + * without asset conversion to that currency at 0 and 30 minutes every hour + * - The amount of repayments is the minimum of available spot balance and liability */ -getLoanCollateralCoins( - params?: GetCollateralCoinsParamsV5, -): Promise> +setAutoRepayMode( + params: SetAutoRepayModeParamsV5, +): Promise> ⋮---- /** - * Get Max. Allowed Collateral Reduction Amount New - * + * Get Liability Info (spot margin UTA): fixed vs floating, spot vs derivatives borrow split. */ -getMaxCollateralAmount(params: GetMaxCollateralAmountParamsV5): Promise< +getSpotMarginLiability( + params: GetSpotMarginLiabilityInfoParamsV5, +): Promise> +⋮---- +/** + * Fixed-rate borrow (place order). + */ +submitFixedRateBorrow( + params: FixedRateBorrowParamsV5, +): Promise> +⋮---- +/** + * Fixed-rate borrow order history (descending by order time). + */ +getFixedRateBorrowOrderInfo( + params?: GetFixedRateBorrowOrderInfoParamsV5, + ): Promise< APIResponseV3WithTime<{ - maxCollateralAmount: string; + list: FixedRateBorrowOrderInfoV5[]; + nextPageCursor: string; }> > { return this.getPrivate( - '/v5/crypto-loan-common/max-collateral-amount', + '/v5/spot-margin-trade/fixedborrow-order-info', params, ); ⋮---- /** - * Obtain Max Loan Amount - * Check the maximum borrowable amount & remaining individual platform limit for crypto loans. - * - * INFO: - * - Permission: "Spot trade" - * - UID rate limit: 5 req/s + * Fixed-rate borrow contract list (descending by borrow time). */ -getMaxLoanAmount( - params: GetMaxLoanAmountParamsV5, -): Promise> +getFixedRateBorrowContractInfo( + params?: GetFixedRateBorrowContractInfoParamsV5, + ): Promise< + APIResponseV3WithTime<{ + list: FixedRateBorrowContractInfoV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate( + '/v5/spot-margin-trade/fixedborrow-contract-info', + params, + ); ⋮---- /** - * Adjust Collateral Amount New - * You can increase or reduce your collateral amount. When you reduce, please obey the Get Max. Allowed Collateral Reduction Amount + * Fixed-rate borrow order book quotes (sort by apy, term, or quantity). */ -updateCollateralAmount( - params: AdjustCollateralAmountParamsV5, -): Promise> +getFixedRateBorrowOrderQuote( + params: GetFixedRateBorrowOrderQuoteParamsV5, +): Promise - > { - return this.getPrivate('/v5/crypto-loan-common/adjustment-history', params); +renewFixedRateBorrow( + params: RenewFixedRateBorrowParamsV5, +): Promise> +⋮---- +getFlexibleAvailableInventory( + params: GetFlexibleAvailableInventoryParamsV5, +): Promise> +⋮---- +getFixedRateAvailableInventory( + params: GetFixedRateAvailableInventoryParamsV5, +): Promise> ⋮---- /** - * Get Crypto Loan Position New + * + ****** Spot Margin Trade APIs (Normal) * */ -getCryptoLoanPosition(): Promise< - APIResponseV3WithTime +⋮---- +/** + * Get Margin Coin Info + */ +getSpotMarginCoinInfo(coin?: string): Promise< + APIResponseV3WithTime<{ + list: { + coin: string; + conversionRate: string; + liquidationOrder: number; + }[]; + }> > { - return this.getPrivate('/v5/crypto-loan-common/position'); + return this.getPrivate('/v5/spot-cross-margin-trade/pledge-token', { + coin, + }); ⋮---- /** - * - ****** Crypto Loan New - Flexible Loan - * + * Get Borrowable Coin Info */ +getSpotMarginBorrowableCoinInfo(coin?: string): Promise< + APIResponseV3WithTime<{ + list: { + coin: string; + borrowingPrecision: number; + repaymentPrecision: number; + }[]; + }> + > { + return this.getPrivate('/v5/spot-cross-margin-trade/borrow-token', { + coin, + }); ⋮---- /** - * Borrow Flexible Loan - * Fully or partially repay a loan. If interest is due, that is paid off first, with the loaned amount being paid off only after due interest. - * + * Get Interest & Quota */ -borrowFlexible( - params: BorrowFlexibleParamsV5, -): Promise> +getSpotMarginInterestAndQuota(coin: string): Promise< + APIResponseV3WithTime<{ + list: { + coin: string; + interestRate: string; + loanAbleAmount: string; + maxLoanAmount: string; + }[]; + }> + > { + return this.getPrivate('/v5/spot-cross-margin-trade/loan-info', { + coin, + }); ⋮---- /** - * Repay Flexible Loan - * Fully or partially repay a loan. If interest is due, that is paid off first, with the loaned amount being paid off only after due interest. - * + * Get Loan Account Info */ -repayFlexible( - params: RepayFlexibleParamsV5, -): Promise> +getSpotMarginLoanAccountInfo(): Promise< + APIResponseV3WithTime<{ + acctBalanceSum: string; + debtBalanceSum: string; + loanAccountList: { + free: string; + interest: string; + loan: string; + remainAmount: string; + locked: string; + tokenId: string; + total: string; + }[]; + riskRate: string; + status: number; + switchStatus: number; + }> + > { + return this.getPrivate('/v5/spot-cross-margin-trade/account'); ⋮---- /** - * Collateral Repayment - * Pay interest first, then repay the principal. + * Borrow */ -repayCollateralFlexible( - params: RepayCollateralFlexibleParamsV5, -): Promise + > { + return this.postPrivate('/v5/spot-cross-margin-trade/loan', params); ⋮---- /** - * Get Flexible Loans - * Query for your ongoing loans - * + * Repay */ -getOngoingFlexibleLoans(params?: GetOngoingFlexibleLoansParamsV5): Promise< +spotMarginRepay(params: { + coin: string; + qty?: string; + completeRepayment: 0 | 1; + }): Promise< APIResponseV3WithTime<{ - list: OngoingFlexibleLoanV5[]; + repayId: string; }> > { - return this.getPrivate('/v5/crypto-loan-flexible/ongoing-coin', params); + return this.postPrivate('/v5/spot-cross-margin-trade/repay', params); ⋮---- /** - * Get Borrow Orders History - * + * Get Borrow Order Detail */ -getBorrowHistoryFlexible(params?: GetBorrowHistoryFlexibleParamsV5): Promise< +getSpotMarginBorrowOrderDetail(params?: { + startTime?: number; + endTime?: number; + coin?: string; + status?: 0 | 1 | 2; + limit?: number; + }): Promise< APIResponseV3WithTime<{ - list: BorrowHistoryFlexibleV5[]; - nextPageCursor: string; + list: { + accountId: string; + coin: string; + createdTime: number; + id: string; + interestAmount: string; + interestBalance: string; + loanAmount: string; + loanBalance: string; + remainAmount: string; + status: string; + type: string; + }[]; }> > { - return this.getPrivate('/v5/crypto-loan-flexible/borrow-history', params); + return this.getPrivate('/v5/spot-cross-margin-trade/orders', params); ⋮---- /** - * Get Repayment Orders History - * + * Get Repayment Order Detail */ -getRepaymentHistoryFlexible( - params?: GetRepaymentHistoryFlexibleParamsV5, - ): Promise< +getSpotMarginRepaymentOrderDetail(params?: { + startTime?: number; + endTime?: number; + coin?: string; + limit?: number; + }): Promise< APIResponseV3WithTime<{ - list: RepaymentHistoryFlexibleV5[]; - nextPageCursor: string; + list: { + accountId: string; + coin: string; + repaidAmount: string; + repayId: string; + repayMarginOrderId: string; + repayTime: string; + transactIds: { + repaidInterest: string; + repaidPrincipal: string; + repaidSerialNumber: string; + transactId: string; + }[]; + }[]; }> > { - return this.getPrivate( - '/v5/crypto-loan-flexible/repayment-history', - params, - ); + return this.getPrivate('/v5/spot-cross-margin-trade/repay-history', params); ⋮---- -getFlexibleLoanAvailableInventory( - params: GetFlexibleLoanAvailableInventoryParamsV5, -): Promise> +/** + * Turn spot margin trade on / off in your NORMAL account. + */ +toggleSpotCrossMarginTrade(params: { + switch: 1 | 0; +}): Promise > { - return this.get('/v5/crypto-loan-fixed/supply-order-quote', params); + return this.get('/v5/crypto-loan/collateral-data', params); ⋮---- /** - * Get Borrowing Market - * If you want to borrow, you can use this endpoint to check whether there are any suitable counterparty supply orders available. + * Get Borrowable Coins * + * INFO: Do not need authentication + * @deprecated - Use "Crypto Loan - New" Endpoints instead */ -getBorrowOrderQuoteFixed(params: GetBorrowOrderQuoteFixedParamsV5): Promise< +getBorrowableCoins(params?: { + vipLevel?: string; + currency?: string; + }): Promise< APIResponseV3WithTime<{ - list: BorrowOrderQuoteFixedV5[]; + vipCoinList: VipBorrowableCoinsV5[]; }> > { - return this.get('/v5/crypto-loan-fixed/borrow-order-quote', params); -⋮---- -/** - * Create Borrow Order - * The loan funds are released to the Funding wallet. - * The collateral funds are deducted from the Funding wallet, so make sure you have enough collateral amount in the Funding wallet. - */ -createBorrowOrderFixed( - params: CreateBorrowOrderFixedParamsV5, -): Promise> + return this.get('/v5/crypto-loan/loanable-data', params); ⋮---- /** - * Create Supply Order + * Get Account Borrow/Collateral Limit + * Query the account borrowable/collateral limit * * Permission: "Spot trade" - * - * Optional `availableSource`: 0 Funding, 1 Earn Flexible, 2 ALL (default 0). - */ -createSupplyOrderFixed( - params: CreateSupplyOrderFixedParamsV5, -): Promise> -⋮---- -/** - * Cancel Borrow Order - * + * @deprecated - Use "Crypto Loan - New" Endpoints instead */ -cancelBorrowOrderFixed( - params: CancelBorrowOrderFixedParamsV5, -): Promise> ⋮---- /** - * Cancel Supply Order + * Borrow Crypto Loan + * @deprecated - Use "Crypto Loan - New" Endpoints instead * - * Optional `refundedAccount`: 0 Funding, 1 EasyEarn (default 0). - */ -cancelSupplyOrderFixed( - params: CancelSupplyOrderFixedParamsV5, -): Promise > { - return this.getPrivate( - '/v5/crypto-loan-fixed/borrow-contract-info', - params, - ); + return this.postPrivate('/v5/crypto-loan/borrow', params); ⋮---- /** - * Get Supply Contract Info + * Repay Crypto Loan * - */ -getSupplyContractInfoFixed( - params?: GetSupplyContractInfoFixedParamsV5, - ): Promise< - APIResponseV3WithTime<{ - list: SupplyContractInfoFixedV5[]; - nextPageCursor: string; - }> - > { - return this.getPrivate( - '/v5/crypto-loan-fixed/supply-contract-info', - params, - ); -⋮---- -/** - * Get Borrow Order Info + * @deprecated - Use "Crypto Loan - New" Endpoints instead + * + * You can repay partial loan. If there is interest occurred, interest will be repaid in priority + * + * Permission: "Spot trade" * + * INFO: + * The repaid amount will be deducted from Funding account + * The collateral amount will not be auto returned when you don't fully repay the debt, but you can also adjust collateral amount */ -getBorrowOrderInfoFixed(params?: GetBorrowOrderInfoFixedParamsV5): Promise< +repayCryptoLoan(params: { orderId: string; amount: string }): Promise< APIResponseV3WithTime<{ - list: BorrowOrderInfoFixedV5[]; - nextPageCursor: string; + repayId: string; }> > { - return this.getPrivate('/v5/crypto-loan-fixed/borrow-order-info', params); + return this.postPrivate('/v5/crypto-loan/repay', params); ⋮---- /** - * Get Supply Order Info + * Get Unpaid Loan Orders + * Query the ongoing loan orders, which are not fully repaid + * + * @deprecated - Use "Crypto Loan - New" Endpoints instead * + * Permission: "Spot trade" */ -getSupplyOrderInfoFixed(params?: GetSupplyOrderInfoFixedParamsV5): Promise< +getUnpaidLoanOrders(params?: GetUnpaidLoanOrdersParamsV5): Promise< APIResponseV3WithTime<{ - list: SupplyOrderInfoFixedV5[]; + list: UnpaidLoanOrderV5[]; nextPageCursor: string; }> > { - return this.getPrivate('/v5/crypto-loan-fixed/supply-order-info', params); + return this.getPrivate('/v5/crypto-loan/ongoing-orders', params); ⋮---- /** - * Repay Fixed Loan - * Either loanId or loanCurrency needs to be passed + * Get Repayment Transaction History + * Query repaid transaction history * - */ -repayFixed( - params: RepayFixedParamsV5, -): Promise> -⋮---- -/** - * Collateral Repayment - * Pay interest first, then repay the principal. + * @deprecated - Use "Crypto Loan - New" Endpoints instead * - */ -repayCollateralFixed( - params: RepayCollateralFixedParamsV5, -): Promise > { - return this.getPrivate('/v5/crypto-loan-fixed/repayment-history', params); + return this.getPrivate('/v5/crypto-loan/repayment-history', params); ⋮---- /** - * Renew Borrow Order - * This endpoint allows you to re-borrow the principal that was previously repaid. - * The renewal amount is the same as the amount previously repaid on this loan. + * Get Completed Loan Order History + * Query the completed loan orders * - * Permission: "Spot trade" - * UID rate limit: 1 req / second - */ -renewBorrowOrderFixed( - params: RenewBorrowOrderFixedParamsV5, -): Promise> -⋮---- -/** - * Get Renew Order Info - * Query for renew order information + * @deprecated - Use "Crypto Loan - New" Endpoints instead * * Permission: "Spot trade" - * UID rate limit: 5 req / second + * + * INFO: + * Support querying last 6 months completed loan orders */ -getRenewOrderInfoFixed(params?: GetRenewOrderInfoFixedParamsV5): Promise< +getCompletedLoanOrderHistory( + params?: GetCompletedLoanOrderHistoryParamsV5, + ): Promise< APIResponseV3WithTime<{ - list: RenewOrderInfoFixedV5[]; + list: CompletedLoanOrderV5[]; nextPageCursor: string; }> > { - return this.getPrivate('/v5/crypto-loan-fixed/renew-info', params); -⋮---- -getFixedLoanAvailableInventory( - params: GetFixedLoanAvailableInventoryParamsV5, -): Promise> + return this.getPrivate('/v5/crypto-loan/borrow-history', params); ⋮---- /** + * Get Max. Allowed Reduction Collateral Amount + * Query the maximum allowed reduction collateral amount * - ****** Institutional Lending + * @deprecated - Use "Crypto Loan - New" Endpoints instead * + * Permission: "Spot trade" */ -⋮---- -/** - * Get Product Info - */ -getInstitutionalLendingProductInfo(productId?: string): Promise< +getMaxAllowedReductionCollateralAmount(params: { orderId: string }): Promise< APIResponseV3WithTime<{ - marginProductInfo: InstitutionalLendingProductInfoV5[]; + maxCollateralAmount: string; }> > { -return this.get('/v5/ins-loan/product-infos', -⋮---- -/** - * Get Coin Delta Amount - * Coin delta amount details for institutional loan hedge product (unified account only). - */ -getInstitutionalLendingCoinDeltaAmount( - params?: GetCoinDeltaAmountParamsV5, -): Promise> + return this.getPrivate('/v5/crypto-loan/max-collateral-amount', params); ⋮---- /** - * Current LTV, liquidation status, and delay-liquidation timing for an institutional loan account. + * Adjust Collateral Amount + * You can increase or reduce collateral amount. When you reduce, please follow the max. allowed reduction amount. + * + * @deprecated - Use "Crypto Loan - New" Endpoints instead + * + * Permission: "Spot trade" + * + * INFO: + * The adjusted collateral amount will be returned to or deducted from Funding account */ -getInstitutionalLendingDelayLiquidationStatus(): Promise< - APIResponseV3WithTime +adjustCollateralAmount(params: { + orderId: string; + amount: string; + direction: '0' | '1'; + }): Promise< + APIResponseV3WithTime<{ + adjustId: string; + }> > { - return this.getPrivate('/v5/ins-loan/delay-liq-status'); -⋮---- -/** - * Get Margin Coin Info - * @deprecated - */ -getInstitutionalLendingMarginCoinInfo( - productId?: string, -): Promise + > { + return this.getPrivate('/v5/crypto-loan/adjustment-history', params); ⋮---- /** - * Get Repay Orders + * + ****** Crypto Loan New + * */ -getInstitutionalLendingRepayOrders(params?: { - startTime?: number; - endTime?: number; - limit?: number; -}): Promise +getLoanBorrowableCoins(params?: GetBorrowableCoinsParamsV5): Promise< + APIResponseV3WithTime<{ + list: BorrowableCoinV5[]; + }> > { - return this.getPrivate('/v5/ins-loan/ltv'); + return this.get('/v5/crypto-loan-common/loanable-data', params); ⋮---- /** - * Get LTV with Ladder Conversion Rate + * Get Collateral Coins New + * */ -getInstitutionalLendingLTVWithLadderConversionRate(): Promise< - APIResponseV3WithTime - > { - return this.getPrivate('/v5/ins-loan/ltv-convert'); +getLoanCollateralCoins( + params?: GetCollateralCoinsParamsV5, +): Promise> ⋮---- /** - * Bind or unbind UID for the institutional loan product. + * Get Max. Allowed Collateral Reduction Amount New * - * INFO - * Risk unit designated UID cannot be unbound - * This endpoint can only be called by uids in the risk unit list - * The UID must be upgraded to UTA Pro if you try to bind it. - * When the API is operated through the API Key of any UID in the risk unit, the UID is bound or unbound in the risk unit. */ -bindOrUnbindUID(params: { uid: string; operate: '0' | '1' }): Promise< +getMaxCollateralAmount(params: GetMaxCollateralAmountParamsV5): Promise< APIResponseV3WithTime<{ - uid: string; - operate: '0' | '1'; + maxCollateralAmount: string; }> > { - return this.postPrivate('/v5/ins-loan/association-uid', params); + return this.getPrivate( + '/v5/crypto-loan-common/max-collateral-amount', + params, + ); ⋮---- /** - * Repay Institutional Loan - * Repay INS loan independently. + * Obtain Max Loan Amount + * Check the maximum borrowable amount & remaining individual platform limit for crypto loans. * - * IMPORTANT: - * - Only the designated Risk Unit UID is allowed to call this API - * - The repayment is processed asynchronously and usually takes 2-3 minutes - * - Confirm repayment status via Get Repayment Orders before initiating next repayment - * - When repaying, principal amount will be deducted from Unified wallet (interest not included) - * - Please contact RM before executing + * INFO: + * - Permission: "Spot trade" + * - UID rate limit: 5 req/s */ -repayInstitutionalLoan( - params: RepayInstitutionalLoanParamsV5, -): Promise> +getMaxLoanAmount( + params: GetMaxLoanAmountParamsV5, +): Promise> ⋮---- /** - * - ****** Broker - * + * Adjust Collateral Amount New + * You can increase or reduce your collateral amount. When you reduce, please obey the Get Max. Allowed Collateral Reduction Amount */ +updateCollateralAmount( + params: AdjustCollateralAmountParamsV5, +): Promise> ⋮---- /** - * Get Exchange Broker Earning. + * Get Collateral Adjustment History New + * Query for your LTV adjustment history. * - * INFO - * Use exchange broker master account to query - * The data can support up to past 1 months until T-1. To extract data from over a month ago, please contact your Relationship Manager - * begin & end are either entered at the same time or not entered, and latest 7 days data are returned by default - * API rate limit: 10 req / sec */ -getExchangeBrokerEarnings( - params?: GetExchangeBrokerEarningsParamsV5, -): Promise> +getCollateralAdjustmentHistory( + params?: GetCollateralAdjustmentHistoryParamsV5, + ): Promise< + APIResponseV3WithTime<{ + list: CollateralAdjustmentHistoryV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/crypto-loan-common/adjustment-history', params); ⋮---- /** - * Get Exchange Broker Account Info. + * Get Crypto Loan Position New * - * INFO - * Use exchange broker master account to query - * API rate limit: 10 req / sec */ -getExchangeBrokerAccountInfo(): Promise< - APIResponseV3WithTime +getCryptoLoanPosition(): Promise< + APIResponseV3WithTime > { - return this.getPrivate('/v5/broker/account-info'); + return this.getPrivate('/v5/crypto-loan-common/position'); ⋮---- /** - * Get Sub Account Deposit Records. - * - * Exchange broker can query subaccount's deposit records by main UID's API key without specifying uid. * - * API rate limit: 300 req / min + ****** Crypto Loan New - Flexible Loan * - * TIP - * endTime - startTime should be less than 30 days. Queries for the last 30 days worth of records by default. */ -getBrokerSubAccountDeposits(params?: GetBrokerSubAccountDepositsV5): Promise< - APIResponseV3WithTime<{ - rows: ExchangeBrokerSubAccountDepositRecordV5[]; - nextPageCursor: string; - }> - > { - return this.getPrivate( - '/v5/broker/asset/query-sub-member-deposit-record', - params, - ); ⋮---- /** - * Query Voucher Spec + * Borrow Flexible Loan + * Fully or partially repay a loan. If interest is due, that is paid off first, with the loaned amount being paid off only after due interest. + * */ -getBrokerVoucherSpec(params: { - id: string; -}): Promise> +borrowFlexible( + params: BorrowFlexibleParamsV5, +): Promise> ⋮---- /** - * Issue a voucher to a user + * Repay Flexible Loan + * Fully or partially repay a loan. If interest is due, that is paid off first, with the loaned amount being paid off only after due interest. * - * INFO - * Use exchange broker master account to issue */ -issueBrokerVoucher( - params: IssueVoucherParamsV5, -): Promise> +repayFlexible( + params: RepayFlexibleParamsV5, +): Promise> ⋮---- /** - * Query an issued voucher - * - * INFO - * Use exchange broker master account to query - */ -getBrokerIssuedVoucher( - params: GetBrokerIssuedVoucherParamsV5, -): Promise> + * Collateral Repayment + * Pay interest first, then repay the principal. + */ +repayCollateralFlexible( + params: RepayCollateralFlexibleParamsV5, +): Promise > { - return this.postPrivate('/v5/broker/apilimit/set', params); + return this.getPrivate('/v5/crypto-loan-flexible/ongoing-coin', params); ⋮---- /** - * Get Rate Limit Cap - * Get your exchange broker account entity total rate limit usage and cap, across the board. - * - * API rate limit: 5 req per second + * Get Borrow Orders History * - * INFO - * - Only Main UIDs can query this endpoint - * - Only exchange broker account can call this endpoint - * - If you never apply for a specific config via account manager, it gives empty response. */ -getBrokerRateLimitCap(): Promise< +getBorrowHistoryFlexible(params?: GetBorrowHistoryFlexibleParamsV5): Promise< APIResponseV3WithTime<{ - list: BrokerRateLimitCapItemV5[]; + list: BorrowHistoryFlexibleV5[]; + nextPageCursor: string; }> > { - return this.getPrivate('/v5/broker/apilimit/query-cap'); + return this.getPrivate('/v5/crypto-loan-flexible/borrow-history', params); ⋮---- /** - * Get All Rate Limits - * Use the master account to query for all your UID-level rate limits, including all master accounts and subaccounts. - * - * API rate limit: 1 req per second + * Get Repayment Orders History * - * INFO - * - Only exchange broker account can call this endpoint - * - 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. */ -getAllBrokerRateLimits(params?: GetAllBrokerRateLimitsParamsV5): Promise< +getRepaymentHistoryFlexible( + params?: GetRepaymentHistoryFlexibleParamsV5, + ): Promise< APIResponseV3WithTime<{ - list: BrokerRateLimitAllItemV5[]; + list: RepaymentHistoryFlexibleV5[]; nextPageCursor: string; }> > { - return this.getPrivate('/v5/broker/apilimit/query-all', params); + return this.getPrivate( + '/v5/crypto-loan-flexible/repayment-history', + params, + ); +⋮---- +getFlexibleLoanAvailableInventory( + params: GetFlexibleLoanAvailableInventoryParamsV5, +): Promise> ⋮---- /** * - ****** EARN + ****** Fixed Loan * */ ⋮---- /** - * Get Product Info for Earn products + * Get Supplying Market + * If you want to supply, you can use this endpoint to check whether there are any suitable counterparty borrow orders available. * - * INFO: Do not need authentication */ -getEarnProduct(params: { category: string; coin?: string }): Promise< +getSupplyOrderQuoteFixed(params: GetSupplyOrderQuoteFixedParamsV5): Promise< APIResponseV3WithTime<{ - list: EarnProductV5[]; + list: SupplyOrderQuoteFixedV5[]; }> > { - return this.get('/v5/earn/product', params); + return this.get('/v5/crypto-loan-fixed/supply-order-quote', params); ⋮---- /** - * Query Flexible Saving auto savings settings. Omit coins to return every supported coin. + * Get Borrowing Market + * If you want to borrow, you can use this endpoint to check whether there are any suitable counterparty supply orders available. + * */ -getFlexibleSavingAutoSavings( - params?: GetFlexibleSavingAutoSavingsParamsV5, -): Promise> +getBorrowOrderQuoteFixed(params: GetBorrowOrderQuoteFixedParamsV5): Promise< + APIResponseV3WithTime<{ + list: BorrowOrderQuoteFixedV5[]; + }> + > { + return this.get('/v5/crypto-loan-fixed/borrow-order-quote', params); ⋮---- /** - * Enable or disable Flexible Saving auto savings for one coin, or globally when coin is omitted. + * Create Borrow Order + * The loan funds are released to the Funding wallet. + * The collateral funds are deducted from the Funding wallet, so make sure you have enough collateral amount in the Funding wallet. */ -setFlexibleSavingAutoSavings( - params: SetFlexibleSavingAutoSavingsParamsV5, -): Promise> ⋮---- /** - * Get Coupon List - * Interest-rate coupons and Dual Assets reward cards for FlexibleSaving or DualAssets. + * Create Supply Order + * + * Permission: "Spot trade" + * + * Optional `availableSource`: 0 Funding, 1 Earn Flexible, 2 ALL (default 0). */ -getEarnCouponList( - params: GetEarnCouponListParamsV5, -): Promise> +createSupplyOrderFixed( + params: CreateSupplyOrderFixedParamsV5, +): Promise> ⋮---- /** - * Get RWA Product List - * Real World Assets earn products. Auth optional; `userQuota` populated when authenticated. + * Cancel Borrow Order + * */ -getRWAProductList( - params?: GetRWAProductListParamsV5, -): Promise> +cancelBorrowOrderFixed( + params: CancelBorrowOrderFixedParamsV5, +): Promise> +cancelSupplyOrderFixed( + params: CancelSupplyOrderFixedParamsV5, +): Promise +getBorrowContractInfoFixed( + params?: GetBorrowContractInfoFixedParamsV5, + ): Promise< + APIResponseV3WithTime<{ + list: BorrowContractInfoFixedV5[]; + nextPageCursor: string; + }> > { - return this.getPrivate('/v5/earn/rwa/position'); + return this.getPrivate( + '/v5/crypto-loan-fixed/borrow-contract-info', + params, + ); ⋮---- /** - * Get RWA Order List + * Get Supply Contract Info + * */ -getRWAOrderList( - params?: GetRWAOrderListParamsV5, -): Promise> +getSupplyContractInfoFixed( + params?: GetSupplyContractInfoFixedParamsV5, + ): Promise< + APIResponseV3WithTime<{ + list: SupplyContractInfoFixedV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate( + '/v5/crypto-loan-fixed/supply-contract-info', + params, + ); ⋮---- /** - * Get RWA NAV Chart - * NAV history for an RWA product (public; max 180-day span). + * Get Borrow Order Info + * */ -getRWANavChart( - params: GetRWANavChartParamsV5, -): Promise> +getBorrowOrderInfoFixed(params?: GetBorrowOrderInfoFixedParamsV5): Promise< + APIResponseV3WithTime<{ + list: BorrowOrderInfoFixedV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/crypto-loan-fixed/borrow-order-info', params); ⋮---- /** - * Get Hold to Earn airdrop products (ByFi). + * Get Supply Order Info * - * No authentication required; guest access supported. Authenticated users get eligibility-filtered products. */ -getHoldToEarnAirdropProducts(): Promise< - APIResponseV3WithTime +getSupplyOrderInfoFixed(params?: GetSupplyOrderInfoFixedParamsV5): Promise< + APIResponseV3WithTime<{ + list: SupplyOrderInfoFixedV5[]; + nextPageCursor: string; + }> > { - return this.get('/v5/earn/hold-to-earn/product'); + return this.getPrivate('/v5/crypto-loan-fixed/supply-order-info', params); ⋮---- /** - * Get Advanced Earn product info (Dual Asset, Double Win, Smart Leverage, etc. via `category`). + * Repay Fixed Loan + * Either loanId or loanCurrency needs to be passed * - * INFO: No authentication. Up to 50 requests/second per IP. */ -getAdvanceEarnProduct( - params: GetAdvanceEarnProductParamsV5, -): Promise> +repayFixed( + params: RepayFixedParamsV5, +): Promise> ⋮---- /** - * Liquidity mining — product list (Advanced Earn). + * Collateral Repayment + * Pay interest first, then repay the principal. * - * INFO: No authentication. Up to 50 requests/second per IP. */ -getLiquidityMiningProduct( - params?: GetLiquidityMiningProductParamsV5, -): Promise> +repayCollateralFixed( + params: RepayCollateralFixedParamsV5, +): Promise> +getRepaymentHistoryFixed(params?: GetRepaymentHistoryFixedParamsV5): Promise< + APIResponseV3WithTime<{ + list: RepaymentHistoryFixedV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/crypto-loan-fixed/repayment-history', params); ⋮---- /** - * Fixed-term / fixed saving — product list (Earn). + * Renew Borrow Order + * This endpoint allows you to re-borrow the principal that was previously repaid. + * The renewal amount is the same as the amount previously repaid on this loan. * - * INFO: No authentication. Up to 50 requests/second per IP. + * Permission: "Spot trade" + * UID rate limit: 1 req / second */ -getFixedTermEarnProduct( - params?: GetFixedTermEarnProductParamsV5, -): Promise> +renewBorrowOrderFixed( + params: RenewBorrowOrderFixedParamsV5, +): Promise> +⋮---- +/** + * Get Renew Order Info + * Query for renew order information + * + * Permission: "Spot trade" + * UID rate limit: 5 req / second + */ +getRenewOrderInfoFixed(params?: GetRenewOrderInfoFixedParamsV5): Promise< + APIResponseV3WithTime<{ + list: RenewOrderInfoFixedV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/crypto-loan-fixed/renew-info', params); +⋮---- +getFixedLoanAvailableInventory( + params: GetFixedLoanAvailableInventoryParamsV5, +): Promise> ⋮---- /** - * Advanced Earn — quote / extra info (Discount Buy, Dual Assets, …). Call before place order where required. * - * INFO: No authentication. Up to 50 requests/second per IP. - * Dual Assets: `productId` is required. Response uses `list` with `buyLowPrice` / `sellHighPrice`. + ****** Institutional Lending + * */ -getAdvanceEarnProductExtraInfo( - params: GetAdvanceEarnProductExtraInfoParamsV5, -): Promise> ⋮---- /** - * Advanced Earn — place order (Dual Assets, Discount Buy, …). Async; use getAdvanceEarnOrder to track. - * - * INFO: API key needs "Earn" permission. Rate limit e.g. 5 req/s (Dual Assets per docs). + * Get Product Info */ -submitAdvanceEarnPlaceOrder( - params: SubmitAdvanceEarnPlaceOrderParamsV5, -): Promise> +getInstitutionalLendingProductInfo(productId?: string): Promise< + APIResponseV3WithTime<{ + marginProductInfo: InstitutionalLendingProductInfoV5[]; + }> + > { +return this.get('/v5/ins-loan/product-infos', ⋮---- /** - * Advanced Earn — active positions (Dual Assets, Discount Buy, …). - * - * INFO: API key needs "Earn" permission. E.g. 10 req/s (Dual Assets per docs). + * Get Coin Delta Amount + * Coin delta amount details for institutional loan hedge product (unified account only). */ -getAdvanceEarnPosition( - params: GetAdvanceEarnPositionListParamsV5, -): Promise> +getInstitutionalLendingCoinDeltaAmount( + params?: GetCoinDeltaAmountParamsV5, +): Promise> ⋮---- /** - * Advanced Earn — order list (Dual Assets, Discount Buy, …). Distinct from getEarnOrderHistory (/v5/earn/order). - * - * INFO: API key needs "Earn" permission. E.g. 10 req/s (Dual Assets per docs). + * Current LTV, liquidation status, and delay-liquidation timing for an institutional loan account. */ -getAdvanceEarnOrder( - params: GetAdvanceEarnOrderListParamsV5, -): Promise> +getInstitutionalLendingDelayLiquidationStatus(): Promise< + APIResponseV3WithTime + > { + return this.getPrivate('/v5/ins-loan/delay-liq-status'); ⋮---- /** - * Fixed-term earn — place order (stake). Async; use getFixedTermEarnOrder to track. - * - * INFO: API key needs "Earn" permission. Rate limit: 5 req/s. + * Get Margin Coin Info + * @deprecated */ -submitFixedTermEarnOrder( - params: SubmitFixedTermEarnOrderParamsV5, -): Promise> +getInstitutionalLendingMarginCoinInfo( + productId?: string, +): Promise> +getInstitutionalLendingMarginCoinInfoWithConversionRate( + productId?: string, +): Promise> +getInstitutionalLendingLoanOrders(params?: { + orderId?: string; + startTime?: number; + endTime?: number; + limit?: number; +}): Promise> +getInstitutionalLendingRepayOrders(params?: { + startTime?: number; + endTime?: number; + limit?: number; +}): Promise>> +getInstitutionalLendingLTV(): Promise< + APIResponseV3WithTime + > { + return this.getPrivate('/v5/ins-loan/ltv'); ⋮---- /** - * Stake or Redeem Earn products - * - * INFO: API key needs "Earn" permission - * - * NOTE: In times of high demand for loans in the market for a specific cryptocurrency, - * the redemption of the principal may encounter delays and is expected to be processed - * within 48 hours. Once the redemption request is initiated, it cannot be canceled, - * and your principal will continue to earn interest until the process is completed. + * Get LTV with Ladder Conversion Rate */ -submitStakeRedeem(params: SubmitStakeRedeemParamsV5): Promise< - APIResponseV3WithTime<{ - orderId: string; - orderLinkId: string; - }> +getInstitutionalLendingLTVWithLadderConversionRate(): Promise< + APIResponseV3WithTime > { - return this.postPrivate('/v5/earn/place-order', params); + return this.getPrivate('/v5/ins-loan/ltv-convert'); ⋮---- /** - * Get Stake/Redeem Order History - * - * INFO: API key needs "Earn" permission + * Bind or unbind UID for the institutional loan product. * - * Note: - * - For category = OnChain, either orderId or orderLinkId is required - * - If both are passed, make sure they're matched, otherwise returning empty result - * - Supports batch query with productId, startTime, endTime, limit, cursor + * INFO + * Risk unit designated UID cannot be unbound + * This endpoint can only be called by uids in the risk unit list + * The UID must be upgraded to UTA Pro if you try to bind it. + * When the API is operated through the API Key of any UID in the risk unit, the UID is bound or unbound in the risk unit. */ -getEarnOrderHistory(params: GetEarnOrderHistoryParamsV5): Promise< +bindOrUnbindUID(params: { uid: string; operate: '0' | '1' }): Promise< APIResponseV3WithTime<{ - list: EarnOrderHistoryV5[]; - nextPageCursor: string; + uid: string; + operate: '0' | '1'; }> > { - return this.getPrivate('/v5/earn/order', params); + return this.postPrivate('/v5/ins-loan/association-uid', params); ⋮---- /** - * Get Staked Position - * - * INFO: API key needs "Earn" permission + * Repay Institutional Loan + * Repay INS loan independently. * - * Note: Fully redeemed position is also returned in the response - * Note: Response includes `autoReinvest` where applicable; use `modifyEarnPosition` to change it (OnChain fixed). - * List items include `availableAmount` (redeemable) and `freezeDetails` (frozen amount + reason). + * IMPORTANT: + * - Only the designated Risk Unit UID is allowed to call this API + * - The repayment is processed asynchronously and usually takes 2-3 minutes + * - Confirm repayment status via Get Repayment Orders before initiating next repayment + * - When repaying, principal amount will be deducted from Unified wallet (interest not included) + * - Please contact RM before executing */ -getEarnPosition(params: GetEarnPositionParamsV5): Promise< - APIResponseV3WithTime<{ - list: EarnPositionV5[]; - }> - > { - return this.getPrivate('/v5/earn/position', params); +repayInstitutionalLoan( + params: RepayInstitutionalLoanParamsV5, +): Promise> ⋮---- /** - * Modify OnChain Earn position (e.g. auto-reinvest for fixed duration products). * - * INFO: API key needs "Earn" permission. Only `category=OnChain` and fixed positions (see product). + ****** Broker + * */ -modifyEarnPosition( - params: ModifyEarnPositionParamsV5, -): Promise>> ⋮---- /** - * Get Yield History - * - * INFO: API key needs "Earn" permission + * Get Exchange Broker Earning. * - * Note: `category` includes `OnChain`. For `OnChain`, do not pass `productId` (error). + * INFO + * Use exchange broker master account to query + * The data can support up to past 1 months until T-1. To extract data from over a month ago, please contact your Relationship Manager + * begin & end are either entered at the same time or not entered, and latest 7 days data are returned by default + * API rate limit: 10 req / sec */ -getEarnYieldHistory(params: GetEarnYieldHistoryParamsV5): Promise< - APIResponseV3WithTime<{ - yield: EarnYieldHistoryV5[]; - nextPageCursor: string; - }> - > { - return this.getPrivate('/v5/earn/yield', params); +getExchangeBrokerEarnings( + params?: GetExchangeBrokerEarningsParamsV5, +): Promise> ⋮---- /** - * Get Hold to Earn airdrop daily PnL records (ByFi). Up to 3 months of completed yield history. + * Get Exchange Broker Account Info. * - * INFO: API key needs "Earn" permission + * INFO + * Use exchange broker master account to query + * API rate limit: 10 req / sec */ -getHoldToEarnAirdropYieldHistory( - params: GetHoldToEarnAirdropYieldHistoryParamsV5, -): Promise> +getExchangeBrokerAccountInfo(): Promise< + APIResponseV3WithTime + > { + return this.getPrivate('/v5/broker/account-info'); ⋮---- /** - * Get Hourly Yield History + * Get Sub Account Deposit Records. * - * INFO: API key needs "Earn" permission + * Exchange broker can query subaccount's deposit records by main UID's API key without specifying uid. + * + * API rate limit: 300 req / min + * + * TIP + * endTime - startTime should be less than 30 days. Queries for the last 30 days worth of records by default. */ -getEarnHourlyYieldHistory(params: GetEarnHourlyYieldHistoryParamsV5): Promise< +getBrokerSubAccountDeposits(params?: GetBrokerSubAccountDepositsV5): Promise< APIResponseV3WithTime<{ - list: EarnHourlyYieldHistoryV5[]; + rows: ExchangeBrokerSubAccountDepositRecordV5[]; nextPageCursor: string; }> > { - return this.getPrivate('/v5/earn/hourly-yield', params); + return this.getPrivate( + '/v5/broker/asset/query-sub-member-deposit-record', + params, + ); ⋮---- /** - * Get historical APR (FlexibleSaving / OnChain), up to ~6 months. - * - * INFO: Does not need authentication + * Query Voucher Spec */ -getEarnAprHistory( - params: GetEarnAprHistoryParamsV5, -): Promise> ⋮---- /** - * Earn token product (e.g. BYUSDT) — Get Product Info - * Without auth, user-specific fields are empty or defaulted. + * Issue a voucher to a user + * + * INFO + * Use exchange broker master account to issue */ -getEarnTokenProduct( - params: GetEarnTokenProductParamsV5, -): Promise> +issueBrokerVoucher( + params: IssueVoucherParamsV5, +): Promise> ⋮---- /** - * Earn token — Place Order (Mint / Redeem). Accepted response is not final settlement; use `getEarnTokenOrders`. + * Query an issued voucher + * + * INFO + * Use exchange broker master account to query */ -submitEarnTokenOrder( - params: PlaceEarnTokenOrderParamsV5, -): Promise> +getBrokerIssuedVoucher( + params: GetBrokerIssuedVoucherParamsV5, +): Promise> ⋮---- /** - * Earn token — Get Order List + * Set Rate Limit + * Exchange broker only. Set the rate limit for sub accounts. + * + * API rate limit: 1 req per second + * + * INFO + * - 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. + * - If the UID requesting this endpoint is a subaccount, the UID can only be itself in uids. + * - Only exchange broker account can call this endpoint */ -getEarnTokenOrders(params: GetEarnTokenOrderListParamsV5): Promise< +setBrokerRateLimit(params: SetBrokerRateLimitParamsV5): Promise< APIResponseV3WithTime<{ - list: EarnTokenOrderV5[]; - nextPageCursor: string; + result: BrokerRateLimitSetResultItemV5[]; }> > { - return this.getPrivate('/v5/earn/token/order', params); -⋮---- -/** - * Earn token — Get Position Info - */ -getEarnTokenPosition( - params: GetEarnTokenPositionParamsV5, -): Promise> + return this.postPrivate('/v5/broker/apilimit/set', params); ⋮---- /** - * Earn token — Get Daily Yield Records + * Get Rate Limit Cap + * Get your exchange broker account entity total rate limit usage and cap, across the board. + * + * API rate limit: 5 req per second + * + * INFO + * - Only Main UIDs can query this endpoint + * - Only exchange broker account can call this endpoint + * - If you never apply for a specific config via account manager, it gives empty response. */ -getEarnTokenDailyYield(params: GetEarnTokenDailyYieldParamsV5): Promise< +getBrokerRateLimitCap(): Promise< APIResponseV3WithTime<{ - list: EarnTokenDailyYieldRecordV5[]; - nextPageCursor: string; + list: BrokerRateLimitCapItemV5[]; }> > { - return this.getPrivate('/v5/earn/token/yield', params); + return this.getPrivate('/v5/broker/apilimit/query-cap'); ⋮---- /** - * Earn token — Get Hourly Yield Records + * Get All Rate Limits + * Use the master account to query for all your UID-level rate limits, including all master accounts and subaccounts. + * + * API rate limit: 1 req per second + * + * INFO + * - Only exchange broker account can call this endpoint + * - 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. */ -getEarnTokenHourlyYield(params: GetEarnTokenHourlyYieldParamsV5): Promise< +getAllBrokerRateLimits(params?: GetAllBrokerRateLimitsParamsV5): Promise< APIResponseV3WithTime<{ - list: EarnTokenHourlyYieldRecordV5[]; + list: BrokerRateLimitAllItemV5[]; nextPageCursor: string; }> > { - return this.getPrivate('/v5/earn/token/hourly-yield', params); -⋮---- -/** - * Earn token — Get History APR (7/30/180 days). No authentication required. - */ -getEarnTokenHistoryApr( - params: GetEarnTokenHistoryAprParamsV5, -): Promise +getEarnProduct(params: { category: string; coin?: string }): Promise< + APIResponseV3WithTime<{ + list: EarnProductV5[]; + }> > { - return this.getPrivate('/v5/earn/pwm/investment-plan/list'); + return this.get('/v5/earn/product', params); ⋮---- /** - * Get PWM investment plan detail (Active or Closed). + * Query Flexible Saving auto savings settings. Omit coins to return every supported coin. */ -getPwmInvestmentPlanDetail( - params: GetPwmInvestmentPlanDetailParamsV5, -): Promise> +getFlexibleSavingAutoSavings( + params?: GetFlexibleSavingAutoSavingsParamsV5, +): Promise> ⋮---- /** - * Get pending PWM investment plan detail (PendingSubscription). + * Enable or disable Flexible Saving auto savings for one coin, or globally when coin is omitted. */ -getPwmPendingInvestmentPlanDetail( - params: GetPwmPendingInvestmentPlanDetailParamsV5, -): Promise> +setFlexibleSavingAutoSavings( + params: SetFlexibleSavingAutoSavingsParamsV5, +): Promise> +getEarnCouponList( + params: GetEarnCouponListParamsV5, +): Promise> ⋮---- /** - * Get PWM investment plan asset trend (default last 7 days). + * Get RWA Product List + * Real World Assets earn products. Auth optional; `userQuota` populated when authenticated. */ -getPwmInvestmentPlanAssetTrend( - params: GetPwmInvestmentPlanAssetTrendParamsV5, -): Promise> +getRWAProductList( + params?: GetRWAProductListParamsV5, +): Promise> ⋮---- /** - * Get PWM fund historical NAV (max 180 days between startTime and endTime). + * Place RWA Order + * Stake or redeem RWA product. Async — use getRWAOrderList to track status. */ -getPwmFundHistoricalNav( - params: GetPwmFundHistoricalNavParamsV5, -): Promise> +placeRWAOrder( + params: PlaceRWAOrderParamsV5, +): Promise> ⋮---- /** - * Subscribe to a PWM investment plan (PendingSubscription). + * Get RWA Position List */ -subscribePwmInvestmentPlan( - params: SubscribePwmInvestmentPlanParamsV5, -): Promise> +getRWAPositionList(): Promise< + APIResponseV3WithTime + > { + return this.getPrivate('/v5/earn/rwa/position'); ⋮---- /** - * Invest more into a PWM investment plan product (Active). + * Get RWA Order List */ -investMorePwmInvestmentPlan( - params: InvestMorePwmInvestmentPlanParamsV5, -): Promise> +getRWAOrderList( + params?: GetRWAOrderListParamsV5, +): Promise> ⋮---- /** - * Redeem from a PWM investment plan product. + * Get RWA NAV Chart + * NAV history for an RWA product (public; max 180-day span). */ -redeemPwmInvestmentPlan( - params: RedeemPwmInvestmentPlanParamsV5, -): Promise> +getRWANavChart( + params: GetRWANavChartParamsV5, +): Promise> ⋮---- /** - * Get PWM investment plan orders (subscribe / redeem / auto-reinvest). + * Get Hold to Earn airdrop products (ByFi). + * + * No authentication required; guest access supported. Authenticated users get eligibility-filtered products. */ -getPwmInvestmentPlanOrders( - params?: GetPwmInvestmentPlanOrdersParamsV5, -): Promise> +getHoldToEarnAirdropProducts(): Promise< + APIResponseV3WithTime + > { + return this.get('/v5/earn/hold-to-earn/product'); ⋮---- /** - * Get PWM subscribable product info for customize plan. No authentication required. + * Get Advanced Earn product info (Dual Asset, Double Win, Smart Leverage, etc. via `category`). + * + * INFO: No authentication. Up to 50 requests/second per IP. */ -getPwmSubscribableProductInfo(): Promise< - APIResponseV3WithTime - > { - return this.get('/v5/earn/pwm/customize-plan/product'); +getAdvanceEarnProduct( + params: GetAdvanceEarnProductParamsV5, +): Promise> ⋮---- /** - * Create a customized PWM investment plan (max 20 Active + Pending plans per user). + * Liquidity mining — product list (Advanced Earn). + * + * INFO: No authentication. Up to 50 requests/second per IP. */ -createPwmCustomizeInvestmentPlan( - params: CreatePwmCustomizeInvestmentPlanParamsV5, -): Promise> +getLiquidityMiningProduct( + params?: GetLiquidityMiningProductParamsV5, +): Promise> ⋮---- /** + * Liquidity mining reinvest. Puts claimable yield of a position back into the pool. + * Async; success means the order was accepted. Use order status to track fill. + * Optional `leverage` is an integer string; defaults to "1" (no leverage). * - ****** PWM — Asset Manager - * + * INFO: Earn permission required. Up to 5 requests/second per UID. */ +reinvestLiquidityMining( + params: ReinvestLiquidityMiningParamsV5, +): Promise> ⋮---- /** - * Get all PWM funds managed by the institution (newest first). + * Fixed-term / fixed saving — product list (Earn). + * + * INFO: No authentication. Up to 50 requests/second per IP. */ -getPwmAllFunds( - params?: GetPwmAllFundsParamsV5, -): Promise> +getFixedTermEarnProduct( + params?: GetFixedTermEarnProductParamsV5, +): Promise> ⋮---- /** - * Settle fund profit sharing (Active funds only). + * Advanced Earn — quote / extra info (Discount Buy, Dual Assets, …). Call before place order where required. + * + * INFO: No authentication. Up to 50 requests/second per IP. + * Dual Assets: `productId` is required. Response uses `list` with `buyLowPrice` / `sellHighPrice`. */ -settlePwmFundProfit( - params: SettlePwmFundProfitParamsV5, -): Promise> +getAdvanceEarnProductExtraInfo( + params: GetAdvanceEarnProductExtraInfoParamsV5, +): Promise> ⋮---- /** - * Create a PWM fund (PendingSubscribe). Max 10 funds per institution. + * Advanced Earn — place order (Dual Assets, Discount Buy, …). Async; use getAdvanceEarnOrder to track. + * + * INFO: API key needs "Earn" permission. Rate limit e.g. 5 req/s (Dual Assets per docs). */ -createPwmFund( - params: CreatePwmFundParamsV5, -): Promise> +submitAdvanceEarnPlaceOrder( + params: SubmitAdvanceEarnPlaceOrderParamsV5, +): Promise> ⋮---- /** - * Create a PWM investment plan for a user (PendingSubscription). Max 10 plans per institution. + * Advanced Earn — active positions (Dual Assets, Discount Buy, …). + * + * INFO: API key needs "Earn" permission. E.g. 10 req/s (Dual Assets per docs). */ -createPwmAssetManagerInvestmentPlan( - params: CreatePwmAssetManagerInvestmentPlanParamsV5, - ): Promise< - APIResponseV3WithTime - > { - return this.postPrivate( - '/v5/earn/pwm/asset-manager/create-investment-plan', - params, - ); +getAdvanceEarnPosition( + params: GetAdvanceEarnPositionListParamsV5, +): Promise> ⋮---- /** - * Get PWM investment plans created by the institution (asset manager). + * Advanced Earn — order list (Dual Assets, Discount Buy, …). Distinct from getEarnOrderHistory (/v5/earn/order). + * + * INFO: API key needs "Earn" permission. E.g. 10 req/s (Dual Assets per docs). */ -getPwmAssetManagerInvestmentPlans( - params?: GetPwmAssetManagerInvestmentPlansParamsV5, -): Promise> +getAdvanceEarnOrder( + params: GetAdvanceEarnOrderListParamsV5, +): Promise> ⋮---- /** - * Manage a PWM investment plan (status and/or fund allocation). + * Fixed-term earn — place order (stake). Async; use getFixedTermEarnOrder to track. + * + * INFO: API key needs "Earn" permission. Rate limit: 5 req/s. */ -managePwmAssetManagerInvestmentPlan( - params: ManagePwmAssetManagerInvestmentPlanParamsV5, - ): Promise< - APIResponseV3WithTime - > { - return this.postPrivate( - '/v5/earn/pwm/asset-manager/manage-investment-plan', - params, - ); +submitFixedTermEarnOrder( + params: SubmitFixedTermEarnOrderParamsV5, +): Promise> ⋮---- /** - * Get all PWM fund orders (asset manager). Default time window: last 7 days. + * Fixed-term earn — early redeem (FundPool only, when product allows). + * + * INFO: API key needs "Earn" permission. Rate limit: 5 req/s. */ -getPwmAllFundOrders( - params?: GetPwmAllFundOrdersParamsV5, -): Promise> +redeemFixedTermEarn( + params: RedeemFixedTermEarnParamsV5, +): Promise> ⋮---- /** - * Manage a PWM fund order (approve / reject Pending Review orders). + * Fixed-term earn — active positions. + * + * INFO: API key needs "Earn" permission. Rate limit: 10 req/s. */ -managePwmFundOrder( - params: ManagePwmFundOrderParamsV5, -): Promise> +getFixedTermEarnPosition( + params?: GetFixedTermEarnPositionParamsV5, +): Promise> ⋮---- /** - * Create a PWM fund sub-account (async; max 30 per fund, fund must be Active). + * Fixed-term earn — order list. + * + * INFO: API key needs "Earn" permission. Rate limit: 10 req/s. */ -createPwmFundSubAccount( - params: CreatePwmFundSubAccountParamsV5, -): Promise> +getFixedTermEarnOrder( + params?: GetFixedTermEarnOrderListParamsV5, +): Promise> ⋮---- /** - * Transfer funds between custodian sub-accounts (fund custodian API key required). + * Fixed-term earn — enable or disable auto-invest on a position. + * + * INFO: API key needs "Earn" permission. Rate limit: 5 req/s. */ -pwmFundTransfer( - params: PwmFundTransferParamsV5, -): Promise> +setFixedTermEarnAutoInvest( + params: SetFixedTermEarnAutoInvestParamsV5, +): Promise>> ⋮---- /** - * Query PWM fund transfer result (fund custodian API key required). + * Stake or Redeem Earn products + * + * INFO: API key needs "Earn" permission + * + * NOTE: In times of high demand for loans in the market for a specific cryptocurrency, + * the redemption of the principal may encounter delays and is expected to be processed + * within 48 hours. Once the redemption request is initiated, it cannot be canceled, + * and your principal will continue to earn interest until the process is completed. */ -getPwmFundTransferRecords( - params?: GetPwmFundTransferRecordsParamsV5, -): Promise> +submitStakeRedeem(params: SubmitStakeRedeemParamsV5): Promise< + APIResponseV3WithTime<{ + orderId: string; + orderLinkId: string; + }> + > { + return this.postPrivate('/v5/earn/place-order', params); ⋮---- /** + * Get Stake/Redeem Order History * - ****** Bybit Card APIs + * INFO: API key needs "Earn" permission * + * Note: + * - For category = OnChain, either orderId or orderLinkId is required + * - If both are passed, make sure they're matched, otherwise returning empty result + * - Supports batch query with productId, startTime, endTime, limit, cursor */ +getEarnOrderHistory(params: GetEarnOrderHistoryParamsV5): Promise< + APIResponseV3WithTime<{ + list: EarnOrderHistoryV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/earn/order', params); ⋮---- /** - * Bybit Card — query card transaction / asset history (filter by status, card digits, merchant, time, type, …). + * Get Staked Position + * + * INFO: API key needs "Earn" permission + * + * Note: Fully redeemed position is also returned in the response + * Note: Response includes `autoReinvest` where applicable; use `modifyEarnPosition` to change it (OnChain fixed). + * List items include `availableAmount` (redeemable) and `freezeDetails` (frozen amount + reason). */ -queryCardAssetRecords( - params?: QueryCardAssetRecordsParamsV5, -): Promise> +getEarnPosition(params: GetEarnPositionParamsV5): Promise< + APIResponseV3WithTime<{ + list: EarnPositionV5[]; + }> + > { + return this.getPrivate('/v5/earn/position', params); ⋮---- /** - * Bybit Card — point balance (available, pending, account status, …). + * Modify OnChain Earn position (e.g. auto-reinvest for fixed duration products). + * + * INFO: API key needs "Earn" permission. Only `category=OnChain` and fixed positions (see product). */ -queryCardPointsBalance(): Promise> +modifyEarnPosition( + params: ModifyEarnPositionParamsV5, +): Promise>> ⋮---- /** - * Bybit Card — point transaction records. + * Get Yield History + * + * INFO: API key needs "Earn" permission + * + * Note: `category` includes `OnChain`. For `OnChain`, do not pass `productId` (error). */ -queryCardPointsRecords( - params?: QueryCardPointRecordsParamsV5, -): Promise> +getEarnYieldHistory(params: GetEarnYieldHistoryParamsV5): Promise< + APIResponseV3WithTime<{ + yield: EarnYieldHistoryV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/earn/yield', params); ⋮---- /** - * Bybit Card — reward tier, spending limit, auto cashback. + * Get Hold to Earn airdrop daily PnL records (ByFi). Up to 3 months of completed yield history. + * + * INFO: API key needs "Earn" permission */ -queryCardPointsTier(): Promise> +getHoldToEarnAirdropYieldHistory( + params: GetHoldToEarnAirdropYieldHistoryParamsV5, +): Promise> ⋮---- /** - * Bybit Card — reward mall item list. + * Get Hourly Yield History + * + * INFO: API key needs "Earn" permission */ -queryCardMallItemList( - params?: QueryCardMallItemListParamsV5, -): Promise> +getEarnHourlyYieldHistory(params: GetEarnHourlyYieldHistoryParamsV5): Promise< + APIResponseV3WithTime<{ + list: EarnHourlyYieldHistoryV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/earn/hourly-yield', params); ⋮---- /** - * Bybit Card — cashback detail for a reward order. + * Get historical APR (FlexibleSaving / OnChain), up to ~6 months. + * + * INFO: Does not need authentication */ -queryCardPointCashbackDetail( - params: QueryCardPointCashbackDetailParamsV5, -): Promise> +getEarnAprHistory( + params: GetEarnAprHistoryParamsV5, +): Promise> ⋮---- /** - * Create RFQ - * Create a new request for quote (RFQ) to specified counterparties + * Earn token — Place Order (Mint / Redeem). Accepted response is not final settlement; use `getEarnTokenOrders`. */ -createRFQ( - params: CreateRFQParamsV5, -): Promise> +submitEarnTokenOrder( + params: PlaceEarnTokenOrderParamsV5, +): Promise> ⋮---- /** - * Get RFQ Configuration - * Query the information of the quoting party that can participate in the transaction - * and your own deskCode and other configuration information + * Earn token — Get Order List */ -getRFQConfig(): Promise> +getEarnTokenOrders(params: GetEarnTokenOrderListParamsV5): Promise< + APIResponseV3WithTime<{ + list: EarnTokenOrderV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/earn/token/order', params); ⋮---- /** - * Cancel RFQ - * Cancel your inquiry - * Pass at least one rfqId or rfqLinkId + * Earn token — Get Position Info */ -cancelRFQ( - params: CancelRFQParamsV5, -): Promise> +getEarnTokenPosition( + params: GetEarnTokenPositionParamsV5, +): Promise> ⋮---- /** - * Cancel All RFQ - * Cancel all your inquiry forms + * Earn token — Get Daily Yield Records */ -cancelAllRFQ(): Promise> +getEarnTokenDailyYield(params: GetEarnTokenDailyYieldParamsV5): Promise< + APIResponseV3WithTime<{ + list: EarnTokenDailyYieldRecordV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/earn/token/yield', params); ⋮---- /** - * Create Quote - * Allow the quotation party specified in the inquiry form to quote - * Pass at least one quoteBuyList and quoteSellList + * Earn token — Get Hourly Yield Records */ -createRFQQuote( - params: CreateRFQQuoteParamsV5, -): Promise> +getEarnTokenHourlyYield(params: GetEarnTokenHourlyYieldParamsV5): Promise< + APIResponseV3WithTime<{ + list: EarnTokenHourlyYieldRecordV5[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/earn/token/hourly-yield', params); ⋮---- /** - * Execute Quote - * Execute quotes, only for the creator of the inquiry form - * Need to view the execution result through the /v5/rfq/blocktrade-list interface + * Earn token — Get History APR (7/30/180 days). No authentication required. */ -executeRFQQuote( - params: ExecuteRFQQuoteParamsV5, -): Promise> +getEarnTokenHistoryApr( + params: GetEarnTokenHistoryAprParamsV5, +): Promise> ⋮---- /** - * Cancel All Quotes - * Cancel all quotations + * Get all PWM investment plans. */ -cancelAllRFQQuotes(): Promise< - APIResponseV3WithTime<{ - data: CancelRFQQuoteItemV5[]; // Array of cancellation results - }> +getPwmInvestmentPlanList(): Promise< + APIResponseV3WithTime > { - return this.postPrivate('/v5/rfq/cancel-all-quotes'); + return this.getPrivate('/v5/earn/pwm/investment-plan/list'); ⋮---- -data: CancelRFQQuoteItemV5[]; // Array of cancellation results +/** + * Get PWM investment plan detail (Active or Closed). + */ +getPwmInvestmentPlanDetail( + params: GetPwmInvestmentPlanDetailParamsV5, +): Promise> +⋮---- +/** + * Get pending PWM investment plan detail (PendingSubscription). + */ +getPwmPendingInvestmentPlanDetail( + params: GetPwmPendingInvestmentPlanDetailParamsV5, +): Promise> ⋮---- /** - * Get Real-time RFQ Information - * Obtain the inquiry information sent or received by the user, query from rfq-engine without delay - * Pass both rfqId and rfqLinkId, rfqId shall prevail - * Sort in reverse order according to the creation time of rfq and return it + * Claim withdrawable funds from a PWM investment plan (Active). */ -getRFQRealtimeInfo( - params?: GetRFQRealtimeParamsV5, -): Promise> +claimPwmWithdrawableFunds( + params: ClaimPwmWithdrawableFundsParamsV5, +): Promise> ⋮---- /** - * Get Historical RFQ Information - * Obtain the information of the inquiry form sent or received by the user, query from the database - * Pass both rfqId and rfqLinkId, rfqId shall prevail - * Sort in reverse order according to the creation time of rfq and return it + * Get PWM investment plan asset trend (default last 7 days). */ -getRFQHistory( - params?: GetRFQListParamsV5, -): Promise> +getPwmInvestmentPlanAssetTrend( + params: GetPwmInvestmentPlanAssetTrendParamsV5, +): Promise> ⋮---- /** - * Get Real-time Quote Information - * Obtain quotation information sent or received by users, query from rfq-engine without delay - * Pass quoteId and quoteLinkId, quoteId shall prevail - * Pass both rfqId and rfqLinkId, rfqId shall prevail - * Sort in reverse order according to the creation time of the quotation - * Return all non-final quotes + * Get PWM fund historical NAV (max 180 days between startTime and endTime). */ -getRFQRealtimeQuote(params?: GetRFQQuoteRealtimeParamsV5): Promise< - APIResponseV3WithTime<{ - list: RFQQuoteItemV5[]; - }> - > { - return this.getPrivate('/v5/rfq/quote-realtime', params); +getPwmFundHistoricalNav( + params: GetPwmFundHistoricalNavParamsV5, +): Promise> ⋮---- /** - * Get Historical Quote Information - * Obtain the quotation information sent or received by the user, query from the database - * Pass quoteId and quoteLinkId, quoteId shall prevail - * Pass both rfqId and rfqLinkId, rfqId shall prevail - * Sort in reverse order according to the creation time of the quotation + * Subscribe to a PWM investment plan (PendingSubscription). */ -getRFQHistoryQuote(params?: GetRFQHistoryParamsV5): Promise< - APIResponseV3WithTime<{ - cursor: string; // Page turning mark - list: RFQQuoteItemV5[]; // Array of quote items - }> - > { - return this.getPrivate('/v5/rfq/quote-list', params); +subscribePwmInvestmentPlan( + params: SubscribePwmInvestmentPlanParamsV5, +): Promise> ⋮---- -cursor: string; // Page turning mark -list: RFQQuoteItemV5[]; // Array of quote items +/** + * Invest more into a PWM investment plan product (Active). + */ +investMorePwmInvestmentPlan( + params: InvestMorePwmInvestmentPlanParamsV5, +): Promise> ⋮---- /** - * Get Trade Information - * Obtain transaction information executed by the user + * Redeem from a PWM investment plan product. */ -getRFQTrades(params?: GetRFQTradeListParamsV5): Promise< - APIResponseV3WithTime<{ - cursor: string; // Page turning mark - list: RFQTradeV5[]; // Array of trade items - }> - > { - return this.getPrivate('/v5/rfq/trade-list', params); +redeemPwmInvestmentPlan( + params: RedeemPwmInvestmentPlanParamsV5, +): Promise> ⋮---- -cursor: string; // Page turning mark -list: RFQTradeV5[]; // Array of trade items +/** + * Get PWM investment plan orders (subscribe / redeem / auto-reinvest). + */ +getPwmInvestmentPlanOrders( + params?: GetPwmInvestmentPlanOrdersParamsV5, +): Promise> ⋮---- /** - * Get RFQ Public Transaction Data - * Get the recently executed RFQ successfullys + * Get PWM subscribable product info for customize plan. No authentication required. */ -getRFQPublicTrades(params?: GetRFQPublicTradesParamsV5): Promise< - APIResponseV3WithTime<{ - cursor: string; // Page turning mark - list: RFQPublicTradeV5[]; // Array of public trade items - }> +getPwmSubscribableProductInfo(): Promise< + APIResponseV3WithTime > { - return this.getPrivate('/v5/rfq/public-trades', params); -⋮---- -cursor: string; // Page turning mark -list: RFQPublicTradeV5[]; // Array of public trade items + return this.get('/v5/earn/pwm/customize-plan/product'); ⋮---- /** - * Accept non-LP Quote - * Accept non-LP Quote. - * - * INFO: - * - Up to 50 requests per second + * Create a customized PWM investment plan (max 20 Active + Pending plans per user). */ -acceptNonLPQuote( - params: AcceptNonLPQuoteParamsV5, -): Promise> -⋮---- -getRFQDetails(params?: GetRFQDetailsParamsV5): Promise< - APIResponseV3WithTime<{ - cursor: string; - list: RFQDetailItemV5[]; - }> - > { - return this.getPrivate('/v5/rfq/rfq-detail-list', params); +createPwmCustomizeInvestmentPlan( + params: CreatePwmCustomizeInvestmentPlanParamsV5, +): Promise> ⋮---- /** * - ****** P2P TRADING + ****** PWM — Asset Manager * */ ⋮---- /** - * - * General P2P + * Get all PWM funds managed by the institution (newest first). */ +getPwmAllFunds( + params?: GetPwmAllFundsParamsV5, +): Promise> ⋮---- /** - * Get coin balance of all account types under the master account, and sub account. - * - * Note: this field is mandatory for accountType=UNIFIED, and supports up to 10 coins each request + * Settle fund profit sharing (Active funds only). */ -getP2PAccountCoinsBalance( - params: GetP2PAccountCoinsBalanceParamsV5, -): Promise> +settlePwmFundProfit( + params: SettlePwmFundProfitParamsV5, +): Promise> ⋮---- /** - * - * Advertisement P2P + * Create a PWM fund (PendingSubscribe). Max 10 funds per institution. */ +createPwmFund( + params: CreatePwmFundParamsV5, +): Promise> ⋮---- /** - * Get market online ads list + * Create a PWM investment plan for a user (PendingSubscription). Max 10 plans per institution. */ -getP2POnlineAds( - params: GetP2POnlineAdsParamsV5, -): Promise> +createPwmAssetManagerInvestmentPlan( + params: CreatePwmAssetManagerInvestmentPlanParamsV5, + ): Promise< + APIResponseV3WithTime + > { + return this.postPrivate( + '/v5/earn/pwm/asset-manager/create-investment-plan', + params, + ); ⋮---- /** - * Post new P2P advertisement + * Get PWM investment plans created by the institution (asset manager). */ -createP2PAd( - params: CreateP2PAdParamsV5, -): Promise> +getPwmAssetManagerInvestmentPlans( + params?: GetPwmAssetManagerInvestmentPlansParamsV5, +): Promise> ⋮---- /** - * Cancel P2P advertisement + * Manage a PWM investment plan (status and/or fund allocation). */ -cancelP2PAd(params: { itemId: string }): Promise< - APIResponseV3WithTime<{ - securityRiskToken: string; - riskTokenType: string; - riskVersion: string; - needSecurityRisk: boolean; - }> +managePwmAssetManagerInvestmentPlan( + params: ManagePwmAssetManagerInvestmentPlanParamsV5, + ): Promise< + APIResponseV3WithTime > { - return this.postPrivate('/v5/p2p/item/cancel', params); + return this.postPrivate( + '/v5/earn/pwm/asset-manager/manage-investment-plan', + params, + ); ⋮---- /** - * Update or relist P2P advertisement + * Get all PWM fund orders (asset manager). Default time window: last 7 days. */ -updateP2PAd( - params: UpdateP2PAdParamsV5, -): Promise> +getPwmAllFundOrders( + params?: GetPwmAllFundOrdersParamsV5, +): Promise> ⋮---- /** - * Get personal P2P ads list - * + * Manage a PWM fund order (approve / reject Pending Review orders). */ -getP2PPersonalAds( - params: GetP2PPersonalAdsParamsV5, -): Promise> +managePwmFundOrder( + params: ManagePwmFundOrderParamsV5, +): Promise> ⋮---- /** - * Get P2P ad details + * Create a PWM fund sub-account (async; max 30 per fund, fund must be Active). */ -getP2PAdDetail(params: { - itemId: string; -}): Promise> +createPwmFundSubAccount( + params: CreatePwmFundSubAccountParamsV5, +): Promise> ⋮---- /** - * - * Orders P2P + * Transfer funds between custodian sub-accounts (fund custodian API key required). */ +pwmFundTransfer( + params: PwmFundTransferParamsV5, +): Promise> ⋮---- /** - * Get all P2P orders - * + * Query PWM fund transfer result (fund custodian API key required). */ -getP2POrders( - params: GetP2POrdersParamsV5, -): Promise> +getPwmFundTransferRecords( + params?: GetPwmFundTransferRecordsParamsV5, +): Promise> ⋮---- /** - * Get P2P order details + * + ****** Bybit Card APIs * */ -getP2POrderDetail(params: { - orderId: string; -}): Promise> ⋮---- /** - * Get pending P2P orders + * Bybit Card — query card transaction / asset history (filter by status, card digits, merchant, time, type, …). */ -getP2PPendingOrders( - params: GetP2PPendingOrdersParamsV5, -): Promise> +queryCardAssetRecords( + params?: QueryCardAssetRecordsParamsV5, +): Promise> ⋮---- /** - * Mark P2P order as paid + * Bybit Card — point balance (available, pending, account status, …). */ -markP2POrderAsPaid( - params: MarkP2POrderAsPaidParamsV5, -): Promise> +queryCardPointsBalance(): Promise> ⋮---- /** - * Release digital assets in a P2P order + * Bybit Card — point transaction records. + */ +queryCardPointsRecords( + params?: QueryCardPointRecordsParamsV5, +): Promise> +⋮---- +/** + * Bybit Card — reward tier, spending limit, auto cashback. + */ +queryCardPointsTier(): Promise> +⋮---- +/** + * Bybit Card — reward mall item list. */ -releaseP2POrder(params: { - orderId: string; -}): Promise> +queryCardMallItemList( + params?: QueryCardMallItemListParamsV5, +): Promise> ⋮---- /** - * Send chat message in a P2P order + * Bybit Card — cashback detail for a reward order. */ -sendP2POrderMessage( - params: SendP2POrderMessageParamsV5, -): Promise> +queryCardPointCashbackDetail( + params: QueryCardPointCashbackDetailParamsV5, +): Promise> ⋮---- /** * - * Chat P2P + ****** RFQ APIs + * */ ⋮---- /** - * Get P2P chat sessions with cursor pagination and read status filtering. - * @see https://bybit-exchange.github.io/docs/p2p/chat/get-chat-session-list + * Create RFQ + * Create a new request for quote (RFQ) to specified counterparties */ -getP2PChatSessions( - params: GetP2PChatSessionsParamsV5, -): Promise> +createRFQ( + params: CreateRFQParamsV5, +): Promise> ⋮---- /** - * Get the AES encrypted P2P chat session ID for a counterparty. - * @see https://bybit-exchange.github.io/docs/p2p/chat/get-session-id + * Get RFQ Configuration + * Query the information of the quoting party that can participate in the transaction + * and your own deskCode and other configuration information */ -getP2PChatSessionId( - params: GetP2PChatSessionIdParamsV5, -): Promise> ⋮---- /** - * Upload chat file for P2P order (Node.js only) - * - * Note: You must provide a Buffer. To upload from a file path, read it into a Buffer first: - * ```typescript - * import fs from 'fs'; - * const buffer = fs.readFileSync('./path/to/file.png'); - * await client.uploadP2PChatFile({ fileBuffer: buffer, fileName: 'file.png' }); - * ``` - * - * Supported file types: jpg, png, jpeg, pdf, mp4 + * Cancel RFQ + * Cancel your inquiry + * Pass at least one rfqId or rfqLinkId */ -uploadP2PChatFile(params: { - fileBuffer: Buffer; - fileName: string; // Required: the filename (used for MIME type detection) - }): Promise< - APIResponseV3WithTime<{ - url: string; - type: string; - uploadId: string | null; - }> - > { - return this.postPrivateFile('/v5/p2p/oss/upload_file', params); -⋮---- -fileName: string; // Required: the filename (used for MIME type detection) +cancelRFQ( + params: CancelRFQParamsV5, +): Promise> ⋮---- /** - * Send a message in a P2P chat session. - * For files, first call uploadP2PChatFile and use its URL as the message. - * @see https://bybit-exchange.github.io/docs/p2p/chat/send-chat-msg + * Cancel All RFQ + * Cancel all your inquiry forms */ -sendP2PChatMessage(params: SendP2PChatMessageParamsV5): Promise< +cancelAllRFQ(): Promise> ⋮---- /** - * Get P2P chat messages, ordered by creation time descending. - * @see https://bybit-exchange.github.io/docs/p2p/chat/get-message-list + * Create Quote + * Allow the quotation party specified in the inquiry form to quote + * Pass at least one quoteBuyList and quoteSellList */ -getP2PChatMessages( - params: GetP2PChatMessagesParamsV5, -): Promise> +createRFQQuote( + params: CreateRFQQuoteParamsV5, +): Promise> ⋮---- /** - * Get chat messages in a P2P order + * Execute Quote + * Execute quotes, only for the creator of the inquiry form + * Need to view the execution result through the /v5/rfq/blocktrade-list interface */ -getP2POrderMessages( - params: GetP2POrderMessagesParamsV5, -): Promise> +executeRFQQuote( + params: ExecuteRFQQuoteParamsV5, +): Promise> ⋮---- /** - * - * User P2P + * Cancel Quote + * Cancel a quotation + * Pass at least one quoteId, rfqId, and quoteLinkId */ +cancelRFQQuote( + params: CancelRFQQuoteParamsV5, +): Promise> ⋮---- /** - * Get P2P user account information + * Cancel All Quotes + * Cancel all quotations */ -getP2PUserInfo(): Promise> +cancelAllRFQQuotes(): Promise< + APIResponseV3WithTime<{ + data: CancelRFQQuoteItemV5[]; // Array of cancellation results + }> + > { + return this.postPrivate('/v5/rfq/cancel-all-quotes'); +⋮---- +data: CancelRFQQuoteItemV5[]; // Array of cancellation results ⋮---- /** - * Get counterparty user information in a P2P order + * Get Real-time RFQ Information + * Obtain the inquiry information sent or received by the user, query from rfq-engine without delay + * Pass both rfqId and rfqLinkId, rfqId shall prevail + * Sort in reverse order according to the creation time of rfq and return it */ -getP2PCounterpartyUserInfo( - params: GetP2PCounterpartyUserInfoParamsV5, -): Promise> +getRFQRealtimeInfo( + params?: GetRFQRealtimeParamsV5, +): Promise> ⋮---- /** - * Get user payment information + * Get Historical RFQ Information + * Obtain the information of the inquiry form sent or received by the user, query from the database + * Pass both rfqId and rfqLinkId, rfqId shall prevail + * Sort in reverse order according to the creation time of rfq and return it */ -getP2PUserPayments(): Promise> +getRFQHistory( + params?: GetRFQListParamsV5, +): Promise> ⋮---- /** - * - ****** API Rate Limit Management APIs - * + * Get Real-time Quote Information + * Obtain quotation information sent or received by users, query from rfq-engine without delay + * Pass quoteId and quoteLinkId, quoteId shall prevail + * Pass both rfqId and rfqLinkId, rfqId shall prevail + * Sort in reverse order according to the creation time of the quotation + * Return all non-final quotes */ +getRFQRealtimeQuote(params?: GetRFQQuoteRealtimeParamsV5): Promise< + APIResponseV3WithTime<{ + list: RFQQuoteItemV5[]; + }> + > { + return this.getPrivate('/v5/rfq/quote-realtime', params); ⋮---- /** - * Set API rate limit - * - * API rate limit: 50 req per second - * - * INFO - * - If UID requesting this endpoint is a master account, uids in the input parameter must be subaccounts of the master account. - * - If UID requesting this endpoint is not a master account, uids in the input parameter must be the UID requesting this endpoint - * - UID requesting this endpoint must be an institutional user. + * Get Historical Quote Information + * Obtain the quotation information sent or received by the user, query from the database + * Pass quoteId and quoteLinkId, quoteId shall prevail + * Pass both rfqId and rfqLinkId, rfqId shall prevail + * Sort in reverse order according to the creation time of the quotation */ -setApiRateLimit(params: { - list: { - uids: string; - bizType: string; - rate: number; - }[]; - }): Promise< +getRFQHistoryQuote(params?: GetRFQHistoryParamsV5): Promise< APIResponseV3WithTime<{ - result: { - uids: string; - bizType: string; - rate: number; - success: boolean; - msg: string; - }[]; + cursor: string; // Page turning mark + list: RFQQuoteItemV5[]; // Array of quote items }> > { - return this.postPrivate('/v5/apilimit/set', params); + return this.getPrivate('/v5/rfq/quote-list', params); +⋮---- +cursor: string; // Page turning mark +list: RFQQuoteItemV5[]; // Array of quote items ⋮---- /** - * Query API rate limit - * - * API rate limit: 50 req per second - * - * INFO - * - A master account can query api rate limit of its own and subaccounts. - * - A subaccount can only query its own api rate limit. + * Get Trade Information + * Obtain transaction information executed by the user */ -queryApiRateLimit(params: { uids: string }): Promise< +getRFQTrades(params?: GetRFQTradeListParamsV5): Promise< APIResponseV3WithTime<{ - list: { - uids: string; - bizType: string; - rate: number; - }[]; + cursor: string; // Page turning mark + list: RFQTradeV5[]; // Array of trade items }> > { - return this.getPrivate('/v5/apilimit/query', params); + return this.getPrivate('/v5/rfq/trade-list', params); +⋮---- +cursor: string; // Page turning mark +list: RFQTradeV5[]; // Array of trade items ⋮---- /** - * Get Rate Limit Cap - * Get your institution's total rate limit usage and cap, across the board. - * - * API rate limit: 50 req per second - * Main UIDs or sub UIDs can query this endpoint, but a main UID can only see the rate limits of subs below it. + * Get RFQ Public Transaction Data + * Get the recently executed RFQ successfullys */ -getRateLimitCap(): Promise< +getRFQPublicTrades(params?: GetRFQPublicTradesParamsV5): Promise< APIResponseV3WithTime<{ - list: { - bizType: string; - totalRate: number; - insCap: number; - uidCap: number; - }[]; + cursor: string; // Page turning mark + list: RFQPublicTradeV5[]; // Array of public trade items }> > { - return this.getPrivate('/v5/apilimit/query-cap'); + return this.getPrivate('/v5/rfq/public-trades', params); +⋮---- +cursor: string; // Page turning mark +list: RFQPublicTradeV5[]; // Array of public trade items ⋮---- /** - * Get All Rate Limits - * Query for all your UID-level rate limits, including all master accounts and subaccounts. + * Accept non-LP Quote + * Accept non-LP Quote. * - * API rate limit: 50 req per second + * INFO: + * - Up to 50 requests per second */ -getAllRateLimits(params?: { - limit?: string; - cursor?: string; - uids?: string; - }): Promise< +acceptNonLPQuote( + params: AcceptNonLPQuoteParamsV5, +): Promise> +⋮---- +getRFQDetails(params?: GetRFQDetailsParamsV5): Promise< APIResponseV3WithTime<{ - list: { - uids: string; - bizType: string; - rate: number; - }[]; - nextPageCursor: string; + cursor: string; + list: RFQDetailItemV5[]; }> > { - return this.getPrivate('/v5/apilimit/query-all', params); + return this.getPrivate('/v5/rfq/rfq-detail-list', params); ⋮---- /** * - ****** Spot-X (Launchpool / Puzzle / Token Splash) + ****** P2P TRADING * */ ⋮---- -getLaunchpoolProjectList( - params: GetLaunchpoolProjectListParamsV5, -): Promise> +/** + * + * General P2P + */ ⋮---- -getLaunchpoolUserActivityLog( - params?: GetLaunchpoolUserActivityLogParamsV5, -): Promise> +/** + * Get coin balance of all account types under the master account, and sub account. + * + * Note: this field is mandatory for accountType=UNIFIED, and supports up to 10 coins each request + */ +getP2PAccountCoinsBalance( + params: GetP2PAccountCoinsBalanceParamsV5, +): Promise> ⋮---- -getLaunchpoolCurrentStaking(): Promise< - APIResponseV3WithTime - > { - return this.getPrivate('/v5/spot-x/launchpool/user/current-staking'); +/** + * + * Advertisement P2P + */ ⋮---- -getLaunchpoolUserHistory( - params?: GetLaunchpoolUserHistoryParamsV5, -): Promise> +/** + * Get market online ads list + */ +getP2POnlineAds( + params: GetP2POnlineAdsParamsV5, +): Promise> ⋮---- -getPuzzleProjectList( - params: GetPuzzleProjectListParamsV5, -): Promise> +/** + * Post new P2P advertisement + */ +createP2PAd( + params: CreateP2PAdParamsV5, +): Promise> ⋮---- -getTokenSplashProjectList( - params: GetTokenSplashProjectListParamsV5, -): Promise> +/** + * Cancel P2P advertisement + */ +cancelP2PAd(params: { itemId: string }): Promise< + APIResponseV3WithTime<{ + securityRiskToken: string; + riskTokenType: string; + riskVersion: string; + needSecurityRisk: boolean; + }> + > { + return this.postPrivate('/v5/p2p/item/cancel', params); ⋮---- -getTokenSplashUserActivityParams( - params?: GetTokenSplashUserActivityParamsV5, -): Promise> +/** + * Update or relist P2P advertisement + */ +updateP2PAd( + params: UpdateP2PAdParamsV5, +): Promise> ⋮---- /** - * - ****** Event Trading (Event Contract) APIs - * - * Market data is public. Trade/position endpoints are market-maker only. - * Public WS: subscribeV5(topics, 'event'). Do not pass category "event" on REST Unified V5 methods. + * Get personal P2P ads list * */ +getP2PPersonalAds( + params: GetP2PPersonalAdsParamsV5, +): Promise> ⋮---- /** - * Get Event Contract instruments info. - * - * INFO: No authentication. + * Get P2P ad details */ -getEventInstrumentsInfo( - params?: GetEventInstrumentsInfoParamsV5, -): Promise> +getP2PAdDetail(params: { + itemId: string; +}): Promise> ⋮---- /** - * Get Event Contract 25-level orderbook. Each level is [payoutRatio, orderValue]. * - * INFO: No authentication. + * Orders P2P */ -getEventOrderbook( - params: GetEventOrderbookParamsV5, -): Promise> ⋮---- /** - * Get Event Contract order history (up to 2 years). Default query window is 7 days if start/end omitted. + * Get all P2P orders * - * INFO: Event Contract maker accounts only. */ -getEventOrderHistory( - params?: GetEventOrderHistoryParamsV5, -): Promise> +getP2POrders( + params: GetP2POrdersParamsV5, +): Promise> ⋮---- /** - * Get Event Contract active (unfilled / partially filled) orders. + * Get P2P order details * - * INFO: Event Contract maker accounts only. */ -getEventActiveOrders( - params?: GetEventActiveOrdersParamsV5, -): Promise> +getP2POrderDetail(params: { + orderId: string; +}): Promise> ⋮---- /** - * Get Event Contract position info (UpDown, Target, Range). - * - * INFO: Event Contract maker accounts only. + * Get pending P2P orders */ -getEventPositionInfo( - params?: GetEventPositionInfoParamsV5, -): Promise> +getP2PPendingOrders( + params: GetP2PPendingOrdersParamsV5, +): Promise> ⋮---- /** - * Get Event Contract trade (execution) history (up to 2 years). Default query window is 7 days if start/end omitted. - * - * INFO: Event Contract maker accounts only. + * Mark P2P order as paid */ -getEventTradeHistory( - params: GetEventTradeHistoryParamsV5, -): Promise> +markP2POrderAsPaid( + params: MarkP2POrderAsPaidParamsV5, +): Promise> ⋮---- /** - * Get Event Contract settlement records (up to 2 years). Default query window is 7 days if start/end omitted. - * - * INFO: Event Contract maker accounts only. + * Release digital assets in a P2P order */ -getEventSettlementRecords( - params: GetEventSettlementRecordsParamsV5, -): Promise> +releaseP2POrder(params: { + orderId: string; +}): Promise> ⋮---- /** - * Submit an Event Contract payout-ratio quote. - * - * INFO: Event Contract maker accounts only. + * Buyer review of a pending seller cancel request. + * Only the order buyer can call this, and only while that request is pending. + * rejectReason and rejectProofs are required when examineResult is REJECT. + * @see https://bybit-exchange.github.io/docs/p2p/order/review-seller-cancel-order-apply */ -submitEventQuote( - params: SubmitEventQuoteParamsV5, -): Promise> +reviewP2PSellerCancelOrderApply( + params: ReviewP2PSellerCancelOrderApplyParamsV5, +): Promise> ⋮---- /** - * Cancel an Event Contract quote. Pass orderLinkId and/or orderId. - * - * INFO: Event Contract maker accounts only. + * Send chat message in a P2P order */ -cancelEventQuote( - params?: CancelEventQuoteParamsV5, -): Promise> - -================ -File: src/websocket-client.ts -================ -/* eslint-disable @typescript-eslint/no-unused-vars */ +sendP2POrderMessage( + params: SendP2POrderMessageParamsV5, +): Promise> ⋮---- -import { - MessageEventLike, - WSCategoryV5, - WSClientConfigurableOptions, - WsKey, - WsMarket, - WsTopic, -} from './types'; -import { - Exact, - WSAPIOperation, - WsAPIOperationResponseMap, - WSAPIRequest, - WsAPITopicRequestParamMap, - WsAPIWsKeyTopicMap, - WsOperation, - WsRequestOperationBybit, -} from './types/websockets/ws-api'; -import { - APIID, - DefaultLogger, - getMaxTopicsPerSubscribeEvent, - getNormalisedTopicRequests, - getPromiseRefForWSAPIRequest, - getTopicsPerWSKey, - getWsKeyForTopic, - getWsUrl, - isPrivateWsTopic, - isTopicSubscriptionConfirmation, - isTopicSubscriptionSuccess, - isWSAPIResponse, - isWsPong, - neverGuard, - WS_AUTH_ON_CONNECT_KEYS, - WS_KEY_MAP, - WSConnectedResult, - WsTopicRequest, -} from './util'; -import { - BaseWebsocketClient, - EmittableEvent, - MidflightWsRequestEvent, -} from './util/BaseWSClient'; -import { SignAlgorithm, signMessage } from './util/webCryptoAPI'; +/** + * + * Chat P2P + */ ⋮---- -export interface WSAPIRequestFlags { - /** If true, will skip auth requirement for WS API connection */ - authIsOptional?: boolean | undefined; -} +/** + * Get P2P chat sessions with cursor pagination and read status filtering. + * @see https://bybit-exchange.github.io/docs/p2p/chat/get-chat-session-list + */ +getP2PChatSessions( + params: GetP2PChatSessionsParamsV5, +): Promise> ⋮---- -/** If true, will skip auth requirement for WS API connection */ +/** + * Get the AES encrypted P2P chat session ID for a counterparty. + * @see https://bybit-exchange.github.io/docs/p2p/chat/get-session-id + */ +getP2PChatSessionId( + params: GetP2PChatSessionIdParamsV5, +): Promise + > { + return this.postPrivateFile('/v5/p2p/oss/upload_file', params); ⋮---- -constructor(options?: WSClientConfigurableOptions, logger?: DefaultLogger) +fileName: string; // Required: the filename (used for MIME type detection) ⋮---- /** - * Request connection of all dependent (public & private) websockets, instead of waiting - * for automatic connection by SDK. + * Send a message in a P2P chat session. + * For files, first call uploadP2PChatFile and use its URL as the message. + * @see https://bybit-exchange.github.io/docs/p2p/chat/send-chat-msg */ -public connectAll(): Promise[] +sendP2PChatMessage(params: SendP2PChatMessageParamsV5): Promise< ⋮---- /** - * Ensures the WS API connection is active and ready. - * - * You do not need to call this, but if you call this before making any WS API requests, - * it can accelerate the first request (by preparing the connection in advance). + * Get P2P chat messages, ordered by creation time descending. + * @see https://bybit-exchange.github.io/docs/p2p/chat/get-message-list */ -public connectWSAPI(): Promise -⋮---- -/** This call automatically ensures the connection is active AND authenticated before resolving */ -⋮---- -public connectPublic(): Promise[] -⋮---- -public connectPrivate(): Promise +getP2PChatMessages( + params: GetP2PChatMessagesParamsV5, +): Promise> ⋮---- /** - * Subscribe to V5 topics & track/persist them. - * @param wsTopics - topic or list of topics - * @param category - the API category this topic is for (e.g. "linear", or "event" for Event Contract public topics). - * The value is only important when connecting to public topics and will be ignored for private topics. - * @param isPrivateTopic - optional - the library will try to detect private topics, you can use this - * to mark a topic as private (if the topic isn't recognised yet) + * Get chat messages in a P2P order */ -public subscribeV5( - wsTopics: WsTopic[] | WsTopic, - category: WSCategoryV5, - isPrivateTopic?: boolean, -): Promise[] -⋮---- -// Sort into per-WsKey batches, in case there is a mix of topics here -⋮---- -// Prevent duplicate requests to the same topic -⋮---- -// Batch sub topics per ws key -⋮---- -// Return promise to resolve midflight WS request (only works if already connected before request) +getP2POrderMessages( + params: GetP2POrderMessagesParamsV5, +): Promise> ⋮---- /** - * Unsubscribe from V5 topics & remove them from memory. They won't be re-subscribed to if the - * connection reconnects. * - * @param wsTopics - topic or list of topics - * @param category - the API category this topic is for (e.g. "linear", or "event" for Event Contract public topics). The value is only - * important when connecting to public topics and will be ignored for private topics. - * @param isPrivateTopic - optional - the library will try to detect private topics, you can - * use this to mark a topic as private (if the topic isn't recognised yet) + * User P2P */ -public unsubscribeV5( - wsTopics: WsTopic[] | WsTopic, - category: WSCategoryV5, - isPrivateTopic?: boolean, -): Promise[] ⋮---- -// Sort into per-WsKey batches, in case there is a mix of topics here +/** + * Get P2P user account information + */ +getP2PUserInfo(): Promise> ⋮---- -// Batch sub topics per ws key +/** + * Get counterparty user information in a P2P order + */ +getP2PCounterpartyUserInfo( + params: GetP2PCounterpartyUserInfoParamsV5, +): Promise> ⋮---- -// Return promise to resolve midflight WS request (only works if already connected before request) +/** + * Get user payment information + */ +getP2PUserPayments(): Promise> ⋮---- /** - * Note: subscribeV5() might be simpler to use. The end result is the same. - * - * Request subscription to one or more topics. Pass topics as either an array of strings, - * or array of objects (if the topic has parameters). - * - * Objects should be formatted as {topic: string, params: object, category: WSCategoryV5}. * - * - Subscriptions are automatically routed to the correct websocket connection. - * - Authentication/connection is automatic. - * - Resubscribe after network issues is automatic. + ****** API Rate Limit Management APIs * - * Call `unsubscribe(topics)` to remove topics */ -public subscribe( - requests: - | (WsTopicRequest | WsTopic) - | (WsTopicRequest | WsTopic)[], - requestedWsKey?: WsKey, -) -⋮---- -// Batch sub topics per ws key ⋮---- /** - * Note: unsubscribe() might be simpler to use. The end result is the same. - * Unsubscribe from one or more topics. Similar to subscribe() but in reverse. + * Set API rate limit * - * - Requests are automatically routed to the correct websocket connection. - * - These topics will be removed from the topic cache, so they won't be subscribed to again. + * API rate limit: 50 req per second + * + * INFO + * - If UID requesting this endpoint is a master account, uids in the input parameter must be subaccounts of the master account. + * - If UID requesting this endpoint is not a master account, uids in the input parameter must be the UID requesting this endpoint + * - UID requesting this endpoint must be an institutional user. */ -public unsubscribe( - requests: - | (WsTopicRequest | WsTopic) - | (WsTopicRequest | WsTopic)[], - wsKey?: WsKey, -) -⋮---- -// Batch sub topics per ws key +setApiRateLimit(params: { + list: { + uids: string; + bizType: string; + rate: number; + }[]; + }): Promise< + APIResponseV3WithTime<{ + result: { + uids: string; + bizType: string; + rate: number; + success: boolean; + msg: string; + }[]; + }> + > { + return this.postPrivate('/v5/apilimit/set', params); ⋮---- /** + * Query API rate limit * + * API rate limit: 50 req per second * - * - * WS API Methods - similar to the REST API, but via WebSockets - * https://bybit-exchange.github.io/docs/v5/websocket/trade/guideline - * - * - * + * INFO + * - A master account can query api rate limit of its own and subaccounts. + * - A subaccount can only query its own api rate limit. */ +queryApiRateLimit(params: { uids: string }): Promise< + APIResponseV3WithTime<{ + list: { + uids: string; + bizType: string; + rate: number; + }[]; + }> + > { + return this.getPrivate('/v5/apilimit/query', params); ⋮---- /** - * Send a Websocket API command/request on a connection. Returns a promise that resolves on reply. - * - * WS API Documentation for list of operations and parameters: - * https://bybit-exchange.github.io/docs/v5/websocket/trade/guideline - * - * Returned promise is rejected if: - * - an exception is detected in the reply, OR - * - the connection disconnects for any reason (even if automatic reconnect will happen). - * - * Authentication is automatic. If you didn't request authentication yourself, there might - * be a small delay after your first request, while the SDK automatically authenticates. + * Get Rate Limit Cap + * Get your institution's total rate limit usage and cap, across the board. * - * @param wsKey - The connection this event is for. Currently only "v5PrivateTrade" is supported - * for Bybit, since that is the dedicated WS API connection. - * @param operation - The command being sent, e.g. "order.create" to submit a new order. - * @param params - Any request parameters for the command. E.g. `OrderParamsV5` to submit a new - * order. Only send parameters for the request body. Everything else is automatically handled. - * @returns Promise - tries to resolve with async WS API response. Rejects if disconnected or exception is seen in async WS API response + * API rate limit: 50 req per second + * Main UIDs or sub UIDs can query this endpoint, but a main UID can only see the rate limits of subs below it. */ +getRateLimitCap(): Promise< + APIResponseV3WithTime<{ + list: { + bizType: string; + totalRate: number; + insCap: number; + uidCap: number; + }[]; + }> + > { + return this.getPrivate('/v5/apilimit/query-cap'); ⋮---- -// This overload allows the caller to omit the 3rd param, if it isn't required -sendWSAPIRequest< - TWSKey extends keyof WsAPIWsKeyTopicMap, - TWSOperation extends WsAPIWsKeyTopicMap[TWSKey], - TWSParams extends Exact, - >( - wsKey: TWSKey, - operation: TWSOperation, - params?: TWSParams extends void | never ? undefined : TWSParams, - requestFlags?: WSAPIRequestFlags, - ): Promise; -⋮---- -// These overloads give stricter types than mapped generics, since generic constraints -// do not trigger excess property checks -// Without these overloads, TypeScript won't complain if you include an -// unexpected property with your request (if it doesn't clash with an existing property) -sendWSAPIRequest( - wsKey: typeof WS_KEY_MAP.v5PrivateTrade, - operation: TWSOperation, - params: WsAPITopicRequestParamMap[TWSOperation], - requestFlags?: WSAPIRequestFlags, - ): Promise; -⋮---- -sendWSAPIRequest( - wsKey: typeof WS_KEY_MAP.v5PrivateTrade, - operation: TWSOperation, - params: WsAPITopicRequestParamMap[TWSOperation], - requestFlags?: WSAPIRequestFlags, - ): Promise; -⋮---- -sendWSAPIRequest( - wsKey: typeof WS_KEY_MAP.v5PrivateTrade, - operation: TWSOperation, - params: WsAPITopicRequestParamMap[TWSOperation], - requestFlags?: WSAPIRequestFlags, - ): Promise; -⋮---- -async sendWSAPIRequest< - TWSKey extends keyof WsAPIWsKeyTopicMap, - TWSOperation extends WsAPIWsKeyTopicMap[TWSKey], - TWSParams extends Exact, - TWSAPIResponse extends - WsAPIOperationResponseMap[TWSOperation] = WsAPIOperationResponseMap[TWSOperation], - >( - wsKey: WsKey = WS_KEY_MAP.v5PrivateTrade, - operation: TWSOperation, - params: TWSParams, - requestFlags?: WSAPIRequestFlags, -): Promise +/** + * Get All Rate Limits + * Query for all your UID-level rate limits, including all master accounts and subaccounts. + * + * API rate limit: 50 req per second + */ +getAllRateLimits(params?: { + limit?: string; + cursor?: string; + uids?: string; + }): Promise< + APIResponseV3WithTime<{ + list: { + uids: string; + bizType: string; + rate: number; + }[]; + nextPageCursor: string; + }> + > { + return this.getPrivate('/v5/apilimit/query-all', params); ⋮---- -// Some commands don't require authentication. +/** + * + ****** Spot-X (Launchpool / Puzzle / Token Splash) + * + */ ⋮---- -// Sign, if needed +getLaunchpoolProjectList( + params: GetLaunchpoolProjectListParamsV5, +): Promise> ⋮---- -// Store deferred promise, resolved within the "resolveEmittableEvents" method while parsing incoming events +getLaunchpoolUserActivityLog( + params?: GetLaunchpoolUserActivityLogParamsV5, +): Promise> ⋮---- -// eslint-disable-next-line @typescript-eslint/no-explicit-any +getLaunchpoolCurrentStaking(): Promise< + APIResponseV3WithTime + > { + return this.getPrivate('/v5/spot-x/launchpool/user/current-staking'); ⋮---- -// Enrich returned promise with request context for easier debugging +getLaunchpoolUserHistory( + params?: GetLaunchpoolUserHistoryParamsV5, +): Promise> ⋮---- -// throw e; +getPuzzleProjectList( + params: GetPuzzleProjectListParamsV5, +): Promise> ⋮---- -// Send event +getTokenSplashProjectList( + params: GetTokenSplashProjectListParamsV5, +): Promise> ⋮---- -// Return deferred promise, so caller can await this call +getTokenSplashUserActivityParams( + params?: GetTokenSplashUserActivityParamsV5, +): Promise> ⋮---- /** * + ****** Event Trading (Event Contract) APIs * - * Internal methods - not intended for public use - * + * Market data is public. Trade/position endpoints are market-maker only. + * Public WS: subscribeV5(topics, 'event'). Do not pass category "event" on REST Unified V5 methods. * */ ⋮---- /** - * Note: implementing this method will wipe the WsStore state for this WsKey, once this method returns + * Get Event Contract instruments info. + * + * INFO: No authentication. */ -protected isCustomReconnectionNeeded(): boolean -⋮---- -protected async triggerCustomReconnectionWorkflow(): Promise +getEventInstrumentsInfo( + params?: GetEventInstrumentsInfoParamsV5, +): Promise> ⋮---- /** - * @returns The WS URL to connect to for this WS key + * Get Event Contract 25-level orderbook. Each level is [payoutRatio, orderValue]. + * + * INFO: No authentication. */ -protected async getWsUrl(wsKey: WsKey): Promise -⋮---- -// If auth is needed for this wsKey URL, this returns a suffix +getEventOrderbook( + params: GetEventOrderbookParamsV5, +): Promise> ⋮---- /** - * Return params required to make authorized request + * Get Event Contract order history (up to 2 years). Default query window is 7 days if start/end omitted. + * + * INFO: Event Contract maker accounts only. */ -private async getWsAuthURLSuffix(): Promise -⋮---- -private async signMessage( - paramsStr: string, - secret: string, - method?: 'hex' | 'base64', - algorithm: SignAlgorithm = 'SHA-256', -): Promise -⋮---- -protected async getWsAuthRequestEvent( - wsKey: WsKey, -): Promise> -⋮---- -private async getWsAuthSignature( - wsKey: WsKey, -): Promise< -⋮---- -undefined, // Let the function automatically determine encoding based on key type -⋮---- -private async signWSAPIRequest( - requestEvent: WSAPIRequest, -): Promise> -⋮---- -// Not needed for Bybit. Auth happens only on connection open, automatically. -⋮---- -protected sendPingEvent(wsKey: WsKey) -⋮---- -protected sendPongEvent(wsKey: WsKey) -⋮---- -/** Force subscription requests to be sent in smaller batches, if a number is returned */ -protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null -⋮---- -protected authPrivateConnectionsOnConnect(_wsKey: WsKey): boolean +getEventOrderHistory( + params?: GetEventOrderHistoryParamsV5, +): Promise> ⋮---- /** - * @returns one or more correctly structured request events for performing a operations over WS. This can vary per exchange spec. + * Get Event Contract active (unfilled / partially filled) orders. + * + * INFO: Event Contract maker accounts only. */ -protected async getWsRequestEvents( - market: WsMarket, - operation: WsOperation, - requests: WsTopicRequest[], - // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars - _wsKey: WsKey, -): Promise>[]> -⋮---- -// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars -⋮---- -// Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values -⋮---- -protected getPrivateWSKeys(): WsKey[] -⋮---- -protected isAuthOnConnectWsKey(wsKey: WsKey): boolean +getEventActiveOrders( + params?: GetEventActiveOrdersParamsV5, +): Promise> ⋮---- /** - * Determines if a topic is for a private channel, using a hardcoded list of strings + * Get Event Contract position info (UpDown, Target, Range). + * + * INFO: Event Contract maker accounts only. */ -protected isPrivateTopicRequest(request: WsTopicRequest): boolean -⋮---- -// eslint-disable-next-line @typescript-eslint/no-explicit-any -protected isWsPing(msg: any): boolean -⋮---- -// eslint-disable-next-line @typescript-eslint/no-explicit-any -protected isWsPong(msg: any): boolean -⋮---- -// public ws connections -⋮---- -// private ws connections +getEventPositionInfo( + params?: GetEventPositionInfoParamsV5, +): Promise> ⋮---- /** - * Abstraction called to sort ws events into emittable event types (response to a request, data update, etc) + * Get Event Contract trade (execution) history (up to 2 years). Default query window is 7 days if start/end omitted. + * + * INFO: Event Contract maker accounts only. */ -protected resolveEmittableEvents( - wsKey: WsKey, - event: MessageEventLike, -): EmittableEvent[] -⋮---- -// this.logger.trace('resolveEmittableEvents', { -// ...WS_LOGGER_CATEGORY, -// wsKey, -// parsed: JSON.stringify(parsed), -// }); -⋮---- -// Only applies to the V5 WS topics -⋮---- -// WS API response -⋮---- -// eslint-disable-next-line max-len -⋮---- -// WS API Exception -⋮---- -// WS API Success -⋮---- -// Messages for a subscribed topic all include the "topic" property -⋮---- -// Messages that are a "reply" to a request/command (e.g. subscribe to these topics) typically include the "op" property -⋮---- -// Failed request +getEventTradeHistory( + params: GetEventTradeHistoryParamsV5, +): Promise> ⋮---- -// These are r equest/reply pattern events (e.g. after subscribing to topics or authenticating) +/** + * Get Event Contract settlement records (up to 2 years). Default query window is 7 days if start/end omitted. + * + * INFO: Event Contract maker accounts only. + */ +getEventSettlementRecords( + params: GetEventSettlementRecordsParamsV5, +): Promise> ⋮---- -// Request/reply pattern for authentication success +/** + * Submit an Event Contract payout-ratio quote. + * + * INFO: Event Contract maker accounts only. + */ +submitEventQuote( + params: SubmitEventQuoteParamsV5, +): Promise> ⋮---- -// In case of catastrophic failure, fallback to noisy emit update +/** + * Cancel an Event Contract quote. Pass orderLinkId and/or orderId. + * + * INFO: Event Contract maker accounts only. + */ +cancelEventQuote( + params?: CancelEventQuoteParamsV5, +): Promise> ================ File: docs/BYBIT_SDK_QUICKSTART_GUIDE.md @@ -21420,11 +21468,14 @@ siebly: summary: Browse SDK source, releases, issues, and endpoint coverage from GitHub. href: https://github.com/sieblyio/bybit-api --> + # Bybit API JavaScript Tutorial for Node.js and TypeScript + > [!TIP] > This guide can be read in tutorial format on the Siebly Website: [Bybit JavaScript REST API & WebSocket Tutorial](https://siebly.io/sdk/bybit/javascript/tutorial) + This tutorial walks through a practical Bybit REST API, WebSocket stream, and WebSocket API integration using [`bybit-api`](https://www.npmjs.com/package/bybit-api), the Bybit JavaScript and TypeScript SDK by Siebly.io. It also covers HTTP, HTTPS, and SOCKS proxy configuration for REST API calls, streams, and WebSocket API connections. @@ -21445,6 +21496,7 @@ The SDK handles the repetitive parts: HMAC and RSA request signing, Bybit API en --- + ## Why use the SDK The Bybit API is unified, but a real integration still has several moving parts: @@ -21471,6 +21523,7 @@ The method names stay close to Bybit's endpoint names, while the SDK handles bas --- + ## Install and API keys If you do not have Node.js installed yet, install it first. The SDK is published to both [GitHub](https://github.com/sieblyio/bybit-api) and [npm](https://www.npmjs.com/package/bybit-api). @@ -21540,6 +21593,7 @@ For RSA setup details, see [examples/Auth/RSA-sign.md](../examples/Auth/RSA-sign --- + ## Products and clients For new Bybit integrations, start with the current API. Older Bybit SDK surfaces were split into many product-specific clients; this SDK now centers the current API around one REST API client plus WebSocket clients. @@ -21570,6 +21624,7 @@ As a rule of thumb: For a complete method map, see [docs/endpointFunctionList.md](./endpointFunctionList.md). + ### REST API, streams, and WebSocket API Bybit exposes several different integration flows. Keep them separate in your architecture: @@ -21586,6 +21641,7 @@ Use the REST API when you want maximum endpoint coverage or a simple one-off req --- + ## Start building: first calls If you only want the fastest path to a working integration, start here. @@ -21593,6 +21649,7 @@ If you only want the fastest path to a working integration, start here. ### 1. First public REST API request + ```typescript import { RestClientV5 } from 'bybit-api'; @@ -21639,6 +21696,7 @@ See also: [public REST API example](../examples/Rest/rest-v5-public.ts) ### 2. First public WebSocket stream + ```typescript import { WebsocketClient, isWsOrderbookEventV5 } from 'bybit-api'; @@ -21658,7 +21716,10 @@ ws.on('reconnect', (data) => console.log('reconnecting', data.wsKey)); ws.on('reconnected', (data) => console.log('reconnected', data.wsKey)); ws.on('exception', console.error); -ws.subscribeV5(['orderbook.50.BTCUSDT', 'tickers.BTCUSDT', 'publicTrade.BTCUSDT'], 'linear'); +ws.subscribeV5( + ['orderbook.50.BTCUSDT', 'tickers.BTCUSDT', 'publicTrade.BTCUSDT'], + 'linear', +); ``` For public streams, pass the category so the SDK can route the topic to the right public endpoint. @@ -21668,6 +21729,7 @@ See also: [public WebSocket example](../examples/Websocket/Public/ws-public-v5.t ### 3. First private account WebSocket stream + ```typescript import { WebsocketClient } from 'bybit-api'; @@ -21707,6 +21769,7 @@ See also: [private WebSocket example](../examples/Websocket/Private/ws-private-v Use demo trading before placing live orders. Demo trading uses a separate Bybit demo account and separate API keys. + ```typescript import { RestClientV5 } from 'bybit-api'; @@ -21749,6 +21812,7 @@ See also: [Demo trading example](../examples/Rest/demo-trading.ts) The WebSocket API lets you submit order commands over a persistent WebSocket connection and await responses. Bybit supports WebSocket API order commands in live and testnet environments, but not demo trading. + ```typescript import { WebsocketAPIClient } from 'bybit-api'; @@ -21799,6 +21863,7 @@ See also: [WebSocket API client example](../examples/Websocket/WS-API/ws-api-cli --- + ## REST API Most Bybit integrations start with `RestClientV5`. It covers the current REST API surface and uses Bybit's `category` parameter to distinguish product groups where the endpoint requires it. @@ -22095,7 +22160,10 @@ const coinBalance = await client.getCoinBalance({ coin: 'USDT', }); -const transferableCoins = await client.getTransferableCoinList('UNIFIED', 'FUND'); +const transferableCoins = await client.getTransferableCoinList( + 'UNIFIED', + 'FUND', +); const deposits = await client.getDepositRecords({ coin: 'USDT', @@ -22129,6 +22197,7 @@ If an endpoint exists in Bybit's API docs, search for the endpoint path or metho --- + ## WebSocket Streams Use `WebsocketClient` when you want event-driven updates instead of REST API polling. The same client handles public streams, private account streams, and raw WebSocket API commands. @@ -22176,7 +22245,12 @@ ws.on('update', (data) => console.log('public update', JSON.stringify(data))); ws.on('exception', console.error); ws.subscribeV5( - ['orderbook.50.BTCUSDT', 'publicTrade.BTCUSDT', 'tickers.BTCUSDT', 'kline.5.BTCUSDT'], + [ + 'orderbook.50.BTCUSDT', + 'publicTrade.BTCUSDT', + 'tickers.BTCUSDT', + 'kline.5.BTCUSDT', + ], 'linear', ); ``` @@ -22218,7 +22292,10 @@ ws.on('authenticated', (data) => console.log('authenticated', data.wsKey)); ws.on('update', (data) => console.log('private update', JSON.stringify(data))); ws.on('exception', console.error); -ws.subscribeV5(['order', 'execution', 'position', 'wallet', 'greeks'], 'linear'); +ws.subscribeV5( + ['order', 'execution', 'position', 'wallet', 'greeks'], + 'linear', +); ``` Private topics currently share the private endpoint. The category parameter is ignored for private routing, but passing the category keeps your code consistent with `subscribeV5(...)`. @@ -22251,6 +22328,7 @@ Do not subscribe to the same topic in multiple clients unless you intentionally --- + ## WebSocket API Bybit's WebSocket API is a request/response API over a persistent WebSocket connection. In this SDK, you can use it in two ways: @@ -22330,15 +22408,19 @@ const ws = new WebsocketClient({ testnet: true, }); -const result = await ws.sendWSAPIRequest(WS_KEY_MAP.v5PrivateTrade, 'order.create', { - category: 'linear', - symbol: 'BTCUSDT', - side: 'Buy', - orderType: 'Limit', - qty: '0.001', - price: '10000', - timeInForce: 'PostOnly', -}); +const result = await ws.sendWSAPIRequest( + WS_KEY_MAP.v5PrivateTrade, + 'order.create', + { + category: 'linear', + symbol: 'BTCUSDT', + side: 'Buy', + orderType: 'Limit', + qty: '0.001', + price: '10000', + timeInForce: 'PostOnly', + }, +); console.log(result); ``` @@ -22355,6 +22437,7 @@ See also: --- + ## Environments and regions ### Live @@ -22420,11 +22503,11 @@ Do not combine `testnet: true` with `demoTrading: true`. Bybit's demo trading do Bybit uses two regional API access models. Use the configuration that matches the site where your account is registered: -| Account setup | REST API endpoint | WebSocket endpoint | SDK configuration | -| --- | --- | --- | --- | -| Account with a dedicated regional domain | Matching regional API domain | Regional mainnet stream when Bybit lists one, otherwise the global stream | Set `apiRegion` | -| Brazil international account | `api.bybit.com` | `stream.bybit.com` | Set `siteId: 'BRA_BTL'` | -| Argentina international account | `api.bybit.com` | `stream.bybit.com` | Set `siteId: 'ARG_BTL'` | +| Account setup | REST API endpoint | WebSocket endpoint | SDK configuration | +| ---------------------------------------- | ---------------------------- | ------------------------------------------------------------------------- | ----------------------- | +| Account with a dedicated regional domain | Matching regional API domain | Regional mainnet stream when Bybit lists one, otherwise the global stream | Set `apiRegion` | +| Brazil international account | `api.bybit.com` | `stream.bybit.com` | Set `siteId: 'BRA_BTL'` | +| Argentina international account | `api.bybit.com` | `stream.bybit.com` | Set `siteId: 'ARG_BTL'` | `apiRegion` selects the regional REST API domain and, where Bybit lists one, the regional mainnet WebSocket domain. `siteId` keeps the default global domains and adds the `x-site-id` header to REST API requests and Node.js WebSocket handshakes. Only set `siteId` when Bybit documents it for your account. Do not derive or invent a value. @@ -22506,6 +22589,7 @@ See also: [custom REST API URL example](../examples/Rest/rest-v5-custom-url.ts) --- + ## Proxies for REST API and WebSocket Use a proxy when a deployment needs a fixed egress IP, must cross an approved corporate network, or has a controlled network failover path. A proxy does not change Bybit account eligibility, product categories, account mode, or the selected live, testnet, or demo environment. @@ -22607,7 +22691,9 @@ const key = process.env.BYBIT_API_KEY; const secret = process.env.BYBIT_API_SECRET; if (!key || !secret) { - throw new Error('Set BYBIT_API_KEY and BYBIT_API_SECRET before running this example.'); + throw new Error( + 'Set BYBIT_API_KEY and BYBIT_API_SECRET before running this example.', + ); } const proxyAgent = new HttpsProxyAgent(proxyUrl); @@ -22726,6 +22812,7 @@ See also: --- + ## Production notes Before a Bybit integration trades unattended, make these decisions explicit. @@ -22753,22 +22840,23 @@ When the SDK emits `reconnect`, pause risky actions if your strategy depends on ws.on('reconnected', async ({ wsKey }) => { console.log('reconnected', wsKey); - const [wallet, positions, regularOpenOrders, stopOpenOrders] = await Promise.all([ - client.getWalletBalance({ accountType: 'UNIFIED' }), - client.getPositionInfo({ category: 'linear', settleCoin: 'USDT' }), - client.getActiveOrders({ - category: 'linear', - settleCoin: 'USDT', - openOnly: 0, - orderFilter: 'Order', - }), - client.getActiveOrders({ - category: 'linear', - settleCoin: 'USDT', - openOnly: 0, - orderFilter: 'StopOrder', - }), - ]); + const [wallet, positions, regularOpenOrders, stopOpenOrders] = + await Promise.all([ + client.getWalletBalance({ accountType: 'UNIFIED' }), + client.getPositionInfo({ category: 'linear', settleCoin: 'USDT' }), + client.getActiveOrders({ + category: 'linear', + settleCoin: 'USDT', + openOnly: 0, + orderFilter: 'Order', + }), + client.getActiveOrders({ + category: 'linear', + settleCoin: 'USDT', + openOnly: 0, + orderFilter: 'StopOrder', + }), + ]); const openOrders = [ ...(regularOpenOrders.result?.list ?? []), @@ -22924,6 +23012,7 @@ For raw HTTP request/response tracing during local debugging, the repo also supp --- + ## FAQ **Do I need API keys for public market data?** @@ -22970,6 +23059,7 @@ No. This guide covers the common first steps and production concerns. For full m --- + ## Next steps If you want to learn more about integrating with the Bybit API and WebSockets: @@ -23793,7 +23883,7 @@ File: package.json ================ { "name": "bybit-api", - "version": "4.7.10", + "version": "4.8.1", "description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/package-lock.json b/package-lock.json index 9a8556de..1533e27f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bybit-api", - "version": "4.8.1", + "version": "4.8.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bybit-api", - "version": "4.8.1", + "version": "4.8.2", "license": "MIT", "dependencies": { "@types/ws": "8.18.1", diff --git a/package.json b/package.json index 3fb8b900..cb81f65d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bybit-api", - "version": "4.8.1", + "version": "4.8.2", "description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/rest-client-v5.ts b/src/rest-client-v5.ts index 1470cf74..7db355e5 100644 --- a/src/rest-client-v5.ts +++ b/src/rest-client-v5.ts @@ -547,6 +547,7 @@ import { RepaymentHistoryFlexibleV5, RepaymentHistoryV5, RequestConvertQuoteParamsV5, + ReviewP2PSellerCancelOrderApplyParamsV5, RFQConfigV5, RFQDetailItemV5, RFQHistory, @@ -5834,6 +5835,21 @@ export class RestClientV5 extends BaseRestClient { return this.postPrivate('/v5/p2p/order/finish', params); } + /** + * Buyer review of a pending seller cancel request. + * Only the order buyer can call this, and only while that request is pending. + * rejectReason and rejectProofs are required when examineResult is REJECT. + * @see https://bybit-exchange.github.io/docs/p2p/order/review-seller-cancel-order-apply + */ + reviewP2PSellerCancelOrderApply( + params: ReviewP2PSellerCancelOrderApplyParamsV5, + ): Promise> { + return this.postPrivate( + '/v5/p2p/order/buyer/examine/sellerCancelOrderApply', + params, + ); + } + /** * Send chat message in a P2P order */ diff --git a/src/types/request/v5-p2p-trading.ts b/src/types/request/v5-p2p-trading.ts index 9c387d4e..1074820a 100644 --- a/src/types/request/v5-p2p-trading.ts +++ b/src/types/request/v5-p2p-trading.ts @@ -99,6 +99,23 @@ export interface MarkP2POrderAsPaidParamsV5 { paymentId: string; } +export type P2PSellerCancelExamineResultV5 = 'PASS' | 'REJECT'; + +export type P2PSellerCancelRejectReasonV5 = + | 'buyerRefuseOrderCancelReason_haveMadePayment' + | 'buyerRefuseOrderCancelReason_haveNotReceivedFullRefund' + | 'buyerRefuseOrderCancelReason_others'; + +export interface ReviewP2PSellerCancelOrderApplyParamsV5 { + orderId: string; + examineResult: P2PSellerCancelExamineResultV5; + /** Required when examineResult is REJECT. */ + rejectReason?: P2PSellerCancelRejectReasonV5; + /** Comma-separated proof URLs. Required when examineResult is REJECT. */ + rejectProofs?: string; + rejectRemark?: string; +} + export interface SendP2POrderMessageParamsV5 { message: string; contentType: string; diff --git a/src/types/response/v5-p2p-trading.ts b/src/types/response/v5-p2p-trading.ts index c6488a0b..f42f1369 100644 --- a/src/types/response/v5-p2p-trading.ts +++ b/src/types/response/v5-p2p-trading.ts @@ -176,6 +176,8 @@ export interface P2PAdDetailV5 { status: number; createDate: string; payments: string[]; + /** Personal ads list only. Empty string means the ad is not hidden. */ + hiddenReason?: string; orderNum: number; finishNum: number; recentOrderNum: number; @@ -262,6 +264,8 @@ export interface P2POrderV5 { fee: string; targetNickName: string; targetUserId: string; + /** Pending orders. Pass this to getP2PChatSessionId as userMaskId. */ + targetUserMaskId?: string; status: number; selfUnreadMsgCount: string; createDate: string; @@ -364,6 +368,8 @@ export interface P2POrderDetailV5 { targetAccountId: string; targetUserId: string; targetNickName: string; + /** Counterparty mask ID. Pass this to getP2PChatSessionId as userMaskId. */ + targetUserMaskId: string; targetFirstName: string; targetSecondName: string; targetUserAuthStatus: number; @@ -441,6 +447,8 @@ export interface P2POrderDetailV5 { cancelReason: string; sellerCancelExamineRemainTime: string; needSellerExamineCancel: boolean; + /** True when the buyer must review a pending seller cancel request. */ + needBuyerExamineCancel: boolean; couponCurrencyAmount: string; totalCurrencyAmount: string; usedCoupon: boolean;