From ce71d74559839215bef7be00624e66a7272dc3dd Mon Sep 17 00:00:00 2001 From: JJ-Cro Date: Tue, 11 Aug 2026 12:51:18 +0200 Subject: [PATCH 1/2] feat(v3.2.2): add Stock+, eligible margin, copy followers, and rate-limit quota APIs Sync Bitget UTA/Classic changelog gaps since July 2026: Stock+ market/trade/asset endpoints, eligible symbols/tiers/loan info, copy-trading follower and profit APIs, institutional rate-limit quotas, plus related response/WS field updates. Co-authored-by: Cursor --- docs/endpointFunctionList.md | 976 +- .../Account/get-eligible-loan-info.js | 18 + .../Account/get-eligible-margin-tier.js | 18 + .../Account/get-eligible-symbols.js | 18 + .../Copy-Trading/copy-trading-transfer.js | 1 + .../Copy-Trading/get-current-followers.js | 18 + .../Copy-Trading/get-history-followers.js | 18 + .../Copy-Trading/get-profit-details.js | 18 + .../Copy-Trading/get-profit-summary.js | 18 + .../RestClientV3/Stock+/Asset/get-account.js | 18 + .../Stock+/Asset/get-cash-flow.js | 21 + .../Stock+/Asset/get-stock-position.js | 20 + .../Stock+/Asset/get-transfer-records.js | 18 + .../RestClientV3/Stock+/Asset/transfer.js | 22 + .../Market/Options/get-option-chain-info.js | 21 + .../Market/Options/get-option-expiry-date.js | 20 + .../Stock+/Market/Options/get-option-quote.js | 20 + .../Market/Options/get-option-volume.js | 20 + .../Market/equity-etf/get-candlestick.js | 23 + .../Stock+/Market/equity-etf/get-depth.js | 20 + .../equity-etf/get-history-candlestick.js | 23 + .../Stock+/Market/equity-etf/get-intraday.js | 20 + .../Stock+/Market/equity-etf/get-quote.js | 20 + .../Market/equity-etf/get-static-info.js | 20 + .../Market/equity-etf/get-trade-detail.js | 21 + .../RestClientV3/Stock+/Trade/cancel-order.js | 21 + .../Stock+/Trade/get-history-executions.js | 20 + .../Stock+/Trade/get-history-orders.js | 20 + .../Stock+/Trade/get-order-detail.js | 20 + .../Stock+/Trade/get-today-executions.js | 20 + .../Stock+/Trade/get-today-orders.js | 20 + .../RestClientV3/Stock+/Trade/modify-order.js | 22 + .../RestClientV3/Stock+/Trade/place-order.js | 26 + .../Sub-Account/get-ratelimit-quota.js | 20 + .../Sub-Account/set-ratelimit-quota.js | 22 + .../Trade/cancel-reality-order.js | 1 + .../RestClientV3/Trade/place-reality-order.js | 1 + llms.txt | 21859 +++++++++------- package-lock.json | 4 +- package.json | 2 +- src/index.ts | 2 + src/rest-client-v3.ts | 283 + src/types/request/v3/account.ts | 25 + src/types/request/v3/copytrading.ts | 14 + src/types/request/v3/stockplus.ts | 165 + src/types/request/v3/trade.ts | 2 + src/types/response/v2/futures.ts | 4 + src/types/response/v3/account.ts | 59 + src/types/response/v3/copytrading.ts | 59 +- src/types/response/v3/public.ts | 5 + src/types/response/v3/stockplus.ts | 346 + src/types/response/v3/trade.ts | 4 + src/types/websockets/ws-api-request.ts | 2 + src/types/websockets/ws-api.ts | 12 + src/types/websockets/ws-events.ts | 8 + src/types/websockets/ws-general.ts | 3 +- src/util/websocket-util.ts | 1 + 57 files changed, 14532 insertions(+), 9970 deletions(-) create mode 100644 examples/apidoc/RestClientV3/Account/get-eligible-loan-info.js create mode 100644 examples/apidoc/RestClientV3/Account/get-eligible-margin-tier.js create mode 100644 examples/apidoc/RestClientV3/Account/get-eligible-symbols.js create mode 100644 examples/apidoc/RestClientV3/Copy-Trading/get-current-followers.js create mode 100644 examples/apidoc/RestClientV3/Copy-Trading/get-history-followers.js create mode 100644 examples/apidoc/RestClientV3/Copy-Trading/get-profit-details.js create mode 100644 examples/apidoc/RestClientV3/Copy-Trading/get-profit-summary.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Asset/get-account.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Asset/get-cash-flow.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Asset/get-stock-position.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Asset/get-transfer-records.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Asset/transfer.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-chain-info.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-expiry-date.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-quote.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-volume.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-candlestick.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-depth.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-history-candlestick.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-intraday.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-quote.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-static-info.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-trade-detail.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Trade/cancel-order.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Trade/get-history-executions.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Trade/get-history-orders.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Trade/get-order-detail.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Trade/get-today-executions.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Trade/get-today-orders.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Trade/modify-order.js create mode 100644 examples/apidoc/RestClientV3/Stock+/Trade/place-order.js create mode 100644 examples/apidoc/RestClientV3/Sub-Account/get-ratelimit-quota.js create mode 100644 examples/apidoc/RestClientV3/Sub-Account/set-ratelimit-quota.js create mode 100644 src/types/request/v3/stockplus.ts create mode 100644 src/types/response/v3/stockplus.ts diff --git a/docs/endpointFunctionList.md b/docs/endpointFunctionList.md index 2505cb1..583092e 100644 --- a/docs/endpointFunctionList.md +++ b/docs/endpointFunctionList.md @@ -50,297 +50,310 @@ This table includes all endpoints from the official Exchange API docs and corres | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | -| [getAnnouncements()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L482) | | GET | `/api/v2/public/annoucements` | -| [getServerTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L494) | | GET | `/api/v2/public/time` | -| [getTradeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L502) | :closed_lock_with_key: | GET | `/api/v2/common/trade-rate` | -| [getSpotTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L517) | :closed_lock_with_key: | GET | `/api/v2/tax/spot-record` | -| [getFuturesTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L523) | :closed_lock_with_key: | GET | `/api/v2/tax/future-record` | -| [getMarginTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L529) | :closed_lock_with_key: | GET | `/api/v2/tax/margin-record` | -| [getP2PTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L535) | :closed_lock_with_key: | GET | `/api/v2/tax/p2p-record` | -| [getP2PMerchantList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L547) | :closed_lock_with_key: | GET | `/api/v2/p2p/merchantList` | -| [getP2PMerchantInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L556) | :closed_lock_with_key: | GET | `/api/v2/p2p/merchantInfo` | -| [getP2PMerchantOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L560) | :closed_lock_with_key: | GET | `/api/v2/p2p/orderList` | -| [getP2PMerchantAdvertisementList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L569) | :closed_lock_with_key: | GET | `/api/v2/p2p/advList` | -| [getSpotWhaleNetFlowData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L586) | :closed_lock_with_key: | GET | `/api/v2/spot/market/whale-net-flow` | -| [getFuturesActiveTakerBuySellVolumeData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L592) | | GET | `/api/v2/mix/market/taker-buy-sell` | -| [getFuturesActiveLongShortPositionData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L599) | | GET | `/api/v2/mix/market/position-long-short` | -| [getFuturesLongShortRatio()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L606) | | GET | `/api/v2/mix/market/long-short-ratio` | -| [getMarginLoanGrowthRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L614) | | GET | `/api/v2/mix/market/loan-growth` | -| [getIsolatedMarginBorrowingRatio()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L622) | | GET | `/api/v2/mix/market/isolated-borrow-rate` | -| [getFuturesActiveBuySellVolumeData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L629) | | GET | `/api/v2/mix/market/long-short` | -| [getSpotFundFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L636) | | GET | `/api/v2/spot/market/fund-flow` | -| [getTradeDataSupportSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L643) | | GET | `/api/v2/spot/market/support-symbols` | -| [getSpotFundNetFlowData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L652) | | GET | `/api/v2/spot/market/fund-net-flow` | -| [getFuturesActiveLongShortAccountData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L663) | | GET | `/api/v2/mix/market/account-long-short` | -| [createVirtualSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L676) | :closed_lock_with_key: | POST | `/api/v2/user/create-virtual-subaccount` | -| [modifyVirtualSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L682) | :closed_lock_with_key: | POST | `/api/v2/user/modify-virtual-subaccount` | -| [batchCreateVirtualSubaccountAndAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L690) | :closed_lock_with_key: | POST | `/api/v2/user/batch-create-subaccount-and-apikey` | -| [getVirtualSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L699) | :closed_lock_with_key: | GET | `/api/v2/user/virtual-subaccount-list` | -| [createVirtualSubaccountAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L712) | :closed_lock_with_key: | POST | `/api/v2/user/create-virtual-subaccount-apikey` | -| [modifyVirtualSubaccountAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L721) | :closed_lock_with_key: | POST | `/api/v2/user/modify-virtual-subaccount-apikey` | -| [getVirtualSubaccountAPIKeys()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L730) | :closed_lock_with_key: | GET | `/api/v2/user/virtual-subaccount-apikey-list` | -| [createAgentSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L743) | :closed_lock_with_key: | POST | `/api/v2/user/create-agent-subaccount` | -| [getFundingAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L754) | :closed_lock_with_key: | GET | `/api/v2/account/funding-assets` | -| [getBotAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L760) | :closed_lock_with_key: | GET | `/api/v2/account/bot-assets` | -| [getBalances()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L767) | :closed_lock_with_key: | GET | `/api/v2/account/all-account-balance` | -| [getConvertCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L784) | :closed_lock_with_key: | GET | `/api/v2/convert/currencies` | -| [getConvertQuotedPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L788) | :closed_lock_with_key: | GET | `/api/v2/convert/quoted-price` | -| [convert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L794) | :closed_lock_with_key: | POST | `/api/v2/convert/trade` | -| [getConvertHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L800) | :closed_lock_with_key: | GET | `/api/v2/convert/convert-record` | -| [getConvertBGBCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L815) | :closed_lock_with_key: | GET | `/api/v2/convert/bgb-convert-coin-list` | -| [convertBGB()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L823) | :closed_lock_with_key: | POST | `/api/v2/convert/bgb-convert` | -| [getConvertBGBHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L829) | :closed_lock_with_key: | GET | `/api/v2/convert/bgb-convert-records` | -| [getSpotCoinInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L849) | :closed_lock_with_key: | GET | `/api/v2/spot/public/coins` | -| [getSpotSymbolInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L855) | :closed_lock_with_key: | GET | `/api/v2/spot/public/symbols` | -| [getSpotVIPFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L861) | :closed_lock_with_key: | GET | `/api/v2/spot/market/vip-fee-rate` | -| [getSpotTicker()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L865) | :closed_lock_with_key: | GET | `/api/v2/spot/market/tickers` | -| [getSpotMergeDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L871) | :closed_lock_with_key: | GET | `/api/v2/spot/market/merge-depth` | -| [getSpotOrderBookDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L879) | :closed_lock_with_key: | GET | `/api/v2/spot/market/orderbook` | -| [getSpotCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L887) | :closed_lock_with_key: | GET | `/api/v2/spot/market/candles` | -| [getSpotHistoricCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L893) | :closed_lock_with_key: | GET | `/api/v2/spot/market/history-candles` | -| [getSpotRecentTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L899) | :closed_lock_with_key: | GET | `/api/v2/spot/market/fills` | -| [getSpotHistoricTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L906) | :closed_lock_with_key: | GET | `/api/v2/spot/market/fills-history` | -| [spotSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L918) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/place-order` | -| [spotCancelandSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L927) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-replace-order` | -| [spotBatchCancelandSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L933) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-replace-order` | -| [spotCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L942) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-order` | -| [spotBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L951) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-orders` | -| [spotBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L957) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-order` | -| [spotCancelSymbolOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L963) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-symbol-order` | -| [getSpotOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L971) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/orderInfo` | -| [getSpotOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L977) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/unfilled-orders` | -| [getSpotHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L983) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/history-orders` | -| [getSpotFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L989) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/fills` | -| [spotSubmitPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1001) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/place-plan-order` | -| [spotModifyPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1010) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/modify-plan-order` | -| [spotCancelPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1019) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-plan-order` | -| [getSpotCurrentPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1030) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/current-plan-order` | -| [getSpotPlanSubOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1040) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/plan-sub-order` | -| [getSpotHistoricPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1046) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/history-plan-order` | -| [spotCancelPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1056) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-plan-order` | -| [getSpotAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1071) | :closed_lock_with_key: | GET | `/api/v2/spot/account/info` | -| [getSpotAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1075) | :closed_lock_with_key: | GET | `/api/v2/spot/account/assets` | -| [getSpotSubAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1082) | :closed_lock_with_key: | GET | `/api/v2/spot/account/subaccount-assets` | -| [spotModifyDepositAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1086) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/modify-deposit-account` | -| [getSpotAccountBills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1096) | :closed_lock_with_key: | GET | `/api/v2/spot/account/bills` | -| [spotTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1102) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/transfer` | -| [getSpotTransferableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1111) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/transfer-coin-info` | -| [spotSubTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1118) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/subaccount-transfer` | -| [spotWithdraw()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1127) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/withdrawal` | -| [getSpotMainSubTransferRecord()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1136) | :closed_lock_with_key: | GET | `/api/v2/spot/account/sub-main-trans-record` | -| [getSpotTransferHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1145) | :closed_lock_with_key: | GET | `/api/v2/spot/account/transferRecords` | -| [spotSwitchBGBDeduct()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1151) | :closed_lock_with_key: | POST | `/api/v2/spot/account/switch-deduct` | -| [getSpotDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1157) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/deposit-address` | -| [getSpotSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1165) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/subaccount-deposit-address` | -| [getSpotBGBDeductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1177) | :closed_lock_with_key: | GET | `/api/v2/spot/account/deduct-info` | -| [spotCancelWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1185) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/cancel-withdrawal` | -| [getSubAccountDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1191) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/subaccount-deposit-records` | -| [getSpotWithdrawalHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1200) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/withdrawal-records` | -| [getSpotDepositHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1206) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/deposit-records` | -| [upgradeToUnifiedAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1221) | :closed_lock_with_key: | POST | `/api/v2/spot/account/upgrade` | -| [getUnifiedAccountSwitchStatus()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1231) | :closed_lock_with_key: | GET | `/api/v2/spot/account/upgrade-status` | -| [getFuturesVIPFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1253) | | GET | `/api/v2/mix/market/vip-fee-rate` | -| [getFuturesInterestRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1257) | | GET | `/api/v2/mix/market/union-interest-rate-history` | -| [getFuturesInterestExchangeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1266) | | GET | `/api/v2/mix/market/exchange-rate` | -| [getFuturesDiscountRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1277) | | GET | `/api/v2/mix/market/discount-rate` | -| [getFuturesMergeDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1281) | | GET | `/api/v2/mix/market/merge-depth` | -| [getFuturesTicker()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1287) | | GET | `/api/v2/mix/market/ticker` | -| [getFuturesAllTickers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1294) | | GET | `/api/v2/mix/market/tickers` | -| [getFuturesRecentTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1300) | | GET | `/api/v2/mix/market/fills` | -| [getFuturesHistoricTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1306) | | GET | `/api/v2/mix/market/fills-history` | -| [getFuturesCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1312) | | GET | `/api/v2/mix/market/candles` | -| [getFuturesHistoricCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1318) | | GET | `/api/v2/mix/market/history-candles` | -| [getFuturesHistoricIndexPriceCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1324) | | GET | `/api/v2/mix/market/history-index-candles` | -| [getFuturesHistoricMarkPriceCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1330) | | GET | `/api/v2/mix/market/history-mark-candles` | -| [getFuturesOpenInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1336) | | GET | `/api/v2/mix/market/open-interest` | -| [getFuturesNextFundingTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1348) | | GET | `/api/v2/mix/market/funding-time` | -| [getFuturesSymbolPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1355) | | GET | `/api/v2/mix/market/symbol-price` | -| [getFuturesHistoricFundingRates()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1362) | | GET | `/api/v2/mix/market/history-fund-rate` | -| [getFuturesCurrentFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1371) | | GET | `/api/v2/mix/market/current-fund-rate` | -| [getFuturesContractConfig()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1389) | | GET | `/api/v2/mix/market/contracts` | -| [getFuturesAccountAsset()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1402) | :closed_lock_with_key: | GET | `/api/v2/mix/account/account` | -| [getFuturesAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1408) | :closed_lock_with_key: | GET | `/api/v2/mix/account/accounts` | -| [getFuturesSubAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1414) | :closed_lock_with_key: | GET | `/api/v2/mix/account/sub-account-assets` | -| [getFuturesInterestHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1427) | :closed_lock_with_key: | GET | `/api/v2/mix/account/interest-history` | -| [getFuturesOpenCount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1433) | :closed_lock_with_key: | GET | `/api/v2/mix/account/open-count` | -| [setFuturesPositionAutoMargin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1441) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-auto-margin` | -| [setFuturesLeverage()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1447) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-leverage` | -| [setFuturesPositionMargin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1453) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-margin` | -| [setFuturesAssetMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1459) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-asset-mode` | -| [setFuturesMarginMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1466) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-margin-mode` | -| [setFuturesPositionMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1472) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-position-mode` | -| [getFuturesAccountBills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1483) | :closed_lock_with_key: | GET | `/api/v2/mix/account/bill` | -| [getUnionTransferLimits()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1498) | :closed_lock_with_key: | GET | `/api/v2/mix/account/transfer-limits` | -| [getUnionConfig()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1510) | :closed_lock_with_key: | GET | `/api/v2/mix/account/union-config` | -| [getSwitchUnionUsdt()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1520) | :closed_lock_with_key: | GET | `/api/v2/mix/account/switch-union-usdt` | -| [unionConvert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1530) | :closed_lock_with_key: | POST | `/api/v2/mix/account/union-convert` | -| [getFuturesMaxOpenableQuantity()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1542) | :closed_lock_with_key: | GET | `/api/v2/mix/account/max-open` | -| [getFuturesLiquidationPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1554) | :closed_lock_with_key: | GET | `/api/v2/mix/account/liq-price` | -| [getFuturesIsolatedSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1566) | :closed_lock_with_key: | GET | `/api/v2/mix/account/isolated-symbols` | -| [getFuturesPositionTier()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1578) | | GET | `/api/v2/mix/market/query-position-lever` | -| [getFuturesPosition()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1585) | :closed_lock_with_key: | GET | `/api/v2/mix/position/single-position` | -| [getFuturesPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1593) | :closed_lock_with_key: | GET | `/api/v2/mix/position/all-position` | -| [getFuturesHistoricPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1600) | :closed_lock_with_key: | GET | `/api/v2/mix/position/history-position` | -| [futuresSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1617) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-order` | -| [futuresSubmitReversal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1626) | :closed_lock_with_key: | POST | `/api/v2/mix/order/click-backhand` | -| [futuresBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1635) | :closed_lock_with_key: | POST | `/api/v2/mix/order/batch-place-order` | -| [futuresModifyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1641) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-order` | -| [futuresCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1650) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-order` | -| [futuresBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1659) | :closed_lock_with_key: | POST | `/api/v2/mix/order/batch-cancel-orders` | -| [futuresFlashClosePositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1665) | :closed_lock_with_key: | POST | `/api/v2/mix/order/close-positions` | -| [getFuturesOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1671) | :closed_lock_with_key: | GET | `/api/v2/mix/order/detail` | -| [getFuturesFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1677) | :closed_lock_with_key: | GET | `/api/v2/mix/order/fills` | -| [getFuturesHistoricOrderFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1686) | :closed_lock_with_key: | GET | `/api/v2/mix/order/fill-history` | -| [getFuturesOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1697) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-pending` | -| [getFuturesHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1706) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-history` | -| [futuresCancelAllOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1715) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-all-orders` | -| [getFuturesTriggerSubOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1727) | :closed_lock_with_key: | GET | `/api/v2/mix/order/plan-sub-order` | -| [futuresSubmitTPSLOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1735) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-tpsl-order` | -| [futuresSubmitPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1744) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-plan-order` | -| [futuresModifyTPSLPOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1753) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-tpsl-order` | -| [futuresModifyPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1762) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-plan-order` | -| [getFuturesPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1771) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-plan-pending` | -| [futuresCancelPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1780) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-plan-order` | -| [getFuturesHistoricPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1786) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-plan-history` | -| [modifySubaccountEmail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1811) | :closed_lock_with_key: | POST | `/api/v2/broker/account/modify-subaccount-email` | -| [getBrokerInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1821) | :closed_lock_with_key: | GET | `/api/v2/broker/account/info` | -| [createSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1831) | :closed_lock_with_key: | POST | `/api/v2/broker/account/create-subaccount` | -| [getSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1838) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-list` | -| [modifySubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1848) | :closed_lock_with_key: | POST | `/api/v2/broker/account/modify-subaccount` | -| [getSubaccountEmail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1854) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-email` | -| [getSubaccountSpotAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1860) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-spot-assets` | -| [getSubaccountFuturesAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1875) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-future-assets` | -| [createSubaccountDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1889) | :closed_lock_with_key: | POST | `/api/v2/broker/account/subaccount-address` | -| [subaccountWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1900) | :closed_lock_with_key: | POST | `/api/v2/broker/account/subaccount-withdrawal` | -| [subaccountSetAutoTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1912) | :closed_lock_with_key: | POST | `/api/v2/broker/account/set-subaccount-autotransfer` | -| [subaccountDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1928) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-deposit` | -| [subaccountWithdrawalRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1939) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-withdrawal` | -| [createSubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1954) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/create-subaccount-apikey` | -| [getSubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1963) | :closed_lock_with_key: | GET | `/api/v2/broker/manage/subaccount-apikey-list` | -| [modifySubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1972) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/modify-subaccount-apikey` | -| [getAllSubDepositWithdrawalRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1988) | :closed_lock_with_key: | GET | `/api/v2/broker/all-sub-deposit-withdrawal` | -| [getBrokerSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2005) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccounts` | -| [getBrokerCommissions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2017) | :closed_lock_with_key: | GET | `/api/v2/broker/commissions` | -| [getBrokerTradeVolume()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2029) | :closed_lock_with_key: | GET | `/api/v2/broker/trade-volume` | -| [getBrokerTotalCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2049) | :closed_lock_with_key: | GET | `/api/v2/broker/total-commission` | -| [getBrokerOrderCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2071) | :closed_lock_with_key: | GET | `/api/v2/broker/order-commission` | -| [getBrokerRebateInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2084) | :closed_lock_with_key: | GET | `/api/v2/broker/rebate-info` | -| [getAgentCustomerCommissions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2096) | :closed_lock_with_key: | GET | `/api/v2/broker/customer-commissions` | -| [getAgentSubCustomerList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2105) | :closed_lock_with_key: | GET | `/api/v2/broker/sub-customer-list` | -| [getAgentCustomerTradeVolume()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2111) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-trade-volume` | -| [getAgentCustomerList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2120) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-list` | -| [getAgentCustomerKycResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2126) | :closed_lock_with_key: | GET | `/api/v2/broker/customer-kyc-result` | -| [getAgentCustomerDeposits()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2132) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-deposit` | -| [getAgentCustomerAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2138) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-asset` | -| [getAgentCommissionDetail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2144) | :closed_lock_with_key: | GET | `/api/v2/broker/agent-commission` | -| [getMarginCurrencies()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2164) | | GET | `/api/v2/margin/currencies` | -| [getMarginBorrowHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2174) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/borrow-history` | -| [getMarginRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2191) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/repay-history` | -| [getMarginInterestHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2208) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/interest-history` | -| [getMarginLiquidationHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2225) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/liquidation-history` | -| [getMarginFinancialHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2242) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/financial-records` | -| [getMarginAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2265) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/assets` | -| [marginBorrow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2276) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/borrow` | -| [marginRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2299) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/repay` | -| [getMarginRiskRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2324) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/risk-rate` | -| [getMarginMaxBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2336) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/max-borrowable-amount` | -| [getMarginMaxTransferable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2349) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/max-transfer-out-amount` | -| [getMarginInterestRateAndMaxBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2364) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/interest-rate-and-limit` | -| [getMarginTierConfiguration()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2380) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/tier-data` | -| [marginFlashRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2392) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/flash-repay` | -| [getMarginFlashRepayResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2410) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/query-flash-repay-status` | -| [marginSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2434) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/place-order` | -| [marginBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2447) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/batch-place-order` | -| [marginCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2458) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/cancel-order` | -| [marginBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2478) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/batch-cancel-order` | -| [getMarginOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2492) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/open-orders` | -| [getMarginHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2506) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/history-orders` | -| [getMarginHistoricOrderFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2523) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/fills` | -| [getMarginLiquidationOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2537) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/liquidation-order` | -| [getFuturesTraderCurrentOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2569) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-current-track` | -| [getFuturesTraderHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2578) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-history-track` | -| [modifyFuturesTraderOrderTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2587) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/order-modify-tpsl` | -| [getFuturesTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2596) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-total-detail` | -| [getFuturesTraderProfitHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2602) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-history-summarys` | -| [getFuturesTraderProfitShareHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2608) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-history-details` | -| [closeFuturesTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2617) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/order-close-positions` | -| [getFuturesTraderProfitShare()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2636) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-details` | -| [getFuturesTraderProfitShareGroup()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2652) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profits-group-coin-date` | -| [getFuturesTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2670) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/config-query-symbols` | -| [updateFuturesTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2679) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-setting-symbols` | -| [updateFuturesTraderGlobalSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2688) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-settings-base` | -| [getFuturesTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2699) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/config-query-followers` | -| [removeFuturesTraderFollower()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2708) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-remove-follower` | -| [getFuturesFollowerCurrentOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2725) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-current-orders` | -| [getFuturesFollowerHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2734) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-history-orders` | -| [updateFuturesFollowerTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2743) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/setting-tpsl` | -| [updateFuturesFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2749) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/settings` | -| [getFuturesFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2755) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-settings` | -| [closeFuturesFollowerPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2761) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/close-positions` | -| [getFuturesFollowerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2774) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-traders` | -| [getFuturesFollowerFollowLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2780) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-quantity-limit` | -| [unfollowFuturesTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2798) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/cancel-trader` | -| [getBrokerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2812) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-traders` | -| [getBrokerTradersHistoricalOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2816) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-history-traces` | -| [getBrokerTradersPendingOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2823) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-current-traces` | -| [getSpotTraderProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2838) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-summarys` | -| [getSpotTraderHistoryProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2842) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-history-details` | -| [getSpotTraderUnrealizedProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2851) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-details` | -| [getSpotTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2859) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-total-detail` | -| [modifySpotTraderOrderTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2863) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/order-modify-tpsl` | -| [getSpotTraderHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2874) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-history-track` | -| [getSpotTraderCurrentOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2883) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-current-track` | -| [sellSpotTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2892) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/order-close-tracking` | -| [getSpotTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2902) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/config-setting-symbols` | -| [removeSpotTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2912) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/config-remove-follower` | -| [getSpotTraderConfiguration()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2921) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/config-query-settings` | -| [getSpotTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2925) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/config-query-followers` | -| [cancelSpotFollowerOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2942) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/stop-order` | -| [updateSpotFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2948) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/settings` | -| [updateSpotFollowerTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2957) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/setting-tpsl` | -| [getSpotFollowerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2965) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-traders` | -| [getSpotFollowerCurrentTraderSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2974) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-trader-symbols` | -| [getSpotFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2985) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-settings` | -| [getSpotFollowerHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2991) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-history-orders` | -| [getSpotFollowerOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3000) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-current-orders` | -| [sellSpotFollower()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3009) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/order-close-tracking` | -| [unfollowSpotTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3019) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/cancel-trader` | -| [getEarnSavingsProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3033) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/product` | -| [getEarnSavingsAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3040) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/account` | -| [getEarnSavingsAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3044) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/assets` | -| [getEarnSavingsRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3050) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/records` | -| [getEarnSavingsSubscription()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3056) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/subscribe-info` | -| [earnSubscribeSavings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3063) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/subscribe` | -| [getEarnSavingsSubscriptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3076) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/subscribe-result` | -| [earnRedeemSavings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3088) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/redeem` | -| [getEarnSavingsRedemptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3097) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/redeem-result` | -| [getEarnAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3117) | :closed_lock_with_key: | GET | `/api/v2/earn/account/assets` | -| [getEarnEliteProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3136) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/product` | -| [getEarnEliteAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3140) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/assets` | -| [getEarnEliteRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3144) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/records` | -| [getEarnEliteSubscribeInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3150) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/subscribe-info` | -| [subscribeEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3156) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/subscribe` | -| [getEarnEliteSubscribeResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3162) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/subscribe-result` | -| [getEarnEliteRedeemInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3168) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/redeem-info` | -| [redeemEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3174) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/redeem` | -| [getSharkfinProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3188) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/product` | -| [getSharkfinAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3196) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/account` | -| [getSharkfinAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3200) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/assets` | -| [getSharkfinRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3206) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/records` | -| [getSharkfinSubscription()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3212) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/subscribe-info` | -| [subscribeSharkfin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3218) | :closed_lock_with_key: | POST | `/api/v2/earn/sharkfin/subscribe` | -| [getSharkfinSubscriptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3227) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/subscribe-result` | -| [getLoanCurrencies()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3244) | | GET | `/api/v2/earn/loan/public/coinInfos` | -| [getLoanEstInterestAndBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3250) | | GET | `/api/v2/earn/loan/public/hour-interest` | -| [borrowLoan()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3261) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/borrow` | -| [getOngoingLoanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3269) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/ongoing-orders` | -| [repayLoan()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3277) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/repay` | -| [getRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3283) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/repay-history` | -| [updateLoanPledgeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3289) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/revise-pledge` | -| [getLoanPledgeRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3299) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/revise-history` | -| [getLoanHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3305) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/borrow-history` | -| [getLoanDebts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3311) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/debts` | -| [getLoanLiquidationRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3315) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/reduces` | +| [getAnnouncements()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L506) | | GET | `/api/v2/public/annoucements` | +| [getServerTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L518) | | GET | `/api/v2/public/time` | +| [getTradeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L526) | :closed_lock_with_key: | GET | `/api/v2/common/trade-rate` | +| [getAllTradeRates()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L535) | :closed_lock_with_key: | GET | `/api/v2/common/all-trade-rate` | +| [getSpotTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L553) | :closed_lock_with_key: | GET | `/api/v2/tax/spot-record` | +| [getFuturesTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L559) | :closed_lock_with_key: | GET | `/api/v2/tax/future-record` | +| [getMarginTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L565) | :closed_lock_with_key: | GET | `/api/v2/tax/margin-record` | +| [getP2PTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L571) | :closed_lock_with_key: | GET | `/api/v2/tax/p2p-record` | +| [getP2PMerchantList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L583) | :closed_lock_with_key: | GET | `/api/v2/p2p/merchantList` | +| [getP2PMerchantInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L592) | :closed_lock_with_key: | GET | `/api/v2/p2p/merchantInfo` | +| [getP2PMerchantOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L596) | :closed_lock_with_key: | GET | `/api/v2/p2p/orderList` | +| [getP2PMerchantAdvertisementList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L605) | :closed_lock_with_key: | GET | `/api/v2/p2p/advList` | +| [getSpotWhaleNetFlowData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L622) | :closed_lock_with_key: | GET | `/api/v2/spot/market/whale-net-flow` | +| [getFuturesActiveTakerBuySellVolumeData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L628) | | GET | `/api/v2/mix/market/taker-buy-sell` | +| [getFuturesActiveLongShortPositionData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L635) | | GET | `/api/v2/mix/market/position-long-short` | +| [getFuturesLongShortRatio()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L642) | | GET | `/api/v2/mix/market/long-short-ratio` | +| [getMarginLoanGrowthRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L650) | | GET | `/api/v2/mix/market/loan-growth` | +| [getIsolatedMarginBorrowingRatio()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L658) | | GET | `/api/v2/mix/market/isolated-borrow-rate` | +| [getFuturesActiveBuySellVolumeData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L665) | | GET | `/api/v2/mix/market/long-short` | +| [getSpotFundFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L672) | | GET | `/api/v2/spot/market/fund-flow` | +| [getTradeDataSupportSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L679) | | GET | `/api/v2/spot/market/support-symbols` | +| [getSpotFundNetFlowData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L688) | | GET | `/api/v2/spot/market/fund-net-flow` | +| [getFuturesActiveLongShortAccountData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L699) | | GET | `/api/v2/mix/market/account-long-short` | +| [createVirtualSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L712) | :closed_lock_with_key: | POST | `/api/v2/user/create-virtual-subaccount` | +| [modifyVirtualSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L718) | :closed_lock_with_key: | POST | `/api/v2/user/modify-virtual-subaccount` | +| [batchCreateVirtualSubaccountAndAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L726) | :closed_lock_with_key: | POST | `/api/v2/user/batch-create-subaccount-and-apikey` | +| [getVirtualSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L735) | :closed_lock_with_key: | GET | `/api/v2/user/virtual-subaccount-list` | +| [createVirtualSubaccountAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L748) | :closed_lock_with_key: | POST | `/api/v2/user/create-virtual-subaccount-apikey` | +| [modifyVirtualSubaccountAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L757) | :closed_lock_with_key: | POST | `/api/v2/user/modify-virtual-subaccount-apikey` | +| [getVirtualSubaccountAPIKeys()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L766) | :closed_lock_with_key: | GET | `/api/v2/user/virtual-subaccount-apikey-list` | +| [createAgentSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L779) | :closed_lock_with_key: | POST | `/api/v2/user/create-agent-subaccount` | +| [getFundingAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L790) | :closed_lock_with_key: | GET | `/api/v2/account/funding-assets` | +| [getBotAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L796) | :closed_lock_with_key: | GET | `/api/v2/account/bot-assets` | +| [getBalances()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L803) | :closed_lock_with_key: | GET | `/api/v2/account/all-account-balance` | +| [getConvertCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L820) | :closed_lock_with_key: | GET | `/api/v2/convert/currencies` | +| [getConvertQuotedPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L824) | :closed_lock_with_key: | GET | `/api/v2/convert/quoted-price` | +| [convert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L830) | :closed_lock_with_key: | POST | `/api/v2/convert/trade` | +| [getConvertHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L836) | :closed_lock_with_key: | GET | `/api/v2/convert/convert-record` | +| [getConvertBGBCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L851) | :closed_lock_with_key: | GET | `/api/v2/convert/bgb-convert-coin-list` | +| [convertBGB()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L859) | :closed_lock_with_key: | POST | `/api/v2/convert/bgb-convert` | +| [getConvertBGBHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L865) | :closed_lock_with_key: | GET | `/api/v2/convert/bgb-convert-records` | +| [getSpotCoinInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L885) | :closed_lock_with_key: | GET | `/api/v2/spot/public/coins` | +| [getSpotSymbolInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L891) | :closed_lock_with_key: | GET | `/api/v2/spot/public/symbols` | +| [getSpotVIPFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L897) | :closed_lock_with_key: | GET | `/api/v2/spot/market/vip-fee-rate` | +| [getSpotTicker()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L901) | :closed_lock_with_key: | GET | `/api/v2/spot/market/tickers` | +| [getSpotMergeDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L907) | :closed_lock_with_key: | GET | `/api/v2/spot/market/merge-depth` | +| [getSpotOrderBookDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L915) | :closed_lock_with_key: | GET | `/api/v2/spot/market/orderbook` | +| [getSpotCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L923) | :closed_lock_with_key: | GET | `/api/v2/spot/market/candles` | +| [getSpotHistoricCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L929) | :closed_lock_with_key: | GET | `/api/v2/spot/market/history-candles` | +| [getSpotRecentTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L935) | :closed_lock_with_key: | GET | `/api/v2/spot/market/fills` | +| [getSpotHistoricTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L942) | :closed_lock_with_key: | GET | `/api/v2/spot/market/fills-history` | +| [getSpotCallAuction()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L948) | | GET | `/api/v2/spot/market/auction` | +| [spotSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L960) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/place-order` | +| [spotCancelandSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L969) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-replace-order` | +| [spotBatchCancelandSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L975) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-replace-order` | +| [spotCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L984) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-order` | +| [spotBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L993) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-orders` | +| [spotBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L999) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-order` | +| [spotCancelSymbolOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1005) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-symbol-order` | +| [getSpotOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1013) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/orderInfo` | +| [getSpotOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1019) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/unfilled-orders` | +| [getSpotHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1025) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/history-orders` | +| [getSpotFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1031) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/fills` | +| [spotSubmitPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1043) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/place-plan-order` | +| [spotModifyPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1052) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/modify-plan-order` | +| [spotCancelPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1061) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-plan-order` | +| [getSpotCurrentPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1072) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/current-plan-order` | +| [getSpotPlanSubOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1082) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/plan-sub-order` | +| [getSpotHistoricPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1088) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/history-plan-order` | +| [spotCancelPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1098) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-plan-order` | +| [getSpotAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1113) | :closed_lock_with_key: | GET | `/api/v2/spot/account/info` | +| [getSpotAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1117) | :closed_lock_with_key: | GET | `/api/v2/spot/account/assets` | +| [getSpotSubAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1124) | :closed_lock_with_key: | GET | `/api/v2/spot/account/subaccount-assets` | +| [spotModifyDepositAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1128) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/modify-deposit-account` | +| [getSpotAccountBills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1138) | :closed_lock_with_key: | GET | `/api/v2/spot/account/bills` | +| [spotTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1144) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/transfer` | +| [getSpotTransferableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1153) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/transfer-coin-info` | +| [spotSubTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1160) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/subaccount-transfer` | +| [spotWithdraw()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1169) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/withdrawal` | +| [getSpotMainSubTransferRecord()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1178) | :closed_lock_with_key: | GET | `/api/v2/spot/account/sub-main-trans-record` | +| [getSpotTransferHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1187) | :closed_lock_with_key: | GET | `/api/v2/spot/account/transferRecords` | +| [spotSwitchBGBDeduct()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1193) | :closed_lock_with_key: | POST | `/api/v2/spot/account/switch-deduct` | +| [getSpotDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1199) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/deposit-address` | +| [getSpotSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1207) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/subaccount-deposit-address` | +| [getSpotBGBDeductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1219) | :closed_lock_with_key: | GET | `/api/v2/spot/account/deduct-info` | +| [spotCancelWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1227) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/cancel-withdrawal` | +| [getSubAccountDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1233) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/subaccount-deposit-records` | +| [getSpotWithdrawalHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1242) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/withdrawal-records` | +| [getSpotDepositHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1248) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/deposit-records` | +| [upgradeToUnifiedAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1263) | :closed_lock_with_key: | POST | `/api/v2/spot/account/upgrade` | +| [getUnifiedAccountSwitchStatus()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1273) | :closed_lock_with_key: | GET | `/api/v2/spot/account/upgrade-status` | +| [getFuturesVIPFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1295) | | GET | `/api/v2/mix/market/vip-fee-rate` | +| [getFuturesInterestRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1299) | | GET | `/api/v2/mix/market/union-interest-rate-history` | +| [getFuturesInterestExchangeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1308) | | GET | `/api/v2/mix/market/exchange-rate` | +| [getFuturesDiscountRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1319) | | GET | `/api/v2/mix/market/discount-rate` | +| [getFuturesMergeDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1323) | | GET | `/api/v2/mix/market/merge-depth` | +| [getFuturesTicker()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1329) | | GET | `/api/v2/mix/market/ticker` | +| [getFuturesAllTickers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1336) | | GET | `/api/v2/mix/market/tickers` | +| [getFuturesRecentTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1342) | | GET | `/api/v2/mix/market/fills` | +| [getFuturesHistoricTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1348) | | GET | `/api/v2/mix/market/fills-history` | +| [getFuturesCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1354) | | GET | `/api/v2/mix/market/candles` | +| [getFuturesHistoricCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1360) | | GET | `/api/v2/mix/market/history-candles` | +| [getFuturesHistoricIndexPriceCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1366) | | GET | `/api/v2/mix/market/history-index-candles` | +| [getFuturesHistoricMarkPriceCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1372) | | GET | `/api/v2/mix/market/history-mark-candles` | +| [getFuturesOpenInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1378) | | GET | `/api/v2/mix/market/open-interest` | +| [getFuturesNextFundingTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1390) | | GET | `/api/v2/mix/market/funding-time` | +| [getFuturesSymbolPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1397) | | GET | `/api/v2/mix/market/symbol-price` | +| [getFuturesHistoricFundingRates()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1404) | | GET | `/api/v2/mix/market/history-fund-rate` | +| [getFuturesCurrentFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1413) | | GET | `/api/v2/mix/market/current-fund-rate` | +| [getFuturesContractConfig()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1431) | | GET | `/api/v2/mix/market/contracts` | +| [getFuturesOiLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1438) | | GET | `/api/v2/mix/market/oi-limit` | +| [getFuturesAccountAsset()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1456) | :closed_lock_with_key: | GET | `/api/v2/mix/account/account` | +| [getFuturesAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1462) | :closed_lock_with_key: | GET | `/api/v2/mix/account/accounts` | +| [getFuturesSubAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1468) | :closed_lock_with_key: | GET | `/api/v2/mix/account/sub-account-assets` | +| [getFuturesInterestHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1481) | :closed_lock_with_key: | GET | `/api/v2/mix/account/interest-history` | +| [getFuturesOpenCount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1487) | :closed_lock_with_key: | GET | `/api/v2/mix/account/open-count` | +| [setFuturesPositionAutoMargin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1495) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-auto-margin` | +| [setFuturesLeverage()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1501) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-leverage` | +| [setFuturesPositionMargin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1507) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-margin` | +| [setFuturesAssetMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1513) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-asset-mode` | +| [setFuturesMarginMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1520) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-margin-mode` | +| [setFuturesPositionMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1526) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-position-mode` | +| [getFuturesAccountBills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1537) | :closed_lock_with_key: | GET | `/api/v2/mix/account/bill` | +| [getUnionTransferLimits()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1552) | :closed_lock_with_key: | GET | `/api/v2/mix/account/transfer-limits` | +| [getUnionConfig()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1564) | :closed_lock_with_key: | GET | `/api/v2/mix/account/union-config` | +| [getSwitchUnionUsdt()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1574) | :closed_lock_with_key: | GET | `/api/v2/mix/account/switch-union-usdt` | +| [unionConvert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1584) | :closed_lock_with_key: | POST | `/api/v2/mix/account/union-convert` | +| [getFuturesMaxOpenableQuantity()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1596) | :closed_lock_with_key: | GET | `/api/v2/mix/account/max-open` | +| [getFuturesLiquidationPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1608) | :closed_lock_with_key: | GET | `/api/v2/mix/account/liq-price` | +| [getFuturesIsolatedSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1620) | :closed_lock_with_key: | GET | `/api/v2/mix/account/isolated-symbols` | +| [getFuturesPositionTier()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1632) | | GET | `/api/v2/mix/market/query-position-lever` | +| [getFuturesPosition()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1639) | :closed_lock_with_key: | GET | `/api/v2/mix/position/single-position` | +| [getFuturesPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1647) | :closed_lock_with_key: | GET | `/api/v2/mix/position/all-position` | +| [getFuturesHistoricPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1654) | :closed_lock_with_key: | GET | `/api/v2/mix/position/history-position` | +| [getFuturesPositionAdlRank()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1665) | :closed_lock_with_key: | GET | `/api/v2/mix/position/adlRank` | +| [futuresSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1677) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-order` | +| [futuresSubmitReversal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1686) | :closed_lock_with_key: | POST | `/api/v2/mix/order/click-backhand` | +| [futuresBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1695) | :closed_lock_with_key: | POST | `/api/v2/mix/order/batch-place-order` | +| [futuresModifyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1701) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-order` | +| [futuresCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1710) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-order` | +| [futuresBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1719) | :closed_lock_with_key: | POST | `/api/v2/mix/order/batch-cancel-orders` | +| [futuresFlashClosePositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1725) | :closed_lock_with_key: | POST | `/api/v2/mix/order/close-positions` | +| [getFuturesOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1731) | :closed_lock_with_key: | GET | `/api/v2/mix/order/detail` | +| [getFuturesFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1737) | :closed_lock_with_key: | GET | `/api/v2/mix/order/fills` | +| [getFuturesHistoricOrderFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1746) | :closed_lock_with_key: | GET | `/api/v2/mix/order/fill-history` | +| [getFuturesOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1757) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-pending` | +| [getFuturesHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1766) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-history` | +| [futuresCancelAllOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1775) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-all-orders` | +| [getFuturesTriggerSubOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1787) | :closed_lock_with_key: | GET | `/api/v2/mix/order/plan-sub-order` | +| [futuresSubmitTPSLOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1795) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-tpsl-order` | +| [futuresSubmitPositionTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1804) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-pos-tpsl` | +| [futuresSubmitPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1816) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-plan-order` | +| [futuresModifyTPSLPOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1825) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-tpsl-order` | +| [futuresModifyPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1834) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-plan-order` | +| [getFuturesPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1843) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-plan-pending` | +| [futuresCancelPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1852) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-plan-order` | +| [getFuturesHistoricPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1858) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-plan-history` | +| [modifySubaccountEmail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1883) | :closed_lock_with_key: | POST | `/api/v2/broker/account/modify-subaccount-email` | +| [getBrokerInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1893) | :closed_lock_with_key: | GET | `/api/v2/broker/account/info` | +| [createSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1903) | :closed_lock_with_key: | POST | `/api/v2/broker/account/create-subaccount` | +| [getSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1910) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-list` | +| [modifySubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1920) | :closed_lock_with_key: | POST | `/api/v2/broker/account/modify-subaccount` | +| [getSubaccountEmail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1926) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-email` | +| [getSubaccountSpotAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1932) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-spot-assets` | +| [getSubaccountFuturesAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1947) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-future-assets` | +| [createSubaccountDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1961) | :closed_lock_with_key: | POST | `/api/v2/broker/account/subaccount-address` | +| [subaccountWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1972) | :closed_lock_with_key: | POST | `/api/v2/broker/account/subaccount-withdrawal` | +| [subaccountSetAutoTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1984) | :closed_lock_with_key: | POST | `/api/v2/broker/account/set-subaccount-autotransfer` | +| [subaccountDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2000) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-deposit` | +| [subaccountWithdrawalRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2011) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-withdrawal` | +| [createSubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2026) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/create-subaccount-apikey` | +| [getSubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2035) | :closed_lock_with_key: | GET | `/api/v2/broker/manage/subaccount-apikey-list` | +| [modifySubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2044) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/modify-subaccount-apikey` | +| [deleteSubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2053) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/delete-subaccount-apikey` | +| [getAllSubDepositWithdrawalRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2069) | :closed_lock_with_key: | GET | `/api/v2/broker/all-sub-deposit-withdrawal` | +| [getBrokerSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2086) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccounts` | +| [getBrokerCommissions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2098) | :closed_lock_with_key: | GET | `/api/v2/broker/commissions` | +| [getBrokerTradeVolume()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2110) | :closed_lock_with_key: | GET | `/api/v2/broker/trade-volume` | +| [getBrokerTotalCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2130) | :closed_lock_with_key: | GET | `/api/v2/broker/total-commission` | +| [getBrokerOrderCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2152) | :closed_lock_with_key: | GET | `/api/v2/broker/order-commission` | +| [getBrokerRebateInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2165) | :closed_lock_with_key: | GET | `/api/v2/broker/rebate-info` | +| [getAgentCustomerCommissions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2177) | :closed_lock_with_key: | GET | `/api/v2/broker/customer-commissions` | +| [getAgentSubCustomerList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2186) | :closed_lock_with_key: | GET | `/api/v2/broker/sub-customer-list` | +| [getAgentCustomerTradeVolume()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2192) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-trade-volume` | +| [getAgentCustomerList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2201) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-list` | +| [getAgentCustomerKycResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2207) | :closed_lock_with_key: | GET | `/api/v2/broker/customer-kyc-result` | +| [getAgentCustomerDeposits()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2213) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-deposit` | +| [getAgentCustomerAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2219) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-asset` | +| [getAgentCommissionDetail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2225) | :closed_lock_with_key: | GET | `/api/v2/broker/agent-commission` | +| [getMarginCurrencies()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2245) | | GET | `/api/v2/margin/currencies` | +| [getMarginBorrowHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2255) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/borrow-history` | +| [getMarginRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2272) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/repay-history` | +| [getMarginInterestHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2289) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/interest-history` | +| [getMarginLiquidationHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2306) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/liquidation-history` | +| [getMarginFinancialHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2323) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/financial-records` | +| [getMarginAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2346) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/assets` | +| [marginBorrow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2357) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/borrow` | +| [marginRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2380) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/repay` | +| [getMarginRiskRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2405) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/risk-rate` | +| [getMarginMaxBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2417) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/max-borrowable-amount` | +| [getMarginMaxTransferable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2430) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/max-transfer-out-amount` | +| [getMarginInterestRateAndMaxBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2445) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/interest-rate-and-limit` | +| [getMarginTierConfiguration()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2461) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/tier-data` | +| [marginFlashRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2473) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/flash-repay` | +| [getMarginFlashRepayResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2491) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/query-flash-repay-status` | +| [marginSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2515) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/place-order` | +| [marginBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2528) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/batch-place-order` | +| [marginCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2539) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/cancel-order` | +| [marginBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2559) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/batch-cancel-order` | +| [getMarginOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2573) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/open-orders` | +| [getMarginHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2587) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/history-orders` | +| [getMarginHistoricOrderFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2604) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/fills` | +| [getMarginLiquidationOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2618) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/liquidation-order` | +| [getFuturesTraderCurrentOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2650) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-current-track` | +| [getFuturesTraderHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2659) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-history-track` | +| [modifyFuturesTraderOrderTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2668) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/order-modify-tpsl` | +| [getFuturesTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2677) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-total-detail` | +| [getFuturesTraderProfitHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2683) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-history-summarys` | +| [getFuturesTraderProfitShareHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2689) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-history-details` | +| [closeFuturesTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2698) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/order-close-positions` | +| [getFuturesTraderProfitShare()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2717) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-details` | +| [getFuturesTraderProfitShareGroup()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2733) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profits-group-coin-date` | +| [getFuturesTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2751) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/config-query-symbols` | +| [updateFuturesTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2760) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-setting-symbols` | +| [updateFuturesTraderGlobalSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2769) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-settings-base` | +| [getFuturesTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2780) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/config-query-followers` | +| [removeFuturesTraderFollower()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2789) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-remove-follower` | +| [getFuturesFollowerCurrentOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2806) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-current-orders` | +| [getFuturesFollowerHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2815) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-history-orders` | +| [updateFuturesFollowerTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2824) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/setting-tpsl` | +| [updateFuturesFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2830) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/settings` | +| [getFuturesFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2836) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-settings` | +| [closeFuturesFollowerPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2842) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/close-positions` | +| [getFuturesFollowerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2855) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-traders` | +| [getFuturesFollowerFollowLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2861) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-quantity-limit` | +| [unfollowFuturesTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2879) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/cancel-trader` | +| [getBrokerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2893) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-traders` | +| [getBrokerTradersHistoricalOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2897) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-history-traces` | +| [getBrokerTradersPendingOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2904) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-current-traces` | +| [getSpotTraderProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2919) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-summarys` | +| [getSpotTraderHistoryProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2923) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-history-details` | +| [getSpotTraderUnrealizedProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2932) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-details` | +| [getSpotTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2940) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-total-detail` | +| [modifySpotTraderOrderTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2944) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/order-modify-tpsl` | +| [getSpotTraderHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2955) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-history-track` | +| [getSpotTraderCurrentOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2964) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-current-track` | +| [sellSpotTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2973) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/order-close-tracking` | +| [getSpotTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2983) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/config-setting-symbols` | +| [removeSpotTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2993) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/config-remove-follower` | +| [getSpotTraderConfiguration()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3002) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/config-query-settings` | +| [getSpotTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3006) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/config-query-followers` | +| [cancelSpotFollowerOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3023) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/stop-order` | +| [updateSpotFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3029) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/settings` | +| [updateSpotFollowerTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3038) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/setting-tpsl` | +| [getSpotFollowerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3046) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-traders` | +| [getSpotFollowerCurrentTraderSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3055) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-trader-symbols` | +| [getSpotFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3066) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-settings` | +| [getSpotFollowerHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3072) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-history-orders` | +| [getSpotFollowerOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3081) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-current-orders` | +| [sellSpotFollower()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3090) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/order-close-tracking` | +| [unfollowSpotTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3100) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/cancel-trader` | +| [getEarnSavingsProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3114) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/product` | +| [getEarnSavingsAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3121) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/account` | +| [getEarnSavingsAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3125) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/assets` | +| [getEarnSavingsRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3131) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/records` | +| [getEarnSavingsSubscription()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3137) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/subscribe-info` | +| [earnSubscribeSavings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3144) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/subscribe` | +| [getEarnSavingsSubscriptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3157) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/subscribe-result` | +| [earnRedeemSavings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3169) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/redeem` | +| [getEarnSavingsRedemptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3178) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/redeem-result` | +| [getEarnAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3198) | :closed_lock_with_key: | GET | `/api/v2/earn/account/assets` | +| [getEarnEliteProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3217) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/product` | +| [getEarnEliteAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3221) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/assets` | +| [getEarnEliteRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3225) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/records` | +| [getEarnEliteSubscribeInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3231) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/subscribe-info` | +| [subscribeEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3237) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/subscribe` | +| [getEarnEliteSubscribeResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3243) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/subscribe-result` | +| [getEarnEliteRedeemInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3249) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/redeem-info` | +| [redeemEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3255) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/redeem` | +| [getSharkfinProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3269) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/product` | +| [getSharkfinAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3277) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/account` | +| [getSharkfinAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3281) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/assets` | +| [getSharkfinRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3287) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/records` | +| [getSharkfinSubscription()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3293) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/subscribe-info` | +| [subscribeSharkfin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3299) | :closed_lock_with_key: | POST | `/api/v2/earn/sharkfin/subscribe` | +| [getSharkfinSubscriptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3308) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/subscribe-result` | +| [getLoanCurrencies()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3325) | | GET | `/api/v2/earn/loan/public/coinInfos` | +| [getLoanEstInterestAndBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3331) | | GET | `/api/v2/earn/loan/public/hour-interest` | +| [borrowLoan()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3342) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/borrow` | +| [getOngoingLoanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3350) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/ongoing-orders` | +| [repayLoan()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3358) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/repay` | +| [getRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3364) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/repay-history` | +| [updateLoanPledgeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3370) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/revise-pledge` | +| [getLoanPledgeRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3380) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/revise-history` | +| [getLoanHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3386) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/borrow-history` | +| [getLoanDebts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3392) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/debts` | +| [getLoanLiquidationRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3396) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/reduces` | +| [getLoanProductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3408) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/product-infos` | +| [getLoanSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3414) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/symbols` | +| [getLoanMarginCoinInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3420) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/ensure-coins-convert` | +| [getLoanRiskUnit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3438) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/risk-unit` | +| [getLoanLTVConvert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3446) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/ltv-convert` | +| [getLoanRepaidHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3458) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/repaid-history` | +| [getLoanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3464) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/loan-order` | # rest-client-v3.ts @@ -348,177 +361,216 @@ This table includes all endpoints from the official Exchange API docs and corres | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | -| [getServerTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L402) | | GET | `/api/v3/public/time` | -| [getInstruments()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L419) | | GET | `/api/v3/market/instruments` | -| [getMarketFeeGroup()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L428) | | GET | `/api/v3/market/fee-group` | -| [getLiquidations()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L437) | | GET | `/api/v3/market/liquidations` | -| [getRpiSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L446) | | GET | `/api/v3/market/rpi-symbols` | -| [getRpiOrderBook()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L453) | | GET | `/api/v3/market/rpi-orderbook` | -| [getCashDividendRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L462) | | GET | `/api/v3/market/cash-dividend-records` | -| [getSpotWhaleFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L471) | | GET | `/api/v3/market/spot-whale-flow` | -| [getSpotFundFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L480) | | GET | `/api/v3/market/spot-fund-flow` | -| [getSpotNetFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L489) | | GET | `/api/v3/market/spot-net-flow` | -| [getMarginLongShort()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L498) | | GET | `/api/v3/market/margin-long-short` | -| [getMarginLoanGrowth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L507) | | GET | `/api/v3/market/margin-loan-growth` | -| [getMarginIsolatedBorrow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L516) | | GET | `/api/v3/market/margin-isolated-borrow` | -| [getFuturesActiveBuySell()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L525) | | GET | `/api/v3/market/futures-active-buy-sell` | -| [getFuturesLongShort()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L534) | | GET | `/api/v3/market/futures-long-short` | -| [getFuturesPositionLongShort()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L543) | | GET | `/api/v3/market/futures-position-long-short` | -| [getFuturesAccountLongShort()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L552) | | GET | `/api/v3/market/futures-account-long-short` | -| [getMarketScoreWeights()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L561) | | GET | `/api/v3/market/score-weights` | -| [getTickers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L570) | | GET | `/api/v3/market/tickers` | -| [getOrderBook()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L577) | | GET | `/api/v3/market/orderbook` | -| [getFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L586) | | GET | `/api/v3/market/fills` | -| [getProofOfReserves()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L595) | | GET | `/api/v3/market/proof-of-reserves` | -| [getOpenInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L602) | | GET | `/api/v3/market/open-interest` | -| [getCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L612) | | GET | `/api/v3/market/candles` | -| [getHistoryCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L621) | | GET | `/api/v3/market/history-candles` | -| [getCurrentFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L630) | | GET | `/api/v3/market/current-fund-rate` | -| [getHistoryFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L639) | | GET | `/api/v3/market/history-fund-rate` | -| [getRiskReserve()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L648) | | GET | `/api/v3/market/risk-reserve` | -| [getRiskReserveHour()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L657) | | GET | `/api/v3/market/risk-reserve-hour` | -| [getRiskReserveAll()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L666) | | GET | `/api/v3/market/risk-reserve-all` | -| [getDiscountRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L675) | | GET | `/api/v3/market/discount-rate` | -| [getMarginLoans()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L682) | | GET | `/api/v3/market/margin-loans` | -| [getPositionTier()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L691) | | GET | `/api/v3/market/position-tier` | -| [getContractsOi()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L700) | | GET | `/api/v3/market/oi-limit` | -| [getIndexComponents()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L709) | | GET | `/api/v3/market/index-components` | -| [getCopyFuturesTradingPairs()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L726) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/trading-pairs` | -| [getCopyFuturesPositionSummary()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L737) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/position-summary` | -| [getCopyFuturesMaxTransferable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L747) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/max-transferable` | -| [copyFuturesTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L757) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/transfer` | -| [getCopyFuturesTransferRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L767) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/transfer-record` | -| [getBalances()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L782) | :closed_lock_with_key: | GET | `/api/v3/account/assets` | -| [getFundingAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L789) | :closed_lock_with_key: | GET | `/api/v3/account/funding-assets` | -| [getAccountInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L799) | :closed_lock_with_key: | GET | `/api/v3/account/info` | -| [getAccountSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L807) | :closed_lock_with_key: | GET | `/api/v3/account/settings` | -| [adjustAccountMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L814) | :closed_lock_with_key: | POST | `/api/v3/account/adjust-account-mode` | -| [getDeltaInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L824) | :closed_lock_with_key: | GET | `/api/v3/account/delta-info` | -| [setLeverage()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L831) | :closed_lock_with_key: | POST | `/api/v3/account/set-leverage` | -| [setHoldMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L838) | :closed_lock_with_key: | POST | `/api/v3/account/set-hold-mode` | -| [getCollateralType()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L847) | :closed_lock_with_key: | GET | `/api/v3/account/collateral-type` | -| [setCollateralType()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L854) | :closed_lock_with_key: | POST | `/api/v3/account/set-collateral-type` | -| [getCustomCollateralCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L863) | | GET | `/api/v3/account/custom-collateral-coins` | -| [preSetLeverage()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L870) | :closed_lock_with_key: | GET | `/api/v3/account/pre-set-leverage` | -| [setMargin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L879) | :closed_lock_with_key: | POST | `/api/v3/account/set-margin` | -| [getMaxWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L886) | :closed_lock_with_key: | GET | `/api/v3/account/max-withdrawal` | -| [getFinancialRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L895) | :closed_lock_with_key: | GET | `/api/v3/account/financial-records` | -| [getRepayableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L907) | :closed_lock_with_key: | GET | `/api/v3/account/repayable-coins` | -| [getPaymentCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L919) | :closed_lock_with_key: | GET | `/api/v3/account/payment-coins` | -| [submitRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L931) | :closed_lock_with_key: | POST | `/api/v3/account/repay` | -| [getConvertRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L938) | :closed_lock_with_key: | GET | `/api/v3/account/convert-records` | -| [setDepositAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L953) | :closed_lock_with_key: | POST | `/api/v3/account/deposit-account` | -| [switchDeduct()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L962) | :closed_lock_with_key: | POST | `/api/v3/account/switch-deduct` | -| [getDeductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L969) | :closed_lock_with_key: | GET | `/api/v3/account/deduct-info` | -| [getFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L980) | :closed_lock_with_key: | GET | `/api/v3/account/fee-rate` | -| [getAllFeeRates()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L992) | :closed_lock_with_key: | GET | `/api/v3/account/all-fee-rate` | -| [getMaxTransferable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1005) | :closed_lock_with_key: | GET | `/api/v3/account/max-transferable` | -| [getOpenInterestLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1017) | :closed_lock_with_key: | GET | `/api/v3/account/open-interest-limit` | -| [downgradeAccountToClassic()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1032) | :closed_lock_with_key: | POST | `/api/v3/account/switch` | -| [getUnifiedAccountSwitchStatus()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1040) | :closed_lock_with_key: | GET | `/api/v3/account/switch-status` | -| [getTaxRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1056) | :closed_lock_with_key: | GET | `/api/v3/tax/records` | -| [createSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1071) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub` | -| [freezeSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1080) | :closed_lock_with_key: | POST | `/api/v3/user/freeze-sub` | -| [getSubUnifiedAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1089) | :closed_lock_with_key: | GET | `/api/v3/account/sub-unified-assets` | -| [getSubAccountList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1098) | :closed_lock_with_key: | GET | `/api/v3/user/sub-list` | -| [createSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1111) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub-api` | -| [updateSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1120) | :closed_lock_with_key: | POST | `/api/v3/user/update-sub-api` | -| [deleteSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1129) | :closed_lock_with_key: | POST | `/api/v3/user/delete-sub-api` | -| [getSubAccountApiKeys()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1138) | :closed_lock_with_key: | GET | `/api/v3/user/sub-api-list` | -| [getTransferableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1157) | :closed_lock_with_key: | GET | `/api/v3/account/transferable-coins` | -| [submitTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1166) | :closed_lock_with_key: | POST | `/api/v3/account/transfer` | -| [subAccountTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1175) | :closed_lock_with_key: | POST | `/api/v3/account/sub-transfer` | -| [getSubTransferRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1187) | :closed_lock_with_key: | GET | `/api/v3/account/sub-transfer-record` | -| [getDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1205) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-address` | -| [getSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1214) | :closed_lock_with_key: | GET | `/api/v3/account/sub-deposit-address` | -| [getDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1223) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-records` | -| [getSubDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1232) | :closed_lock_with_key: | POST | `/api/v3/account/sub-deposit-records` | -| [submitWithdraw()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1247) | :closed_lock_with_key: | POST | `/api/v3/account/withdraw` | -| [getWithdrawRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1256) | :closed_lock_with_key: | GET | `/api/v3/account/withdrawal-records` | -| [getWithdrawAddressBook()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1265) | :closed_lock_with_key: | GET | `/api/v3/account/withdraw-address` | -| [cancelWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1274) | :closed_lock_with_key: | POST | `/api/v3/account/cancel-withdrawal` | -| [submitNewOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1289) | :closed_lock_with_key: | POST | `/api/v3/trade/place-order` | -| [modifyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1298) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-order` | -| [placeRealityOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1307) | :closed_lock_with_key: | POST | `/api/v3/trade/place-reality-order` | -| [cancelRealityOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1316) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-reality-order` | -| [getLoanData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1325) | :closed_lock_with_key: | GET | `/api/v3/trade/loan-data` | -| [cancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1332) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-order` | -| [placeBatchOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1341) | :closed_lock_with_key: | POST | `/api/v3/trade/place-batch` | -| [batchModifyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1350) | :closed_lock_with_key: | POST | `/api/v3/trade/batch-modify-order` | -| [cancelBatchOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1359) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-batch` | -| [cancelAllOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1368) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-symbol-order` | -| [closeAllPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1377) | :closed_lock_with_key: | POST | `/api/v3/trade/close-positions` | -| [getOrderInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1386) | :closed_lock_with_key: | GET | `/api/v3/trade/order-info` | -| [getUnfilledOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1395) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-orders` | -| [getHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1407) | :closed_lock_with_key: | GET | `/api/v3/trade/history-orders` | -| [getTradeFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1419) | :closed_lock_with_key: | GET | `/api/v3/trade/fills` | -| [getCurrentPosition()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1431) | :closed_lock_with_key: | GET | `/api/v3/position/current-position` | -| [getPositionHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1442) | :closed_lock_with_key: | GET | `/api/v3/position/history-position` | -| [getMaxOpenAvailable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1454) | :closed_lock_with_key: | POST | `/api/v3/account/max-open-available` | -| [getPositionAdlRank()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1463) | :closed_lock_with_key: | GET | `/api/v3/position/adlRank` | -| [countdownCancelAll()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1470) | :closed_lock_with_key: | POST | `/api/v3/trade/countdown-cancel-all` | -| [getLoanTransfered()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1485) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/transfered` | -| [getLoanSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1494) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/symbols` | -| [getLoanRiskUnit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1503) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/risk-unit` | -| [getLoanRepaidHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1514) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/repaid-history` | -| [getLoanProductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1523) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/product-infos` | -| [getLoanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1532) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/loan-order` | -| [getLoanLTVConvert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1541) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/ltv-convert` | -| [getLoanMarginCoinInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1550) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/ensure-coins-convert` | -| [bindLoanUid()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1562) | :closed_lock_with_key: | POST | `/api/v3/ins-loan/bind-uid` | -| [getLoanCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1577) | :closed_lock_with_key: | GET | `/api/v3/loan/coins` | -| [getLoanInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1586) | :closed_lock_with_key: | GET | `/api/v3/loan/interest` | -| [loanBorrow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1595) | :closed_lock_with_key: | POST | `/api/v3/loan/borrow` | -| [getLoanBorrowOngoing()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1604) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-ongoing` | -| [getLoanBorrowHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1613) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-history` | -| [loanRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1622) | :closed_lock_with_key: | POST | `/api/v3/loan/repay` | -| [getLoanRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1631) | :closed_lock_with_key: | GET | `/api/v3/loan/repay-history` | -| [loanRevisePledge()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1640) | :closed_lock_with_key: | POST | `/api/v3/loan/revise-pledge` | -| [getLoanPledgeRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1649) | :closed_lock_with_key: | GET | `/api/v3/loan/pledge-rate-history` | -| [getLoanDebts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1658) | :closed_lock_with_key: | GET | `/api/v3/loan/debts` | -| [getLoanReduces()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1665) | :closed_lock_with_key: | GET | `/api/v3/loan/reduces` | -| [submitStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1680) | :closed_lock_with_key: | POST | `/api/v3/trade/place-strategy-order` | -| [modifyStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1689) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-strategy-order` | -| [cancelStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1698) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-strategy-order` | -| [getUnfilledStrategyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1707) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-strategy-orders` | -| [getHistoryStrategyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1716) | :closed_lock_with_key: | GET | `/api/v3/trade/history-strategy-orders` | -| [createBrokerSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1737) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub` | -| [getBrokerSubAccountList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1749) | :closed_lock_with_key: | GET | `/api/v3/broker/sub-list` | -| [modifyBrokerSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1761) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub` | -| [brokerSubWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1776) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-withdrawal` | -| [getBrokerSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1788) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-deposit-address` | -| [getBrokerAllSubDepositWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1800) | :closed_lock_with_key: | GET | `/api/v3/broker/all-sub-deposit-withdrawal` | -| [getBrokerCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1812) | :closed_lock_with_key: | GET | `/api/v3/broker/commission` | -| [createBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1824) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub-apikey` | -| [modifyBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1836) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub-apikey` | -| [deleteBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1852) | :closed_lock_with_key: | POST | `/api/v3/broker/delete-sub-apikey` | -| [getBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1864) | :closed_lock_with_key: | GET | `/api/v3/broker/query-sub-apikey` | -| [getP2pAdList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1876) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-list` | -| [getP2pExchangeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1882) | :closed_lock_with_key: | GET | `/api/v3/p2p/exchange-rate` | -| [simulateP2pFee()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1888) | :closed_lock_with_key: | POST | `/api/v3/p2p/fee-simulate` | -| [getP2pAdLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1894) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-limit` | -| [createP2pAd()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1900) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-create` | -| [updateP2pAd()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1906) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-update` | -| [operateP2pAd()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1910) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-operate` | -| [getP2pAdInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1914) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-info` | -| [getP2pMyAds()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1920) | :closed_lock_with_key: | GET | `/api/v3/p2p/my-ads` | -| [getP2pPendingOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1926) | :closed_lock_with_key: | GET | `/api/v3/p2p/pending-orders` | -| [getP2pAllOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1932) | :closed_lock_with_key: | GET | `/api/v3/p2p/all-orders` | -| [getP2pOrderInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1938) | :closed_lock_with_key: | GET | `/api/v3/p2p/order-info` | -| [confirmP2pOrderPayment()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1944) | :closed_lock_with_key: | POST | `/api/v3/p2p/order-pay` | -| [releaseP2pOrderAsset()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1950) | :closed_lock_with_key: | POST | `/api/v3/p2p/order-release` | -| [getP2pUserInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1956) | :closed_lock_with_key: | GET | `/api/v3/p2p/user-info` | -| [getP2pCurrencies()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1960) | :closed_lock_with_key: | GET | `/api/v3/p2p/currencies` | -| [getP2pPayMethods()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1964) | :closed_lock_with_key: | GET | `/api/v3/p2p/pay-method` | -| [getP2pBalance()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1968) | :closed_lock_with_key: | GET | `/api/v3/p2p/balance` | -| [getEarnEliteProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1980) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-product` | -| [getEarnEliteAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1984) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-assets` | -| [getEarnEliteRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1988) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-records` | -| [getEarnEliteSubscribeInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1994) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-subscribe-info` | -| [subscribeEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2000) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-subscribe` | -| [getEarnEliteSubscribeResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2006) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-subscribe-result` | -| [getEarnEliteRedeemInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2012) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-redeem-info` | -| [redeemEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2018) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-redeem` | +| [getServerTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L480) | | GET | `/api/v3/public/time` | +| [getInstruments()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L497) | | GET | `/api/v3/market/instruments` | +| [getMarketFeeGroup()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L506) | | GET | `/api/v3/market/fee-group` | +| [getLiquidations()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L515) | | GET | `/api/v3/market/liquidations` | +| [getRpiSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L524) | | GET | `/api/v3/market/rpi-symbols` | +| [getRpiOrderBook()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L531) | | GET | `/api/v3/market/rpi-orderbook` | +| [getCashDividendRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L540) | | GET | `/api/v3/market/cash-dividend-records` | +| [getSpotWhaleFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L549) | | GET | `/api/v3/market/spot-whale-flow` | +| [getSpotFundFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L558) | | GET | `/api/v3/market/spot-fund-flow` | +| [getSpotNetFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L567) | | GET | `/api/v3/market/spot-net-flow` | +| [getMarginLongShort()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L576) | | GET | `/api/v3/market/margin-long-short` | +| [getMarginLoanGrowth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L585) | | GET | `/api/v3/market/margin-loan-growth` | +| [getMarginIsolatedBorrow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L594) | | GET | `/api/v3/market/margin-isolated-borrow` | +| [getFuturesActiveBuySell()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L603) | | GET | `/api/v3/market/futures-active-buy-sell` | +| [getFuturesLongShort()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L612) | | GET | `/api/v3/market/futures-long-short` | +| [getFuturesPositionLongShort()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L621) | | GET | `/api/v3/market/futures-position-long-short` | +| [getFuturesAccountLongShort()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L630) | | GET | `/api/v3/market/futures-account-long-short` | +| [getMarketScoreWeights()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L639) | | GET | `/api/v3/market/score-weights` | +| [getTickers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L648) | | GET | `/api/v3/market/tickers` | +| [getOrderBook()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L655) | | GET | `/api/v3/market/orderbook` | +| [getFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L664) | | GET | `/api/v3/market/fills` | +| [getProofOfReserves()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L673) | | GET | `/api/v3/market/proof-of-reserves` | +| [getOpenInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L680) | | GET | `/api/v3/market/open-interest` | +| [getCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L690) | | GET | `/api/v3/market/candles` | +| [getHistoryCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L699) | | GET | `/api/v3/market/history-candles` | +| [getCurrentFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L708) | | GET | `/api/v3/market/current-fund-rate` | +| [getHistoryFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L717) | | GET | `/api/v3/market/history-fund-rate` | +| [getRiskReserve()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L726) | | GET | `/api/v3/market/risk-reserve` | +| [getRiskReserveHour()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L735) | | GET | `/api/v3/market/risk-reserve-hour` | +| [getRiskReserveAll()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L744) | | GET | `/api/v3/market/risk-reserve-all` | +| [getDiscountRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L753) | | GET | `/api/v3/market/discount-rate` | +| [getMarginLoans()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L760) | | GET | `/api/v3/market/margin-loans` | +| [getPositionTier()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L769) | | GET | `/api/v3/market/position-tier` | +| [getContractsOi()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L778) | | GET | `/api/v3/market/oi-limit` | +| [getIndexComponents()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L787) | | GET | `/api/v3/market/index-components` | +| [getRealityOrderBook()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L796) | :closed_lock_with_key: | GET | `/api/v3/account/reality-orderbook` | +| [getRealityFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L805) | :closed_lock_with_key: | GET | `/api/v3/account/reality-fills` | +| [getCopyFuturesTradingPairs()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L822) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/trading-pairs` | +| [getCopyFuturesPositionSummary()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L833) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/position-summary` | +| [getCopyFuturesMaxTransferable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L843) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/max-transferable` | +| [copyFuturesTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L853) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/transfer` | +| [getCopyFuturesTransferRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L863) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/transfer-record` | +| [getCopyFuturesCurrentFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L869) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/current-follower` | +| [getCopyFuturesHistoryFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L875) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/history-follower` | +| [getCopyFuturesProfitSummary()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L881) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/profit-summary` | +| [getCopyFuturesProfitDetails()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L887) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/profit-details` | +| [getStockPlusOptionQuote()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L899) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/option-quote` | +| [getStockPlusOptionChainInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L905) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/option-chain-info` | +| [getStockPlusOptionExpiryDate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L914) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/option-expiry-date` | +| [getStockPlusOptionVolume()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L923) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/option-volume` | +| [getStockPlusStaticInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L929) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/static` | +| [getStockPlusQuote()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L935) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/quote` | +| [getStockPlusTradeDetail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L941) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/trade` | +| [getStockPlusIntraday()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L947) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/intraday` | +| [getStockPlusHistoryCandlestick()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L953) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/history-candlestick` | +| [getStockPlusCandlestick()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L962) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/candlestick` | +| [getStockPlusDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L968) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/depth` | +| [placeStockPlusOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L974) | :closed_lock_with_key: | POST | `/api/v3/stockplus/trade/place-order` | +| [cancelStockPlusOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L980) | :closed_lock_with_key: | POST | `/api/v3/stockplus/trade/cancel-order` | +| [modifyStockPlusOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L986) | :closed_lock_with_key: | POST | `/api/v3/stockplus/trade/modify-order` | +| [getStockPlusTodayOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L992) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/today-orders` | +| [getStockPlusHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L998) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/history-orders` | +| [getStockPlusOrderDetail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1004) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/order-detail` | +| [getStockPlusTodayExecutions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1010) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/today-executions` | +| [getStockPlusHistoryExecutions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1016) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/history-executions` | +| [getStockPlusAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1025) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/account` | +| [getStockPlusCashFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1031) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/cash-flow` | +| [getStockPlusStockPosition()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1037) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/stock-position` | +| [stockPlusTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1043) | :closed_lock_with_key: | POST | `/api/v3/stockplus/asset/transfer` | +| [getStockPlusTransferRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1049) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/transfer-records` | +| [getBalances()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1064) | :closed_lock_with_key: | GET | `/api/v3/account/assets` | +| [getFundingAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1071) | :closed_lock_with_key: | GET | `/api/v3/account/funding-assets` | +| [getAccountInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1081) | :closed_lock_with_key: | GET | `/api/v3/account/info` | +| [getAccountSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1089) | :closed_lock_with_key: | GET | `/api/v3/account/settings` | +| [adjustAccountMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1096) | :closed_lock_with_key: | POST | `/api/v3/account/adjust-account-mode` | +| [getDeltaInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1106) | :closed_lock_with_key: | GET | `/api/v3/account/delta-info` | +| [setLeverage()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1113) | :closed_lock_with_key: | POST | `/api/v3/account/set-leverage` | +| [setHoldMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1120) | :closed_lock_with_key: | POST | `/api/v3/account/set-hold-mode` | +| [getCollateralType()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1129) | :closed_lock_with_key: | GET | `/api/v3/account/collateral-type` | +| [setCollateralType()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1136) | :closed_lock_with_key: | POST | `/api/v3/account/set-collateral-type` | +| [getCustomCollateralCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1145) | | GET | `/api/v3/account/custom-collateral-coins` | +| [preSetLeverage()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1152) | :closed_lock_with_key: | GET | `/api/v3/account/pre-set-leverage` | +| [setMargin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1161) | :closed_lock_with_key: | POST | `/api/v3/account/set-margin` | +| [getMaxWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1168) | :closed_lock_with_key: | GET | `/api/v3/account/max-withdrawal` | +| [getFinancialRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1177) | :closed_lock_with_key: | GET | `/api/v3/account/financial-records` | +| [getRepayableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1189) | :closed_lock_with_key: | GET | `/api/v3/account/repayable-coins` | +| [getPaymentCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1201) | :closed_lock_with_key: | GET | `/api/v3/account/payment-coins` | +| [submitRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1213) | :closed_lock_with_key: | POST | `/api/v3/account/repay` | +| [getConvertRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1220) | :closed_lock_with_key: | GET | `/api/v3/account/convert-records` | +| [setDepositAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1235) | :closed_lock_with_key: | POST | `/api/v3/account/deposit-account` | +| [switchDeduct()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1244) | :closed_lock_with_key: | POST | `/api/v3/account/switch-deduct` | +| [getDeductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1251) | :closed_lock_with_key: | GET | `/api/v3/account/deduct-info` | +| [getFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1262) | :closed_lock_with_key: | GET | `/api/v3/account/fee-rate` | +| [getAllFeeRates()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1274) | :closed_lock_with_key: | GET | `/api/v3/account/all-fee-rate` | +| [getMaxTransferable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1287) | :closed_lock_with_key: | GET | `/api/v3/account/max-transferable` | +| [getOpenInterestLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1299) | :closed_lock_with_key: | GET | `/api/v3/account/open-interest-limit` | +| [getEligibleSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1305) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-symbols` | +| [getEligibleMarginTier()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1311) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-margin-tier` | +| [getEligibleLoanInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1317) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-loan-info` | +| [downgradeAccountToClassic()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1332) | :closed_lock_with_key: | POST | `/api/v3/account/switch` | +| [getUnifiedAccountSwitchStatus()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1340) | :closed_lock_with_key: | GET | `/api/v3/account/switch-status` | +| [getTaxRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1356) | :closed_lock_with_key: | GET | `/api/v3/tax/records` | +| [createSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1371) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub` | +| [createAgentSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1380) | :closed_lock_with_key: | POST | `/api/v3/user/sub-account/agent-create` | +| [freezeSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1389) | :closed_lock_with_key: | POST | `/api/v3/user/freeze-sub` | +| [getSubUnifiedAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1398) | :closed_lock_with_key: | GET | `/api/v3/account/sub-unified-assets` | +| [getSubAccountList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1407) | :closed_lock_with_key: | GET | `/api/v3/user/sub-list` | +| [createSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1420) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub-api` | +| [updateSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1429) | :closed_lock_with_key: | POST | `/api/v3/user/update-sub-api` | +| [deleteSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1438) | :closed_lock_with_key: | POST | `/api/v3/user/delete-sub-api` | +| [getSubAccountApiKeys()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1447) | :closed_lock_with_key: | GET | `/api/v3/user/sub-api-list` | +| [getRateLimitQuota()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1457) | :closed_lock_with_key: | GET | `/api/v3/user/rate-limit-quota` | +| [setRateLimitQuota()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1463) | :closed_lock_with_key: | POST | `/api/v3/user/set-rate-limit-quota` | +| [getTransferableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1478) | :closed_lock_with_key: | GET | `/api/v3/account/transferable-coins` | +| [submitTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1487) | :closed_lock_with_key: | POST | `/api/v3/account/transfer` | +| [subAccountTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1496) | :closed_lock_with_key: | POST | `/api/v3/account/sub-transfer` | +| [getSubTransferRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1508) | :closed_lock_with_key: | GET | `/api/v3/account/sub-transfer-record` | +| [subMasterTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1520) | :closed_lock_with_key: | POST | `/api/v3/account/sub-master-transfer` | +| [getDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1538) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-address` | +| [getSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1547) | :closed_lock_with_key: | GET | `/api/v3/account/sub-deposit-address` | +| [getDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1556) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-records` | +| [getSubDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1565) | :closed_lock_with_key: | POST | `/api/v3/account/sub-deposit-records` | +| [submitWithdraw()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1580) | :closed_lock_with_key: | POST | `/api/v3/account/withdraw` | +| [getWithdrawRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1589) | :closed_lock_with_key: | GET | `/api/v3/account/withdrawal-records` | +| [getWithdrawAddressBook()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1598) | :closed_lock_with_key: | GET | `/api/v3/account/withdraw-address` | +| [cancelWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1607) | :closed_lock_with_key: | POST | `/api/v3/account/cancel-withdrawal` | +| [submitNewOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1622) | :closed_lock_with_key: | POST | `/api/v3/trade/place-order` | +| [modifyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1631) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-order` | +| [placeRealityOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1640) | :closed_lock_with_key: | POST | `/api/v3/trade/place-reality-order` | +| [cancelRealityOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1649) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-reality-order` | +| [getLoanData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1658) | :closed_lock_with_key: | GET | `/api/v3/trade/loan-data` | +| [cancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1665) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-order` | +| [placeBatchOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1674) | :closed_lock_with_key: | POST | `/api/v3/trade/place-batch` | +| [batchModifyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1683) | :closed_lock_with_key: | POST | `/api/v3/trade/batch-modify-order` | +| [cancelBatchOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1692) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-batch` | +| [cancelAllOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1701) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-symbol-order` | +| [closeAllPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1710) | :closed_lock_with_key: | POST | `/api/v3/trade/close-positions` | +| [getOrderInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1719) | :closed_lock_with_key: | GET | `/api/v3/trade/order-info` | +| [getUnfilledOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1728) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-orders` | +| [getHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1740) | :closed_lock_with_key: | GET | `/api/v3/trade/history-orders` | +| [movePositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1752) | :closed_lock_with_key: | POST | `/api/v3/account/move-positions` | +| [getMovePositionHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1761) | :closed_lock_with_key: | GET | `/api/v3/account/move-position-history` | +| [getTradeFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1773) | :closed_lock_with_key: | GET | `/api/v3/trade/fills` | +| [getCurrentPosition()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1785) | :closed_lock_with_key: | GET | `/api/v3/position/current-position` | +| [getPositionHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1796) | :closed_lock_with_key: | GET | `/api/v3/position/history-position` | +| [getMaxOpenAvailable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1808) | :closed_lock_with_key: | POST | `/api/v3/account/max-open-available` | +| [getPositionAdlRank()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1817) | :closed_lock_with_key: | GET | `/api/v3/position/adlRank` | +| [countdownCancelAll()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1824) | :closed_lock_with_key: | POST | `/api/v3/trade/countdown-cancel-all` | +| [getLoanTransfered()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1839) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/transfered` | +| [getLoanSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1848) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/symbols` | +| [getLoanRiskUnit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1857) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/risk-unit` | +| [getLoanRepaidHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1868) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/repaid-history` | +| [getLoanProductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1877) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/product-infos` | +| [getLoanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1886) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/loan-order` | +| [getLoanLTVConvert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1895) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/ltv-convert` | +| [getLoanMarginCoinInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1904) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/ensure-coins-convert` | +| [bindLoanUid()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1916) | :closed_lock_with_key: | POST | `/api/v3/ins-loan/bind-uid` | +| [getLoanCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1931) | :closed_lock_with_key: | GET | `/api/v3/loan/coins` | +| [getLoanInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1940) | :closed_lock_with_key: | GET | `/api/v3/loan/interest` | +| [loanBorrow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1949) | :closed_lock_with_key: | POST | `/api/v3/loan/borrow` | +| [getLoanBorrowOngoing()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1958) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-ongoing` | +| [getLoanBorrowHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1967) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-history` | +| [loanRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1976) | :closed_lock_with_key: | POST | `/api/v3/loan/repay` | +| [getLoanRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1985) | :closed_lock_with_key: | GET | `/api/v3/loan/repay-history` | +| [loanRevisePledge()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1994) | :closed_lock_with_key: | POST | `/api/v3/loan/revise-pledge` | +| [getLoanPledgeRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2003) | :closed_lock_with_key: | GET | `/api/v3/loan/pledge-rate-history` | +| [getLoanDebts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2012) | :closed_lock_with_key: | GET | `/api/v3/loan/debts` | +| [getLoanReduces()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2019) | :closed_lock_with_key: | GET | `/api/v3/loan/reduces` | +| [submitStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2034) | :closed_lock_with_key: | POST | `/api/v3/trade/place-strategy-order` | +| [modifyStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2043) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-strategy-order` | +| [cancelStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2052) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-strategy-order` | +| [getUnfilledStrategyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2061) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-strategy-orders` | +| [getHistoryStrategyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2070) | :closed_lock_with_key: | GET | `/api/v3/trade/history-strategy-orders` | +| [createBrokerSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2091) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub` | +| [getBrokerSubAccountList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2103) | :closed_lock_with_key: | GET | `/api/v3/broker/sub-list` | +| [modifyBrokerSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2115) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub` | +| [brokerSubWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2130) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-withdrawal` | +| [getBrokerSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2142) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-deposit-address` | +| [getBrokerAllSubDepositWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2154) | :closed_lock_with_key: | GET | `/api/v3/broker/all-sub-deposit-withdrawal` | +| [getBrokerCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2166) | :closed_lock_with_key: | GET | `/api/v3/broker/commission` | +| [createBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2178) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub-apikey` | +| [modifyBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2190) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub-apikey` | +| [deleteBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2206) | :closed_lock_with_key: | POST | `/api/v3/broker/delete-sub-apikey` | +| [getBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2218) | :closed_lock_with_key: | GET | `/api/v3/broker/query-sub-apikey` | +| [getP2pAdList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2230) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-list` | +| [getP2pExchangeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2236) | :closed_lock_with_key: | GET | `/api/v3/p2p/exchange-rate` | +| [simulateP2pFee()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2242) | :closed_lock_with_key: | POST | `/api/v3/p2p/fee-simulate` | +| [getP2pAdLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2248) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-limit` | +| [createP2pAd()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2254) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-create` | +| [updateP2pAd()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2260) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-update` | +| [operateP2pAd()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2264) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-operate` | +| [getP2pAdInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2268) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-info` | +| [getP2pMyAds()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2274) | :closed_lock_with_key: | GET | `/api/v3/p2p/my-ads` | +| [getP2pPendingOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2280) | :closed_lock_with_key: | GET | `/api/v3/p2p/pending-orders` | +| [getP2pAllOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2286) | :closed_lock_with_key: | GET | `/api/v3/p2p/all-orders` | +| [getP2pOrderInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2292) | :closed_lock_with_key: | GET | `/api/v3/p2p/order-info` | +| [confirmP2pOrderPayment()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2298) | :closed_lock_with_key: | POST | `/api/v3/p2p/order-pay` | +| [releaseP2pOrderAsset()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2304) | :closed_lock_with_key: | POST | `/api/v3/p2p/order-release` | +| [getP2pUserInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2310) | :closed_lock_with_key: | GET | `/api/v3/p2p/user-info` | +| [getP2pCurrencies()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2314) | :closed_lock_with_key: | GET | `/api/v3/p2p/currencies` | +| [getP2pPayMethods()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2318) | :closed_lock_with_key: | GET | `/api/v3/p2p/pay-method` | +| [getP2pBalance()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2322) | :closed_lock_with_key: | GET | `/api/v3/p2p/balance` | +| [getEarnEliteProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2334) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-product` | +| [getEarnEliteAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2338) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-assets` | +| [getEarnEliteRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2342) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-records` | +| [getEarnEliteSubscribeInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2348) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-subscribe-info` | +| [subscribeEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2354) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-subscribe` | +| [getEarnEliteSubscribeResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2360) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-subscribe-result` | +| [getEarnEliteRedeemInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2366) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-redeem-info` | +| [redeemEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2372) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-redeem` | # websocket-api-client.ts diff --git a/examples/apidoc/RestClientV3/Account/get-eligible-loan-info.js b/examples/apidoc/RestClientV3/Account/get-eligible-loan-info.js new file mode 100644 index 0000000..1a87d19 --- /dev/null +++ b/examples/apidoc/RestClientV3/Account/get-eligible-loan-info.js @@ -0,0 +1,18 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getEligibleLoanInfo() + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Account/get-eligible-margin-tier.js b/examples/apidoc/RestClientV3/Account/get-eligible-margin-tier.js new file mode 100644 index 0000000..aa13e22 --- /dev/null +++ b/examples/apidoc/RestClientV3/Account/get-eligible-margin-tier.js @@ -0,0 +1,18 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getEligibleMarginTier() + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Account/get-eligible-symbols.js b/examples/apidoc/RestClientV3/Account/get-eligible-symbols.js new file mode 100644 index 0000000..d732bc2 --- /dev/null +++ b/examples/apidoc/RestClientV3/Account/get-eligible-symbols.js @@ -0,0 +1,18 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getEligibleSymbols() + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Copy-Trading/copy-trading-transfer.js b/examples/apidoc/RestClientV3/Copy-Trading/copy-trading-transfer.js index a6c8b31..810f4da 100644 --- a/examples/apidoc/RestClientV3/Copy-Trading/copy-trading-transfer.js +++ b/examples/apidoc/RestClientV3/Copy-Trading/copy-trading-transfer.js @@ -13,6 +13,7 @@ client type: 'in', coin: 'USDT', amount: '100', + inAccountType: 'funding,uta,otc', }) .then((response) => { console.log(response); diff --git a/examples/apidoc/RestClientV3/Copy-Trading/get-current-followers.js b/examples/apidoc/RestClientV3/Copy-Trading/get-current-followers.js new file mode 100644 index 0000000..46ca48d --- /dev/null +++ b/examples/apidoc/RestClientV3/Copy-Trading/get-current-followers.js @@ -0,0 +1,18 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getCopyFuturesCurrentFollowers() + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Copy-Trading/get-history-followers.js b/examples/apidoc/RestClientV3/Copy-Trading/get-history-followers.js new file mode 100644 index 0000000..422cb39 --- /dev/null +++ b/examples/apidoc/RestClientV3/Copy-Trading/get-history-followers.js @@ -0,0 +1,18 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getCopyFuturesHistoryFollowers() + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Copy-Trading/get-profit-details.js b/examples/apidoc/RestClientV3/Copy-Trading/get-profit-details.js new file mode 100644 index 0000000..aad3cf8 --- /dev/null +++ b/examples/apidoc/RestClientV3/Copy-Trading/get-profit-details.js @@ -0,0 +1,18 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getCopyFuturesProfitDetails() + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Copy-Trading/get-profit-summary.js b/examples/apidoc/RestClientV3/Copy-Trading/get-profit-summary.js new file mode 100644 index 0000000..f3c745e --- /dev/null +++ b/examples/apidoc/RestClientV3/Copy-Trading/get-profit-summary.js @@ -0,0 +1,18 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getCopyFuturesProfitSummary() + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Asset/get-account.js b/examples/apidoc/RestClientV3/Stock+/Asset/get-account.js new file mode 100644 index 0000000..063e22f --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Asset/get-account.js @@ -0,0 +1,18 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusAccount() + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Asset/get-cash-flow.js b/examples/apidoc/RestClientV3/Stock+/Asset/get-cash-flow.js new file mode 100644 index 0000000..9afdd54 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Asset/get-cash-flow.js @@ -0,0 +1,21 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusCashFlow({ + startTime: '1650037563', + endTime: '1650747581', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Asset/get-stock-position.js b/examples/apidoc/RestClientV3/Stock+/Asset/get-stock-position.js new file mode 100644 index 0000000..f035a3d --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Asset/get-stock-position.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusStockPosition({ + symbol: 'AAPL.US,MSTR.US', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Asset/get-transfer-records.js b/examples/apidoc/RestClientV3/Stock+/Asset/get-transfer-records.js new file mode 100644 index 0000000..b5b79a9 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Asset/get-transfer-records.js @@ -0,0 +1,18 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusTransferRecords() + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Asset/transfer.js b/examples/apidoc/RestClientV3/Stock+/Asset/transfer.js new file mode 100644 index 0000000..4db770c --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Asset/transfer.js @@ -0,0 +1,22 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .stockPlusTransfer({ + coin: 'USDC', + amount: '100', + direction: 'in', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-chain-info.js b/examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-chain-info.js new file mode 100644 index 0000000..04c126b --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-chain-info.js @@ -0,0 +1,21 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusOptionChainInfo({ + symbol: 'AAPL.US', + expiryDate: '20220429', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-expiry-date.js b/examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-expiry-date.js new file mode 100644 index 0000000..c5ce3f4 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-expiry-date.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusOptionExpiryDate({ + symbol: 'AAPL.US', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-quote.js b/examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-quote.js new file mode 100644 index 0000000..f89f1cb --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-quote.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusOptionQuote({ + symbol: 'AAPL220429P162500.US', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-volume.js b/examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-volume.js new file mode 100644 index 0000000..32901c4 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Market/Options/get-option-volume.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusOptionVolume({ + symbol: 'AAPL.US', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-candlestick.js b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-candlestick.js new file mode 100644 index 0000000..06cb47f --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-candlestick.js @@ -0,0 +1,23 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusCandlestick({ + symbol: 'AAPL.US', + period: 'Min_1', + count: '10', + adjustType: 'NoAdjust', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-depth.js b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-depth.js new file mode 100644 index 0000000..fc249d1 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-depth.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusDepth({ + symbol: 'AAPL.US', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-history-candlestick.js b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-history-candlestick.js new file mode 100644 index 0000000..6fbb1a8 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-history-candlestick.js @@ -0,0 +1,23 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusHistoryCandlestick({ + symbol: 'AAPL.US', + period: 'Min_1', + count: '10', + adjustType: 'NoAdjust', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-intraday.js b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-intraday.js new file mode 100644 index 0000000..e193276 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-intraday.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusIntraday({ + symbol: 'AAPL.US', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-quote.js b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-quote.js new file mode 100644 index 0000000..2786c58 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-quote.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusQuote({ + symbol: 'AAPL.US', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-static-info.js b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-static-info.js new file mode 100644 index 0000000..cc1d308 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-static-info.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusStaticInfo({ + symbol: 'AAPL.US', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-trade-detail.js b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-trade-detail.js new file mode 100644 index 0000000..b7fc3cb --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Market/equity-etf/get-trade-detail.js @@ -0,0 +1,21 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusTradeDetail({ + symbol: 'AAPL.US', + count: '10', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Trade/cancel-order.js b/examples/apidoc/RestClientV3/Stock+/Trade/cancel-order.js new file mode 100644 index 0000000..f8e53da --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Trade/cancel-order.js @@ -0,0 +1,21 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .cancelStockPlusOrder({ + symbol: 'AAPL220429C150000.US', + orderId: '701276261045858304', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Trade/get-history-executions.js b/examples/apidoc/RestClientV3/Stock+/Trade/get-history-executions.js new file mode 100644 index 0000000..8e535a0 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Trade/get-history-executions.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusHistoryExecutions({ + symbol: 'AAPL.US', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Trade/get-history-orders.js b/examples/apidoc/RestClientV3/Stock+/Trade/get-history-orders.js new file mode 100644 index 0000000..60f189f --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Trade/get-history-orders.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusHistoryOrders({ + symbol: 'AAPL.US', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Trade/get-order-detail.js b/examples/apidoc/RestClientV3/Stock+/Trade/get-order-detail.js new file mode 100644 index 0000000..16fea7d --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Trade/get-order-detail.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusOrderDetail({ + orderId: '701276261045858304', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Trade/get-today-executions.js b/examples/apidoc/RestClientV3/Stock+/Trade/get-today-executions.js new file mode 100644 index 0000000..a4464f0 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Trade/get-today-executions.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusTodayExecutions({ + symbol: 'AAPL.US', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Trade/get-today-orders.js b/examples/apidoc/RestClientV3/Stock+/Trade/get-today-orders.js new file mode 100644 index 0000000..09b83c1 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Trade/get-today-orders.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getStockPlusTodayOrders({ + symbol: 'AAPL.US', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Trade/modify-order.js b/examples/apidoc/RestClientV3/Stock+/Trade/modify-order.js new file mode 100644 index 0000000..72c82b6 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Trade/modify-order.js @@ -0,0 +1,22 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .modifyStockPlusOrder({ + orderId: '701276261045858304', + quantity: '200', + price: '155.00', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Stock+/Trade/place-order.js b/examples/apidoc/RestClientV3/Stock+/Trade/place-order.js new file mode 100644 index 0000000..57b0cb0 --- /dev/null +++ b/examples/apidoc/RestClientV3/Stock+/Trade/place-order.js @@ -0,0 +1,26 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .placeStockPlusOrder({ + symbol: 'AAPL.US', + orderType: 'LO', + side: 'Buy', + submittedQuantity: '100', + timeInForce: 'Day', + submittedPrice: '150.00', + outsideRth: 'RTHOnly', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Sub-Account/get-ratelimit-quota.js b/examples/apidoc/RestClientV3/Sub-Account/get-ratelimit-quota.js new file mode 100644 index 0000000..188311d --- /dev/null +++ b/examples/apidoc/RestClientV3/Sub-Account/get-ratelimit-quota.js @@ -0,0 +1,20 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .getRateLimitQuota({ + category: 'futures', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Sub-Account/set-ratelimit-quota.js b/examples/apidoc/RestClientV3/Sub-Account/set-ratelimit-quota.js new file mode 100644 index 0000000..2f86546 --- /dev/null +++ b/examples/apidoc/RestClientV3/Sub-Account/set-ratelimit-quota.js @@ -0,0 +1,22 @@ +import { RestClientV3 } from 'bitget-api'; +// or, if require is preferred: +// const { RestClientV3 } = require('bitget-api'); + +const client = new RestClientV3({ + apiKey: 'insert_api_key_here', + apiSecret: 'insert_api_secret_here', + apiPass: 'insert_api_pass_here', +}); + +client + .setRateLimitQuota({ + category: 'futures', + uids: ['123456', '123457'], + quota: '100', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/RestClientV3/Trade/cancel-reality-order.js b/examples/apidoc/RestClientV3/Trade/cancel-reality-order.js index b2d1d2e..9766a31 100644 --- a/examples/apidoc/RestClientV3/Trade/cancel-reality-order.js +++ b/examples/apidoc/RestClientV3/Trade/cancel-reality-order.js @@ -10,6 +10,7 @@ const client = new RestClientV3({ client .cancelRealityOrder({ + category: 'SPOT', symbol: 'rAAPLUSDT', orderId: '121211212122', }) diff --git a/examples/apidoc/RestClientV3/Trade/place-reality-order.js b/examples/apidoc/RestClientV3/Trade/place-reality-order.js index 8fd6c37..76b1d0b 100644 --- a/examples/apidoc/RestClientV3/Trade/place-reality-order.js +++ b/examples/apidoc/RestClientV3/Trade/place-reality-order.js @@ -10,6 +10,7 @@ const client = new RestClientV3({ client .placeRealityOrder({ + category: 'SPOT', symbol: 'rAAPLUSDT', side: 'buy', orderType: 'limit', diff --git a/llms.txt b/llms.txt index a7dc479..48aa7de 100644 --- a/llms.txt +++ b/llms.txt @@ -48,6 +48,8 @@ Notes: ================================================================ Directory Structure ================================================================ +docs/ + BITGET_SDK_QUICKSTART_GUIDE.md examples/ auth/ fasterHmacSign.ts @@ -90,6 +92,7 @@ src/ copytrading.ts earn.ts futures.ts + instloan.ts margin.ts spot.ts v3/ @@ -100,6 +103,7 @@ src/ loan.ts p2p.ts public.ts + stockplus.ts strategy.ts trade.ts shared.ts @@ -110,6 +114,7 @@ src/ copy-trading.ts earn.ts futures.ts + instloan.ts margin.ts spot.ts v3/ @@ -120,6 +125,7 @@ src/ loan.ts p2p.ts public.ts + stockplus.ts strategy.ts trade.ts websockets/ @@ -745,417 +751,231 @@ export interface GetMarginLiquidationOrdersRequestV2 { } ================ -File: src/types/request/v2/spot.ts +File: src/types/request/v3/stockplus.ts ================ -type SpotKlineIntervalV2 = - | '1min' - | '5min' - | '15min' - | '30min' - | '1h' - | '4h' - | '6h' - | '12h' - | '1day' - | '3day' - | '1week' - | '1M' - | '6Hutc' - | '12Hutc' - | '1Dutc' - | '3Dutc' - | '1Wutc' - | '1Mutc'; +/** + * + * + * Stock+ (UTA) + * + * + */ ⋮---- -export interface SpotCandlesRequestV2 { +export interface GetStockPlusOptionQuoteRequestV3 { symbol: string; - granularity: SpotKlineIntervalV2; - startTime?: string; - endTime?: string; - limit?: string; } ⋮---- -export interface SpotHistoricCandlesRequestV2 { +export interface GetStockPlusOptionChainInfoRequestV3 { symbol: string; - granularity: SpotKlineIntervalV2; - endTime?: string; - limit?: string; + expiryDate: string; } ⋮---- -export interface SpotHistoricTradesRequestV2 { +export interface GetStockPlusOptionExpiryDateRequestV3 { symbol: string; - limit?: string; - idLessThan?: string; - startTime?: string; - endTime?: string; } ⋮---- -/** - * - * * Spot | Trade - * - */ +export interface GetStockPlusOptionVolumeRequestV3 { + symbol: string; +} ⋮---- -export type SpotOrderSideV2 = 'buy' | 'sell'; +export interface GetStockPlusStaticInfoRequestV3 { + symbol: string; +} ⋮---- -export type SpotOrderTypeV2 = 'limit' | 'market'; +export interface GetStockPlusQuoteRequestV3 { + symbol: string; +} ⋮---- -export type SpotOrderForceV2 = 'gtc' | 'post_only' | 'fok' | 'ioc'; +export interface GetStockPlusTradeDetailRequestV3 { + symbol: string; + count?: string; +} ⋮---- -export type SpotTPSLTypeV2 = 'normal' | 'tpsl'; +export interface GetStockPlusIntradayRequestV3 { + symbol: string; +} ⋮---- -export type SpotSTPModeV2 = - | 'none' - | 'cancel_taker' - | 'cancel_maker' - | 'cancel_both'; +export interface GetStockPlusHistoryCandlestickRequestV3 { + symbol: string; + period: string; + count?: string; + adjustType?: string; + forward?: boolean; + time?: string; + tradeSessions?: string; +} ⋮---- -export type SpotBatchModeV2 = 'single' | 'multiple'; +export interface GetStockPlusCandlestickRequestV3 { + symbol: string; + period: string; + count?: string; + adjustType?: string; + tradeSessions?: string; +} ⋮---- -export interface SpotOrderRequestV2 { +export interface GetStockPlusDepthRequestV3 { symbol: string; - side: SpotOrderSideV2; - orderType: SpotOrderTypeV2; - force: SpotOrderForceV2; - price?: string; - size: string; - clientOid?: string; - triggerPrice?: string; - tpslType?: SpotTPSLTypeV2; - requestTime?: string; - receiveWindow?: string; - stpMode?: SpotSTPModeV2; - presetTakeProfitPrice?: string; - executeTakeProfitPrice?: string; - presetStopLossPrice?: string; - executeStopLossPrice?: string; } ⋮---- -export interface SpotCancelandSubmitOrderRequestV2 { +export interface PlaceStockPlusOrderRequestV3 { symbol: string; - price: string; - size: string; - orderId?: string; - clientOid?: string; - newClientOid?: string; - presetTakeProfitPrice?: string; - executeTakeProfitPrice?: string; - presetStopLossPrice?: string; - executeStopLossPrice?: string; + orderType: 'LO' | 'MO' | 'LIT' | 'MIT' | 'TSLPAMT' | 'TSLPPCT'; + side: 'Buy' | 'Sell'; + submittedQuantity: string; + timeInForce: 'Day' | 'GoodTilCanceled' | 'GoodTilDate'; + submittedPrice?: string; + triggerPrice?: string; + limitOffset?: string; + trailingAmount?: string; + trailingPercent?: string; + expireDate?: string; + outsideRth?: 'RTHOnly' | 'AnyTime' | 'Overnight'; + limitDepthLevel?: number; + triggerCount?: number; + monitorPrice?: string; + remark?: string; } ⋮---- -export interface SpotCancelOrderRequestV2 { +export interface CancelStockPlusOrderRequestV3 { symbol: string; - tpslType?: SpotTPSLTypeV2; orderId?: string; clientOid?: string; } ⋮---- -export interface SpotBatchOrderRequestItemV2 { - symbol?: string; - side: SpotOrderSideV2; - orderType: SpotOrderTypeV2; - force: SpotOrderForceV2; +export interface ModifyStockPlusOrderRequestV3 { + orderId: string; + quantity: string; price?: string; - size: string; - clientOid?: string; - stpMode?: SpotSTPModeV2; - presetTakeProfitPrice?: string; - executeTakeProfitPrice?: string; - presetStopLossPrice?: string; - executeStopLossPrice?: string; + triggerPrice?: string; + limitOffset?: string; + trailingAmount?: string; + trailingPercent?: string; + limitDepthLevel?: number; + triggerCount?: number; + monitorPrice?: string; + remark?: string; } ⋮---- -export interface SpotBatchOrderRequestV2 { +export interface GetStockPlusTodayOrdersRequestV3 { symbol?: string; - batchMode?: SpotBatchModeV2; - orderList: SpotBatchOrderRequestItemV2[]; + status?: string | string[]; + side?: string; + market?: string; + orderId?: string; } ⋮---- -export interface SpotBatchCancelOrderRequestV2 { +export interface GetStockPlusHistoryOrdersRequestV3 { symbol?: string; - batchMode?: SpotBatchModeV2; - orderList: { - symbol?: string; - orderId?: string; - clientOid?: string; - }[]; + status?: string | string[]; + side?: string; + market?: string; + startAt?: string; + endAt?: string; } ⋮---- -export interface GetSpotOrderInfoRequestV2 { - orderId?: string; - clientOid?: string; - requestTime?: string; - receiveWindow?: string; +export interface GetStockPlusOrderDetailRequestV3 { + orderId: string; } ⋮---- -export interface GetSpotOpenOrdersRequestV2 { +export interface GetStockPlusTodayExecutionsRequestV3 { symbol?: string; - startTime?: string; - endTime?: string; - idLessThan?: string; - limit?: string; orderId?: string; - tpslType?: SpotTPSLTypeV2; - requestTime?: string; - receiveWindow?: string; } ⋮---- -export interface GetSpotHistoryOrdersRequestV2 { +export interface GetStockPlusHistoryExecutionsRequestV3 { symbol?: string; - startTime?: string; - endTime?: string; - idLessThan?: string; - limit?: string; - orderId?: string; - tpslType?: SpotTPSLTypeV2; - requestTime?: string; - receiveWindow?: string; + startAt?: string; + endAt?: string; } ⋮---- -export interface GetSpotFillsRequestV2 { - symbol: string; - orderId?: string; +export interface GetStockPlusAccountRequestV3 { + currency?: string; +} +⋮---- +export interface GetStockPlusCashFlowRequestV3 { + startTime: string; + endTime: string; + businessType?: string; + symbol?: string; + page?: string; + size?: string; +} +⋮---- +export interface GetStockPlusStockPositionRequestV3 { + symbol?: string; +} +⋮---- +export interface StockPlusTransferRequestV3 { + coin?: string; + amount?: string; + direction?: 'in' | 'out'; +} +⋮---- +export interface GetStockPlusTransferRecordsRequestV3 { + transferId?: string; startTime?: string; endTime?: string; limit?: string; - idLessThan?: string; + cursor?: string; +} + +================ +File: src/types/request/shared.ts +================ +/** Pagination */ +export interface Pagination { + /** Time after */ + after?: string; + /** Time before */ + before?: string; + /** Elements per page */ + limit?: string; } ⋮---- -/** - * - * * Spot | Trigger Orders - * - */ -⋮---- -export type SpotPlanTypeV2 = 'amount' | 'total'; +/** Time after */ ⋮---- -export type SpotTriggerTypeV2 = 'fill_price' | 'mark_price'; +/** Time before */ ⋮---- -export interface SpotPlanOrderRequestV2 { - symbol: string; - side: SpotOrderSideV2; - triggerPrice: string; - orderType: SpotOrderTypeV2; - executePrice?: string; - planType?: SpotPlanTypeV2; - size: string; - triggerType: SpotTriggerTypeV2; - clientOid?: string; - force?: SpotOrderForceV2; - stpMode?: SpotSTPModeV2; -} +/** Elements per page */ ⋮---- -export interface SpotModifyPlanOrderRequestV2 { - orderId?: string; - clientOid?: string; - triggerPrice: string; - orderType: SpotOrderTypeV2; - executePrice?: string; - size: string; -} +export type OrderTimeInForce = 'normal' | 'post_only' | 'fok' | 'ioc'; ⋮---- -export interface GetSpotCurrentPlanOrdersRequestV2 { +export interface GetHistoricTradesParams { symbol: string; limit?: string; - idLessThan?: string; + tradeId?: string; startTime?: string; endTime?: string; } ⋮---- -export interface GetSpotHistoryPlanOrdersRequestV2 { - symbol: string; - startTime: string; - endTime: string; - limit?: string; -} +/** + * The margin type, used directly in building the endpoint URL + */ +export type MarginType = 'crossed' | 'isolated'; +⋮---- +export type FuturesProductTypeV2 = + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES' + | 'SUSDT-FUTURES' + | 'SCOIN-FUTURES' + | 'SUSDC-FUTURES'; ⋮---- +export type FuturesPlanTypeV2 = + | 'profit_plan' + | 'loss_plan' + | 'moving_plan' + | 'pos_profit' + | 'pos_loss'; + +================ +File: src/types/response/v2/copy-trading.ts +================ /** * - * * Spot | Account - * - */ -⋮---- -export type SpotBillGroupTypeV2 = - | 'deposit' - | 'withdraw' - | 'transaction' - | 'transfer' - | 'other'; -⋮---- -export type SpotBusinessTypeV2 = - | 'deposit' - | 'withdraw' - | 'buy' - | 'sell' - | 'deduction of handling fee' - | 'transfer-in' - | 'transfer-out' - | 'rebate rewards' - | 'airdrop rewards' - | 'USDT contract rewards' - | 'mix contract rewards' - | 'system lock' - | 'user lock'; -⋮---- -export type SpotAccountTypeV2 = - | 'spot' - | 'p2p' - | 'coin_futures' - | 'usdt_futures' - | 'usdc_futures' - | 'crossed_margin' - | 'isolated_margin'; -⋮---- -export interface GetSpotAccountBillsRequestV2 { - coin?: string; - groupType?: SpotBillGroupTypeV2; - businessType?: SpotBusinessTypeV2; - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: string; -} -⋮---- -export interface SpotTransferRequestV2 { - fromType: SpotAccountTypeV2; - toType: SpotAccountTypeV2; - amount: string; - coin: string; - symbol: string; - clientOid?: string; -} -⋮---- -export interface SpotSubAccountTransferRequestV2 { - fromType: SpotAccountTypeV2; - toType: SpotAccountTypeV2; - amount: string; - coin: string; - symbol?: string; - clientOid?: string; - fromUserId: string; - toUserId: string; -} -⋮---- -export interface SpotWithdrawalRequestV2 { - coin: string; - transferType: 'on_chain' | 'internal_transfer'; - address: string; - chain?: string; - innerToType?: 'email' | 'mobile' | 'uid'; - areaCode?: string; - tag?: string; - size: string; - remark?: string; - clientOid?: string; -} -⋮---- -export interface SpotMainSubTransferRecordRequestV2 { - coin?: string; - role?: 'initiator' | 'receiver'; - subUid?: string; - startTime?: string; - endTime?: string; - clientOid?: string; - limit?: string; - idLessThan?: string; -} -⋮---- -export interface GetSpotTransferRecordRequestV2 { - coin: string; - fromType: SpotAccountTypeV2; - startTime?: string; - endTime?: string; - clientOid?: string; - limit?: string; - idLessThan?: string; -} -⋮---- -export interface GetSpotSubAccountDepositRecordRequestV2 { - subUid: string; - coin?: string; - startTime?: string; - endTime?: string; - idLessThan?: string; - limit?: string; -} -⋮---- -export interface GetSpotWithdrawalRecordRequestV2 { - coin?: string; - clientOid?: string; - startTime: string; - endTime: string; - idLessThan?: string; - orderId?: string; - limit?: string; -} -⋮---- -export interface GetSpotDepositRecordRequestV2 { - coin?: string; - orderId?: string; - startTime: string; - endTime: string; - idLessThan?: string; - limit?: string; -} - -================ -File: src/types/request/shared.ts -================ -/** Pagination */ -export interface Pagination { - /** Time after */ - after?: string; - /** Time before */ - before?: string; - /** Elements per page */ - limit?: string; -} -⋮---- -/** Time after */ -⋮---- -/** Time before */ -⋮---- -/** Elements per page */ -⋮---- -export type OrderTimeInForce = 'normal' | 'post_only' | 'fok' | 'ioc'; -⋮---- -export interface GetHistoricTradesParams { - symbol: string; - limit?: string; - tradeId?: string; - startTime?: string; - endTime?: string; -} -⋮---- -/** - * The margin type, used directly in building the endpoint URL - */ -export type MarginType = 'crossed' | 'isolated'; -⋮---- -export type FuturesProductTypeV2 = - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES' - | 'SUSDT-FUTURES' - | 'SCOIN-FUTURES' - | 'SUSDC-FUTURES'; -⋮---- -export type FuturesPlanTypeV2 = - | 'profit_plan' - | 'loss_plan' - | 'moving_plan' - | 'pos_profit' - | 'pos_loss'; - -================ -File: src/types/response/v2/copy-trading.ts -================ -/** - * - * - * Copy Trading | Future copy trading | Trader Api - * + * + * Copy Trading | Future copy trading | Trader Api + * * */ ⋮---- @@ -1881,569 +1701,993 @@ export interface MarginLiquidationOrderV2 { } ================ -File: src/types/websockets/ws-api-response.ts +File: src/types/response/v3/stockplus.ts ================ -export interface WSAPIPlaceOrderResponseV3 { +/** + * + * + * Stock+ (UTA) + * + * + */ +⋮---- +export interface StockPlusOptionQuoteItemV3 { symbol: string; - orderId: string; - clientOid: string; - cTime: string; + lastDone: string; + prevClose: string; + open: string; + high: string; + low: string; + timestamp: string; + volume: string; + turnover: string; + tradeStatus: string; + impliedVolatility: string; + openInterest: string; + expiryDate: string; + strikePrice: string; + contractMultipier: string; + contractType: string; + contractSize: string; + direction: string; + historicalVolatility: string; + underlyingSymbol: string; } - -================ -File: src/types/websockets/ws-events.ts -================ -export interface MessageEventLike { - target: WebSocket; - type: 'message'; - data: string; +⋮---- +export interface StockPlusOptionQuoteV3 { + secuQuote: StockPlusOptionQuoteItemV3[]; } ⋮---- -export function isMessageEvent(msg: unknown): msg is MessageEventLike +export interface StockPlusOptionStrikePriceInfoV3 { + price: string; + callSymbol: string; + putSymbol: string; + standard: boolean; +} ⋮---- -export interface WsBaseEvent { - action: TAction; - arg: unknown; - data: TData[]; +export interface StockPlusOptionChainInfoV3 { + strikePriceInfo: StockPlusOptionStrikePriceInfoV3[]; } ⋮---- -export interface WsSnapshotChannelEvent extends WsBaseEvent<'snapshot'> { - arg: { - instType: string; - channel: string; - instId: string; - }; +export interface StockPlusOptionExpiryDateV3 { + expiryDate: string[]; } ⋮---- -export interface WsSnapshotAccountEvent extends WsBaseEvent<'snapshot'> { - arg: { - instType: string; - channel: 'account'; - instId: string; - }; +export interface StockPlusOptionVolumeV3 { + c: string; + p: string; } ⋮---- -export interface WsSnapshotPositionsEvent extends WsBaseEvent<'snapshot'> { - arg: { - instType: string; - channel: 'positions'; - instId: string; - }; +export interface StockPlusStaticInfoItemV3 { + symbol: string; + nameCn: string; + nameEn: string; + exchange: string; + currency: string; + lotSize: number | string; + totalShares: string | number; + circulatingShares: string | number; + eps: string | number; + epsTtm: string | number; + bps: string | number; + dividendYield: string | number; + stockDerivatives: string[]; + board: string; } ⋮---- -export interface WsAccountSnapshotDataUMCBL { - marginCoin: string; - locked: string; - available: string; - maxOpenPosAvailable: string; - maxTransferOut: string; - equity: string; - usdtEquity: string; +export interface StockPlusStaticInfoV3 { + list: StockPlusStaticInfoItemV3[]; } ⋮---- -export interface WsAccountSnapshotUMCBL extends WsBaseEvent<'snapshot'> { - arg: { - instType: 'umcbl'; - channel: 'account'; - instId: string; - }; - data: WsAccountSnapshotDataUMCBL[]; +export interface StockPlusSessionQuoteV3 { + lastDone: string | number; + timestamp: string; + volume: string | number; + turnover: string | number; + high: string | number; + low: string | number; + prevClose: string | number; } ⋮---- -export interface WsPositionSnapshotDataUMCBL { - posId: string; - instId: string; - instName: string; - marginCoin: string; - margin: string; - marginMode: string; - holdSide: string; - holdMode: string; - total: string; - available: string; - locked: string; - averageOpenPrice: string; - leverage: number; - achievedProfits: string; - upl: string; - uplRate: string; - liqPx: string; - keepMarginRate: string; - marginRate: string; - cTime: string; - uTime: string; - markPrice: string; +export interface StockPlusQuoteItemV3 { + symbol: string; + lastDone: string | number; + prevClose: string | number; + open: string | number; + high: string | number; + low: string | number; + timestamp: string; + volume: string | number; + turnover: string | number; + tradeStatus: string; + preMarketQuote?: StockPlusSessionQuoteV3 | null; + postMarketQuote?: StockPlusSessionQuoteV3 | null; + overnightQuote?: StockPlusSessionQuoteV3 | null; } ⋮---- -export interface WSPositionSnapshotUMCBL extends WsBaseEvent<'snapshot'> { - arg: { - instType: 'umcbl'; - channel: 'positions'; - instId: string; - }; - data: WsPositionSnapshotDataUMCBL[]; +export interface StockPlusQuoteV3 { + list: StockPlusQuoteItemV3[]; } ⋮---- -/** Classic V2 depth channel push data. checksum removed May 2026 - use seq instead */ -export interface WsDepthBookDataV2 { - asks: [string, string][]; - bids: [string, string][]; - ts: string; - seq: string; - /** Futures books channel only - previous push serial number */ - pseq?: string; +export interface StockPlusTradeDetailItemV3 { + price: string | number; + volume: string | number; + timestamp: string; + tradeType: string; + direction: string; + tradeSession: string; } ⋮---- -/** Futures books channel only - previous push serial number */ - -================ -File: src/websocket-client-v2.ts -================ -import { - WSOperation, - WSOperationLoginParams, - WsRequestOperationBitget, -} from './types/websockets/ws-api.js'; -import { MessageEventLike } from './types/websockets/ws-events.js'; -import { - BitgetInstTypeV2, - WsKey, - WsTopicV2, -} from './types/websockets/ws-general.js'; -import { - BaseWebsocketClient, - EmittableEvent, - MidflightWsRequestEvent, -} from './util/BaseWSClient.js'; -import { isWsPong } from './util/requestUtils.js'; -import { - SignAlgorithm, - SignEncodeMethod, - signMessage, -} from './util/webCryptoAPI.js'; -import { - getMaxTopicsPerSubscribeEvent, - getNormalisedTopicRequests, - getWsUrl, - isPrivateChannel, - WS_AUTH_ON_CONNECT_KEYS, - WS_KEY_MAP, - WsTopicRequest, -} from './util/websocket-util.js'; -import { WSConnectedResult } from './util/WsStore.types.js'; +export type StockPlusTradeDetailV3 = StockPlusTradeDetailItemV3[]; ⋮---- -export class WebsocketClientV2 extends BaseWebsocketClient< +export interface StockPlusIntradayItemV3 { + price: string | number; + timestamp: string; + volume: string | number; + turnover: string | number; + avgPrice: string | number; +} ⋮---- -WsRequestOperationBitget // subscribe requests have an "args" parameter with an object within +export interface StockPlusIntradayV3 { + list: StockPlusIntradayItemV3[]; +} ⋮---- -/** - * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library - */ -public connectAll(): Promise[] +export interface StockPlusCandlestickItemV3 { + close: string; + open: string; + low: string; + high: string; + volume: string; + turnover: string; + timestamp: string; + tradeSession: string; +} ⋮---- -/** Some private channels use `coin` instead of `instId`. This method handles building the sub/unsub request */ -private getSubRequest( - instType: BitgetInstTypeV2, - topic: WsTopicV2, - coin: string = 'default', -): WsTopicRequest +export interface StockPlusCandlestickV3 { + list: StockPlusCandlestickItemV3[]; +} ⋮---- -/** - * Subscribe to a topic - * @param instType instrument type (refer to API docs). - * @param topic topic name (e.g. "ticker"). - * @param instId instrument ID (e.g. "BTCUSDT"). Use "default" for private topics. - */ -public subscribeTopic( - instType: BitgetInstTypeV2, - topic: WsTopicV2, - coin: string = 'default', -) +export type StockPlusHistoryCandlestickV3 = StockPlusCandlestickV3; ⋮---- -/** - * Unsubscribe from a topic - * @param instType instrument type (refer to API docs). - * @param topic topic name (e.g. "ticker"). - * @param instId instrument ID (e.g. "BTCUSDT"). Use "default" for private topics to get all symbols. - */ -public unsubscribeTopic( - instType: BitgetInstTypeV2, - topic: WsTopicV2, - coin: string = 'default', -) +export interface StockPlusDepthLevelV3 { + position: number; + price: string; + volume: string; + orderNum: number; +} ⋮---- -/** - * 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: CategoryV5}. - * - * - 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 | WsTopicV2) - | (WsTopicRequest | WsTopicV2)[], - wsKey: WsKey, -): Promise +export interface StockPlusDepthV3 { + asks: StockPlusDepthLevelV3[]; + bids: StockPlusDepthLevelV3[]; +} ⋮---- -/** - * 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 | WsTopicV2) - | (WsTopicRequest | WsTopicV2)[], - wsKey: WsKey, -) +export interface StockPlusPlaceOrderResponseV3 { + orderId: string; + clientOid: string; + symbol: string; +} ⋮---- -/** - * - * - * Internal methods required to integrate with the BaseWSClient - * - * - */ +export type StockPlusCancelOrderResponseV3 = StockPlusPlaceOrderResponseV3; +export type StockPlusModifyOrderResponseV3 = StockPlusPlaceOrderResponseV3; ⋮---- -protected sendPingEvent(wsKey: WsKey): void +export interface StockPlusOrderV3 { + orderId: string; + status: string; + stockName: string; + quantity: string | number; + executedQuantity: string | number; + price: string | number | null; + executedPrice: string | number | null; + submittedAt: string; + side: string; + symbol: string; + orderType: string; + lastDone: string | number | null; + triggerPrice: string | number | null; + msg: string; + tag: string; + timeInForce: string; + expireDate: string | null; + updatedAt: string | null; + triggerAt: string | null; + trailingAmount: string | number | null; + trailingPercent: string | number | null; + limitOffset: string | number | null; + triggerStatus: string | null; + currency: string; + outsideRth: string; + remark?: string; + limitDepthLevel: number | null; + triggerCount: number | null; + monitorPrice: string | null; +} ⋮---- -protected sendPongEvent(wsKey: WsKey): void +export interface StockPlusOrdersV3 { + orders: StockPlusOrderV3[]; +} ⋮---- -protected isWsPing(data: any): boolean +export interface StockPlusHistoryOrdersV3 { + hasMore: boolean; + orders: StockPlusOrderV3[]; +} ⋮---- -protected isWsPong(data: any): boolean +export interface StockPlusOrderHistoryItemV3 { + price: string | number; + quantity: string | number; + status: string; + msg: string; + time: string; +} ⋮---- -protected isPrivateTopicRequest( - _request: WsTopicRequest, - wsKey: WsKey, -): boolean +export interface StockPlusChargeFeeItemV3 { + code: string; + name: string; + amount: number | string; + currency: string; +} ⋮---- -protected getPrivateWSKeys(): WsKey[] +export interface StockPlusChargeCategoryV3 { + code: string; + name: string; + fees: StockPlusChargeFeeItemV3[]; +} ⋮---- -protected isAuthOnConnectWsKey(wsKey: WsKey): boolean +export interface StockPlusChargeDetailV3 { + totalAmount: number | string; + currency: string; + items: StockPlusChargeCategoryV3[]; +} ⋮---- -protected async getWsUrl(wsKey: WsKey): Promise +export interface StockPlusOrderDetailV3 extends StockPlusOrderV3 { + freeStatus?: string; + freeAmount?: string | null; + freeCurrency?: string | null; + deductionsStatus?: string; + deductionsAmount?: string | null; + deductionsCurrency?: string | null; + platformDeductedStatus?: string; + platformDeductedAmount?: string | null; + platformDeductedCurrency?: string | null; + history?: StockPlusOrderHistoryItemV3[]; + chargeDetail?: StockPlusChargeDetailV3; +} ⋮---- -protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null +export interface StockPlusExecutionV3 { + orderId: string; + tradeId: string; + symbol: string; + tradeDoneAt: string; + quantity: number | string; + price: number | string; +} ⋮---- -/** - * @returns one or more correctly structured request events for performing a operations over WS. This can vary per exchange spec. - */ -protected async getWsRequestEvents( - operation: WSOperation, - requests: WsTopicRequest[], -): Promise>[]> +export interface StockPlusTodayExecutionsV3 { + trades: StockPlusExecutionV3[]; +} ⋮---- -// Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values +export interface StockPlusHistoryExecutionsV3 { + hasMore: boolean; + trades: StockPlusExecutionV3[]; +} ⋮---- -/** - { - "op":"subscribe", - "args":[ - { - "instType":"SPOT", - "channel":"ticker", - "instId":"BTCUSDT" - }, - { - "instType":"SPOT", - "channel":"candle5m", - "instId":"BTCUSDT" - } - ] - } - */ +export interface StockPlusCashInfoV3 { + withdrawCash: number | string; + availableCash: number | string; + frozenCash: number | string; + settlingCash: number | string; + currency: string; +} ⋮---- -// const request = { -// topic: 'ticker', -// payload: { instType: 'SPOT', instId: 'BTCUSDT' }, -// }; -// becomes: -// const request = { -// channel: 'ticker', -// instType: 'SPOT', -// instId: 'BTCUSDT', -// }; +export interface StockPlusFrozenTransactionFeeV3 { + currency?: string; + amount?: number | string; + [key: string]: unknown; +} ⋮---- -private async getWsAuthSignature( - wsKey: WsKey, -): Promise< +export interface StockPlusAccountItemV3 { + totalCash: number | string; + maxFinanceAmount: number | string; + remainingFinanceAmount: number | string; + riskLevel: number | string; + marginCall: number | string; + netAssets: number | string; + initMargin: number | string; + maintenanceMargin: number | string; + currency: string; + buyPower: number | string; + cashInfos: StockPlusCashInfoV3[]; + frozenTransactionFees: StockPlusFrozenTransactionFeeV3[]; +} ⋮---- -private async signMessage( - paramsStr: string, - secret: string, - method: SignEncodeMethod, - algorithm: SignAlgorithm, -): Promise +export interface StockPlusAccountV3 { + list: StockPlusAccountItemV3[]; +} ⋮---- -protected async getWsAuthRequestEvent( - wsKey: WsKey, -): Promise> +export interface StockPlusCashFlowItemV3 { + transactionFlowName: string; + direction: string; + businessType: string; + balance: number | string; + currency: string; + businessTime: string; + symbol: string | null; + description: 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[] -⋮---- -// v2 event processing +export interface StockPlusCashFlowV3 { + list: StockPlusCashFlowItemV3[]; +} ⋮---- -// v2 authentication event +export interface StockPlusPositionItemV3 { + symbol: string; + symbolName: string; + quantity: number | string; + availableQuantity: number | string; + currency: string; + costPrice: number | string; + market: string; + initQuantity: number | string; +} ⋮---- -// messageType: typeof msg, -// messageString: JSON.stringify(msg), +export interface StockPlusPositionChannelV3 { + accountChannel: string; + positions: StockPlusPositionItemV3[]; +} ⋮---- -// messageType: typeof msg, -// messageString: JSON.stringify(msg), +export interface StockPlusStockPositionV3 { + channels: StockPlusPositionChannelV3[]; +} ⋮---- -// fallback emit anyway +export interface StockPlusTransferResponseV3 { + transferId: string; +} ⋮---- -/** - * @deprecrated not supported by Bitget's V2 API offering - */ -async sendWSAPIRequest(): Promise - -================ -File: .eslintrc.cjs -================ -// 'no-unused-vars': ['warn'], - -================ -File: .jshintrc -================ -{ - "esversion": 8, - "asi": true, - "laxbreak": true, - "predef": [ "-Promise" ] +export interface StockPlusTransferRecordsV3 { + transferId: string; + coin: string; + amount: string; + direction: string; + cursor: string; } ================ -File: .nvmrc -================ -v22.17.1 - -================ -File: .prettierrc +File: src/types/websockets/ws-api-response.ts ================ -{ - "tabWidth": 2, - "singleQuote": true, - "trailingComma": "all" +export interface WSAPIPlaceOrderResponseV3 { + symbol: string; + orderId: string; + clientOid: string; + cTime: string; } ================ -File: jest.config.ts +File: src/websocket-api-client.ts ================ +import { CancelOrderRequestV3 } from './types/request/v3/trade.js'; +import { CancelOrderResponseV3 } from './types/response/v3/trade.js'; +import { WSAPIResponse } from './types/websockets/ws-api.js'; +import { WSAPIPlaceOrderRequestV3 } from './types/websockets/ws-api-request.js'; +import { WSAPIPlaceOrderResponseV3 } from './types/websockets/ws-api-response.js'; +import { + BitgetInstTypeV3, + WSClientConfigurableOptions, +} from './types/websockets/ws-general.js'; +import { DefaultLogger } from './util/logger.js'; +import { WS_KEY_MAP } from './util/websocket-util.js'; +import { WebsocketClientV3 } from './websocket-client-v3.js'; +⋮---- /** - * For a detailed explanation regarding each configuration property, visit: - * https://jestjs.io/docs/configuration + * Configurable options specific to only the REST-like WebsocketAPIClient */ +export interface WSAPIClientConfigurableOptions { + /** + * Default: true + * + * Attach default event listeners, which will console log any high level + * events (opened/reconnecting/reconnected/etc). + * + * If you disable this, you should set your own event listeners + * on the embedded WS Client `wsApiClient.getWSClient().on(....)`. + */ + attachEventListeners: boolean; +} ⋮---- -import type { Config } from 'jest'; +/** + * Default: true + * + * Attach default event listeners, which will console log any high level + * events (opened/reconnecting/reconnected/etc). + * + * If you disable this, you should set your own event listeners + * on the embedded WS Client `wsApiClient.getWSClient().on(....)`. + */ ⋮---- -// All imported modules in your tests should be mocked automatically -// automock: false, +/** + * This is a minimal Websocket API wrapper around the WebsocketClient. + * + * Note: You can also directly use the sendWSAPIRequest() method to make WS API calls, but some + * may find the below methods slightly more intuitive. + * + * Refer to the WS API promises example for a more detailed example on using sendWSAPIRequest() directly: + * https://github.com/tiagosiebler/bitget-api/blob/master/examples/V3/ws-api-trade-raw.ts + */ +export class WebsocketAPIClient ⋮---- -// Stop running tests after `n` failures -// bail: 0, -bail: false, // enable to stop test when an error occur, +constructor( + options?: WSClientConfigurableOptions & + Partial, + logger?: DefaultLogger, +) ⋮---- -// The directory where Jest should store its cached dependency information -// cacheDirectory: "/private/var/folders/kf/2k3sz4px6c9cbyzj1h_b192h0000gn/T/jest_dx", +public getWSClient(): WebsocketClientV3 ⋮---- -// Automatically clear mock calls, instances, contexts and results before every test +public setTimeOffsetMs(newOffset: number): void ⋮---- -// Indicates whether the coverage information should be collected while executing the test +/* + * Bitget WebSocket API Methods + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel + */ ⋮---- -// An array of glob patterns indicating a set of files for which coverage information should be collected +/** + * Submit a new order + * + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel + * + * @returns + */ +submitNewOrder( + category: BitgetInstTypeV3, + params: WSAPIPlaceOrderRequestV3, +): Promise> ⋮---- -// The directory where Jest should output its coverage files +/** + * Submit a new order + * + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel + * + * @returns + */ +placeBatchOrders( + category: BitgetInstTypeV3, + params: WSAPIPlaceOrderRequestV3[], +): Promise> ⋮---- -// An array of regexp pattern strings used to skip coverage collection -// coveragePathIgnorePatterns: [ -// "/node_modules/" -// ], +/* + * Bitget WebSocket API Methods + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel + */ ⋮---- -// Indicates which provider should be used to instrument code for coverage +/** + * Cancel Order + * + * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel + * + * @returns + */ +cancelOrder( + category: BitgetInstTypeV3, + params: CancelOrderRequestV3, +): Promise> ⋮---- -// A list of reporter names that Jest uses when writing coverage reports -// coverageReporters: [ -// "json", -// "text", -// "lcov", -// "clover" -// ], +/** + * Batch Cancel Order + * + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel + * + * @returns + */ +cancelBatchOrders( + category: BitgetInstTypeV3, + params: CancelOrderRequestV3[], +): Promise> ⋮---- -// An object that configures minimum threshold enforcement for coverage results -// coverageThreshold: undefined, +/** + * + * + * + * + * + * + * + * Private methods for handling some of the convenience/automation provided by the WS API Client + * + * + * + * + * + * + * + */ ⋮---- -// A path to a custom dependency extractor -// dependencyExtractor: undefined, +private setupDefaultEventListeners() ⋮---- -// Make calling deprecated APIs throw helpful error messages -// errorOnDeprecated: false, +/** + * General event handlers for monitoring the WebsocketClient + */ ⋮---- -// The default configuration for fake timers -// fakeTimers: { -// "enableGlobally": false -// }, +// Blind JSON.stringify can fail on circular references ⋮---- -// Force coverage collection from ignored files using an array of glob patterns -// forceCoverageMatch: [], +// JSON.stringify({ ...data, target: 'WebSocket' }), + +================ +File: src/websocket-client-v2.ts +================ +import { + WSOperation, + WSOperationLoginParams, + WsRequestOperationBitget, +} from './types/websockets/ws-api.js'; +import { MessageEventLike } from './types/websockets/ws-events.js'; +import { + BitgetInstTypeV2, + WsKey, + WsTopicV2, +} from './types/websockets/ws-general.js'; +import { + BaseWebsocketClient, + EmittableEvent, + MidflightWsRequestEvent, +} from './util/BaseWSClient.js'; +import { isWsPong } from './util/requestUtils.js'; +import { + SignAlgorithm, + SignEncodeMethod, + signMessage, +} from './util/webCryptoAPI.js'; +import { + getMaxTopicsPerSubscribeEvent, + getNormalisedTopicRequests, + getWsUrl, + isPrivateChannel, + WS_AUTH_ON_CONNECT_KEYS, + WS_KEY_MAP, + WsTopicRequest, +} from './util/websocket-util.js'; +import { WSConnectedResult } from './util/WsStore.types.js'; ⋮---- -// A path to a module which exports an async function that is triggered once before all test suites -// globalSetup: undefined, -⋮---- -// A path to a module which exports an async function that is triggered once after all test suites -// globalTeardown: undefined, -⋮---- -// A set of global variables that need to be available in all test environments -// globals: {}, -⋮---- -// 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%", -⋮---- -// An array of directory names to be searched recursively up from the requiring module's location -// moduleDirectories: [ -// "node_modules" -// ], -⋮---- -// An array of file extensions your modules use -⋮---- -// modulePaths: ['src'], -⋮---- -// 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: {}, -⋮---- -// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader -// modulePathIgnorePatterns: [], -⋮---- -// Activates notifications for test results -// notify: false, +export class WebsocketClientV2 extends BaseWebsocketClient< ⋮---- -// An enum that specifies notification mode. Requires { notify: true } -// notifyMode: "failure-change", +WsRequestOperationBitget // subscribe requests have an "args" parameter with an object within ⋮---- -// A preset that is used as a base for Jest's configuration -// preset: undefined, +/** + * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library + */ +public connectAll(): Promise[] ⋮---- -// Run tests from one or more projects -// projects: undefined, +/** Some private channels use `coin` instead of `instId`. This method handles building the sub/unsub request */ +private getSubRequest( + instType: BitgetInstTypeV2, + topic: WsTopicV2, + coin: string = 'default', +): WsTopicRequest ⋮---- -// Use this configuration option to add custom reporters to Jest -// reporters: undefined, +/** + * Subscribe to a topic + * @param instType instrument type (refer to API docs). + * @param topic topic name (e.g. "ticker"). + * @param instId instrument ID (e.g. "BTCUSDT"). Use "default" for private topics. + */ +public subscribeTopic( + instType: BitgetInstTypeV2, + topic: WsTopicV2, + coin: string = 'default', +) ⋮---- -// Automatically reset mock state before every test -// resetMocks: false, +/** + * Unsubscribe from a topic + * @param instType instrument type (refer to API docs). + * @param topic topic name (e.g. "ticker"). + * @param instId instrument ID (e.g. "BTCUSDT"). Use "default" for private topics to get all symbols. + */ +public unsubscribeTopic( + instType: BitgetInstTypeV2, + topic: WsTopicV2, + coin: string = 'default', +) ⋮---- -// Reset the module registry before running each individual test -// resetModules: false, +/** + * 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: CategoryV5}. + * + * - 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 | WsTopicV2) + | (WsTopicRequest | WsTopicV2)[], + wsKey: WsKey, +): Promise ⋮---- -// A path to a custom resolver -// resolver: undefined, +/** + * 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 | WsTopicV2) + | (WsTopicRequest | WsTopicV2)[], + wsKey: WsKey, +) ⋮---- -// Automatically restore mock state and implementation before every test -// restoreMocks: false, +/** + * + * + * Internal methods required to integrate with the BaseWSClient + * + * + */ ⋮---- -// The root directory that Jest should scan for tests and modules within -// rootDir: undefined, +protected sendPingEvent(wsKey: WsKey): void ⋮---- -// A list of paths to directories that Jest should use to search for files in -// roots: [ -// "" -// ], +protected sendPongEvent(wsKey: WsKey): void ⋮---- -// Allows you to use a custom runner instead of Jest's default test runner -// runner: "jest-runner", +protected isWsPing(data: any): boolean ⋮---- -// The paths to modules that run some code to configure or set up the testing environment before each test -// setupFiles: [], +protected isWsPong(data: any): boolean ⋮---- -// A list of paths to modules that run some code to configure or set up the testing framework before each test -// setupFilesAfterEnv: [], +protected isPrivateTopicRequest( + _request: WsTopicRequest, + wsKey: WsKey, +): boolean ⋮---- -// The number of seconds after which a test is considered as slow and reported as such in the results. -// slowTestThreshold: 5, +protected getPrivateWSKeys(): WsKey[] ⋮---- -// A list of paths to snapshot serializer modules Jest should use for snapshot testing -// snapshotSerializers: [], +protected isAuthOnConnectWsKey(wsKey: WsKey): boolean ⋮---- -// The test environment that will be used for testing -// testEnvironment: "jest-environment-node", +protected async getWsUrl(wsKey: WsKey): Promise ⋮---- -// Options that will be passed to the testEnvironment -// testEnvironmentOptions: {}, +protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null ⋮---- -// Adds a location field to test results -// testLocationInResults: false, +/** + * @returns one or more correctly structured request events for performing a operations over WS. This can vary per exchange spec. + */ +protected async getWsRequestEvents( + operation: WSOperation, + requests: WsTopicRequest[], +): Promise>[]> ⋮---- -// The glob patterns Jest uses to detect test files +// Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values ⋮---- -// "**/__tests__/**/*.[jt]s?(x)", +/** + { + "op":"subscribe", + "args":[ + { + "instType":"SPOT", + "channel":"ticker", + "instId":"BTCUSDT" + }, + { + "instType":"SPOT", + "channel":"candle5m", + "instId":"BTCUSDT" + } + ] + } + */ ⋮---- -// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped -// testPathIgnorePatterns: [ -// "/node_modules/" -// ], +// const request = { +// topic: 'ticker', +// payload: { instType: 'SPOT', instId: 'BTCUSDT' }, +// }; +// becomes: +// const request = { +// channel: 'ticker', +// instType: 'SPOT', +// instId: 'BTCUSDT', +// }; ⋮---- -// The regexp pattern or array of patterns that Jest uses to detect test files -// testRegex: [], +private async getWsAuthSignature( + wsKey: WsKey, +): Promise< ⋮---- -// This option allows the use of a custom results processor -// testResultsProcessor: undefined, +private async signMessage( + paramsStr: string, + secret: string, + method: SignEncodeMethod, + algorithm: SignAlgorithm, +): Promise ⋮---- -// This option allows use of a custom test runner -// testRunner: "jest-circus/runner", +protected async getWsAuthRequestEvent( + wsKey: WsKey, +): Promise> ⋮---- -// A map from regular expressions to paths to transformers -// transform: undefined, +/** + * Abstraction called to sort ws events into emittable event types (response to a request, data update, etc) + */ +protected resolveEmittableEvents( + wsKey: WsKey, + event: MessageEventLike, +): EmittableEvent[] ⋮---- -// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation -// transformIgnorePatterns: [ -// "/node_modules/", -// "\\.pnp\\.[^\\/]+$" -// ], +// v2 event processing ⋮---- -// Prevents import esm module error from v1 axios release, issue #5026 +// v2 authentication event ⋮---- -// 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, +// messageType: typeof msg, +// messageString: JSON.stringify(msg), ⋮---- -// Indicates whether each individual test should be reported during the run -// verbose: undefined, -verbose: true, // report individual test +// messageType: typeof msg, +// messageString: JSON.stringify(msg), ⋮---- -// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode -// watchPathIgnorePatterns: [], +// fallback emit anyway ⋮---- -// Whether to use watchman for file crawling -// watchman: true, +/** + * @deprecrated not supported by Bitget's V2 API offering + */ +async sendWSAPIRequest(): Promise ================ -File: LICENSE.md +File: .eslintrc.cjs ================ -Copyright 2022 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. +// 'no-unused-vars': ['warn'], ================ -File: postBuild.sh +File: .gitignore ================ -#!/bin/bash +!.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 +bundleReport.html +.history/ +tiagoSpot.ts +restClientRegex.ts +localtest.sh +privaterepotracker +testfile.ts +dist +repomix.sh +coverage + +================ +File: .jshintrc +================ +{ + "esversion": 8, + "asi": true, + "laxbreak": true, + "predef": [ "-Promise" ] +} + +================ +File: .prettierrc +================ +{ + "tabWidth": 2, + "singleQuote": true, + "trailingComma": "all" +} + +================ +File: jest.config.ts +================ +/** + * For a detailed explanation regarding each configuration property, visit: + * https://jestjs.io/docs/configuration + */ +⋮---- +import type { Config } from 'jest'; +⋮---- +// All imported modules in your tests should be mocked automatically +// automock: false, +⋮---- +// Stop running tests after `n` failures +// bail: 0, +bail: false, // enable to stop test when an error occur, +⋮---- +// The directory where Jest should store its cached dependency information +// cacheDirectory: "/private/var/folders/kf/2k3sz4px6c9cbyzj1h_b192h0000gn/T/jest_dx", +⋮---- +// Automatically clear mock calls, instances, contexts and results before every test +⋮---- +// Indicates whether the coverage information should be collected while executing the test +⋮---- +// An array of glob patterns indicating a set of files for which coverage information should be collected +⋮---- +// The directory where Jest should output its coverage files +⋮---- +// An array of regexp pattern strings used to skip coverage collection +// coveragePathIgnorePatterns: [ +// "/node_modules/" +// ], +⋮---- +// Indicates which provider should be used to instrument code for coverage +⋮---- +// 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, +⋮---- +// A path to a custom dependency extractor +// dependencyExtractor: undefined, +⋮---- +// Make calling deprecated APIs throw helpful error messages +// errorOnDeprecated: false, +⋮---- +// The default configuration for fake timers +// fakeTimers: { +// "enableGlobally": false +// }, +⋮---- +// Force coverage collection from ignored files using an array of glob patterns +// forceCoverageMatch: [], +⋮---- +// A path to a module which exports an async function that is triggered once before all test suites +// globalSetup: undefined, +⋮---- +// A path to a module which exports an async function that is triggered once after all test suites +// globalTeardown: undefined, +⋮---- +// A set of global variables that need to be available in all test environments +// globals: {}, +⋮---- +// 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%", +⋮---- +// An array of directory names to be searched recursively up from the requiring module's location +// moduleDirectories: [ +// "node_modules" +// ], +⋮---- +// An array of file extensions your modules use +⋮---- +// modulePaths: ['src'], +⋮---- +// 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: {}, +⋮---- +// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader +// modulePathIgnorePatterns: [], +⋮---- +// Activates notifications for test results +// notify: false, +⋮---- +// An enum that specifies notification mode. Requires { notify: true } +// notifyMode: "failure-change", +⋮---- +// A preset that is used as a base for Jest's configuration +// preset: undefined, +⋮---- +// Run tests from one or more projects +// projects: undefined, +⋮---- +// Use this configuration option to add custom reporters to Jest +// reporters: undefined, +⋮---- +// Automatically reset mock state before every test +// resetMocks: false, +⋮---- +// Reset the module registry before running each individual test +// resetModules: false, +⋮---- +// A path to a custom resolver +// resolver: undefined, +⋮---- +// Automatically restore mock state and implementation before every test +// restoreMocks: false, +⋮---- +// The root directory that Jest should scan for tests and modules within +// rootDir: undefined, +⋮---- +// A list of paths to directories that Jest should use to search for files in +// roots: [ +// "" +// ], +⋮---- +// Allows you to use a custom runner instead of Jest's default test runner +// runner: "jest-runner", +⋮---- +// The paths to modules that run some code to configure or set up the testing environment before each test +// setupFiles: [], +⋮---- +// A list of paths to modules that run some code to configure or set up the testing framework before each test +// setupFilesAfterEnv: [], +⋮---- +// 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: LICENSE.md +================ +Copyright 2022 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: postBuild.sh +================ +#!/bin/bash # # Add package.json files to cjs/mjs subtrees # @@ -2672,207 +2916,9 @@ import { RestClientV3 } from '../../../src/index.js'; // import { RestClientV3 } from 'bitget-api'; ================ -File: src/types/request/v2/common.ts +File: src/constants/enum.ts ================ -import { FuturesProductTypeV2, MarginType } from '../shared.js'; -⋮---- -/** - * - * * Common | Notice - * - */ -⋮---- -export interface GetAnnouncementsRequestV2 { - annType?: string; - startTime?: string; - endTime?: string; - language: string; -} -⋮---- -/** - * - * * Common | Public - * - */ -⋮---- -export interface GetTradeRateRequestV2 { - symbol: string; - businessType: string; -} -⋮---- -/** - * - * * Common | Tax - * - */ -⋮---- -export interface GetSpotTransactionsRequestV2 { - coin?: string; - startTime: string; - endTime: string; - limit?: string; - idLessThan?: string; -} -⋮---- -export interface GetFuturesTransactionsRequestV2 { - productType?: FuturesProductTypeV2; - marginCoin?: string; - startTime: string; - endTime: string; - limit?: string; - idLessThan?: string; -} -⋮---- -export interface GetMarginTransactionsRequestV2 { - marginType?: MarginType; - coin?: string; - startTime: string; - endTime: string; - limit?: string; - idLessThan?: string; -} -⋮---- -export interface GetP2PTransactionsRequestV2 { - coin?: string; - startTime: string; - endTime: string; - limit?: string; - idLessThan?: string; -} -⋮---- -/** - * - * * Common | P2P - * - */ -⋮---- -export interface GetP2PMerchantsRequestV2 { - online?: 'yes' | 'no'; - idLessThan?: string; - limit?: string; -} -⋮---- -export interface GetMerchantP2POrdersRequestV2 { - startTime: string; - endTime?: string; - idLessThan?: string; - limit?: string; - status?: string; - advNo: string; - side?: string; - coin?: string; - language: string; - fiat?: string; - orderNo?: string; -} -⋮---- -export interface GetMerchantAdvertisementsRequestV2 { - startTime: string; - endTime?: string; - idLessThan?: string; - limit?: string; - status: string; - advNo?: string; - side: string; - coin: string; - language?: string; - fiat: string; - orderBy?: string; - payMethodId?: string; - sourceType?: string; -} -⋮---- -/** - * - * * Common | Virtual Subaccount - * - */ -⋮---- -export interface ModifyVirtualSubRequestV2 { - subAccountUid: string; - permList: string[]; - status: string; -} -⋮---- -export interface CreateVirtualSubRequestV2 { - subAccountName: string; - passphrase: string; - label: string; - ipList?: string[]; - permList?: string[]; -} -⋮---- -export interface CreateVirtualSubApiKeyRequestV2 { - subAccountUid: string; - passphrase: string; - label: string; - ipList?: string[]; - permList?: string[]; -} -⋮---- -export interface ModifyVirtualSubApiKeyRequestV2 { - subAccountUid: string; - subAccountApiKey: string; - passphrase: string; - label: string; - ipList?: string[]; - permList?: string[]; -} -⋮---- -export interface CreateAgentSubaccountRequestV2 { - /** Lowercase letters only; max 20 characters */ - username: string; - /** 8–32 characters, letters and numbers */ - passphrase: string; - note?: string; -} -⋮---- -/** Lowercase letters only; max 20 characters */ -⋮---- -/** 8–32 characters, letters and numbers */ -⋮---- -/** - * - * * Common | Convert - * - */ -⋮---- -export interface ConvertQuoteRequestV2 { - fromCoin: string; - fromCoinSize?: string; - toCoin: string; - toCoinSize?: string; -} -⋮---- -export interface ConvertRequestV2 { - fromCoin: string; - fromCoinSize: string; - cnvtPrice: string; - toCoin: string; - toCoinSize: string; - traceId: string; -} -⋮---- -export interface GetConvertHistoryRequestV2 { - startTime: string; - endTime: string; - limit?: string; - idLessThan?: string; -} -⋮---- -/** - * - * * Common | BGB Convert - * - */ -⋮---- -export interface GetConvertBGBHistoryRequestV2 { - orderId?: string; - startTime: string; - endTime: string; - limit?: string; - idLessThan?: string; -} +/** Parameter verification exception margin mode == FIXED */ ================ File: src/types/request/v2/earn.ts @@ -3060,425 +3106,428 @@ export interface RedeemEarnEliteRequestV2 { } ================ -File: src/types/request/v3/copytrading.ts +File: src/types/request/v2/instloan.ts ================ -export interface GetCopyFuturesMaxTransferableRequestV3 { - coin: string; +export interface GetInstLoanProductInfoRequestV2 { + productId: string; } ⋮---- -export interface CopyFuturesTransferRequestV3 { - type: 'in' | 'out'; - coin: string; - amount: string; +export interface GetInstLoanSymbolsRequestV2 { + productId: string; } ⋮---- -export interface GetCopyFuturesTransferRecordRequestV3 { +export interface GetInstLoanRepaidHistoryRequestV2 { startTime?: string; endTime?: string; limit?: string; - /** Pass transferId from the previous page to paginate forward */ - cursor?: string; } ⋮---- -/** Pass transferId from the previous page to paginate forward */ - -================ -File: src/types/request/v3/earn.ts -================ -/** - * - * - * Earn | On-Chain Elite (UTA) - * - * - */ -⋮---- -export interface GetEarnEliteRecordsRequestV3 { - type: 'subscribe' | 'redeem' | 'interest'; +export interface GetInstLoanOrderRequestV2 { + orderId?: string; startTime?: string; endTime?: string; - limit?: string; - cursor?: string; -} -⋮---- -export interface GetEarnEliteSubscribeInfoRequestV3 { - productId: string; -} -⋮---- -export interface EarnEliteSubscribeRequestV3 { - productSubId: string; - amount: string; - coin?: string; - paymentAccount?: 'spot' | 'unified'; -} -⋮---- -export interface GetEarnEliteSubscribeResultRequestV3 { - orderId: string; } ⋮---- -export interface GetEarnEliteRedeemInfoRequestV3 { - productId: string; +export interface GetInstLoanLTVConvertRequestV2 { + riskUnitId?: string; } ⋮---- -export interface RedeemEarnEliteRequestV3 { +export interface GetInstLoanMarginCoinInfoRequestV2 { productId: string; - productSubId: string; - redeemType: 'fast' | 'standard'; - amount: string; - receiveAccount: 'spot' | 'unified'; - advancedSettle?: 'yes' | 'no'; - coin?: string; } ================ -File: src/types/request/v3/loan.ts +File: src/types/request/v2/spot.ts ================ -export interface GetTransferedRequestV3 { - userId?: string; - coin: string; -} -⋮---- -export interface GetSymbolsRequestV3 { - productId: string; -} +type SpotKlineIntervalV2 = + | '1min' + | '5min' + | '15min' + | '30min' + | '1h' + | '4h' + | '6h' + | '12h' + | '1day' + | '3day' + | '1week' + | '1M' + | '6Hutc' + | '12Hutc' + | '1Dutc' + | '3Dutc' + | '1Wutc' + | '1Mutc'; ⋮---- -export interface GetRepaidHistoryRequestV3 { +export interface SpotCandlesRequestV2 { + symbol: string; + granularity: SpotKlineIntervalV2; startTime?: string; endTime?: string; limit?: string; } ⋮---- -export interface GetProductInfosRequestV3 { - productId: string; +export interface SpotHistoricCandlesRequestV2 { + symbol: string; + granularity: SpotKlineIntervalV2; + endTime?: string; + limit?: string; } ⋮---- -export interface GetLoanOrderRequestV3 { - orderId?: string; +export interface SpotHistoricTradesRequestV2 { + symbol: string; + limit?: string; + idLessThan?: string; startTime?: string; endTime?: string; } ⋮---- -export interface GetEnsureCoinsRequestV3 { - productId: string; +export interface SpotCallAuctionRequestV2 { + symbol: string; } ⋮---- -export interface BindUidRequestV3 { - riskUnitId?: string; - uid: string; - operate: 'bind' | 'unbind'; -} +/** + * + * * Spot | Trade + * + */ ⋮---- -export interface GetLTVConvertRequestV3 { - riskUnitId?: string; -} +export type SpotOrderSideV2 = 'buy' | 'sell'; ⋮---- -/* Unified Account Staking & Lending (Crypto Loans) - /api/v3/loan/* */ +export type SpotOrderTypeV2 = 'limit' | 'market'; ⋮---- -export interface GetLoanCoinsRequestV3 { - coin?: string; -} +export type SpotOrderForceV2 = 'gtc' | 'post_only' | 'fok' | 'ioc'; ⋮---- -export interface GetLoanInterestRequestV3 { - loanCoin: string; - pledgeCoin: string; - daily: 'SEVEN' | 'THIRTY' | 'FLEXIBLE'; - pledgeAmount: string; -} +export type SpotTPSLTypeV2 = 'normal' | 'tpsl'; ⋮---- -export interface LoanBorrowRequestV3 { - loanCoin: string; - pledgeCoin: string; - daily: 'SEVEN' | 'THIRTY' | 'FLEXIBLE'; - pledgeAmount?: string; - loanAmount?: string; +export type SpotSTPModeV2 = + | 'none' + | 'cancel_taker' + | 'cancel_maker' + | 'cancel_both'; +⋮---- +export type SpotBatchModeV2 = 'single' | 'multiple'; +⋮---- +export interface SpotOrderRequestV2 { + symbol: string; + side: SpotOrderSideV2; + orderType: SpotOrderTypeV2; + force: SpotOrderForceV2; + price?: string; + size: string; + clientOid?: string; + triggerPrice?: string; + tpslType?: SpotTPSLTypeV2; + requestTime?: string; + receiveWindow?: string; + stpMode?: SpotSTPModeV2; + presetTakeProfitPrice?: string; + executeTakeProfitPrice?: string; + presetStopLossPrice?: string; + executeStopLossPrice?: string; } ⋮---- -export interface GetLoanBorrowOngoingRequestV3 { +export interface SpotCancelandSubmitOrderRequestV2 { + symbol: string; + price: string; + size: string; orderId?: string; - loanCoin?: string; - pledgeCoin?: string; + clientOid?: string; + newClientOid?: string; + presetTakeProfitPrice?: string; + executeTakeProfitPrice?: string; + presetStopLossPrice?: string; + executeStopLossPrice?: string; } ⋮---- -export interface GetLoanBorrowHistoryRequestV3 { +export interface SpotCancelOrderRequestV2 { + symbol: string; + tpslType?: SpotTPSLTypeV2; orderId?: string; - loanCoin?: string; - pledgeCoin?: string; - status?: 'ROLLBACK' | 'FORCE' | 'REPAY'; - startTime: string; - endTime: string; - pageNum?: string; - pageSize?: string; + clientOid?: string; } ⋮---- -export interface LoanRepayRequestV3 { - orderId: string; - method: 'borrowed_coin' | 'collateral'; - repayAll: 'yes' | 'no'; - amount?: string; - repayUnlock?: 'yes' | 'no'; +export interface SpotBatchOrderRequestItemV2 { + symbol?: string; + side: SpotOrderSideV2; + orderType: SpotOrderTypeV2; + force: SpotOrderForceV2; + price?: string; + size: string; + clientOid?: string; + stpMode?: SpotSTPModeV2; + presetTakeProfitPrice?: string; + executeTakeProfitPrice?: string; + presetStopLossPrice?: string; + executeStopLossPrice?: string; } ⋮---- -export interface GetLoanRepayHistoryRequestV3 { - orderId?: string; - loanCoin?: string; - pledgeCoin?: string; - startTime: string; - endTime: string; - pageNum?: string; - pageSize?: string; +export interface SpotBatchOrderRequestV2 { + symbol?: string; + batchMode?: SpotBatchModeV2; + orderList: SpotBatchOrderRequestItemV2[]; } ⋮---- -export interface LoanRevisePledgeRequestV3 { - orderId: string; - amount: string; - pledgeCoin: string; - reviseType?: 'OUT' | 'IN'; +export interface SpotBatchCancelOrderRequestV2 { + symbol?: string; + batchMode?: SpotBatchModeV2; + orderList: { + symbol?: string; + orderId?: string; + clientOid?: string; + }[]; } ⋮---- -export interface GetLoanPledgeRateHistoryRequestV3 { +export interface GetSpotOrderInfoRequestV2 { orderId?: string; - reviseSide?: 'down' | 'up'; - pledgeCoin?: string; - startTime: string; - endTime: string; - pageNum?: string; - pageSize?: string; + clientOid?: string; + requestTime?: string; + receiveWindow?: string; } ⋮---- -export interface GetLoanReducesRequestV3 { +export interface GetSpotOpenOrdersRequestV2 { + symbol?: string; + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; orderId?: string; - loanCoin?: string; - pledgeCoin?: string; - status?: 'COMPLETE' | 'WAIT'; - startTime: string; - endTime: string; - pageNum?: string; - pageSize?: string; + tpslType?: SpotTPSLTypeV2; + requestTime?: string; + receiveWindow?: string; } - -================ -File: src/types/request/v3/p2p.ts -================ -export type P2pSideV3 = 'buy' | 'sell'; -⋮---- -export type P2pPriceTypeV3 = 'fixed' | 'floating'; ⋮---- -export type P2pMarketTypeV3 = 'public' | 'private'; +export interface GetSpotHistoryOrdersRequestV2 { + symbol?: string; + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + orderId?: string; + tpslType?: SpotTPSLTypeV2; + requestTime?: string; + receiveWindow?: string; +} ⋮---- -export type P2pAdStatusV3 = 'publish' | 'delist' | 'remove'; +export interface GetSpotFillsRequestV2 { + symbol: string; + orderId?: string; + startTime?: string; + endTime?: string; + limit?: string; + idLessThan?: string; +} ⋮---- -export type P2pAdOperationV3 = 'publish' | 'delist' | 'remove'; +/** + * + * * Spot | Trigger Orders + * + */ ⋮---- -export type P2pOrderStatusV3 = - | 'pending_payment' - | 'pending_release' - | 'completed' - | 'cancelled' - | 'in_appeal'; +export type SpotPlanTypeV2 = 'amount' | 'total'; ⋮---- -export interface P2pPayMethodIdRefV3 { - payMethodId: string; - userPayMethodId?: string; -} +export type SpotTriggerTypeV2 = 'fill_price' | 'mark_price'; ⋮---- -export interface GetP2pAdListRequestV3 { - token: string; - fiat: string; - side: P2pSideV3; - amount?: string; - pageNum: string; - limit: string; +export interface SpotPlanOrderRequestV2 { + symbol: string; + side: SpotOrderSideV2; + triggerPrice: string; + orderType: SpotOrderTypeV2; + executePrice?: string; + planType?: SpotPlanTypeV2; + size: string; + triggerType: SpotTriggerTypeV2; + clientOid?: string; + force?: SpotOrderForceV2; + stpMode?: SpotSTPModeV2; } ⋮---- -export interface GetP2pExchangeRateRequestV3 { - token: string; - fiat: string; +export interface SpotModifyPlanOrderRequestV2 { + orderId?: string; + clientOid?: string; + triggerPrice: string; + orderType: SpotOrderTypeV2; + executePrice?: string; + size: string; } ⋮---- -export interface P2pFeeSimulateRequestV3 { - token: string; - fiat: string; - side: P2pSideV3; - marketType: P2pMarketTypeV3; - amount: string; +export interface GetSpotCurrentPlanOrdersRequestV2 { + symbol: string; + limit?: string; + idLessThan?: string; + startTime?: string; + endTime?: string; } ⋮---- -export interface GetP2pAdLimitRequestV3 { - token: string; - fiat: string; - side: P2pSideV3; +export interface GetSpotHistoryPlanOrdersRequestV2 { + symbol: string; + startTime: string; + endTime: string; + limit?: string; } ⋮---- -export interface CreateP2pAdRequestV3 { - token: string; - fiat: string; - side: P2pSideV3; - priceType: P2pPriceTypeV3; - price?: string; - premium?: string; - minAmount: string; - maxAmount: string; - quantity: string; - payMethodIds: P2pPayMethodIdRefV3[]; - remark?: string; - tradeTerms?: string; - payTimeLimit: string; +/** + * + * * Spot | Account + * + */ +⋮---- +export type SpotBillGroupTypeV2 = + | 'deposit' + | 'withdraw' + | 'transaction' + | 'transfer' + | 'other'; +⋮---- +export type SpotBusinessTypeV2 = + | 'deposit' + | 'withdraw' + | 'buy' + | 'sell' + | 'deduction of handling fee' + | 'transfer-in' + | 'transfer-out' + | 'rebate rewards' + | 'airdrop rewards' + | 'USDT contract rewards' + | 'mix contract rewards' + | 'system lock' + | 'user lock'; +⋮---- +export type SpotAccountTypeV2 = + | 'spot' + | 'p2p' + | 'coin_futures' + | 'usdt_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'isolated_margin'; +⋮---- +export interface GetSpotAccountBillsRequestV2 { + coin?: string; + groupType?: SpotBillGroupTypeV2; + businessType?: SpotBusinessTypeV2; + startTime?: string; + endTime?: string; + limit?: string; + idLessThan?: string; } ⋮---- -export interface UpdateP2pAdRequestV3 { - advId: string; - priceType?: P2pPriceTypeV3; - price?: string; - premium?: string; - minAmount?: string; - maxAmount?: string; - quantity?: string; - payMethodIds?: P2pPayMethodIdRefV3[]; - payTimeLimit?: string; - remark?: string; - tradeTerms?: string; +export interface SpotTransferRequestV2 { + fromType: SpotAccountTypeV2; + toType: SpotAccountTypeV2; + amount: string; + coin: string; + symbol: string; + clientOid?: string; } ⋮---- -export interface OperateP2pAdRequestV3 { - advId: string; - operation: P2pAdOperationV3; +export interface SpotSubAccountTransferRequestV2 { + fromType: SpotAccountTypeV2; + toType: SpotAccountTypeV2; + amount: string; + coin: string; + symbol?: string; + clientOid?: string; + fromUserId: string; + toUserId: string; } ⋮---- -export interface GetP2pAdInfoRequestV3 { - advId: string; +export interface SpotWithdrawalRequestV2 { + coin: string; + transferType: 'on_chain' | 'internal_transfer'; + address: string; + chain?: string; + innerToType?: 'email' | 'mobile' | 'uid'; + areaCode?: string; + tag?: string; + size: string; + remark?: string; + clientOid?: string; } ⋮---- -export interface GetP2pMyAdsRequestV3 { +export interface SpotMainSubTransferRecordRequestV2 { + coin?: string; + role?: 'initiator' | 'receiver'; + subUid?: string; startTime?: string; endTime?: string; + clientOid?: string; limit?: string; - cursor?: string; - advId?: string; - token?: string; - fiat?: string; - status?: P2pAdStatusV3; + idLessThan?: string; } ⋮---- -export interface GetP2pPendingOrdersRequestV3 { - orderId?: string; - side?: P2pSideV3; +export interface GetSpotTransferRecordRequestV2 { + coin: string; + fromType: SpotAccountTypeV2; startTime?: string; endTime?: string; - cursor?: string; + clientOid?: string; limit?: string; + idLessThan?: string; } ⋮---- -export interface GetP2pAllOrdersRequestV3 { +export interface GetSpotSubAccountDepositRecordRequestV2 { + subUid: string; + coin?: string; startTime?: string; endTime?: string; + idLessThan?: string; limit?: string; - cursor?: string; - orderId?: string; - side?: P2pSideV3; - status?: P2pOrderStatusV3; -} -⋮---- -export interface GetP2pOrderInfoRequestV3 { - orderId: string; } ⋮---- -export interface P2pOrderActionRequestV3 { - orderId: string; +export interface GetSpotWithdrawalRecordRequestV2 { + coin?: string; + clientOid?: string; + startTime: string; + endTime: string; + idLessThan?: string; + orderId?: string; + limit?: string; } ⋮---- -export interface GetP2pBalanceRequestV3 { - token: string; +export interface GetSpotDepositRecordRequestV2 { + coin?: string; + orderId?: string; + startTime: string; + endTime: string; + idLessThan?: string; + limit?: string; } ================ -File: src/types/request/v3/strategy.ts +File: src/types/request/v3/copytrading.ts ================ -export type StrategyOrderTypeV3 = 'tpsl' | 'trigger'; -⋮---- -export type StrategyOrderStatusV3 = - | 'pending' - | 'success' - | 'failed' - | 'cancelled' - | 'submitting'; +export interface GetCopyFuturesMaxTransferableRequestV3 { + coin: string; +} ⋮---- -export type StrategyTriggerByV3 = 'market' | 'mark'; +export interface CopyFuturesTransferRequestV3 { + type: 'in' | 'out'; + coin: string; + amount: string; + /** Source account type(s) for transfer-in. Comma-separated: funding, uta, otc */ + inAccountType?: string; +} ⋮---- -export type StrategyTriggerOrderTypeV3 = 'limit' | 'market'; +/** Source account type(s) for transfer-in. Comma-separated: funding, uta, otc */ ⋮---- -export interface PlaceStrategyOrderRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol: string; - clientOid?: string; - type?: StrategyOrderTypeV3; - tpslMode?: 'full' | 'partial'; - /** Required when tpslMode=partial or for trigger orders */ - qty?: string; - side?: 'buy' | 'sell'; - posSide?: 'long' | 'short'; - reduceOnly?: 'yes' | 'no'; - tpTriggerBy?: StrategyTriggerByV3; - slTriggerBy?: StrategyTriggerByV3; - takeProfit?: string; - stopLoss?: string; - tpOrderType?: StrategyTriggerOrderTypeV3; - slOrderType?: StrategyTriggerOrderTypeV3; - tpLimitPrice?: string; - slLimitPrice?: string; - triggerBy?: StrategyTriggerByV3; - triggerPrice?: string; - triggerOrderType?: StrategyTriggerOrderTypeV3; - triggerOrderPrice?: string; +export interface GetCopyFuturesTransferRecordRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + /** Pass transferId from the previous page to paginate forward */ + cursor?: string; } ⋮---- -/** Required when tpslMode=partial or for trigger orders */ +/** Pass transferId from the previous page to paginate forward */ ⋮---- -export interface ModifyStrategyOrderRequestV3 { - orderId?: string; - clientOid?: string; - qty: string; - tpTriggerBy?: StrategyTriggerByV3; - slTriggerBy?: StrategyTriggerByV3; - takeProfit?: string; - stopLoss?: string; - tpOrderType?: StrategyTriggerOrderTypeV3; - slOrderType?: StrategyTriggerOrderTypeV3; - tpLimitPrice?: string; - slLimitPrice?: string; - triggerBy?: StrategyTriggerByV3; - triggerPrice?: string; - triggerOrderType?: StrategyTriggerOrderTypeV3; - triggerOrderPrice?: string; -} -⋮---- -export interface CancelStrategyOrderRequestV3 { - orderId?: string; - clientOid?: string; -} -⋮---- -export interface GetUnfilledStrategyOrdersRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - type?: StrategyOrderTypeV3; +export interface GetCopyFuturesFollowersRequestV3 { + limit?: string; + cursor?: string; } ⋮---- -export interface GetHistoryStrategyOrdersRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - type?: StrategyOrderTypeV3; +export interface GetCopyFuturesProfitDetailsRequestV3 { startTime?: string; endTime?: string; limit?: string; @@ -3486,2539 +3535,2531 @@ export interface GetHistoryStrategyOrdersRequestV3 { } ================ -File: src/types/request/v3/trade.ts +File: src/types/request/v3/earn.ts ================ -export interface BatchModifyOrderRequestV3 { - orderId?: string; - clientOid?: string; - qty?: string; - price?: string; - autoCancel?: 'yes' | 'no'; +/** + * + * + * Earn | On-Chain Elite (UTA) + * + * + */ +⋮---- +export interface GetEarnEliteRecordsRequestV3 { + type: 'subscribe' | 'redeem' | 'interest'; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface CancelAllOrdersRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; +export interface GetEarnEliteSubscribeInfoRequestV3 { + productId: string; } ⋮---- -export interface CancelBatchOrdersRequestV3 { - orderId?: string; - clientOid?: string; - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol: string; +export interface EarnEliteSubscribeRequestV3 { + productSubId: string; + amount: string; + coin?: string; + paymentAccount?: 'spot' | 'unified'; } ⋮---- -export interface CloseAllPositionsRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - posSide?: 'long' | 'short'; +export interface GetEarnEliteSubscribeResultRequestV3 { + orderId: string; } ⋮---- -export interface CancelOrderRequestV3 { - orderId?: string; - clientOid?: string; +export interface GetEarnEliteRedeemInfoRequestV3 { + productId: string; } ⋮---- -export interface GetMaxOpenAvailableRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol: string; - orderType: 'limit' | 'market'; - side: 'buy' | 'sell'; - price?: string; - size?: string; +export interface RedeemEarnEliteRequestV3 { + productId: string; + productSubId: string; + redeemType: 'fast' | 'standard'; + amount: string; + receiveAccount: 'spot' | 'unified'; + advancedSettle?: 'yes' | 'no'; + coin?: string; +} + +================ +File: src/types/request/v3/loan.ts +================ +export interface GetTransferedRequestV3 { + userId?: string; + coin: string; } ⋮---- -export interface GetOrderInfoRequestV3 { - orderId?: string; - clientOid?: string; +export interface GetSymbolsRequestV3 { + productId: string; } ⋮---- -export interface GetFillsRequestV3 { - orderId?: string; +export interface GetRepaidHistoryRequestV3 { startTime?: string; endTime?: string; limit?: string; - cursor?: string; } ⋮---- -export interface GetUnfilledOrdersRequestV3 { - category?: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +export interface GetProductInfosRequestV3 { + productId: string; } ⋮---- -export interface GetHistoryOrdersRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; +export interface GetLoanOrderRequestV3 { + orderId?: string; startTime?: string; endTime?: string; - limit?: string; - cursor?: string; } ⋮---- -export interface GetPositionHistoryRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +export interface GetEnsureCoinsRequestV3 { + productId: string; } ⋮---- -export interface GetCurrentPositionRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - posSide?: 'long' | 'short'; +export interface BindUidRequestV3 { + riskUnitId?: string; + uid: string; + operate: 'bind' | 'unbind'; } ⋮---- -export interface ModifyOrderRequestV3 { - orderId?: string; - clientOid?: string; - qty?: string; - price?: string; - autoCancel?: 'yes' | 'no'; - symbol?: string; - category?: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - tpTriggerBy?: 'market' | 'mark'; - slTriggerBy?: 'market' | 'mark'; - takeProfit?: string; - stopLoss?: string; - tpOrderType?: 'limit' | 'market'; - slOrderType?: 'limit' | 'market'; - tpLimitPrice?: string; - slLimitPrice?: string; +export interface GetLTVConvertRequestV3 { + riskUnitId?: string; } ⋮---- -export interface PlaceRealityOrderRequestV3 { - symbol: string; - side: 'buy' | 'sell'; - orderType: 'limit' | 'market'; - qty: string; - price?: string; - clientOid?: string; +/* Unified Account Staking & Lending (Crypto Loans) - /api/v3/loan/* */ +⋮---- +export interface GetLoanCoinsRequestV3 { + coin?: string; } ⋮---- -export interface CancelRealityOrderRequestV3 { - symbol: string; - orderId?: string; - clientOid?: string; +export interface GetLoanInterestRequestV3 { + loanCoin: string; + pledgeCoin: string; + daily: 'SEVEN' | 'THIRTY' | 'FLEXIBLE'; + pledgeAmount: string; } ⋮---- -export interface PlaceBatchOrdersRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol: string; - qty: string; - price?: string; - side: 'buy' | 'sell'; - orderType: 'limit' | 'market'; - timeInForce?: 'ioc' | 'fok' | 'gtc' | 'post_only'; - posSide?: 'long' | 'short'; - clientOid?: string; - reduceOnly?: 'yes' | 'no'; +export interface LoanBorrowRequestV3 { + loanCoin: string; + pledgeCoin: string; + daily: 'SEVEN' | 'THIRTY' | 'FLEXIBLE'; + pledgeAmount?: string; + loanAmount?: string; } ⋮---- -export type FuturesMarginModeV3 = 'crossed' | 'isolated'; +export interface GetLoanBorrowOngoingRequestV3 { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; +} ⋮---- -export interface PlaceOrderRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol: string; - qty: string; - price?: string; - side: 'buy' | 'sell'; - orderType: 'limit' | 'market'; - timeInForce?: 'ioc' | 'fok' | 'gtc' | 'post_only'; - posSide?: 'long' | 'short'; - clientOid?: string; - reduceOnly?: 'yes' | 'no'; - /** Futures only. Defaults to crossed */ - marginMode?: FuturesMarginModeV3; - stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; - takeProfitPrice?: string; - stopLossPrice?: string; - takeProfitTriggerType?: 'mark_price' | 'last_price'; - stopLossTriggerType?: 'mark_price' | 'last_price'; +export interface GetLoanBorrowHistoryRequestV3 { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; + status?: 'ROLLBACK' | 'FORCE' | 'REPAY'; + startTime: string; + endTime: string; + pageNum?: string; + pageSize?: string; } ⋮---- -/** Futures only. Defaults to crossed */ +export interface LoanRepayRequestV3 { + orderId: string; + method: 'borrowed_coin' | 'collateral'; + repayAll: 'yes' | 'no'; + amount?: string; + repayUnlock?: 'yes' | 'no'; +} ⋮---- -export interface CountdownCancelAllRequestV3 { - countdown: string; // seconds until auto-cancel (5-60, or 0 to disable) +export interface GetLoanRepayHistoryRequestV3 { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; + startTime: string; + endTime: string; + pageNum?: string; + pageSize?: string; } ⋮---- -countdown: string; // seconds until auto-cancel (5-60, or 0 to disable) +export interface LoanRevisePledgeRequestV3 { + orderId: string; + amount: string; + pledgeCoin: string; + reviseType?: 'OUT' | 'IN'; +} +⋮---- +export interface GetLoanPledgeRateHistoryRequestV3 { + orderId?: string; + reviseSide?: 'down' | 'up'; + pledgeCoin?: string; + startTime: string; + endTime: string; + pageNum?: string; + pageSize?: string; +} +⋮---- +export interface GetLoanReducesRequestV3 { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; + status?: 'COMPLETE' | 'WAIT'; + startTime: string; + endTime: string; + pageNum?: string; + pageSize?: string; +} ================ -File: src/types/response/v2/common.ts +File: src/types/request/v3/p2p.ts ================ -/** - * - * * Common | Notice - * - */ +export type P2pSideV3 = 'buy' | 'sell'; ⋮---- -export interface AnnouncementV2 { - annId: string; - annTitle: string; - annDesc: string; - cTime: string; - language: string; - annUrl: string; -} +export type P2pPriceTypeV3 = 'fixed' | 'floating'; ⋮---- -/** - * - * * Common | Public - * - */ +export type P2pMarketTypeV3 = 'public' | 'private'; ⋮---- -/** - * - * * Common | Tax - * - */ +export type P2pAdStatusV3 = 'publish' | 'delist' | 'remove'; ⋮---- -export interface SpotTransactionRecordV2 { - id: string; - coin: string; - spotTaxType: string; - amount: string; - fee: string; - balance: string; - ts: string; -} +export type P2pAdOperationV3 = 'publish' | 'delist' | 'remove'; ⋮---- -export interface FuturesTransactionRecordV2 { - id: string; - symbol: string; - marginCoin: string; - futureTaxType: string; - amount: string; - fee: string; - ts: string; -} +export type P2pOrderStatusV3 = + | 'pending_payment' + | 'pending_release' + | 'completed' + | 'cancelled' + | 'in_appeal'; ⋮---- -export interface MarginTransactionRecordV2 { - id: string; - coin: string; - marginTaxType: string; - amount: string; - fee: string; - total: string; - symbol: string; - ts: string; +export interface P2pPayMethodIdRefV3 { + payMethodId: string; + userPayMethodId?: string; } ⋮---- -export interface P2PMerchantOrdersV2 { - id: string; - coin: string; - p2pTaxType: string; - total: string; - ts: string; +export interface GetP2pAdListRequestV3 { + token: string; + fiat: string; + side: P2pSideV3; + amount?: string; + pageNum: string; + limit: string; } ⋮---- -/** - * - * * Common | P2P - * - */ +export interface GetP2pExchangeRateRequestV3 { + token: string; + fiat: string; +} ⋮---- -export interface P2PMerchantV2 { - registerTime: string; - nickName: string; - isOnline: string; - avgPaymentTime: string; - avgReleaseTime: string; - totalTrades: string; - totalBuy: string; - totalSell: string; - totalCompletionRate: string; - trades30d: string; - sell30d: string; - buy30d: string; - completionRate30d: string; +export interface P2pFeeSimulateRequestV3 { + token: string; + fiat: string; + side: P2pSideV3; + marketType: P2pMarketTypeV3; + amount: string; } ⋮---- -export interface P2PMerchantInfoV2 { - registerTime: string; - nickName: string; - merchantId: string; - avgPaymentTime: string; - avgReleaseTime: string; - totalTrades: string; - totalBuy: string; - totalSell: string; - totalCompletionRate: string; - trades30d: string; - sell30d: string; - buy30d: string; - completionRate30d: string; - kycStatus: boolean; - emailBindStatus: boolean; - mobileBindStatus: boolean; - email: string; - mobile: string; +export interface GetP2pAdLimitRequestV3 { + token: string; + fiat: string; + side: P2pSideV3; } ⋮---- -export interface P2PMerchantOrderV2 { - orderId: string; - orderNo: string; - advNo: string; - side: string; - count: string; - coin: string; - price: string; +export interface CreateP2pAdRequestV3 { + token: string; fiat: string; - withdrawTime: string; - representTime: string; - releaseTime: string; - paymentTime: string; - amount: string; - status: string; - buyerRealName: string; - sellerRealName: string; - ctime: string; - utime: string; - paymentInfo: { - paymethodName: string; - paymethodId: string; - paymethodInfo: { - name: string; - required: string; - type: string; - value: string; - }[]; - }; + side: P2pSideV3; + priceType: P2pPriceTypeV3; + price?: string; + premium?: string; + minAmount: string; + maxAmount: string; + quantity: string; + payMethodIds: P2pPayMethodIdRefV3[]; + remark?: string; + tradeTerms?: string; + payTimeLimit: string; } ⋮---- -export interface P2PMerchantAdvertismentV2 { +export interface UpdateP2pAdRequestV3 { advId: string; - advNo: string; - side: string; - advSize: string; - size: string; - coin: string; - price: string; - coinPrecision: string; - fiat: string; - fiatPrecision: string; - fiatSymbol: string; - status: string; - hide: string; - maxTradeAmount: string; - minTradeAmount: string; - payDuration: string; - turnoverNum: string; - turnoverRate: string; - label: string | null; - userLimitList: { - minCompleteNum: string; - maxCompleteNum: string; - placeOrderNum: string; - allowMerchantPlace: string; - completeRate30d: string; - country: string; - }; - paymentMethodList: { - paymentMethod: string; - paymentId: string; - paymentInfo: { - name: string; - required: boolean; - type: string; - }[]; - }[]; - merchantCertifiedList: { - imageUrl: string; - desc: string; - }[]; - utime: string; - ctime: string; -} -⋮---- -/** - * - * * Common | Trading insights - * - */ -⋮---- -export interface SpotWhaleNetFlowV2 { - volume: string; - date: string; + priceType?: P2pPriceTypeV3; + price?: string; + premium?: string; + minAmount?: string; + maxAmount?: string; + quantity?: string; + payMethodIds?: P2pPayMethodIdRefV3[]; + payTimeLimit?: string; + remark?: string; + tradeTerms?: string; } ⋮---- -export interface FuturesActiveBuySellVolumeV2 { - buyVolume: string; - sellVolume: string; - ts: string; +export interface OperateP2pAdRequestV3 { + advId: string; + operation: P2pAdOperationV3; } ⋮---- -export interface FuturesActiveLongShortPositionV2 { - longPositionRatio: string; - shortPositionRatio: string; - longShortPositionRatio: string; - ts: string; +export interface GetP2pAdInfoRequestV3 { + advId: string; } ⋮---- -export interface LeveragedLongShortRatioV2 { - ts: string; - longShortRatio: string; +export interface GetP2pMyAdsRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; + advId?: string; + token?: string; + fiat?: string; + status?: P2pAdStatusV3; } ⋮---- -export interface MarginLoanGrowthRateV2 { - ts: string; - growthRate: string; +export interface GetP2pPendingOrdersRequestV3 { + orderId?: string; + side?: P2pSideV3; + startTime?: string; + endTime?: string; + cursor?: string; + limit?: string; } ⋮---- -export interface IsolatedMarginBorrowingRatioV2 { - ts: string; - borrowRate: string; +export interface GetP2pAllOrdersRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; + orderId?: string; + side?: P2pSideV3; + status?: P2pOrderStatusV3; } ⋮---- -export interface FuturesLongShortRatioV2 { - longRatio: string; - shortRatio: string; - longShortRatio: string; - ts: string; +export interface GetP2pOrderInfoRequestV3 { + orderId: string; } ⋮---- -export interface SpotFundFlowV2 { - whaleBuyVolume: string; - dolphinBuyVolume: string; - fishBuyVolume: string; - whaleSellVolume: string; - dolphinSellVolume: string; - fishSellVolume: string; - whaleBuyRatio: string; - dolphinBuyRatio: string; - fishBuyRatio: string; - whaleSellRatio: string; - dolphinSellRatio: string; - fishSellRatio: string; +export interface P2pOrderActionRequestV3 { + orderId: string; } ⋮---- -export interface FuturesActiveLongShortAccountV2 { - longAccountRatio: string; - shortAccountRatio: string; - longShortAccountRatio: string; - ts: string; +export interface GetP2pBalanceRequestV3 { + token: string; } -⋮---- + +================ +File: src/types/response/v2/broker.ts +================ /** * - * * Common | Virtual Subaccount + * * Broker | Subaccount * */ ⋮---- -export interface CreateVirtualSubAccountV2 { - failureList: { - subaAccountName: string; - }[]; - successList: { - subaAccountUid: string; - subaAccountName: string; - status: string; - label: string; - permList: string[]; - cTime: string; - uTime: string; - }[]; -} -⋮---- -export interface CreateVirtualSubAccountAndApiKeyV2 { - subAccountUid: string; - subAccountName: string; - label: string; - subAccountApiKey: string; - secretKey: string; +export interface CreateSubaccountResponseV2 { + subUid: string; + subaccountName: string; + status: string; permList: string[]; - ipList: string[]; + label: string; + cTime: string; } ⋮---- -export interface VirtualSubAccountV2 { - subAccountUid: string; - subAccountName: string; +export interface BrokerSubaccountV2 { + subUid: string; + subaccountName: string; status: string; permList: string[]; label: string; - accountType: string; - bindingTime: string; + language: string; cTime: string; uTime: string; } ⋮---- -export interface CreateVirtualSubAccountApiKeyV2 { - subAccountUid: string; - label: string; - subAccountApiKey: string; - secretKey: string; +export interface ModifySubaccountResponseV2 { + subUid: string; + subaccountName: string; + status: string; permList: string[]; - ipList: string[]; -} -⋮---- -export interface ModifyVirtualSubAccountApiKeyV2 { - subAccountUid: string; label: string; - subAccountApiKey: string; - secretKey: string; - permList: string[]; - ipList: string[]; + language: string; + cTime: string; + uTime: string; } ⋮---- -export interface CreateAgentSubaccountV2 { - username: string; +export interface SubaccountEmailV2 { subUid: string; - apiKey: string; - secret: string; - note: string; - createdTime: string; -} -⋮---- -export interface SubAccountApiKeyItemV2 { - subAccountUid: string; - label: string; - subAccountApiKey: string; - permList: string[]; - ipList: string[]; + subaccountName: string; + subaccountEmail: string; + cTime: string; + uTime: string; } ⋮---- -/** - * - * * Common | Assets - * - */ -⋮---- -export interface FundingAssetV2 { +export interface BrokerSubaccountSpotAssetV2 { coin: string; available: string; frozen: string; - usdtValue: string; + locked: string; + uTime: string; } ⋮---- -export interface BotAssetV2 { - coin: string; +export interface BrokerSubaccountFutureAssetV2 { + marginCoin: string; available: string; - equity: string; - bonus: string; frozen: string; - usdtValue: string; + locked: string; + crossedMaxAvailable: string; + isolatedMaxAvailable: string; + maxTransferOut: string; + accountEquity: string; + usdtEquity: string; + btcEquity: string; + uTime: string; } ⋮---- -/** - * - * * Common | Convert - * - */ -⋮---- -export interface ConvertCurrencyV2 { +export interface CreateSubaccountDepositAddressV2 { + subUid: string; coin: string; - available: string; - maxAmount: string; - minAmount: string; + address: string; + chain: string; + tag: string; + url: string; + cTime: string; } ⋮---- -export interface ConvertQuotedPriceV2 { - fee: string; - fromCoinSize: string; - fromCoin: string; - cnvtPrice: string; - toCoinSize: string; - toCoin: string; - traceId: string; -} -⋮---- -export interface ConvertTradeResponseV2 { - ts: string; - cnvtPrice: string; - toCoinSize: string; - toCoin: string; +export interface SubaccountDepositV2 { + orderId: string; + txId: string; + coin: string; + type: string; + dest: string; + amount: string; + status: string; + fromAddress: string; + toAddress: string; + fee: string; + chain: string; + confirm: string; + tag: string; + cTime: string; + uTime: string; } ⋮---- -export interface ConvertRecordV2 { - id: string; - ts: string; - cnvtPrice: string; +export interface BrokerSubaccountWithdrawalV2 { + orderId: string; + txId: string; + coin: string; + type: string; + dest: string; + amount: string; + status: string; + fromAddress: string; + toAddress: string; fee: string; - fromCoinSize: string; - fromCoin: string; - toCoinSize: string; - toCoin: string; + chain: string; + confirm: string; + tag: string; + userId: string; + cTime: string; + uTime: string; } ⋮---- /** * - * * Common | BGB Convert + * Broker | Api Key * */ ⋮---- -export interface BGBConvertCoinV2 { - coin: string; - available: string; - bgbEstAmount: string; - precision: string; - feeDetail: { - feeRate: string; - fee: string; - }[]; - cTime: string; +export interface CreateSubaccountApiKeyResponseV2 { + subUid: string; + apiKey: string; + secretKey: string; + label: string; + ipList: string[]; + permType: string; + permList: string[]; } ⋮---- -export interface ConvertBGBResponseV2 { - orderList: { - coin: string; - orderId: string; - }[]; +export interface SubaccountApiKeyV2 { + subUid: string; + label: string; + apiKey: string; + secretKey: string; + permType: string; + permList: string[]; + ipList: string[]; } ⋮---- -export interface BGBConvertHistoryV2 { - orderId: string; - fromCoin: string; - fromAmount: string; - fromCoinPrice: string; - toCoin: string; - toAmount: string; - toCoinPrice: string; - feeDetail: { - feeCoin: string; - fee: string; - }[]; - status: string; - ctime: string; +export interface ModifySubaccountApiKeyResponseV2 { + subUid: string; + apiKey: string; + label: string; + ipList: string[]; + permType: string; + permList: string[]; } - -================ -File: src/types/response/v2/earn.ts -================ +⋮---- /** * - * - * Earn | Savings - * + * * Broker | All Sub-accounts Deposit and Withdrawal Records * */ ⋮---- -export interface EarnSavingsProductsV2 { - productId: string; +export interface AllSubDepositWithdrawalRecordV2 { + uid: string; + txId: string; + type: 'deposit' | 'withdrawal'; + subType: 'onchain' | 'internal' | 'fast'; coin: string; - periodType: string; - period: string; - apyType: string; - advanceRedeem: string; - settleMethod: string; - apyList: { - rateLevel: string; - minStepVal: string; - maxStepVal: string; - currentApy: string; - }[]; - status: string; - productLevel: string; -} -⋮---- -export interface EarnSavingsAccountV2 { - btcAmount: string; - usdtAmount: string; - btc24hEarning: string; - usdt24hEarning: string; - btcTotalEarning: string; - usdtTotalEarning: string; -} -⋮---- -export interface EarnSavingsAssetV2 { - productId: string; - orderId: string; - productCoin: string; - interestCoin: string; - periodType: string; - period: string; - holdAmount: string; - lastProfit: string; - totalProfit: string; - holdDays: string; - status: string; - allowRedemption: string; - productLevel: string; - apy: { - rateLevel: string; - minApy: string; - maxApy: string; - currentApy: string; - }[]; -} -⋮---- -export interface EarnSavingsAssetsV2 { - resultList: EarnSavingsAssetV2[]; - endId: string; -} -⋮---- -export interface EarnSavingsRecordV2 { - orderId: string; - coinName: string; - settleCoinName: string; - productType: string; - period: string; - productLevel: string; amount: string; + status: 'pending' | 'fail' | 'success'; ts: string; - orderType: string; } ⋮---- -export interface EarnSavingsRecordsV2 { - resultList: EarnSavingsRecordV2[]; - endId: string; -} +/** + * + * * Broker | Subaccounts + * + */ ⋮---- -export interface EarnSavingsSubscriptionDetailV2 { - singleMinAmount: string; - singleMaxAmount: string; - remainingAmount: string; - subscribePrecision: string; - profitPrecision: string; - subscribeTime: string; - interestTime: string; - settleTime: string; - expireTime: string; - redeemTime: string; - settleMethod: string; - apyList: { - rateLevel: string; - minStepVal: string; - maxStepVal: string; - currentApy: string; - }[]; - redeemDelay: string; +export interface BrokerSubaccountInfoV2 { + uid: string; + asset: string; + firstTimeDeposit: string; + firstTimeTrade: string; + registerTime: string; } ⋮---- /** * - * - * Earn | Earn Account - * + * * Broker | Commissions * */ ⋮---- +export interface BrokerCommissionV2 { + uid: string; + coin: string; + symbol: string; + dealtAmount: string; + totalFee: string; + deductedFee: string; + paidFee: string; + markUpFee: string; + totalCommission: string; +} +⋮---- /** * + * * Broker | Trade Volume * - * Earn | Shark Fin + */ +⋮---- +export interface BrokerTradeVolumeV2 { + uid: string; + volume: string; + spotVolume: string; + futureVolume: string; +} +⋮---- +/** * + * * Broker | Total Commission * */ ⋮---- -export interface EarnSharkfinProductV2 { - productId: string; - productName: string; - productCoin: string; - subscribeCoin: string; - farmingStartTime: string; - farmingEndTime: string; - lowerRate: string; - defaultRate: string; - upperRate: string; - period: string; - interestStartTime: string; - status: string; - minAmount: string; - limitAmount: string; - soldAmount: string; - endTime: string; - startTime: string; -} -⋮---- -export interface EarnSharkfinProductsV2 { - resultList: EarnSharkfinProductV2[]; - endId: string; -} -⋮---- -export interface EarnSharkfinAccountV2 { - btcSubscribeAmount: string; - usdtSubscribeAmount: string; - btcHistoricalAmount: string; - usdtHistoricalAmount: string; - btcTotalEarning: string; - usdtTotalEarning: string; -} -⋮---- -export interface EarnSharkfinAssetV2 { - productId: string; - interestStartTime: string; - interestEndTime: string; - productCoin: string; - subscribeCoin: string; - trend: string; - settleTime: string; - interestAmount: string; - productStatus: string; +export interface BrokerTotalCommissionV2 { + date: string; + totalTradingVolume: string; + totalActiveTraders: string; + totalCommission: string; + spot: { + spotTradingVolume: string; + spotTradingFee: string; + spotPureTradingFee: string; + spotCommission: string; + }; + futures: { + futuresTradingVolume: string; + futuresTradingFee: string; + futuresPureTradingFee: string; + futuresCommission: string; + }; } ⋮---- -export interface EarnSharkfinAssetsV2 { - resultList: EarnSharkfinAssetV2[]; - endId: string; -} +/** + * + * * Broker | Order Commission + * + */ ⋮---- -export interface EarnSharkfinRecordV2 { +export interface BrokerOrderCommissionItemV2 { + fillId: string; orderId: string; - product: string; - period: string; - amount: string; ts: string; - type: string; -} -export interface EarnSharkfinRecordsV2 { - resultList: EarnSharkfinRecordV2[]; - endId: string; + clientOid: string; + bizType: 'spot' | 'futures'; + subBizType: + | 'spot_trade' + | 'spot_margin' + | 'usdt_futures' + | 'coin_futures' + | 'usdc_futures'; + symbol: string; + volume: string; + fee: string; + pureFee: string; + rebateAmount: string; } ⋮---- -export interface EarnSharkfinSubscriptionDetailV2 { - productCoin: string; - subscribeCoin: string; - interestTime: string; - expirationTime: string; - minPrice: string; - currentPrice: string; - maxPrice: string; - minRate: string; - defaultRate: string; - maxRate: string; - period: string; - productMinAmount: string; - availableBalance: string; - userAmount: string; - remainingAmount: string; - profitPrecision: string; - subscribePrecision: string; +export interface BrokerOrderCommissionV2 { + commissionlist: BrokerOrderCommissionItemV2[]; + endId: string; } ⋮---- /** * + * * Broker | Rebate Info * - * Earn | Loan + */ +⋮---- +export interface BrokerRebateInfoV2 { + affiliationType: 'affiliate' | 'official'; + userLevel: string; + clientSpotRebateRatio: string; + clientFuturesRebateRatio: string; +} +⋮---- +/** * + * * Broker | Agent (affiliate) customer APIs * */ ⋮---- -export interface EarnLoanCurrencyLoanInfoV2 { - coin: string; - hourRate7D: string; - rate7D: string; - hourRate30D: string; - rate30D: string; - minUsdt: string; - maxUsdt: string; - min: string; - max: string; -} -export interface EarnLoanCurrencyPledgeInfoV2 { +export interface AgentCustomerCommissionItemV2 { + uid: string; + date: string; coin: string; - initRate: string; - supRate: string; - forceRate: string; - minUsdt: string; - maxUsdt: string; + symbol: string; + productType: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES' + | string; + dealAmount: string; + fee: string; + feeDeduction: string; + activityBonusDeduct: string; + spotCouponDeduct: string; + futuresCouponDeduct: string; + spotFeeDiscountDeduct: string; + negativeMakerFeeDeduct: string; + feePaid: string; + rebateAmount: string; + userTotalRebateAmount: string; + dayTotalRebateAmount: string; + totalRebateAmount: string; } ⋮---- -export interface EarnLoanCurrenciesV2 { - loanInfos: EarnLoanCurrencyLoanInfoV2[]; - pledgeInfos: EarnLoanCurrencyPledgeInfoV2[]; +export interface AgentCustomerCommissionsV2 { + endId: string; + commissionList: AgentCustomerCommissionItemV2[]; } ⋮---- -export interface EarnLoanOrdersV2 { - orderId: string; - loanCoin: string; - loanAmount: string; - interestAmount: string; - hourInterestRate: string; - pledgeCoin: string; - pledgeAmount: string; - pledgeRate: string; - supRate: string; - forceRate: string; - borrowTime: string; - expireTime: string; +export interface AgentSubCustomerItemV2 { + uid: string; + registerTime: string; } ⋮---- -export interface EarnLoanRepayResponseV2 { - loanCoin: string; - pledgeCoin: string; - repayAmount: string; - payInterest: string; - repayLoanAmount: string; - repayUnlockAmount: string; +export interface AgentSubCustomerListV2 { + list: AgentSubCustomerItemV2[]; + minId: string; } ⋮---- -export interface EarnLoanRepayHistoryV2 { - orderId: string; - loanCoin: string; - pledgeCoin: string; - repayAmount: string; - payInterest: string; - repayLoanAmount: string; - repayUnlockAmount: string; - repayTime: string; +export interface AgentCustomerTradeVolumeItemV2 { + uid: string; + /** API field name (Bitget spelling). */ + volumn: string; + spotVolume: string; + futuresVolume: string; + time: string; } ⋮---- -export interface EarnLoanPledgeRateHistoryV2 { - loanCoin: string; - pledgeCoin: string; - orderId: string; - reviseTime: string; - reviseSide: string; - reviseAmount: string; - afterPledgeRate: string; - beforePledgeRate: string; +/** API field name (Bitget spelling). */ +⋮---- +export interface AgentCustomerListItemV2 { + uid: string; + registerTime: string; } ⋮---- -export interface EarnLoanHistoryV2 { - orderId: string; - loanCoin: string; - pledgeCoin: string; - initPledgeAmount: string; - initLoanAmount: string; - hourRate: string; - daily: string; - borrowTime: string; - status: string; +export interface AgentCustomerKycItemV2 { + uid: string; + kycResult: 'passed' | 'not_passed' | string; } ⋮---- -export interface EarnLoanDebtPledgeInfoV2 { - coin: string; - amount: string; - amountUsdt: string; +export interface AgentCustomerKycResultV2 { + userList: AgentCustomerKycItemV2[]; + endId: string; } ⋮---- -export interface EarnLoanDebtLoanInfoV2 { - coin: string; - amount: string; - amountUsdt: string; +export interface AgentCustomerDepositItemV2 { + orderId: string; + uid: string; + depositTime: string; + depositCoin: string; + depositAmount: string; } ⋮---- -export interface EarnLoanDebtsV2 { - pledgeInfos: EarnLoanDebtPledgeInfoV2[]; - loanInfos: EarnLoanDebtLoanInfoV2[]; +export interface AgentCustomerAssetItemV2 { + balance: string; + uid: string; + uTime: string; + remark: string; } ⋮---- -export interface EarnLoanLiquidationRecordsV2 { - orderId: string; - loanCoin: string; - pledgeCoin: string; - reduceTime: string; - pledgeRate: string; - pledgePrice: string; - status: string; - pledgeAmount: string; - reduceFee: string; - residueAmount: string; - runlockAmount: string; - repayLoanAmount: string; +export interface AgentCommissionDetailItemV2 { + uid: string; + bizType: 'spot' | 'futures' | string; + subBizType: string; + symbol: string; + coin: string; + fee: string; + volume: string; + activityBonusDeduct: string; + spotCouponDeduct: string; + futuresCouponDeduct: string; + spotFeeDiscountDeduct: string; + negativeMakerFeeDeduct: string; + feePaid: string; + directCommission: string; + subCommission: string; + partnerCommission: string; + partnerActualCommission: string; + traderType: string; + apiType: string; + status: 'settled' | 'unsettled' | 'notIssued' | string; + startCalculationTime: string; + endCalculationTime: string; } ⋮---- +export interface AgentCommissionDetailV2 { + endId: string; + commissionList: AgentCommissionDetailItemV2[]; +} + +================ +File: src/types/response/v2/common.ts +================ /** * - * - * Earn | On-Chain Elite - * + * * Common | Notice * */ ⋮---- -export interface EarnEliteSubscriptionCoinV2 { - subscriptionCoin: string; - precision: string; - feeRate: string; - exchangeRate: string; - remainQuota?: string; - minAmount?: string; -} -⋮---- -export interface EarnEliteProductV2 { - productId: string; - coin: string; - minApr: string; - maxApr: string; - subscriptionCoinList: EarnEliteSubscriptionCoinV2[]; - sellOut: 'YES' | 'NO' | string; -} -⋮---- -export interface EarnEliteAssetProjectV2 { - projectName: string; +export interface AnnouncementV2 { + annId: string; + annTitle: string; + annDesc: string; + cTime: string; + language: string; + annUrl: string; } ⋮---- -export interface EarnEliteAssetV2 { - productId: string; - productCoin: string; - holdingAmount: string; - usdtHoldingAmount: string; - exchangeRate: string; - apr: string; - minApy?: string; - maxApy?: string; - subscriptionCoin: string; - exchangeAmount: string; - projectList?: EarnEliteAssetProjectV2[]; - unsettledBGPoints: string; - interestCoin: string; - totalProfit: string; -} +/** + * + * * Common | Public + * + */ ⋮---- -export interface EarnEliteAssetsV2 { - resultList: EarnEliteAssetV2[]; -} +/** + * + * * Common | Tax + * + */ ⋮---- -export interface EarnEliteRecordV2 { - recordId: string; - productId: string; +export interface SpotTransactionRecordV2 { + id: string; coin: string; - status: string; - exchangeRate: string; - receivedCoin: string; - receivedAmount: string; - investAmount: string; - feeRate: string; - redeemType?: string | string[]; - receivingAccount: string; - actualReceivingAccount: string; - paymentAccount?: string[]; - settlePoints: string; + spotTaxType: string; + amount: string; fee: string; + balance: string; + ts: string; } ⋮---- -export interface EarnEliteRecordsV2 { - recordList: EarnEliteRecordV2[]; - endId: string; -} -⋮---- -export interface EarnEliteSubscribeInfoV2 { - productSubId: string; - minAmount: string; - remainQuota: string; - exchangeRate: string; - productCoin: string; - interestTime: string; - settleTime: string; - precision: string; - feeRate: string; - /** Present for BGUSD per API docs. */ - subscriptionCoinList?: EarnEliteSubscriptionCoinV2[]; -} -⋮---- -/** Present for BGUSD per API docs. */ -⋮---- -export interface EarnEliteSubscribeResultV2 { - orderId: string; -} -⋮---- -export interface EarnEliteSubscribeStatusV2 { - result: 'settled' | 'pending' | 'rejected' | string; -} -⋮---- -export interface EarnEliteRedeemInfoBgusdReceiveCoinV2 { - bgusdReceiveCoin: string; - bgusdExchangeRate: string; +export interface FuturesTransactionRecordV2 { + id: string; + symbol: string; + marginCoin: string; + futureTaxType: string; + amount: string; + fee: string; + ts: string; } ⋮---- -export interface EarnEliteRedeemModeV2 { - redeemFeeRate: string; - remainQuota: string; - redeemType: 'fast' | 'standard' | string; - redeemScale: string; - redeemDelayDate: string; - minRedeemAmount: string; - redeemTime: string; +export interface MarginTransactionRecordV2 { + id: string; + coin: string; + marginTaxType: string; + amount: string; + fee: string; + total: string; + symbol: string; + ts: string; } ⋮---- -export interface EarnEliteRedeemInfoV2 { - productId: string; - productSubId: string; - productCoin: string; - subscriptionCoin: string; - profitCoin: string; - exchangeRate: string; - totalUnPayInterestAmount: string; - preSettleApr: string; - receivedCoin: string; - unsettledPoints: string; - bgusdReceiveCoinList: EarnEliteRedeemInfoBgusdReceiveCoinV2[]; - redeemModeList: EarnEliteRedeemModeV2[]; +export interface P2PMerchantOrdersV2 { + id: string; + coin: string; + p2pTaxType: string; + total: string; + ts: string; } ⋮---- -export interface RedeemEarnEliteResultV2 { - orderId: string; -} - -================ -File: src/types/response/v2/spot.ts -================ /** * - * * Spot | Market + * * Common | P2P * */ ⋮---- -export interface SpotCoinChainV2 { - chain: string; - needTag: boolean; - withdrawable: boolean; - rechargeable: boolean; - withdrawFee: string; - extraWithdrawFee: string; - depositConfirm: string; - withdrawConfirm: string; - minDepositAmount: string; - minWithdrawAmount: string; - browserUrl: string; - contractAddress: string; - withdrawStep: string; - withdrawMinScale: string; - congestion: string; -} -⋮---- -export interface SpotCoinInfoV2 { - coinId: string; - coin: string; - transfer: boolean; - chains: SpotCoinChainV2[]; +export interface P2PMerchantV2 { + registerTime: string; + nickName: string; + isOnline: string; + avgPaymentTime: string; + avgReleaseTime: string; + totalTrades: string; + totalBuy: string; + totalSell: string; + totalCompletionRate: string; + trades30d: string; + sell30d: string; + buy30d: string; + completionRate30d: string; } ⋮---- -export interface SpotSymbolInfoV2 { - symbol: string; - baseCoin: string; - quoteCoin: string; - minTradeAmount: string; - maxTradeAmount: string; - takerFeeRate: string; - makerFeeRate: string; - pricePrecision: string; - quantityPrecision: string; - quotePrecision: string; - minTradeUSDT: string; +export interface P2PMerchantInfoV2 { + registerTime: string; + nickName: string; + merchantId: string; + avgPaymentTime: string; + avgReleaseTime: string; + totalTrades: string; + totalBuy: string; + totalSell: string; + totalCompletionRate: string; + trades30d: string; + sell30d: string; + buy30d: string; + completionRate30d: string; + kycStatus: boolean; + emailBindStatus: boolean; + mobileBindStatus: boolean; + email: string; + mobile: string; +} +⋮---- +export interface P2PMerchantOrderV2 { + orderId: string; + orderNo: string; + advNo: string; + side: string; + count: string; + coin: string; + price: string; + fiat: string; + withdrawTime: string; + representTime: string; + releaseTime: string; + paymentTime: string; + amount: string; status: string; - buyLimitPriceRatio: string; - sellLimitPriceRatio: string; - orderQuantity: string; - areaSymbol: string; - maxLimitOrderValue?: string; - maxMarketOrderValue?: string; + buyerRealName: string; + sellerRealName: string; + ctime: string; + utime: string; + paymentInfo: { + paymethodName: string; + paymethodId: string; + paymethodInfo: { + name: string; + required: string; + type: string; + value: string; + }[]; + }; } ⋮---- -export interface SpotVipFeeRateV2 { - level: number; - dealAmount: string; - assetAmount: string; - takerFeeRate: string; - makerFeeRate: string; - btcWithdrawAmount: string; - usdtWithdrawAmount: string; +export interface P2PMerchantAdvertismentV2 { + advId: string; + advNo: string; + side: string; + advSize: string; + size: string; + coin: string; + price: string; + coinPrecision: string; + fiat: string; + fiatPrecision: string; + fiatSymbol: string; + status: string; + hide: string; + maxTradeAmount: string; + minTradeAmount: string; + payDuration: string; + turnoverNum: string; + turnoverRate: string; + label: string | null; + userLimitList: { + minCompleteNum: string; + maxCompleteNum: string; + placeOrderNum: string; + allowMerchantPlace: string; + completeRate30d: string; + country: string; + }; + paymentMethodList: { + paymentMethod: string; + paymentId: string; + paymentInfo: { + name: string; + required: boolean; + type: string; + }[]; + }[]; + merchantCertifiedList: { + imageUrl: string; + desc: string; + }[]; + utime: string; + ctime: string; } ⋮---- -export interface SpotTickerV2 { - symbol: string; - high24h: string; - open: string; - low24h: string; - lastPr: string; - quoteVolume: string; - baseVolume: string; - usdtVolume: string; - bidPr: string; - askPr: string; - bidSz: string; - askSz: string; - openUtc: string; +/** + * + * * Common | Trading insights + * + */ +⋮---- +export interface SpotWhaleNetFlowV2 { + volume: string; + date: string; +} +⋮---- +export interface FuturesActiveBuySellVolumeV2 { + buyVolume: string; + sellVolume: string; ts: string; - changeUtc24h: string; - change24h: string; } ⋮---- -export interface SpotMergeDepthV2 { - asks: [string, string][]; - bids: [string, string][]; +export interface FuturesActiveLongShortPositionV2 { + longPositionRatio: string; + shortPositionRatio: string; + longShortPositionRatio: string; ts: string; - scale: string; - precision: string; - isMaxPrecision: string; } ⋮---- -export interface SpotOrderBookDepthV2 { - asks: [string, string][]; - bids: [string, string][]; +export interface LeveragedLongShortRatioV2 { ts: string; + longShortRatio: string; } ⋮---- -export type SpotCandlestickV2 = [ - string, // timestamp - string, // open - string, // high - string, // low - string, // close - string, // baseVolume - string, // usdtVolume - string, // quoteVolume -]; +export interface MarginLoanGrowthRateV2 { + ts: string; + growthRate: string; +} ⋮---- -string, // timestamp -string, // open -string, // high -string, // low -string, // close -string, // baseVolume -string, // usdtVolume -string, // quoteVolume +export interface IsolatedMarginBorrowingRatioV2 { + ts: string; + borrowRate: string; +} ⋮---- -export interface SpotTradeV2 { - symbol: string; - tradeId: string; - side: string; - price: string; - size: string; +export interface FuturesLongShortRatioV2 { + longRatio: string; + shortRatio: string; + longShortRatio: string; + ts: string; +} +⋮---- +export interface SpotFundFlowV2 { + whaleBuyVolume: string; + dolphinBuyVolume: string; + fishBuyVolume: string; + whaleSellVolume: string; + dolphinSellVolume: string; + fishSellVolume: string; + whaleBuyRatio: string; + dolphinBuyRatio: string; + fishBuyRatio: string; + whaleSellRatio: string; + dolphinSellRatio: string; + fishSellRatio: string; +} +⋮---- +export interface FuturesActiveLongShortAccountV2 { + longAccountRatio: string; + shortAccountRatio: string; + longShortAccountRatio: string; ts: string; } ⋮---- /** * - * * Spot | Trade + * * Common | Virtual Subaccount * */ ⋮---- -export interface CancelAndSubmitSpotOrderResponseV2 { - orderId: string; - clientOid: string | null; - success: string; - msg: string | null; -} -⋮---- -export interface SubmitSpotBatchOrdersResponseV2 { - successList: { - orderId: string; - clientOid: string; - }[]; +export interface CreateVirtualSubAccountV2 { failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - errorCode?: string; + subaAccountName: string; + }[]; + successList: { + subaAccountUid: string; + subaAccountName: string; + status: string; + label: string; + permList: string[]; + cTime: string; + uTime: string; }[]; } ⋮---- -export interface SpotOrderInfoV2 { - userId: string; - symbol: string; - orderId: string; - clientOid: string; - price: string; - size: string; - orderType: string; - side: string; - status: string; - priceAvg: string; - baseVolume: string; - quoteVolume: string; - enterPointSource: string; - feeDetail: { - BGB?: { - deduction: boolean; - feeCoinCode: string; - totalDeductionFee: string; - totalFee: string; - }; - newFees?: { - c: number; - d: number; - deduction: boolean; - r: string; - t: string; - totalDeductionFee: number; - }; - }; - orderSource: string; - cancelReason: string; - cTime: string; - uTime: string; +export interface CreateVirtualSubAccountAndApiKeyV2 { + subAccountUid: string; + subAccountName: string; + label: string; + subAccountApiKey: string; + secretKey: string; + permList: string[]; + ipList: string[]; } ⋮---- -export interface SpotOpenOrderV2 { - userId: string; - symbol: string; - orderId: string; - clientOid: string; - priceAvg: string; - size: string; - orderType: string; - side: string; +export interface VirtualSubAccountV2 { + subAccountUid: string; + subAccountName: string; status: string; - basePrice: string; - baseVolume: string; - quoteVolume: string; - enterPointSource: string; - orderSource?: string; - presetTakeProfitPrice: string; - executeTakeProfitPrice: string; - presetStopLossPrice: string; - executeStopLossPrice: string; - cTime: string; - uTime?: string; - tpslType: string; - triggerPrice: string | null; -} -⋮---- -export interface SpotFillV2 { - userId: string; - symbol: string; - orderId: string; - tradeId: string; - orderType: string; - side: string; - priceAvg: string; - size: string; - amount: string; - feeDetail: { - deduction: string; - feeCoin: string; - totalDeductionFee: string; - totalFee: string; - }; - tradeScope: string; + permList: string[]; + label: string; + accountType: string; + bindingTime: string; cTime: string; uTime: string; } ⋮---- -/** - * - * * Spot | Trigger Orders - * - */ -⋮---- -export interface SpotCurrentPlanOrderV2 { - orderId: string; - clientOid: string; - symbol: string; - size: string; - executePrice: string; - triggerPrice: string; - status: string; - orderType: string; - side: string; - planType: string; - triggerType: string; - enterPointSource: string; - uTime: string; - cTime: string; +export interface CreateVirtualSubAccountApiKeyV2 { + subAccountUid: string; + label: string; + subAccountApiKey: string; + secretKey: string; + permList: string[]; + ipList: string[]; } ⋮---- -export interface SpotHistoryPlanOrderV2 { - orderId: string; - clientOid: string; - symbol: string; - size: string; - executePrice: string; - triggerPrice: string; - status: string; - orderType: string; - side: string; - planType: string; - triggerType: string; - enterPointSource: string; - uTime: string; - cTime: string; +export interface ModifyVirtualSubAccountApiKeyV2 { + subAccountUid: string; + label: string; + subAccountApiKey: string; + secretKey: string; + permList: string[]; + ipList: string[]; } ⋮---- -export interface SpotPlanSubOrderV2 { - orderId: string; - price: string; - type: string; - status: string; +export interface CreateAgentSubaccountV2 { + username: string; + subUid: string; + apiKey: string; + secret: string; + note: string; + createdTime: string; } ⋮---- -export interface SpotCancelPlanOrdersV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - }[]; +export interface SubAccountApiKeyItemV2 { + subAccountUid: string; + label: string; + subAccountApiKey: string; + permList: string[]; + ipList: string[]; } ⋮---- /** * - * * Spot | Account + * * Common | Assets * */ ⋮---- -export interface SpotAccountInfoV2 { - userId: string; - inviterId: string; - ips: string; - authorities: string[]; - parentId: number; - traderType: string; - channelCode: string; - channel: string; - regisTime: string; -} -⋮---- -export interface SpotAccountAssetV2 { +export interface FundingAssetV2 { coin: string; available: string; frozen: string; - locked: string; - limitAvailable: string; - uTime: string; + usdtValue: string; } ⋮---- -export interface SpotSubAccountAssetV2 { +export interface BotAssetV2 { coin: string; available: string; - limitAvailable: string; + equity: string; + bonus: string; frozen: string; - locked: string; - uTime: string; -} -export interface SpotSubAccountAssetsV2 { - userId: number; - assetsList: SpotSubAccountAssetV2[]; + usdtValue: string; } ⋮---- -export interface SpotAccountBillV2 { - cTime: string; +/** + * + * * Common | Convert + * + */ +⋮---- +export interface ConvertCurrencyV2 { coin: string; - groupType: string; - businessType: string; - size: string; - balance: string; - fees: string; - billId: string; + available: string; + maxAmount: string; + minAmount: string; } ⋮---- -export interface SpotMainSubTransferRecordV2 { - coin: string; - status: string; - toType: string; - fromType: string; - size: string; - ts: string; - clientOid: string; - transferId: string; - fromUserId: string; - toUserId: string; +export interface ConvertQuotedPriceV2 { + fee: string; + fromCoinSize: string; + fromCoin: string; + cnvtPrice: string; + toCoinSize: string; + toCoin: string; + traceId: string; } ⋮---- -export interface SpotTransferRecordV2 { - coin: string; - status: string; - toType: string; - toSymbol: string; - fromType: string; - fromSymbol: string; - size: string; +export interface ConvertTradeResponseV2 { ts: string; - clientOid: string; - transferId: string; + cnvtPrice: string; + toCoinSize: string; + toCoin: string; } ⋮---- -export interface SpotDepositAddressV2 { - address: string; - chain: string; - coin: string; - tag: string; - url: string; +export interface ConvertRecordV2 { + id: string; + ts: string; + cnvtPrice: string; + fee: string; + fromCoinSize: string; + fromCoin: string; + toCoinSize: string; + toCoin: string; } ⋮---- -export interface SpotSubAccountDepositRecordV2 { - orderId: string; - tradeId: string; - coin: string; - size: string; - status: string; - toAddress: string; - dest: string; - chain: string; - fromAddress: string; - clientOid?: string; - confirm?: string; - tag?: string; - cTime: string; - uTime: string; -} +/** + * + * * Common | BGB Convert + * + */ ⋮---- -export interface SpotWithdrawalRecordV2 { - orderId: string; - tradeId: string; +export interface BGBConvertCoinV2 { coin: string; - dest: string; - clientOid: string; - type: string; - tag: string; - size: string; - fee: string; - status: string; - toAddress: string; - fromAddress: string; - confirm: string; - chain: string; + available: string; + bgbEstAmount: string; + precision: string; + feeDetail: { + feeRate: string; + fee: string; + }[]; cTime: string; - uTime: string; } ⋮---- -export interface SpotDepositRecordV2 { +export interface ConvertBGBResponseV2 { + orderList: { + coin: string; + orderId: string; + }[]; +} +⋮---- +export interface BGBConvertHistoryV2 { orderId: string; - tradeId: string; - coin: string; - type: string; - size: string; + fromCoin: string; + fromAmount: string; + fromCoinPrice: string; + toCoin: string; + toAmount: string; + toCoinPrice: string; + feeDetail: { + feeCoin: string; + fee: string; + }[]; status: string; - toAddress: string; - dest: string; - chain: string; - fromAddress: string; - cTime: string; - uTime: string; + ctime: string; } ================ -File: src/types/response/v3/earn.ts +File: src/types/response/v2/earn.ts ================ /** * * - * Earn | On-Chain Elite (UTA) + * Earn | Savings * * */ ⋮---- -export interface EarnEliteSubscriptionCoinV3 { - subscriptionCoin: string; - precision: string; - feeRate: string; - exchangeRate: string; - remainQuota?: string; - minAmount?: string; -} -⋮---- -export interface EarnEliteProductV3 { +export interface EarnSavingsProductsV2 { productId: string; coin: string; - minApr: string; - maxApr: string; - subscriptionCoinList: EarnEliteSubscriptionCoinV3[]; - sellOut: 'YES' | 'NO' | string; + periodType: string; + period: string; + apyType: string; + advanceRedeem: string; + settleMethod: string; + apyList: { + rateLevel: string; + minStepVal: string; + maxStepVal: string; + currentApy: string; + }[]; + status: string; + productLevel: string; } ⋮---- -export interface EarnEliteAssetProjectV3 { - projectName: string; +export interface EarnSavingsAccountV2 { + btcAmount: string; + usdtAmount: string; + btc24hEarning: string; + usdt24hEarning: string; + btcTotalEarning: string; + usdtTotalEarning: string; } ⋮---- -export interface EarnEliteAssetV3 { +export interface EarnSavingsAssetV2 { productId: string; + orderId: string; productCoin: string; - holdingAmount: string; - usdtHoldingAmount: string; - exchangeRate: string; - apr: string; - minApy?: string; - maxApy?: string; - subscriptionCoin: string; - exchangeAmount: string; - projectList?: EarnEliteAssetProjectV3[]; - unsettledBGPoints: string; interestCoin: string; + periodType: string; + period: string; + holdAmount: string; + lastProfit: string; totalProfit: string; + holdDays: string; + status: string; + allowRedemption: string; + productLevel: string; + apy: { + rateLevel: string; + minApy: string; + maxApy: string; + currentApy: string; + }[]; } ⋮---- -export interface EarnEliteAssetsV3 { - resultList: EarnEliteAssetV3[]; +export interface EarnSavingsAssetsV2 { + resultList: EarnSavingsAssetV2[]; + endId: string; } ⋮---- -export interface EarnEliteRecordV3 { - recordId: string; - productId: string; - coin: string; - status: string; - exchangeRate: string; - receivedCoin: string; - receivedAmount: string; - investAmount: string; - feeRate: string; - redeemType?: string | string[]; - receivingAccount: string; - actualReceivingAccount: string; - paymentAccount?: string[]; - settlePoints: string; - fee: string; +export interface EarnSavingsRecordV2 { + orderId: string; + coinName: string; + settleCoinName: string; + productType: string; + period: string; + productLevel: string; + amount: string; + ts: string; + orderType: string; } ⋮---- -export interface EarnEliteRecordsV3 { - recordList: EarnEliteRecordV3[]; +export interface EarnSavingsRecordsV2 { + resultList: EarnSavingsRecordV2[]; endId: string; } ⋮---- -export interface EarnEliteSubscribeInfoV3 { - productSubId: string; - minAmount: string; - remainQuota: string; - exchangeRate: string; - productCoin: string; +export interface EarnSavingsSubscriptionDetailV2 { + singleMinAmount: string; + singleMaxAmount: string; + remainingAmount: string; + subscribePrecision: string; + profitPrecision: string; + subscribeTime: string; interestTime: string; settleTime: string; - precision: string; - feeRate: string; - subscriptionCoinList?: EarnEliteSubscriptionCoinV3[]; + expireTime: string; + redeemTime: string; + settleMethod: string; + apyList: { + rateLevel: string; + minStepVal: string; + maxStepVal: string; + currentApy: string; + }[]; + redeemDelay: string; } ⋮---- -export interface EarnEliteSubscribeResultV3 { - orderId: string; -} +/** + * + * + * Earn | Earn Account + * + * + */ ⋮---- -export interface EarnEliteSubscribeStatusV3 { - result: 'settled' | 'pending' | 'rejected' | string; +/** + * + * + * Earn | Shark Fin + * + * + */ +⋮---- +export interface EarnSharkfinProductV2 { + productId: string; + productName: string; + productCoin: string; + subscribeCoin: string; + farmingStartTime: string; + farmingEndTime: string; + lowerRate: string; + defaultRate: string; + upperRate: string; + period: string; + interestStartTime: string; + status: string; + minAmount: string; + limitAmount: string; + soldAmount: string; + endTime: string; + startTime: string; } ⋮---- -export interface EarnEliteRedeemInfoBgusdReceiveCoinV3 { - bgusdReceiveCoin: string; - bgusdExchangeRate: string; +export interface EarnSharkfinProductsV2 { + resultList: EarnSharkfinProductV2[]; + endId: string; } ⋮---- -export interface EarnEliteRedeemModeV3 { - redeemFeeRate: string; - remainQuota: string; - redeemType: 'fast' | 'standard' | string; - redeemScale: string; - redeemDelayDate: string; - minRedeemAmount: string; - redeemTime: string; +export interface EarnSharkfinAccountV2 { + btcSubscribeAmount: string; + usdtSubscribeAmount: string; + btcHistoricalAmount: string; + usdtHistoricalAmount: string; + btcTotalEarning: string; + usdtTotalEarning: string; } ⋮---- -export interface EarnEliteRedeemInfoV3 { +export interface EarnSharkfinAssetV2 { productId: string; - productSubId: string; + interestStartTime: string; + interestEndTime: string; productCoin: string; - subscriptionCoin: string; - profitCoin: string; - exchangeRate: string; - totalUnPayInterestAmount: string; - preSettleApr: string; - receivedCoin: string; - unsettledPoints: string; - bgusdReceiveCoinList: EarnEliteRedeemInfoBgusdReceiveCoinV3[]; - redeemModeList: EarnEliteRedeemModeV3[]; + subscribeCoin: string; + trend: string; + settleTime: string; + interestAmount: string; + productStatus: string; } ⋮---- -export interface RedeemEarnEliteResultV3 { - orderId: string; +export interface EarnSharkfinAssetsV2 { + resultList: EarnSharkfinAssetV2[]; + endId: string; } - -================ -File: src/types/response/v3/p2p.ts -================ -import type { - P2pAdStatusV3, - P2pMarketTypeV3, - P2pOrderStatusV3, - P2pPriceTypeV3, - P2pSideV3, -} from '../../request/v3/p2p.js'; ⋮---- -export interface P2pPayMethodInfoFieldV3 { - name: string; - type: 'file' | 'number' | 'txt'; - value: string; +export interface EarnSharkfinRecordV2 { + orderId: string; + product: string; + period: string; + amount: string; + ts: string; + type: string; } -⋮---- -export interface P2pPayMethodV3 { - payMethodId: string; - payMethodName: string; - payMethodUserName: string; - userPayMethodId: string; - payMethodInfo: P2pPayMethodInfoFieldV3[]; +export interface EarnSharkfinRecordsV2 { + resultList: EarnSharkfinRecordV2[]; + endId: string; } ⋮---- -export interface P2pTokenDetailV3 { - token: string; - precision: string; +export interface EarnSharkfinSubscriptionDetailV2 { + productCoin: string; + subscribeCoin: string; + interestTime: string; + expirationTime: string; + minPrice: string; + currentPrice: string; + maxPrice: string; + minRate: string; + defaultRate: string; + maxRate: string; + period: string; + productMinAmount: string; + availableBalance: string; + userAmount: string; + remainingAmount: string; + profitPrecision: string; + subscribePrecision: string; } ⋮---- -export interface P2pFiatPayMethodV3 { - payMethodName: string; - iconUrl: string; - payMethodId: string; +/** + * + * + * Earn | Loan + * + * + */ +⋮---- +export interface EarnLoanCurrencyLoanInfoV2 { + coin: string; + hourRate7D: string; + rate7D: string; + hourRate30D: string; + rate30D: string; + minUsdt: string; + maxUsdt: string; + min: string; + max: string; +} +export interface EarnLoanCurrencyPledgeInfoV2 { + coin: string; + initRate: string; + supRate: string; + forceRate: string; + minUsdt: string; + maxUsdt: string; } ⋮---- -export interface P2pWithdrawalLimitV3 { - withdrawLimitKey: string; - withdrawLimitValue: string; +export interface EarnLoanCurrenciesV2 { + loanInfos: EarnLoanCurrencyLoanInfoV2[]; + pledgeInfos: EarnLoanCurrencyPledgeInfoV2[]; } ⋮---- -export interface P2pFiatDetailV3 { - fiat: string; - precision: string; - floatRateMin: string; - floatRateMax: string; - fixedRateMin: string; - fixedRateMax: string; - adMinLimit: string; - adMaxLimit: string; - payMethods: P2pFiatPayMethodV3; - withdrawalLimit: P2pWithdrawalLimitV3; - payTimeLimit: number[]; +export interface EarnLoanOrdersV2 { + orderId: string; + loanCoin: string; + loanAmount: string; + interestAmount: string; + hourInterestRate: string; + pledgeCoin: string; + pledgeAmount: string; + pledgeRate: string; + supRate: string; + forceRate: string; + borrowTime: string; + expireTime: string; } ⋮---- -export interface P2pCurrenciesV3 { - tokenDetailList: P2pTokenDetailV3[]; - fiatDetailList: P2pFiatDetailV3[]; +export interface EarnLoanRepayResponseV2 { + loanCoin: string; + pledgeCoin: string; + repayAmount: string; + payInterest: string; + repayLoanAmount: string; + repayUnlockAmount: string; } ⋮---- -export interface P2pUserEquityDetailV3 { - maxAdvSellNum: string; - maxAdvSellLimit: string; - maxAdvBuyNum: string; - maxAdvBuyLimit: string; - totalMaxPendingOrder: string; - advMaxPendingOrder: string; +export interface EarnLoanRepayHistoryV2 { + orderId: string; + loanCoin: string; + pledgeCoin: string; + repayAmount: string; + payInterest: string; + repayLoanAmount: string; + repayUnlockAmount: string; + repayTime: string; } ⋮---- -export interface P2pUserInfoV3 { - uid: string; - nickName: string; - accountLevel: 'starter' | 'advanced' | 'master'; - completedOrderNum: string; - positiveRate: string; - completedOrderNum30D: string; - completedRate30D: string; - avgPayTime30D: string; - avgReleaseTime30D: string; - equityDetail: P2pUserEquityDetailV3; - registerTime: string; +export interface EarnLoanPledgeRateHistoryV2 { + loanCoin: string; + pledgeCoin: string; + orderId: string; + reviseTime: string; + reviseSide: string; + reviseAmount: string; + afterPledgeRate: string; + beforePledgeRate: string; } ⋮---- -export interface P2pBalanceV3 { - token: string; - totalBalance: string; - frozenBalance: string; - availableBalance: string; +export interface EarnLoanHistoryV2 { + orderId: string; + loanCoin: string; + pledgeCoin: string; + initPledgeAmount: string; + initLoanAmount: string; + hourRate: string; + daily: string; + borrowTime: string; + status: string; } ⋮---- -export interface P2pExchangeRateV3 { - rate: string; +export interface EarnLoanDebtPledgeInfoV2 { + coin: string; + amount: string; + amountUsdt: string; } ⋮---- -export interface P2pFeeSimulateV3 { - feeToken: string; - feeAmount: string; - taxToken: string; - taxAmount: string; +export interface EarnLoanDebtLoanInfoV2 { + coin: string; + amount: string; + amountUsdt: string; } ⋮---- -export interface P2pAdLimitV3 { - buyMinTokenAmount: string; - buyMaxTokenAmount: string; - sellMinTokenAmount: string; - sellMaxTokenAmount: string; +export interface EarnLoanDebtsV2 { + pledgeInfos: EarnLoanDebtPledgeInfoV2[]; + loanInfos: EarnLoanDebtLoanInfoV2[]; } ⋮---- -export interface P2pCreateAdResponseV3 { - advId: string; +export interface EarnLoanLiquidationRecordsV2 { + orderId: string; + loanCoin: string; + pledgeCoin: string; + reduceTime: string; + pledgeRate: string; + pledgePrice: string; + status: string; + pledgeAmount: string; + reduceFee: string; + residueAmount: string; + runlockAmount: string; + repayLoanAmount: string; } ⋮---- -export interface P2pAdPayMethodRefV3 { - payMethodId: string; - userPayMethodId?: string; +/** + * + * + * Earn | On-Chain Elite + * + * + */ +⋮---- +export interface EarnEliteSubscriptionCoinV2 { + subscriptionCoin: string; + precision: string; + feeRate: string; + exchangeRate: string; + remainQuota?: string; + minAmount?: string; } ⋮---- -export interface P2pAdInfoV3 { - advId: string; - side: P2pSideV3; - priceType: P2pPriceTypeV3; - token: string; - fiat: string; - price: string; - amount: string; - minAmount: string; - maxAmount: string; - payDuration: string; - soldAmount: string; - lastAmount: string; - premium: string; - turnover: string; - remark: string; - tradeTerm: string; - payMethodIds: P2pAdPayMethodRefV3[]; - tokenPrecision: string; - fiatPrecision: string; - market: P2pMarketTypeV3; - avgTime: string; - createdTime: string; - updatedTime: string; +export interface EarnEliteProductV2 { + productId: string; + coin: string; + minApr: string; + maxApr: string; + subscriptionCoinList: EarnEliteSubscriptionCoinV2[]; + sellOut: 'YES' | 'NO' | string; } ⋮---- -export interface P2pPublicAdListItemV3 { - advId: string; - merchantId: string; - merchantName: string; - token: string; - fiat: string; - side: P2pSideV3; - price: string; - minAmount: string; - maxAmount: string; - quantity: string; - payMethods: { - payMethodId: string; - payMethodName: string; - }[]; - completedOrderNum: string; - completedRate: string; - avgReleaseTime: string; - createdTime: string; +export interface EarnEliteAssetProjectV2 { + projectName: string; } ⋮---- -export interface P2pMyAdListItemV3 { - advId: string; - side: P2pSideV3; - priceType: P2pPriceTypeV3; - token: string; - fiat: string; - price: string; - soldAmount: string; - lastAmount: string; - payMethods: { payMethodId: string }[]; - status: P2pAdStatusV3; - createdTime: string; - updatedTime: string; +export interface EarnEliteAssetV2 { + productId: string; + productCoin: string; + holdingAmount: string; + usdtHoldingAmount: string; + exchangeRate: string; + apr: string; + minApy?: string; + maxApy?: string; + subscriptionCoin: string; + exchangeAmount: string; + projectList?: EarnEliteAssetProjectV2[]; + unsettledBGPoints: string; + interestCoin: string; + totalProfit: string; } ⋮---- -export interface P2pCursorListV3 { - items: T[]; - nextId?: string; +export interface EarnEliteAssetsV2 { + resultList: EarnEliteAssetV2[]; } ⋮---- -export interface P2pOrderListItemV3 { - orderId: string; - side: P2pSideV3; - token: string; - fiat: string; - price: string; - amount: string; - quantity: string; +export interface EarnEliteRecordV2 { + recordId: string; + productId: string; + coin: string; + status: string; + exchangeRate: string; + receivedCoin: string; + receivedAmount: string; + investAmount: string; + feeRate: string; + redeemType?: string | string[]; + receivingAccount: string; + actualReceivingAccount: string; + paymentAccount?: string[]; + settlePoints: string; fee: string; - counterparty: string; - status: P2pOrderStatusV3; - createdTime: string; - updatedTime: string; } ⋮---- -export interface P2pOrderPayMethodDetailV3 { - payMethodId: string; - payMethodName: string; - payMethodUserName: string; - postscript: string; - payMethodInfo: P2pPayMethodInfoFieldV3[]; +export interface EarnEliteRecordsV2 { + recordList: EarnEliteRecordV2[]; + endId: string; } ⋮---- -export interface P2pOrderUserInfoV3 { - nickName: string; - realName: string; +export interface EarnEliteSubscribeInfoV2 { + productSubId: string; + minAmount: string; + remainQuota: string; + exchangeRate: string; + productCoin: string; + interestTime: string; + settleTime: string; + precision: string; + feeRate: string; + /** Present for BGUSD per API docs. */ + subscriptionCoinList?: EarnEliteSubscriptionCoinV2[]; } ⋮---- -export interface P2pOrderInfoV3 { +/** Present for BGUSD per API docs. */ +⋮---- +export interface EarnEliteSubscribeResultV2 { orderId: string; - side: P2pSideV3; - token: string; - fiat: string; - price: string; - quantity: string; - amount: string; - status: P2pOrderStatusV3; - advId: string; - remark: string; - orderCancelCountdown: string; - fee: string; - verifyCapital: 'yes' | 'no'; - payMethodDetail?: P2pOrderPayMethodDetailV3; - sellUserInfo: P2pOrderUserInfoV3; - buyUserInfo: P2pOrderUserInfoV3; - createdTime: string; - updatedTime: string; } - -================ -File: src/types/response/v3/strategy.ts -================ -import type { - StrategyOrderStatusV3, - StrategyTriggerByV3, - StrategyTriggerOrderTypeV3, -} from '../../request/v3/strategy.js'; ⋮---- -export interface PlaceStrategyOrderResponseV3 { - orderId: string; - clientOid: string; +export interface EarnEliteSubscribeStatusV2 { + result: 'settled' | 'pending' | 'rejected' | string; } ⋮---- -export interface ModifyStrategyOrderResponseV3 { - orderId: string; - clientOid: string; +export interface EarnEliteRedeemInfoBgusdReceiveCoinV2 { + bgusdReceiveCoin: string; + bgusdExchangeRate: string; } ⋮---- -export interface StrategyOrderV3 { - orderId: string; - clientOid: string; - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - qty: string; - posSide: 'long' | 'short'; - status: StrategyOrderStatusV3; - triggerType?: 'takeProfit' | 'stopLoss'; - tpTriggerBy?: StrategyTriggerByV3; - slTriggerBy?: StrategyTriggerByV3; - takeProfit?: string; - stopLoss?: string; - tpOrderType?: StrategyTriggerOrderTypeV3; - slOrderType?: StrategyTriggerOrderTypeV3; - tpLimitPrice?: string; - slLimitPrice?: string; - triggerBy?: StrategyTriggerByV3; - triggerPrice?: string; - triggerOrderType?: StrategyTriggerOrderTypeV3; - triggerOrderPrice?: string; - createdTime: string; - updatedTime: string; +export interface EarnEliteRedeemModeV2 { + redeemFeeRate: string; + remainQuota: string; + redeemType: 'fast' | 'standard' | string; + redeemScale: string; + redeemDelayDate: string; + minRedeemAmount: string; + redeemTime: string; } - -================ -File: src/types/websockets/ws-api-request.ts -================ -import type { FuturesMarginModeV3 } from '../request/v3/trade.js'; ⋮---- -export interface WSAPIPlaceOrderRequestV3 { - symbol: string; - orderType: 'limit' | 'market'; - qty: string; - price?: string; - side: 'buy' | 'sell'; - posSide?: 'long' | 'short'; - timeInForce?: 'gtc' | 'ioc' | 'fok' | 'post_only'; - reduceOnly?: 'YES' | 'NO'; // Note: reduceOnly is not supported for batch place WS API. Might be supported starting late Q4 2025, but not supported yet. - /** Futures only. Defaults to crossed */ - marginMode?: FuturesMarginModeV3; - clientOid?: string; - stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; - tpTriggerBy?: 'market' | 'mark'; - slTriggerBy?: 'market' | 'mark'; - takeProfit?: string; - stopLoss?: string; - tpOrderType?: 'limit' | 'market'; - slOrderType?: 'limit' | 'market'; - tpLimitPrice?: string; - slLimitPrice?: string; +export interface EarnEliteRedeemInfoV2 { + productId: string; + productSubId: string; + productCoin: string; + subscriptionCoin: string; + profitCoin: string; + exchangeRate: string; + totalUnPayInterestAmount: string; + preSettleApr: string; + receivedCoin: string; + unsettledPoints: string; + bgusdReceiveCoinList: EarnEliteRedeemInfoBgusdReceiveCoinV2[]; + redeemModeList: EarnEliteRedeemModeV2[]; } ⋮---- -reduceOnly?: 'YES' | 'NO'; // Note: reduceOnly is not supported for batch place WS API. Might be supported starting late Q4 2025, but not supported yet. -/** Futures only. Defaults to crossed */ +export interface RedeemEarnEliteResultV2 { + orderId: string; +} ================ -File: src/types/websockets/ws-api.ts +File: src/types/response/v2/instloan.ts ================ -import { WS_KEY_MAP } from '../../util/websocket-util.js'; -import { CancelOrderRequestV3 } from '../request/v3/trade.js'; -import { CancelOrderResponseV3 } from '../response/v3/trade.js'; -import { WSAPIPlaceOrderRequestV3 } from './ws-api-request.js'; -import { WSAPIPlaceOrderResponseV3 } from './ws-api-response.js'; -import { BitgetInstTypeV3, WsKey } from './ws-general.js'; -⋮---- -export type WSOperation = 'subscribe' | 'unsubscribe' | 'login'; -⋮---- -// When new WS API operations are added, make sure to also update WS_API_Operations[] below -export type WSAPIOperation = - | 'place-order' - | 'batch-place' - | 'cancel-order' - | 'batch-cancel'; -⋮---- -export interface WSOperationLoginParams { - apiKey: string; - passphrase: string; - timestamp: number; - sign: string; +export interface InstLoanProductInfoV2 { + productId: string; + leverage: string; + transferLine: string; + spotBuyLine: string; + liquidationLine: string; + stopLiquidationLine: string; } ⋮---- -export interface WSAPIRequestBitgetV3 { - op: 'trade'; - id: string; - category: BitgetInstTypeV3; - topic: WSAPIOperation; - args: TWSParams | TWSParams[]; +export interface InstLoanSymbolsV2 { + productId: string; + spotSymbols: string[]; } ⋮---- -export interface WSAPIRequestFlags { - /** If true, will skip auth requirement for WS API connection */ - authIsOptional?: boolean | undefined; +export interface InstLoanRepaidHistoryItemV2 { + repayOrderId: string; + businessType: string; + repayType: string; + repaidTime: string; + coin: string; + repaidAmount: string; + repaidInterest: string; } ⋮---- -/** If true, will skip auth requirement for WS API connection */ -⋮---- -export type Exact = { - // This part says: if there's any key that's not in T, it's an error - [K: string]: never; -} & { - [K in keyof T]: T[K]; -}; +export interface InstLoanOrderV2 { + orderId: string; + orderProductId: string; + uid: string; + loanTime: string; + loanCoin: string; + loanAmount: string; + unpaidAmount: string; + unpaidInterest: string; + repaidAmount: string; + repaidInterest: string; + status: string; +} ⋮---- -// This part says: if there's any key that's not in T, it's an error +export interface InstLoanCoinInfoV2 { + coin: string; + convertRatio: string; + maxConvertValue: string; +} ⋮---- -/** +export interface InstLoanLTVConvertV2 { + ltv: string; + subAccountUids: string[]; + unpaidUsdtAmount: string; + usdtBalance: string; + unpaidInfo: { + coin: string; + unpaidQty: string; + unpaidInterest: string; + }[]; + balanceInfo: { + coin: string; + price: string; + amount: string; + convertedUsdtAmount: string; + }[]; +} +================ +File: src/types/response/v3/earn.ts +================ /** - * V2 request looks like this: -{ - "op":"subscribe", - "args":[ - { - "instType":"SPOT", - "channel":"ticker", - "instId":"BTCUSDT" - }, - { - "instType":"SPOT", - "channel":"candle5m", - "instId":"BTCUSDT" - } - ] -} + * + * + * Earn | On-Chain Elite (UTA) + * + * */ -export interface WsRequestOperationBitget { - op: WSOperation; - args?: (TWSRequestArg | string | number)[]; -} -export interface WSAPIResponse< - TResponseData extends object = object, - TOperation extends WSAPIOperation = WSAPIOperation, -> { - wsKey: WsKey; - /** Auto-generated */ - id: string; - event: 'trade'; - category: BitgetInstTypeV3; - topic: TOperation; - args: TResponseData; - code: '0' | string; - msg: 'success' | string; - ts: string; - /** Connection ID (trade operation responses, May 2026+) */ - connId?: string; -} -⋮---- -/** Auto-generated */ ⋮---- -/** Connection ID (trade operation responses, May 2026+) */ +export interface EarnEliteSubscriptionCoinV3 { + subscriptionCoin: string; + precision: string; + feeRate: string; + exchangeRate: string; + remainQuota?: string; + minAmount?: string; +} ⋮---- -/** - * List of operations supported for this WsKey (connection) - */ -export interface WsAPIWsKeyTopicMap { - [WS_KEY_MAP.v3Private]: WSAPIOperation; +export interface EarnEliteProductV3 { + productId: string; + coin: string; + minApr: string; + maxApr: string; + subscriptionCoinList: EarnEliteSubscriptionCoinV3[]; + sellOut: 'YES' | 'NO' | string; } ⋮---- -/** - * Request parameters expected per operation - */ -export interface WsAPITopicRequestParamMap { - // https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters - 'place-order': WSAPIPlaceOrderRequestV3; - // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel - 'batch-place': WSAPIPlaceOrderRequestV3[]; - // https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel - 'cancel-order': CancelOrderRequestV3; - // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel - 'batch-cancel': CancelOrderRequestV3[]; +export interface EarnEliteAssetProjectV3 { + projectName: string; } ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters +export interface EarnEliteAssetV3 { + productId: string; + productCoin: string; + holdingAmount: string; + usdtHoldingAmount: string; + exchangeRate: string; + apr: string; + minApy?: string; + maxApy?: string; + subscriptionCoin: string; + exchangeAmount: string; + projectList?: EarnEliteAssetProjectV3[]; + unsettledBGPoints: string; + interestCoin: string; + totalProfit: string; +} ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel +export interface EarnEliteAssetsV3 { + resultList: EarnEliteAssetV3[]; +} ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel +export interface EarnEliteRecordV3 { + recordId: string; + productId: string; + coin: string; + status: string; + exchangeRate: string; + receivedCoin: string; + receivedAmount: string; + investAmount: string; + feeRate: string; + redeemType?: string | string[]; + receivingAccount: string; + actualReceivingAccount: string; + paymentAccount?: string[]; + settlePoints: string; + fee: string; +} ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel +export interface EarnEliteRecordsV3 { + recordList: EarnEliteRecordV3[]; + endId: string; +} ⋮---- -/** - * Response structure expected for each operation - */ -export interface WsAPIOperationResponseMap { - // https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters - 'place-order': WSAPIResponse<[WSAPIPlaceOrderResponseV3], 'place-order'>; - // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel - 'batch-place': WSAPIResponse; - // https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel - 'cancel-order': WSAPIResponse<[CancelOrderResponseV3], 'cancel-order'>; - // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel - 'batch-cancel': WSAPIResponse; +export interface EarnEliteSubscribeInfoV3 { + productSubId: string; + minAmount: string; + remainQuota: string; + exchangeRate: string; + productCoin: string; + interestTime: string; + settleTime: string; + precision: string; + feeRate: string; + subscriptionCoinList?: EarnEliteSubscriptionCoinV3[]; } ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters +export interface EarnEliteSubscribeResultV3 { + orderId: string; +} ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel +export interface EarnEliteSubscribeStatusV3 { + result: 'settled' | 'pending' | 'rejected' | string; +} ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel +export interface EarnEliteRedeemInfoBgusdReceiveCoinV3 { + bgusdReceiveCoin: string; + bgusdExchangeRate: string; +} ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel - -================ -File: src/types/shared.ts -================ -import { REST_CLIENT_TYPE_ENUM } from '../util/requestUtils.js'; +export interface EarnEliteRedeemModeV3 { + redeemFeeRate: string; + remainQuota: string; + redeemType: 'fast' | 'standard' | string; + redeemScale: string; + redeemDelayDate: string; + minRedeemAmount: string; + redeemTime: string; +} ⋮---- -export type numberInString = string; -⋮---- -export type OrderSide = 'Buy' | 'Sell'; -⋮---- -/** - * @deprecated use SpotKlineInterval or FuturesKlineInterval, depending on which API group you're using - */ -export type KlineInterval = - | '1min' - | '5min' - | '15min' - | '30min' - | '1h' - | '4h' - | '6h' - | '12h' - | '1M' - | '1W' - | '1week' - | '6Hutc' - | '12Hutc' - | '1Dutc' - | '3Dutc' - | '1Wutc' - | '1Mutc'; -⋮---- -export type RestClientType = - (typeof REST_CLIENT_TYPE_ENUM)[keyof typeof REST_CLIENT_TYPE_ENUM]; +export interface EarnEliteRedeemInfoV3 { + productId: string; + productSubId: string; + productCoin: string; + subscriptionCoin: string; + profitCoin: string; + exchangeRate: string; + totalUnPayInterestAmount: string; + preSettleApr: string; + receivedCoin: string; + unsettledPoints: string; + bgusdReceiveCoinList: EarnEliteRedeemInfoBgusdReceiveCoinV3[]; + redeemModeList: EarnEliteRedeemModeV3[]; +} ⋮---- -export interface APIResponse { - code: string; - requestTime: number; - msg: 'success' | string; - data: T; +export interface RedeemEarnEliteResultV3 { + orderId: string; } ================ -File: webpack/webpack.config.cjs +File: src/types/response/v3/p2p.ts ================ -function generateConfig(name) -⋮---- -// Add '.ts' and '.tsx' as resolvable extensions. +import type { + P2pAdStatusV3, + P2pMarketTypeV3, + P2pOrderStatusV3, + P2pPriceTypeV3, + P2pSideV3, +} from '../../request/v3/p2p.js'; ⋮---- -// Node.js core modules not available in browsers -// The REST client's https.Agent (for keepAlive) is Node.js-only and won't work in browsers +export interface P2pPayMethodInfoFieldV3 { + name: string; + type: 'file' | 'number' | 'txt'; + value: string; +} ⋮---- -// Code is already transpiled from TypeScript, no additional loaders needed - -================ -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 -bundleReport.html -.history/ -tiagoSpot.ts -restClientRegex.ts -localtest.sh -privaterepotracker -testfile.ts -dist -repomix.sh -coverage - -================ -File: examples/auth/fasterHmacSign.ts -================ -import { createHmac } from 'crypto'; +export interface P2pPayMethodV3 { + payMethodId: string; + payMethodName: string; + payMethodUserName: string; + userPayMethodId: string; + payMethodInfo: P2pPayMethodInfoFieldV3[]; +} ⋮---- -import { - DefaultLogger, - RestClientV3, - WebsocketClientV3, -} from '../../src/index.js'; +export interface P2pTokenDetailV3 { + token: string; + precision: string; +} ⋮---- -// or -// import { createHmac } from 'crypto'; -// import { DefaultLogger, RestClientV3, WebsocketClientV3 } from 'bitget-api'; +export interface P2pFiatPayMethodV3 { + payMethodName: string; + iconUrl: string; + payMethodId: string; +} ⋮---- -/** - * Injecting a custom signMessage function. - * - * As of version 3.0.0 of the bitget-api Node.js/TypeScript/JavaScript - * SDK for Bitget, the SDK uses the Web Crypto API for signing requests. - * While it is compatible with Node and Browser environments, it is - * slightly slower than using Node's native crypto module (only - * available in backend Node environments). - * - * For latency sensitive users, you can inject the previous node crypto sign - * method (or your own even faster implementation), if this change affects you. - * - * This example demonstrates how to inject a custom sign function, to achieve - * the same peformance as seen before the Web Crypto API was introduced. - * - * For context on standard usage, the "signMessage" function is used: - * - During every single API call - * - After opening a new private WebSocket connection - */ +export interface P2pWithdrawalLimitV3 { + withdrawLimitKey: string; + withdrawLimitValue: string; +} ⋮---- -/** - * Set this to true to enable demo trading: - */ +export interface P2pFiatDetailV3 { + fiat: string; + precision: string; + floatRateMin: string; + floatRateMax: string; + fixedRateMin: string; + fixedRateMax: string; + adMinLimit: string; + adMaxLimit: string; + payMethods: P2pFiatPayMethodV3; + withdrawalLimit: P2pWithdrawalLimitV3; + payTimeLimit: number[]; +} ⋮---- -/** - * Overkill in almost every case, but if you need any optimisation available, - * you can inject a faster sign mechanism such as node's native createHmac: - */ +export interface P2pCurrenciesV3 { + tokenDetailList: P2pTokenDetailV3[]; + fiatDetailList: P2pFiatDetailV3[]; +} ⋮---- -// Optional, uncomment the "trace" override to log a lot more info about what the WS client is doing +export interface P2pUserEquityDetailV3 { + maxAdvSellNum: string; + maxAdvSellLimit: string; + maxAdvBuyNum: string; + maxAdvBuyLimit: string; + totalMaxPendingOrder: string; + advMaxPendingOrder: string; +} ⋮---- -// trace: (...params) => console.log('trace', ...params), +export interface P2pUserInfoV3 { + uid: string; + nickName: string; + accountLevel: 'starter' | 'advanced' | 'master'; + completedOrderNum: string; + positiveRate: string; + completedOrderNum30D: string; + completedRate30D: string; + avgPayTime30D: string; + avgReleaseTime30D: string; + equityDetail: P2pUserEquityDetailV3; + registerTime: string; +} ⋮---- -/** - * Set this to true to enable demo trading for the private account data WS - * Topics: order,execution,position,wallet,greeks - */ +export interface P2pBalanceV3 { + token: string; + totalBalance: string; + frozenBalance: string; + availableBalance: string; +} ⋮---- -/** - * Overkill in almost every case, but if you need any optimisation available, - * you can inject a faster sign mechanism such as node's native createHmac: - */ +export interface P2pExchangeRateV3 { + rate: string; +} ⋮---- -function setWsClientEventListeners( - websocketClient: WebsocketClientV3, - accountRef: string, -): Promise +export interface P2pFeeSimulateV3 { + feeToken: string; + feeAmount: string; + taxToken: string; + taxAmount: string; +} ⋮---- -// console.log('raw message received ', JSON.stringify(data, null, 2)); +export interface P2pAdLimitV3 { + buyMinTokenAmount: string; + buyMaxTokenAmount: string; + sellMinTokenAmount: string; + sellMaxTokenAmount: string; +} ⋮---- -// Simple promise to ensure we're subscribed before trying anything else +export interface P2pCreateAdResponseV3 { + advId: string; +} ⋮---- -// Start trading - -================ -File: examples/V2 - Classic/Rest/rest-trade-futures.ts -================ -import { - FuturesPlaceOrderRequestV2, - RestClientV2, - WebsocketClientV2, -} from '../../../src/index.js'; +export interface P2pAdPayMethodRefV3 { + payMethodId: string; + userPayMethodId?: string; +} ⋮---- -// or -// import { FuturesPlaceOrderRequestV2, RestClientV2, WebsocketClientV2 } from '../src'; -⋮---- -// read from environmental variables +export interface P2pAdInfoV3 { + advId: string; + side: P2pSideV3; + priceType: P2pPriceTypeV3; + token: string; + fiat: string; + price: string; + amount: string; + minAmount: string; + maxAmount: string; + payDuration: string; + soldAmount: string; + lastAmount: string; + premium: string; + turnover: string; + remark: string; + tradeTerm: string; + payMethodIds: P2pAdPayMethodRefV3[]; + tokenPrecision: string; + fiatPrecision: string; + market: P2pMarketTypeV3; + avgTime: string; + createdTime: string; + updatedTime: string; +} ⋮---- -// If running from CLI in unix, you can pass env vars as such: -// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/rest-trade-futures.ts +export interface P2pPublicAdListItemV3 { + advId: string; + merchantId: string; + merchantName: string; + token: string; + fiat: string; + side: P2pSideV3; + price: string; + minAmount: string; + maxAmount: string; + quantity: string; + payMethods: { + payMethodId: string; + payMethodName: string; + }[]; + completedOrderNum: string; + completedRate: string; + avgReleaseTime: string; + createdTime: string; +} ⋮---- -// note the single quotes, preventing special characters such as $ from being incorrectly passed +export interface P2pMyAdListItemV3 { + advId: string; + side: P2pSideV3; + priceType: P2pPriceTypeV3; + token: string; + fiat: string; + price: string; + soldAmount: string; + lastAmount: string; + payMethods: { payMethodId: string }[]; + status: P2pAdStatusV3; + createdTime: string; + updatedTime: string; +} ⋮---- -// apiKey: 'apiKeyHere', -// apiSecret: 'apiSecretHere', -// apiPass: 'apiPassHere', +export interface P2pCursorListV3 { + items: T[]; + nextId?: string; +} ⋮---- -function logWSEvent(type: string, data: any) +export interface P2pOrderListItemV3 { + orderId: string; + side: P2pSideV3; + token: string; + fiat: string; + price: string; + amount: string; + quantity: string; + fee: string; + counterparty: string; + status: P2pOrderStatusV3; + createdTime: string; + updatedTime: string; +} ⋮---- -// simple sleep function -function promiseSleep(milliseconds: number) +export interface P2pOrderPayMethodDetailV3 { + payMethodId: string; + payMethodName: string; + payMethodUserName: string; + postscript: string; + payMethodInfo: P2pPayMethodInfoFieldV3[]; +} ⋮---- -/** - * This is a simple script wrapped in a immediately invoked function expression (to execute the below workflow immediately). - * - * It is designed to: - * - open a private websocket channel to log account events - * - check for any available USDT balance in the futures account - * - immediately open a minimum sized long position on BTCUSDT - * - check active positions - * - immediately send closing orders for any active futures positions - * - check positions again - * - */ +export interface P2pOrderUserInfoV3 { + nickName: string; + realName: string; +} ⋮---- -// Add event listeners to log websocket events on account +export interface P2pOrderInfoV3 { + orderId: string; + side: P2pSideV3; + token: string; + fiat: string; + price: string; + quantity: string; + amount: string; + status: P2pOrderStatusV3; + advId: string; + remark: string; + orderCancelCountdown: string; + fee: string; + verifyCapital: 'yes' | 'no'; + payMethodDetail?: P2pOrderPayMethodDetailV3; + sellUserInfo: P2pOrderUserInfoV3; + buyUserInfo: P2pOrderUserInfoV3; + createdTime: string; + updatedTime: string; +} + +================ +File: src/types/response/v3/strategy.ts +================ +import type { + StrategyOrderStatusV3, + StrategyTriggerByV3, + StrategyTriggerOrderTypeV3, +} from '../../request/v3/strategy.js'; ⋮---- -// futures private -// : account updates +export interface PlaceStrategyOrderResponseV3 { + orderId: string; + clientOid: string; +} ⋮---- -// : position updates +export interface ModifyStrategyOrderResponseV3 { + orderId: string; + clientOid: string; +} ⋮---- -// : order updates +export interface StrategyOrderV3 { + orderId: string; + clientOid: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + qty: string; + posSide: 'long' | 'short'; + status: StrategyOrderStatusV3; + triggerType?: 'takeProfit' | 'stopLoss'; + tpTriggerBy?: StrategyTriggerByV3; + slTriggerBy?: StrategyTriggerByV3; + takeProfit?: string; + stopLoss?: string; + tpOrderType?: StrategyTriggerOrderTypeV3; + slOrderType?: StrategyTriggerOrderTypeV3; + tpLimitPrice?: string; + slLimitPrice?: string; + triggerBy?: StrategyTriggerByV3; + triggerPrice?: string; + triggerOrderType?: StrategyTriggerOrderTypeV3; + triggerOrderPrice?: string; + createdTime: string; + updatedTime: string; +} + +================ +File: src/types/websockets/ws-api-request.ts +================ +import type { FuturesMarginModeV3 } from '../request/v3/trade.js'; ⋮---- -// wait briefly for ws to be ready (could also use the response or authenticated events, to make sure topics are subscribed to before starting) +export interface WSAPIPlaceOrderRequestV3 { + symbol: string; + orderType: 'limit' | 'market'; + qty: string; + price?: string; + side: 'buy' | 'sell'; + posSide?: 'long' | 'short'; + timeInForce?: 'gtc' | 'ioc' | 'fok' | 'post_only'; + reduceOnly?: 'YES' | 'NO'; // Note: reduceOnly is not supported for batch place WS API. Might be supported starting late Q4 2025, but not supported yet. + /** Futures only. Defaults to crossed */ + marginMode?: FuturesMarginModeV3; + clientOid?: string; + stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; + tpTriggerBy?: 'market' | 'mark'; + slTriggerBy?: 'market' | 'mark'; + takeProfit?: string; + stopLoss?: string; + tpOrderType?: 'limit' | 'market'; + slOrderType?: 'limit' | 'market'; + tpLimitPrice?: string; + slLimitPrice?: string; + /** Order TTL in ms [10, 60000]. Only effective when requestTime is also set on the envelope */ + receiveWindow?: string; +} ⋮---- -// const balances = allBalances.filter((bal) => Number(bal.available) != 0); +reduceOnly?: 'YES' | 'NO'; // Note: reduceOnly is not supported for batch place WS API. Might be supported starting late Q4 2025, but not supported yet. +/** Futures only. Defaults to crossed */ ⋮---- -// Loop through any active positions and send a closing market order on each position +/** Order TTL in ms [10, 60000]. Only effective when requestTime is also set on the envelope */ ================ -File: examples/V2 - Classic/Rest/rest-trade-spot.ts +File: src/types/websockets/ws-api.ts ================ -import { - RestClientV2, - SpotOrderRequestV2, - WebsocketClientV2, -} from '../../../src/index.js'; -⋮---- -// import { RestClientV2, WebsocketClient } from '../src/index'; +import { WS_KEY_MAP } from '../../util/websocket-util.js'; +import { CancelOrderRequestV3 } from '../request/v3/trade.js'; +import { CancelOrderResponseV3 } from '../response/v3/trade.js'; +import { WSAPIPlaceOrderRequestV3 } from './ws-api-request.js'; +import { WSAPIPlaceOrderResponseV3 } from './ws-api-response.js'; +import { BitgetInstTypeV3, WsKey } from './ws-general.js'; ⋮---- -// read from environmental variables +export type WSOperation = 'subscribe' | 'unsubscribe' | 'login'; ⋮---- -// If running from CLI in unix, you can pass env vars as such: -// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/rest-trade-spot.ts +// When new WS API operations are added, make sure to also update WS_API_Operations[] below +export type WSAPIOperation = + | 'place-order' + | 'batch-place' + | 'cancel-order' + | 'batch-cancel'; ⋮---- -// note the single quotes, preventing special characters such as $ from being incorrectly passed +export interface WSOperationLoginParams { + apiKey: string; + passphrase: string; + timestamp: number; + sign: string; +} ⋮---- -// apiKey: 'apiKeyHere', -// apiSecret: 'apiSecretHere', -// apiPass: 'apiPassHere', +export interface WSAPIRequestBitgetV3 { + op: 'trade'; + id: string; + category: BitgetInstTypeV3; + topic: WSAPIOperation; + args: TWSParams | TWSParams[]; + /** Client-side request timestamp; required for receiveWindow on place-order */ + requestTime?: string; +} ⋮---- -function logWSEvent(type: string, data: any) +/** Client-side request timestamp; required for receiveWindow on place-order */ ⋮---- -// simple sleep function -function promiseSleep(milliseconds: number) -⋮---- -/** This is a simple script wrapped in a immediately invoked function expression, designed to check for any available BTC balance and immediately sell the full amount for USDT */ -⋮---- -// Add event listeners to log websocket events on account -⋮---- -// Subscribe to private account topics -// spot private -// : account updates -⋮---- -// : order updates (note: symbol is required) -⋮---- -// wait briefly for ws to be ready (could also use the response or authenticated events, to make sure topics are subscribed to before starting) -⋮---- -// console.log('balance: ', JSON.stringify(balances, null, 2)); - -================ -File: examples/V2 - Classic/Websocket/ws-demo-trading.ts -================ -import { DefaultLogger, WebsocketClientV2 } from '../../../src/index.js'; -⋮---- -// or -// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; -⋮---- -// If running from CLI in unix, you can pass env vars as such: -// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/ws-private.ts -⋮---- -// restOptions: { -// optionally provide rest options, e.g. to pass through a proxy -// }, +export interface WSAPIRequestFlags { + /** If true, will skip auth requirement for WS API connection */ + authIsOptional?: boolean | undefined; +} ⋮---- -// Set demoTrading to true, to route all connections to the demo trading wss URLs: +/** If true, will skip auth requirement for WS API connection */ ⋮---- -// If using private topics, make sure to include API keys +export type Exact = { + // This part says: if there's any key that's not in T, it's an error + [K: string]: never; +} & { + [K in keyof T]: T[K]; +}; ⋮---- -// console.log('WS raw message received ', JSON.stringify(data, null, 2)); +// This part says: if there's any key that's not in T, it's an error ⋮---- /** - * Public events - */ -================ -File: examples/V2 - Classic/Websocket/ws-private.ts -================ -import { DefaultLogger, WebsocketClientV2 } from '../../../src/index.js'; -⋮---- -// or -// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; +/** + * V2 request looks like this: +{ + "op":"subscribe", + "args":[ + { + "instType":"SPOT", + "channel":"ticker", + "instId":"BTCUSDT" + }, + { + "instType":"SPOT", + "channel":"candle5m", + "instId":"BTCUSDT" + } + ] +} + */ +export interface WsRequestOperationBitget { + op: WSOperation; + args?: (TWSRequestArg | string | number)[]; +} +export interface WSAPIRateLimitV3 { + limit: string; + remaining: string; +} ⋮---- -// If running from CLI in unix, you can pass env vars as such: -// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/ws-private.ts +export interface WSAPIResponse< + TResponseData extends object = object, + TOperation extends WSAPIOperation = WSAPIOperation, +> { + wsKey: WsKey; + /** Auto-generated */ + id: string; + event: 'trade'; + category: BitgetInstTypeV3; + topic: TOperation; + args: TResponseData; + code: '0' | string; + msg: 'success' | string; + ts: string; + /** Connection ID (trade operation responses, May 2026+) */ + connId?: string; + /** Gateway receive time, Unix microseconds */ + receiveTime?: string; + /** Gateway push time, Unix microseconds */ + pushTime?: string; + rateLimit?: WSAPIRateLimitV3[]; +} ⋮---- -// note the single quotes, preventing special characters such as $ from being incorrectly passed +/** Auto-generated */ ⋮---- -// restOptions: { -// optionally provide rest options, e.g. to pass through a proxy -// }, +/** Connection ID (trade operation responses, May 2026+) */ ⋮---- -// console.log('WS raw message received ', JSON.stringify(data, null, 2)); +/** Gateway receive time, Unix microseconds */ ⋮---- -// auth happens async after the ws connection opens +/** Gateway push time, Unix microseconds */ ⋮---- -// wsClient.subscribePublicSpotTickers(['BTCUSDT', 'LTCUSDT']); +/** + * List of operations supported for this WsKey (connection) + */ +export interface WsAPIWsKeyTopicMap { + [WS_KEY_MAP.v3Private]: WSAPIOperation; +} ⋮---- /** - * Private account updates - */ + * Request parameters expected per operation + */ +export interface WsAPITopicRequestParamMap { + // https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters + 'place-order': WSAPIPlaceOrderRequestV3; + // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel + 'batch-place': WSAPIPlaceOrderRequestV3[]; + // https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel + 'cancel-order': CancelOrderRequestV3; + // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel + 'batch-cancel': CancelOrderRequestV3[]; +} ⋮---- -// spot private -// : account updates +// https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters ⋮---- -// : order updates (note: symbol is required) -// wsClient.subscribeTopic('SPOT', 'orders', 'BTCUSDT'); +// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel ⋮---- -// futures private -// : account updates +// https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel ⋮---- -// : position updates -// wsClient.subscribeTopic('USDT-FUTURES', 'positions'); +// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel ⋮---- -// : order updates -// wsClient.subscribeTopic('USDT-FUTURES', 'orders'); +/** + * Response structure expected for each operation + */ +export interface WsAPIOperationResponseMap { + // https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters + 'place-order': WSAPIResponse<[WSAPIPlaceOrderResponseV3], 'place-order'>; + // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel + 'batch-place': WSAPIResponse; + // https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel + 'cancel-order': WSAPIResponse<[CancelOrderResponseV3], 'cancel-order'>; + // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel + 'batch-cancel': WSAPIResponse; +} ⋮---- -// : plan order updates -// wsClient.subscribeTopic('USDT-FUTURES', 'orders-algo'); +// https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters ⋮---- -// wsClient -// .getWsStore() -// .getKeys() -// .forEach((wsKey) => { -// const state = wsClient.getWsStore().get(wsKey); -// console.log(`${wsKey} state: `, state.subscribedTopics.values()); -// }); +// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel ⋮---- -// setTimeout(() => { -// wsClient.unsubscribeTopic('USDT-FUTURES', 'account'); -// }, 1000 * 2); +// https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel ⋮---- -// setTimeout(() => { -// wsClient -// .getWsStore() -// .getKeys() -// .forEach((wsKey) => { -// const state = wsClient.getWsStore().get(wsKey); -// console.log(`${wsKey} state: `, state.subscribedTopics.values()); -// }); -// }, 1000 * 5); +// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel ================ -File: examples/V2 - Classic/Websocket/ws-public.ts +File: src/types/websockets/ws-events.ts ================ -import { - DefaultLogger, - WebsocketClientV2, - WS_KEY_MAP, -} from '../../../src/index.js'; -⋮---- -// or -// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; -⋮---- -// restOptions: { -// optionally provide rest options, e.g. to pass through a proxy -// }, -⋮---- -// console.log('WS raw message received ', JSON.stringify(data, null, 2)); +export interface MessageEventLike { + target: WebSocket; + type: 'message'; + data: string; +} ⋮---- -/** - * Public events - */ +export function isMessageEvent(msg: unknown): msg is MessageEventLike ⋮---- -// Spot public +export interface WsBaseEvent { + action: TAction; + arg: unknown; + data: TData[]; +} ⋮---- -// tickers +export interface WsSnapshotChannelEvent extends WsBaseEvent<'snapshot'> { + arg: { + instType: string; + channel: string; + instId: string; + }; +} ⋮---- -// candles -// wsClient.subscribeTopic('SPOT', 'candle1m', symbol); +export interface WsSnapshotAccountEvent extends WsBaseEvent<'snapshot'> { + arg: { + instType: string; + channel: 'account'; + instId: string; + }; +} ⋮---- -// orderbook updates -// wsClient.subscribeTopic('SPOT', 'books', symbol); +export interface WsSnapshotPositionsEvent extends WsBaseEvent<'snapshot'> { + arg: { + instType: string; + channel: 'positions'; + instId: string; + }; +} ⋮---- -// trades -// wsClient.subscribeTopic('SPOT', 'trade', symbol); +export interface WsAccountSnapshotDataUMCBL { + marginCoin: string; + locked: string; + available: string; + maxOpenPosAvailable: string; + maxTransferOut: string; + equity: string; + usdtEquity: string; +} ⋮---- -// Futures public +export interface WsAccountSnapshotUMCBL extends WsBaseEvent<'snapshot'> { + arg: { + instType: 'umcbl'; + channel: 'account'; + instId: string; + }; + data: WsAccountSnapshotDataUMCBL[]; +} ⋮---- -// tickers -// wsClient.subscribeTopic('USDT-FUTURES', 'ticker', symbol); +export interface WsPositionSnapshotDataUMCBL { + posId: string; + instId: string; + instName: string; + marginCoin: string; + margin: string; + marginMode: string; + holdSide: string; + holdMode: string; + total: string; + available: string; + locked: string; + averageOpenPrice: string; + leverage: number; + achievedProfits: string; + upl: string; + uplRate: string; + liqPx: string; + keepMarginRate: string; + marginRate: string; + cTime: string; + uTime: string; + markPrice: string; + /** Cash dividend, USDT (Classic V2 positions channel) */ + cashDividend?: string; +} ⋮---- -// candles -// wsClient.subscribeTopic('USDT-FUTURES', 'candle1m', symbol); +/** Cash dividend, USDT (Classic V2 positions channel) */ ⋮---- -// orderbook updates -// wsClient.subscribeTopic('USDT-FUTURES', 'books', symbol); +/** UTA reality-orderbook push (ts/seq/pseq removed July 2026) */ +export interface WsRealityOrderBookDataV3 { + a: [string, string][]; + b: [string, string][]; +} ⋮---- -// trades -// wsClient.subscribeTopic('USDT-FUTURES', 'trade', symbol); +export interface WSPositionSnapshotUMCBL extends WsBaseEvent<'snapshot'> { + arg: { + instType: 'umcbl'; + channel: 'positions'; + instId: string; + }; + data: WsPositionSnapshotDataUMCBL[]; +} ⋮---- -// Topics are tracked per websocket type -// Get a list of subscribed topics (e.g. all public topics) (after a 5 second delay) +/** Classic V2 depth channel push data. checksum removed May 2026 - use seq instead */ +export interface WsDepthBookDataV2 { + asks: [string, string][]; + bids: [string, string][]; + ts: string; + seq: string; + /** Futures books channel only - previous push serial number */ + pseq?: string; +} +⋮---- +/** Futures books channel only - previous push serial number */ ================ -File: examples/V3 - UTA/Rest/rest-trade-UTA-futures.ts +File: src/types/shared.ts ================ -/* eslint-disable @typescript-eslint/no-unused-vars */ +import { REST_CLIENT_TYPE_ENUM } from '../util/requestUtils.js'; +⋮---- +export type numberInString = string; +⋮---- +export type OrderSide = 'Buy' | 'Sell'; +⋮---- +/** + * @deprecated use SpotKlineInterval or FuturesKlineInterval, depending on which API group you're using + */ +export type KlineInterval = + | '1min' + | '5min' + | '15min' + | '30min' + | '1h' + | '4h' + | '6h' + | '12h' + | '1M' + | '1W' + | '1week' + | '6Hutc' + | '12Hutc' + | '1Dutc' + | '3Dutc' + | '1Wutc' + | '1Mutc'; +⋮---- +export type RestClientType = + (typeof REST_CLIENT_TYPE_ENUM)[keyof typeof REST_CLIENT_TYPE_ENUM]; +⋮---- +export interface APIResponse { + code: string; + requestTime: number; + msg: 'success' | string; + data: T; +} + +================ +File: .nvmrc +================ +v24.18.0 + +================ +File: examples/auth/fasterHmacSign.ts +================ +import { createHmac } from 'crypto'; +⋮---- import { - PlaceOrderRequestV3, + DefaultLogger, RestClientV3, WebsocketClientV3, +} from '../../src/index.js'; +⋮---- +// or +// import { createHmac } from 'crypto'; +// import { DefaultLogger, RestClientV3, WebsocketClientV3 } from 'bitget-api'; +⋮---- +/** + * Injecting a custom signMessage function. + * + * As of version 3.0.0 of the bitget-api Node.js/TypeScript/JavaScript + * SDK for Bitget, the SDK uses the Web Crypto API for signing requests. + * While it is compatible with Node and Browser environments, it is + * slightly slower than using Node's native crypto module (only + * available in backend Node environments). + * + * For latency sensitive users, you can inject the previous node crypto sign + * method (or your own even faster implementation), if this change affects you. + * + * This example demonstrates how to inject a custom sign function, to achieve + * the same peformance as seen before the Web Crypto API was introduced. + * + * For context on standard usage, the "signMessage" function is used: + * - During every single API call + * - After opening a new private WebSocket connection + */ +⋮---- +/** + * Set this to true to enable demo trading: + */ +⋮---- +/** + * Overkill in almost every case, but if you need any optimisation available, + * you can inject a faster sign mechanism such as node's native createHmac: + */ +⋮---- +// Optional, uncomment the "trace" override to log a lot more info about what the WS client is doing +⋮---- +// trace: (...params) => console.log('trace', ...params), +⋮---- +/** + * Set this to true to enable demo trading for the private account data WS + * Topics: order,execution,position,wallet,greeks + */ +⋮---- +/** + * Overkill in almost every case, but if you need any optimisation available, + * you can inject a faster sign mechanism such as node's native createHmac: + */ +⋮---- +function setWsClientEventListeners( + websocketClient: WebsocketClientV3, + accountRef: string, +): Promise +⋮---- +// console.log('raw message received ', JSON.stringify(data, null, 2)); +⋮---- +// Simple promise to ensure we're subscribed before trying anything else +⋮---- +// Start trading + +================ +File: examples/V2 - Classic/Rest/rest-trade-futures.ts +================ +import { + FuturesPlaceOrderRequestV2, + RestClientV2, + WebsocketClientV2, } from '../../../src/index.js'; ⋮---- // or -// import { PlaceOrderRequestV3, RestClientV3, WebsocketClientV3 } from '../src'; +// import { FuturesPlaceOrderRequestV2, RestClientV2, WebsocketClientV2 } from '../src'; ⋮---- // read from environmental variables ⋮---- // If running from CLI in unix, you can pass env vars as such: -// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/V3/rest-trade-futures.ts +// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/rest-trade-futures.ts ⋮---- // note the single quotes, preventing special characters such as $ from being incorrectly passed ⋮---- @@ -6036,7 +6077,7 @@ function promiseSleep(milliseconds: number) * * It is designed to: * - open a private websocket channel to log account events - * - check for any available USDT balance in the account + * - check for any available USDT balance in the futures account * - immediately open a minimum sized long position on BTCUSDT * - check active positions * - immediately send closing orders for any active futures positions @@ -6046,32 +6087,34 @@ function promiseSleep(milliseconds: number) ⋮---- // Add event listeners to log websocket events on account ⋮---- -// Subscribe to private topics for UTA account +// futures private +// : account updates ⋮---- -// Subscribe to position updates +// : position updates ⋮---- -// Subscribe to order updates +// : order updates ⋮---- // wait briefly for ws to be ready (could also use the response or authenticated events, to make sure topics are subscribed to before starting) ⋮---- +// const balances = allBalances.filter((bal) => Number(bal.available) != 0); +⋮---- // Loop through any active positions and send a closing market order on each position ================ -File: examples/V3 - UTA/Rest/rest-trade-UTA-spot.ts +File: examples/V2 - Classic/Rest/rest-trade-spot.ts ================ -/* eslint-disable @typescript-eslint/no-unused-vars */ import { - PlaceOrderRequestV3, - RestClientV3, - WebsocketClientV3, + RestClientV2, + SpotOrderRequestV2, + WebsocketClientV2, } from '../../../src/index.js'; ⋮---- -// import { RestClientV3, WebsocketClientV3 } from '../src/index'; +// import { RestClientV2, WebsocketClient } from '../src/index'; ⋮---- // read from environmental variables ⋮---- // If running from CLI in unix, you can pass env vars as such: -// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/V3/rest-trade-spot.ts +// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/rest-trade-spot.ts ⋮---- // note the single quotes, preventing special characters such as $ from being incorrectly passed ⋮---- @@ -6089,20 +6132,19 @@ function promiseSleep(milliseconds: number) // Add event listeners to log websocket events on account ⋮---- // Subscribe to private account topics -// Account updates for UTA (unified trading account) +// spot private +// : account updates ⋮---- -// Order updates for spot +// : order updates (note: symbol is required) ⋮---- // wait briefly for ws to be ready (could also use the response or authenticated events, to make sure topics are subscribed to before starting) +⋮---- +// console.log('balance: ', JSON.stringify(balances, null, 2)); ================ -File: examples/V3 - UTA/Websocket/ws-private.ts +File: examples/V2 - Classic/Websocket/ws-demo-trading.ts ================ -import { - DefaultLogger, - WebsocketClientV3, - WS_KEY_MAP, -} from '../../../src/index.js'; +import { DefaultLogger, WebsocketClientV2 } from '../../../src/index.js'; ⋮---- // or // import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; @@ -6110,42 +6152,283 @@ import { // If running from CLI in unix, you can pass env vars as such: // API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/ws-private.ts ⋮---- -// console.log('WS raw message received ', JSON.stringify(data, null, 2)); -⋮---- -// You can subscribe to one topic at a time -⋮---- -instType: 'UTA', // Note: all account events go on the UTA instType +// restOptions: { +// optionally provide rest options, e.g. to pass through a proxy +// }, ⋮---- -WS_KEY_MAP.v3Private, // This parameter points to private or public +// Set demoTrading to true, to route all connections to the demo trading wss URLs: ⋮---- -// Note: all account events go on the UTA instType +// If using private topics, make sure to include API keys ⋮---- -// Or multiple at once: +// console.log('WS raw message received ', JSON.stringify(data, null, 2)); ⋮---- -// Topics are tracked per websocket type -// The below example will pull a list of subscribed topics on that connection (e.g. all private topics), after a 5 second delay: +/** + * Public events + */ ================ -File: examples/V3 - UTA/Websocket/ws-public.ts +File: examples/V2 - Classic/Websocket/ws-private.ts ================ -import { - DefaultLogger, - WebsocketClientV3, - WS_KEY_MAP, -} from '../../../src/index.js'; +import { DefaultLogger, WebsocketClientV2 } from '../../../src/index.js'; ⋮---- // or // import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; ⋮---- -// console.log('WS raw message received ', JSON.stringify(data, null, 2)); +// If running from CLI in unix, you can pass env vars as such: +// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/ws-private.ts ⋮---- -/** - * Public events - */ +// note the single quotes, preventing special characters such as $ from being incorrectly passed ⋮---- -// You can subscribe to one topic at a time +// restOptions: { +// optionally provide rest options, e.g. to pass through a proxy +// }, ⋮---- -WS_KEY_MAP.v3Public, // This parameter points to private or public +// console.log('WS raw message received ', JSON.stringify(data, null, 2)); +⋮---- +// auth happens async after the ws connection opens +⋮---- +// wsClient.subscribePublicSpotTickers(['BTCUSDT', 'LTCUSDT']); +⋮---- +/** + * Private account updates + */ +⋮---- +// spot private +// : account updates +⋮---- +// : order updates (note: symbol is required) +// wsClient.subscribeTopic('SPOT', 'orders', 'BTCUSDT'); +⋮---- +// futures private +// : account updates +⋮---- +// : position updates +// wsClient.subscribeTopic('USDT-FUTURES', 'positions'); +⋮---- +// : order updates +// wsClient.subscribeTopic('USDT-FUTURES', 'orders'); +⋮---- +// : plan order updates +// wsClient.subscribeTopic('USDT-FUTURES', 'orders-algo'); +⋮---- +// wsClient +// .getWsStore() +// .getKeys() +// .forEach((wsKey) => { +// const state = wsClient.getWsStore().get(wsKey); +// console.log(`${wsKey} state: `, state.subscribedTopics.values()); +// }); +⋮---- +// setTimeout(() => { +// wsClient.unsubscribeTopic('USDT-FUTURES', 'account'); +// }, 1000 * 2); +⋮---- +// setTimeout(() => { +// wsClient +// .getWsStore() +// .getKeys() +// .forEach((wsKey) => { +// const state = wsClient.getWsStore().get(wsKey); +// console.log(`${wsKey} state: `, state.subscribedTopics.values()); +// }); +// }, 1000 * 5); + +================ +File: examples/V2 - Classic/Websocket/ws-public.ts +================ +import { + DefaultLogger, + WebsocketClientV2, + WS_KEY_MAP, +} from '../../../src/index.js'; +⋮---- +// or +// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; +⋮---- +// restOptions: { +// optionally provide rest options, e.g. to pass through a proxy +// }, +⋮---- +// console.log('WS raw message received ', JSON.stringify(data, null, 2)); +⋮---- +/** + * Public events + */ +⋮---- +// Spot public +⋮---- +// tickers +⋮---- +// candles +// wsClient.subscribeTopic('SPOT', 'candle1m', symbol); +⋮---- +// orderbook updates +// wsClient.subscribeTopic('SPOT', 'books', symbol); +⋮---- +// trades +// wsClient.subscribeTopic('SPOT', 'trade', symbol); +⋮---- +// Futures public +⋮---- +// tickers +// wsClient.subscribeTopic('USDT-FUTURES', 'ticker', symbol); +⋮---- +// candles +// wsClient.subscribeTopic('USDT-FUTURES', 'candle1m', symbol); +⋮---- +// orderbook updates +// wsClient.subscribeTopic('USDT-FUTURES', 'books', symbol); +⋮---- +// trades +// wsClient.subscribeTopic('USDT-FUTURES', 'trade', symbol); +⋮---- +// Topics are tracked per websocket type +// Get a list of subscribed topics (e.g. all public topics) (after a 5 second delay) + +================ +File: examples/V3 - UTA/Rest/rest-trade-UTA-futures.ts +================ +/* eslint-disable @typescript-eslint/no-unused-vars */ +import { + PlaceOrderRequestV3, + RestClientV3, + WebsocketClientV3, +} from '../../../src/index.js'; +⋮---- +// or +// import { PlaceOrderRequestV3, RestClientV3, WebsocketClientV3 } from '../src'; +⋮---- +// read from environmental variables +⋮---- +// If running from CLI in unix, you can pass env vars as such: +// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/V3/rest-trade-futures.ts +⋮---- +// note the single quotes, preventing special characters such as $ from being incorrectly passed +⋮---- +// apiKey: 'apiKeyHere', +// apiSecret: 'apiSecretHere', +// apiPass: 'apiPassHere', +⋮---- +function logWSEvent(type: string, data: any) +⋮---- +// simple sleep function +function promiseSleep(milliseconds: number) +⋮---- +/** + * This is a simple script wrapped in a immediately invoked function expression (to execute the below workflow immediately). + * + * It is designed to: + * - open a private websocket channel to log account events + * - check for any available USDT balance in the account + * - immediately open a minimum sized long position on BTCUSDT + * - check active positions + * - immediately send closing orders for any active futures positions + * - check positions again + * + */ +⋮---- +// Add event listeners to log websocket events on account +⋮---- +// Subscribe to private topics for UTA account +⋮---- +// Subscribe to position updates +⋮---- +// Subscribe to order updates +⋮---- +// wait briefly for ws to be ready (could also use the response or authenticated events, to make sure topics are subscribed to before starting) +⋮---- +// Loop through any active positions and send a closing market order on each position + +================ +File: examples/V3 - UTA/Rest/rest-trade-UTA-spot.ts +================ +/* eslint-disable @typescript-eslint/no-unused-vars */ +import { + PlaceOrderRequestV3, + RestClientV3, + WebsocketClientV3, +} from '../../../src/index.js'; +⋮---- +// import { RestClientV3, WebsocketClientV3 } from '../src/index'; +⋮---- +// read from environmental variables +⋮---- +// If running from CLI in unix, you can pass env vars as such: +// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/V3/rest-trade-spot.ts +⋮---- +// note the single quotes, preventing special characters such as $ from being incorrectly passed +⋮---- +// apiKey: 'apiKeyHere', +// apiSecret: 'apiSecretHere', +// apiPass: 'apiPassHere', +⋮---- +function logWSEvent(type: string, data: any) +⋮---- +// simple sleep function +function promiseSleep(milliseconds: number) +⋮---- +/** This is a simple script wrapped in a immediately invoked function expression, designed to check for any available BTC balance and immediately sell the full amount for USDT */ +⋮---- +// Add event listeners to log websocket events on account +⋮---- +// Subscribe to private account topics +// Account updates for UTA (unified trading account) +⋮---- +// Order updates for spot +⋮---- +// wait briefly for ws to be ready (could also use the response or authenticated events, to make sure topics are subscribed to before starting) + +================ +File: examples/V3 - UTA/Websocket/ws-private.ts +================ +import { + DefaultLogger, + WebsocketClientV3, + WS_KEY_MAP, +} from '../../../src/index.js'; +⋮---- +// or +// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; +⋮---- +// If running from CLI in unix, you can pass env vars as such: +// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/ws-private.ts +⋮---- +// console.log('WS raw message received ', JSON.stringify(data, null, 2)); +⋮---- +// You can subscribe to one topic at a time +⋮---- +instType: 'UTA', // Note: all account events go on the UTA instType +⋮---- +WS_KEY_MAP.v3Private, // This parameter points to private or public +⋮---- +// Note: all account events go on the UTA instType +⋮---- +// Or multiple at once: +⋮---- +// Topics are tracked per websocket type +// The below example will pull a list of subscribed topics on that connection (e.g. all private topics), after a 5 second delay: + +================ +File: examples/V3 - UTA/Websocket/ws-public.ts +================ +import { + DefaultLogger, + WebsocketClientV3, + WS_KEY_MAP, +} from '../../../src/index.js'; +⋮---- +// or +// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; +⋮---- +// console.log('WS raw message received ', JSON.stringify(data, null, 2)); +⋮---- +/** + * Public events + */ +⋮---- +// You can subscribe to one topic at a time +⋮---- +WS_KEY_MAP.v3Public, // This parameter points to private or public ⋮---- // Or multiple at once: ⋮---- @@ -6293,5419 +6576,6539 @@ import { */ ================ -File: src/constants/enum.ts -================ -/** Parameter verification exception margin mode == FIXED */ - -================ -File: src/types/request/v3/broker.ts +File: src/types/request/v2/broker.ts ================ -export interface CreateBrokerSubAccountRequestV3 { - subaccountName: string; - label: string; -} +/** + * + * * Broker | Subaccount + * + */ ⋮---- -export interface GetBrokerSubAccountListRequestV3 { +export interface GetSubAccountsRequestV2 { limit?: string; - cursor?: string; - status?: 'normal' | 'freeze'; + idLessThan?: string; + status?: 'normal' | 'freeze' | 'del'; + startTime?: string; + endTime?: string; } ⋮---- -export interface ModifyBrokerSubAccountRequestV3 { +export type SubAccountPermissionV2 = + | 'withdraw' + | 'transfer' + | 'spot_trade' + | 'contract_trade' + | 'read' + | 'deposit' + | 'margin_trade'; +⋮---- +export type SubAccountLanguageV2 = + | 'en_US' + | 'zh_CN' + | 'ja_JP' + | 'vi_VN' + | 'zh_TW' + | 'ru_RU' + | 'es_ES' + | 'tr_TR' + | 'fr_FR' + | 'de_DE' + | 'pt_PT' + | 'th_TH'; +⋮---- +export type SubAccountStatusV2 = 'normal' | 'freeze'; +⋮---- +export interface ModifySubRequestV2 { subUid: string; - status?: 'normal' | 'freeze'; - permList?: string[]; + permList: SubAccountPermissionV2[]; + status: SubAccountStatusV2; + language?: SubAccountLanguageV2; } ⋮---- -export interface BrokerSubWithdrawalRequestV3 { +export interface SubWithdrawalRequestV2 { subUid: string; coin: string; dest: 'on_chain' | 'internal_transfer'; + chain?: string; address: string; amount: string; - chain?: string; tag?: string; clientOid?: string; } ⋮---- -export interface GetBrokerSubDepositAddressRequestV3 { - subUid: string; - coin: string; - chain?: string; -} -⋮---- -export interface GetBrokerAllSubDepositWithdrawalRequestV3 { +export interface SubDepositRecordsRequestV2 { + orderId?: string; + userId?: string; startTime?: string; endTime?: string; limit?: string; - cursor?: string; - status?: 'pending' | 'fail' | 'success'; + idLessThan?: string; } ⋮---- -export interface GetBrokerCommissionRequestV3 { +export interface SubWithdrawalRecordsRequestV2 { + orderId?: string; + userId?: string; startTime?: string; endTime?: string; - pageSize?: string; - pageNo?: string; - bizType?: 'spot' | 'futures'; - subBizType?: - | 'spot_trade' - | 'spot_margin' - | 'usdt_futures' - | 'usdc_futures' - | 'coin_futures'; + limit?: string; + idLessThan?: string; } ⋮---- -export interface CreateBrokerSubApiKeyRequestV3 { +/** + * + * * Broker | Subaccount + * + */ +⋮---- +export interface CreateSubAccountApiKeyRequestV2 { subUid: string; passphrase: string; - label: string; - ipList?: string[]; - permType: 'read_write' | 'read_only'; + label?: string; + ipList: string[]; + permType: string; permList: string[]; } ⋮---- -export interface ModifyBrokerSubApiKeyRequestV3 { +export interface ModifySubAccountApiKeyRequestV2 { subUid: string; - passphrase: string; apiKey: string; label?: string; + passphrase: string; ipList?: string[]; - permType?: 'read_write' | 'read_only'; - permList?: string[]; + permType?: string; + permList: string[]; } ⋮---- -export interface DeleteBrokerSubApiKeyRequestV3 { +export interface DeleteSubAccountApiKeyRequestV2 { subUid: string; apiKey: string; } ⋮---- -export interface GetBrokerSubApiKeyRequestV3 { - subUid: string; -} - -================ -File: src/types/response/v3/broker.ts -================ -export interface CreateBrokerSubAccountResponseV3 { - subUid: string; - subaccountName: string; - subaccountEmail: string; - status: 'normal' | 'freeze'; - permList: string[]; - label: string; - cTime: string; -} +/** + * + * * Broker | All Sub-accounts Deposit and Withdrawal Records + * + */ ⋮---- -export interface BrokerSubAccountV3 { - subUid: string; - subaccountName: string; - subaccountEmail: string | null; - status: 'normal' | 'freeze'; - permList: string[]; - label: string; - language: string; - cTime: string; - uTime: string; +export interface GetAllSubDepositWithdrawalRequestV2 { + startTime?: string; + endTime?: string; + limit?: string; + idLessThan?: string; + type?: 'all' | 'deposit' | 'withdrawal'; } ⋮---- -export interface GetBrokerSubAccountListResponseV3 { - subList: BrokerSubAccountV3[]; -} +/** + * + * * Broker | Subaccounts + * + */ ⋮---- -export interface ModifyBrokerSubAccountResponseV3 { - subUid: string; - subaccountName: string; - status: 'normal' | 'freeze'; - permList: string[]; - label: string; - cTime: string; - uTime: string; +export interface GetBrokerSubaccountsRequestV2 { + startTime?: string; + endTime?: string; + pageSize?: string; + pageNo?: string; } ⋮---- -export interface BrokerSubWithdrawalResponseV3 { - orderId: string; - clientOid: string; +/** + * + * * Broker | Commissions + * + */ +⋮---- +export interface GetBrokerCommissionsRequestV2 { + startTime?: string; + endTime?: string; + pageSize?: string; + pageNo?: string; + bizType?: 'spot' | 'futures'; + subBizType?: + | 'spot_trade' + | 'spot_margin' + | 'usdt_futures' + | 'usdc_futures' + | 'coin_futures'; } ⋮---- -export interface BrokerSubDepositAddressV3 { - subUid: string; - coin: string; - address: string; - chain: string; - tag: string | null; - url: string; - cTime: string; +/** + * + * * Broker | Trade Volume + * + */ +⋮---- +export interface GetBrokerTradeVolumeRequestV2 { + startTime?: string; + endTime?: string; + pageSize?: string; + pageNo?: string; } ⋮---- -export interface BrokerSubDepositWithdrawalRecordV3 { - uid: string; - txId: string; - type: 'deposit' | 'withdrawal'; - subType: 'onchain' | 'internal' | 'fast'; - coin: string; - amount: string; - status: 'pending' | 'fail' | 'success'; - ts: string; +/** + * + * * Broker | Total Commission + * + */ +⋮---- +export interface GetBrokerTotalCommissionRequestV2 { + startTime?: string; + endTime?: string; } ⋮---- -export interface GetBrokerAllSubDepositWithdrawalResponseV3 { - list: BrokerSubDepositWithdrawalRecordV3[]; - endId: string; +/** + * + * * Broker | Order Commission + * + */ +⋮---- +export interface GetBrokerOrderCommissionRequestV2 { + startTime?: string; + endTime?: string; + limit?: string; + uid?: string; + orderId?: string; + idLessThan?: string; } ⋮---- -export interface BrokerCommissionRecordV3 { +/** + * + * * Broker | Rebate Info + * + */ +⋮---- +export interface GetBrokerRebateInfoRequestV2 { uid: string; - coin: string; - symbol: string; - dealtAmount: string; - totalFee: string; - deductedFee: string; - paidFee: string; - markUpFee: string; - totalCommission: string; } ⋮---- -export interface CreateBrokerSubApiKeyResponseV3 { - subUid: string; - label: string; - apiKey: string; - secretKey: string; - permType: 'read_write' | 'read_only'; - permList: string[]; - ipList: string[] | null; -} -⋮---- -export interface ModifyBrokerSubApiKeyResponseV3 { - subUid: string; - label: string; - apiKey: string; - permType: 'read_write' | 'read_only'; - permList: string[]; - ipList: string[]; -} -⋮---- -export interface GetBrokerSubApiKeyResponseV3 { - subUid: string; - label: string; - apiKey: string; - secretKey: string; - permType: 'read_write' | 'read_only'; - permList: string[]; - ipList: string[] | null; -} - -================ -File: src/types/response/v3/copytrading.ts -================ /** * - * - * Copy Trading | Futures (UTA) - * + * * Broker | Agent (affiliate) customer APIs * */ ⋮---- -export interface CopyFuturesMarginDetailV3 { - marginCoin: string; - maxLongCount: string; - remainingLongCount: string; - maxShortCount: string; - remainingShortCount: string; +export interface GetAgentCustomerCommissionsRequestV2 { + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + uid?: string; + coin?: string; + symbol?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface CopyFuturesTradingPairV3 { - symbol: string; - leverage: string; - marginDetails: CopyFuturesMarginDetailV3[]; +export interface GetAgentSubCustomerListRequestV2 { + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface CopyFuturesPositionSummaryV3 { - unrealizedPnl: string; - realizedPnl: string; - holdSize: string; - avgPrice: string; - symbol: string; - leverage: string; - marginMode: string; - liqPrice: string; - margin: string; - holdSide: string; - roi: string; - markPrice: string; - positionValue: string; +export interface AgentCustomerTradeVolumeRequestV2 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface CopyFuturesMaxTransferableV3 { - maxTransferable: string; - available: string; +export interface AgentCustomerListRequestV2 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + referralCode?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface CopyFuturesTransferResponseV3 { - transferId: string; +export interface GetAgentCustomerKycResultRequestV2 { + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export type CopyFuturesTransferAccountTypeV3 = 'spot' | 'uta' | 'lead'; +export interface AgentCustomerDepositRequestV2 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; +} ⋮---- -export interface CopyFuturesTransferRecordV3 { - transferId: string; - fromType: CopyFuturesTransferAccountTypeV3; - toType: CopyFuturesTransferAccountTypeV3; - amount: string; - coin: string; - status: 'Successful' | 'Failed' | 'Processing'; - createdTime: string; +export interface AgentCustomerAssetRequestV2 { + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface CopyFuturesTransferRecordListV3 { - list: CopyFuturesTransferRecordV3[]; +export interface GetAgentCommissionDetailRequestV2 { + startTime?: string; + endTime?: string; + limit?: string; + idLessThan?: string; } ================ -File: src/types/response/v3/loan.ts +File: src/types/request/v2/common.ts ================ -export interface LoanTransfersV3 { - coin: string; - transfered: string; - userId: string; +import { FuturesProductTypeV2, MarginType } from '../shared.js'; +⋮---- +/** + * + * * Common | Notice + * + */ +⋮---- +export interface GetAnnouncementsRequestV2 { + annType?: string; + startTime?: string; + endTime?: string; + language: string; } ⋮---- -export interface LoanSymbolSettingV3 { +/** + * + * * Common | Public + * + */ +⋮---- +export interface GetTradeRateRequestV2 { symbol: string; - leverage: string; + businessType: string; } ⋮---- -export interface LoanSymbolsV3 { - productId: string; - spotSymbols: string[]; - marginLeverage: string; - usdtContractLeverage: string; - coinContractLeverage: string; - usdcContractLeverage: string; - usdtContractSymbols: LoanSymbolSettingV3[]; - coinContractSymbols: LoanSymbolSettingV3[]; - usdcContractSymbols: LoanSymbolSettingV3[]; +export interface GetAllTradeRatesRequestV2 { + businessType: string; } ⋮---- -export interface RepaidHistoryItemV3 { - repayOrderId: string; - businessType: 'normal' | 'liquidation'; - repayType: 'all' | 'part'; - repaidTime: string; - coin: string; - repayAmount: string; - repayInterest: string; -} +/** + * + * * Common | Tax + * + */ ⋮---- -export interface LoanProductInfoV3 { - productId: string; - leverage: string; - supportUsdtContract: 'YES' | 'NO'; - supportCoinContract: 'YES' | 'NO'; - supportUsdcContract: 'YES' | 'NO'; - transferLine: string; - spotBuyLine: string; - usdtContractOpenLine: string; - coinContractOpenLine: string; - usdcContractOpenLine: string; - liquidationLine: string; - stopLiquidationLine: string; +export interface GetSpotTransactionsRequestV2 { + coin?: string; + startTime: string; + endTime: string; + limit?: string; + idLessThan?: string; } ⋮---- -export interface LoanOrderV3 { - orderId: string; - orderProductId: string; - uid: string; - loanTime: string; - loanCoin: string; - loanAmount: string; - unpaidAmount: string; - unpaidInterest: string; - repaidAmount: string; - repaidInterest: string; - reserve: string; - status: 'not_paid_off' | 'paid_off'; +export interface GetFuturesTransactionsRequestV2 { + productType?: FuturesProductTypeV2; + marginCoin?: string; + startTime: string; + endTime: string; + limit?: string; + idLessThan?: string; } ⋮---- -/** Tiered conversion rate item (when Tiered Discount Rate Model is enabled) */ -export interface ConvertRatioListItemV3 { - ladder: string; - convertRatio: string; +export interface GetMarginTransactionsRequestV2 { + marginType?: MarginType; + coin?: string; + startTime: string; + endTime: string; + limit?: string; + idLessThan?: string; } ⋮---- -export interface CoinInfoV3 { - coin: string; - convertRatio: string; - maxConvertValue: string; - /** Tiered conversion rate (when margin mode is Tiered Discount Rate Model) */ - convertRatioList?: ConvertRatioListItemV3[]; +export interface GetP2PTransactionsRequestV2 { + coin?: string; + startTime: string; + endTime: string; + limit?: string; + idLessThan?: string; } ⋮---- -/** Tiered conversion rate (when margin mode is Tiered Discount Rate Model) */ +/** + * + * * Common | P2P + * + */ ⋮---- -export interface BindUidResponseV3 { - riskUnitId: string; - uid: string; - operate: 'bind' | 'unbind'; +export interface GetP2PMerchantsRequestV2 { + online?: 'yes' | 'no'; + idLessThan?: string; + limit?: string; } ⋮---- -export interface UnpaidInfoV3 { - coin: string; - unpaidQty: string; - unpaidInterest: string; +export interface GetMerchantP2POrdersRequestV2 { + startTime: string; + endTime?: string; + idLessThan?: string; + limit?: string; + status?: string; + advNo: string; + side?: string; + coin?: string; + language: string; + fiat?: string; + orderNo?: string; } ⋮---- -export interface BalanceInfoV3 { +export interface GetMerchantAdvertisementsRequestV2 { + startTime: string; + endTime?: string; + idLessThan?: string; + limit?: string; + status: string; + advNo?: string; + side: string; coin: string; - price: string; - amount: string; - convertedUsdtAmount: string; + language?: string; + fiat: string; + orderBy?: string; + payMethodId?: string; + sourceType?: string; } ⋮---- -export interface LTVConvertResponseV3 { - ltv: string; - subAccountUids: string[]; - unpaidUsdtAmount: string; - usdtBalance: string; - unpaidInfo: UnpaidInfoV3[]; - balanceInfo: BalanceInfoV3[]; -} +/** + * + * * Common | Virtual Subaccount + * + */ ⋮---- -/* Unified Account Staking & Lending (Crypto Loans) - /api/v3/loan/* */ +export interface ModifyVirtualSubRequestV2 { + subAccountUid: string; + permList: string[]; + status: string; +} ⋮---- -export interface LoanCoinInfoV3 { - coin: string; - hourRateFlexible: string; - rateFlexible: string; - hourRate7D: string; - rate7D: string; - hourRate30D: string; - rate30D: string; - minBorrowAmount: string; - maxBorrowAmount: string; - minBorrowLimit: string; - maxBorrowLimit: string; +export interface CreateVirtualSubRequestV2 { + subAccountName: string; + passphrase: string; + label: string; + ipList?: string[]; + permList?: string[]; } ⋮---- -export interface LoanPledgeInfoV3 { - coin: string; - initRate: string; - supRate: string; - forceRate: string; - minPledgeAmount: string; - maxPledgeAmount: string; +export interface CreateVirtualSubApiKeyRequestV2 { + subAccountUid: string; + passphrase: string; + label: string; + ipList?: string[]; + permList?: string[]; } ⋮---- -export interface GetLoanCoinsResponseV3 { - loanInfos: LoanCoinInfoV3[]; - pledgeInfos: LoanPledgeInfoV3[]; +export interface ModifyVirtualSubApiKeyRequestV2 { + subAccountUid: string; + subAccountApiKey: string; + passphrase: string; + label: string; + ipList?: string[]; + permList?: string[]; } ⋮---- -export interface GetLoanInterestResponseV3 { - hourInterest: string; - loanAmount: string; +export interface CreateAgentSubaccountRequestV2 { + /** Lowercase letters only; max 20 characters */ + username: string; + /** 8–32 characters, letters and numbers */ + passphrase: string; + note?: string; } ⋮---- -export interface LoanBorrowResponseV3 { - orderId: string; +/** Lowercase letters only; max 20 characters */ +⋮---- +/** 8–32 characters, letters and numbers */ +⋮---- +/** + * + * * Common | Convert + * + */ +⋮---- +export interface ConvertQuoteRequestV2 { + fromCoin: string; + fromCoinSize?: string; + toCoin: string; + toCoinSize?: string; } ⋮---- -export interface LoanBorrowOngoingItemV3 { - orderId: string; - loanCoin: string; - loanAmount: string; - interestAmount: string; - hourInterestRate: string; - pledgeCoin: string; - pledgeAmount: string; - pledgeRate: string; - supRate: string; - forceRate: string; - borrowTime: string; - expireTime: string; +export interface ConvertRequestV2 { + fromCoin: string; + fromCoinSize: string; + cnvtPrice: string; + toCoin: string; + toCoinSize: string; + traceId: string; } ⋮---- -export interface LoanBorrowHistoryItemV3 { - orderId: string; - loanCoin: string; - pledgeCoin: string; - initPledgeAmount: string; - initLoanAmount: string; - hourRate: string; - daily: string; - borrowTime: string; - status: string; +export interface GetConvertHistoryRequestV2 { + startTime: string; + endTime: string; + limit?: string; + idLessThan?: string; } ⋮---- -export interface LoanRepayResponseV3 { - loanCoin: string; - pledgeCoin: string; - repayAmount: string; - payInterest: string; - repayLoanAmount: string; - repayUnlockAmount: string; +/** + * + * * Common | BGB Convert + * + */ +⋮---- +export interface GetConvertBGBHistoryRequestV2 { + orderId?: string; + startTime: string; + endTime: string; + limit?: string; + idLessThan?: string; } + +================ +File: src/types/request/v2/futures.ts +================ +import { FuturesPlanTypeV2, FuturesProductTypeV2 } from '../shared.js'; ⋮---- -export interface LoanRepayHistoryItemV3 { - orderId: string; - loanCoin: string; - pledgeCoin: string; - repayAmount: string; - payInterest: string; - repayLoanAmount: string; - repayUnlockAmount: string; - repayTime: string; +export type FuturesKlineInterval = + | '1m' + | '3m' + | '5m' + | '15m' + | '30m' + | '1H' + | '2H' + | '4H' + | '6H' + | '12H' + | '1D' + | '3D' + | '1W' + | '1M' + | '6Hutc' + | '12Hutc' + | '1Dutc' + | '3Dutc' + | '1Wutc' + | '1Mutc'; +⋮---- +export type FuturesKlineTypeV2 = 'MARKET' | 'MARK' | 'INDEX'; +⋮---- +export interface FuturesAccountBillRequestV2 { + productType: FuturesProductTypeV2; + symbol?: string; + coin?: string; + businessType?: string; + idLessThan?: string; + startTime?: string; + endTime?: string; + limit?: string; } ⋮---- -export interface LoanRevisePledgeResponseV3 { - loanCoin: string; - pledgeCoin: string; - afterPledgeRate: string; +/** + * + * * Futures | Market + * + */ +⋮---- +export interface FuturesMergeDepthRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + precision?: 'scale0' | 'scale1' | 'scale2' | 'scale3'; + limit?: '1' | '5' | '15' | '50' | 'max'; } ⋮---- -export interface LoanPledgeRateHistoryItemV3 { - loanCoin: string; - pledgeCoin: string; - orderId: string; - reviseTime: string; - reviseSide: string; - reviseAmount: string; - afterPledgeRate: string; - beforePledgeRate: string; +export interface FuturesOiLimitRequestV2 { + productType: FuturesProductTypeV2; + symbol?: string; } ⋮---- -export interface LoanDebtInfoV3 { - coin: string; - amount: string; - amountUsdt: string; +export interface FuturesPositionAdlRankRequestV2 { + productType: FuturesProductTypeV2; } ⋮---- -export interface GetLoanDebtsResponseV3 { - pledgeInfos: LoanDebtInfoV3[]; - loanInfos: LoanDebtInfoV3[]; +export interface FuturesRecentTradesRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + limit?: string; } ⋮---- -export interface LoanReduceItemV3 { - orderId: string; - loanCoin: string; - pledgeCoin: string; - reduceTime: string; - pledgeRate: string; - pledgePrice: string; - status: string; - pledgeAmount: string; - reduceFee: string; - residueAmount: string; - runlockAmount: string; - repayLoanAmount: string; -} - -================ -File: src/types/response/v3/trade.ts -================ -export interface BatchModifyOrderResponseV3 { - orderId: string; - clientOid: string; -} -⋮---- -export interface CancelAllOrdersResponseV3 { - list: { - orderId: string; - clientOid: string; - code: string; - msg: string; - }[]; +export interface FuturesHistoricTradesRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + limit?: string; + idLessThan?: string; + startTime?: string; + endTime?: string; } ⋮---- -export interface CancelBatchOrdersResponseV3 { - orderId: string; - clientOid: string; - code?: string; - msg?: string; +export interface FuturesCandlesRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + granularity: FuturesKlineInterval; + startTime?: string; + endTime?: string; + kLineType?: FuturesKlineTypeV2; + limit?: string; } ⋮---- -export interface CloseAllPositionsResponseV3 { - list: { - orderId: string; - clientOid: string; - code: string; - msg: string; - }[]; -} +/** + * + * * Futures | Account + * + */ ⋮---- -export interface CancelOrderResponseV3 { - orderId: string; - clientOid: string; +export interface FuturesSingleAccountRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; } ⋮---- -export interface GetMaxOpenAvailableResponseV3 { - available: string; - maxOpen: string; - buyOpenCost: string; - sellOpenCost: string; - maxBuyOpen: string; - maxSellOpen: string; +export interface FuturesInterestHistoryRequestV2 { + productType: 'USDT-FUTURES' | 'SUSDT-FUTURES'; + coin?: string; + idLessThan?: string; + startTime?: string; + endTime?: string; + limit?: string; } ⋮---- -export interface FeeDetailV3 { - feeCoin: string; - fee: string; +export interface FuturesOpenCountRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + openAmount: string; + openPrice: string; + leverage?: string; } ⋮---- -export interface OrderInfoV3 { - orderId: string; - clientOid: string; - category: string; +export interface FuturesSetAutoMarginRequestV2 { symbol: string; - orderType: string; - side: string; - price: string; - qty: string; + autoMargin: 'on' | 'off'; + marginCoin: string; amount: string; - cumExecQty: string; - cumExecValue: string; - avgPrice: string; - timeInForce: string; - orderStatus: string; - posSide: string; - holdMode: string; - delegateType?: string; - reduceOnly: string; - feeDetail: FeeDetailV3[]; - cancelReason: string; - execType: string; - stpMode?: string; - createdTime: string; - updatedTime: string; + holdSide?: 'long' | 'short'; } ⋮---- -export type FillCategoryV3 = - | 'spot' - | 'margin' - | 'usdt-futures' - | 'coin-futures' - | 'usdc-futures' - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; -⋮---- -export interface FillV3 { - execId: string; - orderId: string; - category: FillCategoryV3; +export interface FuturesSetLeverageRequestV2 { symbol: string; - orderType: string; - side: string; - execPrice: string; - execQty: string; - execValue: string; - tradeScope: string; - feeDetail: FeeDetailV3[]; - execPnl?: string; - tradeSide?: string; - createdTime: string; - updatedTime: string; + productType: FuturesProductTypeV2; + marginCoin: string; + leverage: string; + holdSide?: 'long' | 'short'; } ⋮---- -export interface UnfilledOrderV3 { - orderId: string; - clientOid: string; - category: string; +export interface FuturesSetPositionMarginRequestV2 { symbol: string; - orderType: string; - side: string; - price: string; - qty: string; + productType: FuturesProductTypeV2; + marginCoin: string; + holdSide: 'long' | 'short'; amount: string; - cumExecQty: string; - cumExecValue: string; - avgPrice: string; - timeInForce: string; - orderStatus: string; - posSide: string; - holdMode: string; - delegateType?: string; - reduceOnly: string; - feeDetail: FeeDetailV3[]; - stpMode?: string; - createdTime: string; - updatedTime: string; } ⋮---- -export interface HistoryOrderV3 { - orderId: string; - clientOid: string; - category: string; +export interface FuturesSetMarginModeRequestV2 { symbol: string; - orderType: string; - side: string; - price: string; - qty: string; - amount: string; - cumExecQty: string; - cumExecValue: string; - avgPrice: string; - timeInForce: string; - orderStatus: string; - posSide: string; - holdMode: string; - delegateType?: string; - reduceOnly: string; - feeDetail: FeeDetailV3[]; - cancelReason: string; - execType: string; - stpMode?: string; - createdTime: string; - updatedTime: string; + productType: FuturesProductTypeV2; + marginCoin: string; + marginMode: 'isolated' | 'crossed'; } ⋮---- -export interface PositionHistoryV3 { - positionId: string; - category: string; - symbol: string; - marginCoin: string; - holdMode: string; - posSide: string; - marginMode: string; - openPriceAvg: string; - closePriceAvg: string; - openTotalPos: string; - closeTotalPos: string; - cumRealisedPnl: string; - netProfit: string; - totalFunding: string; - openFeeTotal: string; - closeFeeTotal: string; - createdTime: string; - updatedTime: string; +/** + * + * * Futures | Position + * + */ +⋮---- +export interface FuturesHistoricalPositionsRequestV2 { + symbol?: string; + productType?: FuturesProductTypeV2; + idLessThan?: string; + startTime?: string; + endTime?: string; + limit?: string; } ⋮---- -export interface CurrentPositionV3 { - category: string; +/** + * + * * Futures | Trade + * + */ +⋮---- +export interface FuturesPlaceOrderRequestV2 { symbol: string; + productType: FuturesProductTypeV2; + marginMode: 'isolated' | 'crossed'; marginCoin: string; - holdMode: string; - posSide: string; - marginMode: string; - positionBalance: string; - available: string; - frozen: string; - total: string; - leverage: string; - curRealisedPnl: string; - avgPrice: string; - positionStatus: string; - unrealisedPnl: string; - liquidationPrice: string; - mmr: string; - profitRate: string; - markPrice: string; - breakEvenPrice: string; - totalFunding: string; - openFeeTotal: string; - closeFeeTotal: string; - createdTime: string; - updatedTime: string; + size: string; + price?: string; + side: 'buy' | 'sell'; + tradeSide?: 'open' | 'close'; + orderType: 'limit' | 'market'; + force?: 'ioc' | 'fok' | 'gtc' | 'post_only'; + clientOid?: string; + reduceOnly?: 'YES' | 'NO'; + presetStopSurplusPrice?: string; + presetStopLossPrice?: string; + stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; } ⋮---- -export interface LoanDataDebtCoinV3 { - coin: string; - debt: string; - interestFreeAmount: string; - interestRateNextHour: string; +export interface FuturesReversalOrderRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + size: string; + side?: 'buy' | 'sell'; + tradeSide?: 'open' | 'close'; + clientOid?: string; } ⋮---- -export interface LoanDataV3 { - currentLoans: string; - interestPaymentTime: string; - debtCoinList: LoanDataDebtCoinV3[]; +interface FuturesBatchOrderItem { + size: string; + price?: string; + side: 'buy' | 'sell'; + tradeSide?: 'open' | 'close'; + orderType: 'limit' | 'market'; + force?: 'ioc' | 'fok' | 'gtc' | 'post_only'; + clientOid?: string; + reduceOnly?: 'YES' | 'NO'; + presetStopSurplusPrice?: string; + presetStopLossPrice?: string; + stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; } ⋮---- -export interface ModifyOrderResponseV3 { - orderId: string; - clientOid: string; +export interface FuturesBatchOrderRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + marginMode: 'isolated' | 'crossed'; + orderList: FuturesBatchOrderItem[]; } ⋮---- -export interface PlaceBatchOrdersResponseV3 { - orderId: string; - clientOid: string; - code?: string; - msg?: string; +export interface FuturesModifyOrderRequestV2 { + orderId?: string; + clientOid?: string; + symbol: string; + productType: FuturesProductTypeV2; + newClientOid: string; + newSize?: string; + newPrice?: string; + newPresetStopSurplusPrice?: string; + newPresetStopLossPrice?: string; } ⋮---- -export interface PlaceOrderResponseV3 { - orderId: string; - clientOid: string; +export interface FuturesCancelOrderRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin?: string; + orderId?: string; + clientOid?: string; } ⋮---- -export interface PositionAdlRankV3 { +interface FuturesBatchCancelOrderItem { + orderId?: string; + clientOid?: string; +} +⋮---- +export interface FuturesBatchCancelOrderRequestV2 { + orderIdList?: FuturesBatchCancelOrderItem[]; + symbol?: string; + productType: FuturesProductTypeV2; + marginCoin?: string; +} +⋮---- +export interface FuturesFlashClosePositionsRequestV2 { + symbol?: string; + productType: FuturesProductTypeV2; + holdSide?: 'long' | 'short'; +} +⋮---- +export interface FuturesGetOrderRequestV2 { symbol: string; - marginCoin: string; - adlRank: string; - holdSide: 'long' | 'short'; + productType: FuturesProductTypeV2; + orderId?: string; + clientOid?: string; } - -================ -File: src/websocket-api-client.ts -================ -import { CancelOrderRequestV3 } from './types/request/v3/trade.js'; -import { CancelOrderResponseV3 } from './types/response/v3/trade.js'; -import { WSAPIResponse } from './types/websockets/ws-api.js'; -import { WSAPIPlaceOrderRequestV3 } from './types/websockets/ws-api-request.js'; -import { WSAPIPlaceOrderResponseV3 } from './types/websockets/ws-api-response.js'; -import { - BitgetInstTypeV3, - WSClientConfigurableOptions, -} from './types/websockets/ws-general.js'; -import { DefaultLogger } from './util/logger.js'; -import { WS_KEY_MAP } from './util/websocket-util.js'; -import { WebsocketClientV3 } from './websocket-client-v3.js'; ⋮---- -/** - * Configurable options specific to only the REST-like WebsocketAPIClient - */ -export interface WSAPIClientConfigurableOptions { - /** - * Default: true - * - * Attach default event listeners, which will console log any high level - * events (opened/reconnecting/reconnected/etc). - * - * If you disable this, you should set your own event listeners - * on the embedded WS Client `wsApiClient.getWSClient().on(....)`. - */ - attachEventListeners: boolean; +export interface FuturesGetOrderFillsRequestV2 { + orderId?: string; + symbol?: string; + productType: FuturesProductTypeV2; + idLessThan?: string; + startTime?: string; + endTime?: string; + limit?: string; } ⋮---- -/** - * Default: true - * - * Attach default event listeners, which will console log any high level - * events (opened/reconnecting/reconnected/etc). - * - * If you disable this, you should set your own event listeners - * on the embedded WS Client `wsApiClient.getWSClient().on(....)`. - */ +export interface FuturesGetHistoricalFillsRequestV2 { + orderId?: string; + symbol?: string; + productType: FuturesProductTypeV2; + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; +} +⋮---- +export interface FuturesGetOpenOrdersRequestV2 { + orderId?: string; + clientOid?: string; + symbol?: string; + productType: FuturesProductTypeV2; + status?: 'live' | 'partially_filled'; + idLessThan?: string; + startTime?: string; + endTime?: string; + limit?: string; +} +⋮---- +export type FuturesOrderSourceV2 = + | 'normal' + | 'market' + | 'profit_market' + | 'loss_market' + | 'Trader_delegate' + | 'trader_profit' + | 'trader_loss' + | 'reverse' + | 'trader_reverse' + | 'profit_limit' + | 'loss_limit' + | 'liquidation' + | 'delivery_close_long' + | 'delivery_close_short' + | 'pos_profit_limit' + | 'pos_profit_market' + | 'pos_loss_limit' + | 'pos_loss_market'; +⋮---- +export interface FuturesGetHistoryOrdersRequestV2 { + orderId?: string; + clientOid?: string; + symbol?: string; + productType: FuturesProductTypeV2; + idLessThan?: string; + orderSource?: FuturesOrderSourceV2; + startTime?: string; + endTime?: string; + limit?: string; +} +⋮---- +export interface FuturesCancelAllOrdersRequestV2 { + symbol?: string; + productType: FuturesProductTypeV2; + marginCoin?: string; + requestTime?: string; + receiveWindow?: string; +} ⋮---- /** - * This is a minimal Websocket API wrapper around the WebsocketClient. * - * Note: You can also directly use the sendWSAPIRequest() method to make WS API calls, but some - * may find the below methods slightly more intuitive. + * * Futures | Trigger Orders * - * Refer to the WS API promises example for a more detailed example on using sendWSAPIRequest() directly: - * https://github.com/tiagosiebler/bitget-api/blob/master/examples/V3/ws-api-trade-raw.ts */ -export class WebsocketAPIClient ⋮---- -constructor( - options?: WSClientConfigurableOptions & - Partial, - logger?: DefaultLogger, -) +export type FuturesTriggerTypeV2 = 'fill_price' | 'mark_price'; ⋮---- -public getWSClient(): WebsocketClientV3 +export type FuturesStpModeV2 = + | 'none' + | 'cancel_taker' + | 'cancel_maker' + | 'cancel_both'; ⋮---- -public setTimeOffsetMs(newOffset: number): void +export interface FuturesTPSLOrderRequestV2 { + marginCoin: string; + productType: FuturesProductTypeV2; + symbol: string; + planType: FuturesPlanTypeV2; + triggerPrice: string; + triggerType?: FuturesTriggerTypeV2; + executePrice?: string; + holdSide: 'long' | 'short' | 'buy' | 'sell'; + size: string; + rangeRate?: string; + clientOid?: string; + stpMode?: FuturesStpModeV2; +} ⋮---- -/* - * Bitget WebSocket API Methods - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel - */ +export interface FuturesPositionTPSLOrderRequestV2 { + marginCoin: string; + productType: FuturesProductTypeV2; + symbol: string; + stopSurplusTriggerPrice?: string; + stopSurplusSize?: string; + stopSurplusTriggerType?: FuturesTriggerTypeV2; + stopSurplusExecutePrice?: string; + stopLossTriggerPrice?: string; + stopLossSize?: string; + stopLossTriggerType?: FuturesTriggerTypeV2; + stopLossExecutePrice?: string; + holdSide: 'long' | 'short' | 'buy' | 'sell'; + stpMode?: FuturesStpModeV2; + stopSurplusClientOid?: string; + stopLossClientOid?: string; +} ⋮---- -/** - * Submit a new order - * - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel - * - * @returns - */ -submitNewOrder( - category: BitgetInstTypeV3, - params: WSAPIPlaceOrderRequestV3, -): Promise> +export type FuturesTriggerPriceTypeV2 = + | 'fill_price' + | 'mark_price' + | 'index_price'; ⋮---- -/** - * Submit a new order - * - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel - * - * @returns - */ -placeBatchOrders( - category: BitgetInstTypeV3, - params: WSAPIPlaceOrderRequestV3[], -): Promise> +export interface FuturesPlanOrderRequestV2 { + planType: 'normal_plan' | 'track_plan'; + symbol: string; + productType: FuturesProductTypeV2; + marginMode: 'isolated' | 'crossed'; + marginCoin: string; + size: string; + price?: string; + callbackRatio?: string; + triggerPrice: string; + triggerType: 'mark_price' | 'fill_price'; + side: 'buy' | 'sell'; + tradeSide?: 'open' | 'close'; + orderType: 'limit' | 'market'; + clientOid?: string; + reduceOnly?: 'YES' | 'NO'; + stopSurplusTriggerPrice?: string; + stopSurplusExecutePrice?: string; + stopSurplusTriggerType?: FuturesTriggerPriceTypeV2; + stopLossTriggerPrice?: string; + stopLossExecutePrice?: string; + stopLossTriggerType?: FuturesTriggerPriceTypeV2; + stpMode?: FuturesStpModeV2; +} ⋮---- -/* - * Bitget WebSocket API Methods - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel - */ +export interface FuturesModifyTPSLOrderRequestV2 { + orderId?: string; + clientOid?: string; + marginCoin: string; + productType: FuturesProductTypeV2; + symbol: string; + triggerPrice: string; + triggerType?: 'fill_price' | 'mark_price'; + executePrice?: string; + size: string; + rangeRate?: string; +} ⋮---- -/** - * Cancel Order - * - * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel - * - * @returns - */ -cancelOrder( - category: BitgetInstTypeV3, - params: CancelOrderRequestV3, -): Promise> +export interface FuturesModifyPlanOrderRequestV2 { + planType: 'normal_plan' | 'track_plan'; + orderId?: string; + clientOid?: string; + symbol: string; + productType: FuturesProductTypeV2; + newSize?: string; + newPrice?: string; + newCallbackRatio?: string; + newTriggerPrice?: string; + newTriggerType?: 'fill_price' | 'mark_price'; + newStopSurplusTriggerPrice?: string; + newStopSurplusExecutePrice?: string; + newStopSurplusTriggerType?: FuturesTriggerPriceTypeV2; + newStopLossTriggerPrice?: string; + newStopLossExecutePrice?: string; + newStopLossTriggerType?: FuturesTriggerPriceTypeV2; +} ⋮---- -/** - * Batch Cancel Order - * - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel - * - * @returns - */ -cancelBatchOrders( - category: BitgetInstTypeV3, - params: CancelOrderRequestV3[], -): Promise> +export interface FuturesGetPlanOrdersRequestV2 { + orderId?: string; + clientOid?: string; + symbol?: string; + planType: 'normal_plan' | 'track_plan' | 'profit_loss'; + productType: FuturesProductTypeV2; + idLessThan?: string; + startTime?: string; + endTime?: string; + limit?: string; +} ⋮---- -/** - * - * - * - * - * - * - * - * Private methods for handling some of the convenience/automation provided by the WS API Client - * - * - * - * - * - * - * - */ +interface FuturesCancelPlanOrderItemV2 { + orderId?: string; + clientOid?: string; +} ⋮---- -private setupDefaultEventListeners() +export type FuturesPlanOrderTypeV2 = + | 'normal_plan' + | 'profit_plan' + | 'loss_plan' + | 'pos_profit' + | 'pos_loss' + | 'moving_plan'; ⋮---- -/** - * General event handlers for monitoring the WebsocketClient - */ +export interface FuturesCancelPlanOrderRequestV2 { + orderIdList?: FuturesCancelPlanOrderItemV2[]; + symbol?: string; + productType: FuturesProductTypeV2; + marginCoin?: string; + planType?: FuturesPlanOrderTypeV2; +} ⋮---- -// Blind JSON.stringify can fail on circular references +export type FuturesPlanStatusV2 = 'executed' | 'fail_trigger' | 'cancelled'; ⋮---- -// JSON.stringify({ ...data, target: 'WebSocket' }), - -================ -File: src/websocket-client-v3.ts -================ -import { - WsAPIOperationResponseMap, - WSAPIRequestBitgetV3, - WSAPIRequestFlags, - WsAPITopicRequestParamMap, - WsAPIWsKeyTopicMap, - WSOperation, - WSOperationLoginParams, - WsRequestOperationBitget, -} from './types/websockets/ws-api.js'; -import { MessageEventLike } from './types/websockets/ws-events.js'; -import { - BitgetInstTypeV3, - WsKey, - WsTopicV3, -} from './types/websockets/ws-general.js'; -import { - BaseWebsocketClient, - EmittableEvent, - MidflightWsRequestEvent, -} from './util/BaseWSClient.js'; -import { isWsPong } from './util/requestUtils.js'; -import { isWSAPIResponse } from './util/type-guards.js'; -import { SignAlgorithm, signMessage } from './util/webCryptoAPI.js'; -import { - getMaxTopicsPerSubscribeEvent, - getNormalisedTopicRequests, - getPromiseRefForWSAPIRequest, - getWsUrl, - WS_AUTH_ON_CONNECT_KEYS, - WS_KEY_MAP, - WS_LOGGER_CATEGORY, - WsTopicRequest, -} from './util/websocket-util.js'; -import { WSConnectedResult } from './util/WsStore.types.js'; +export interface FuturesGetHistoryPlanOrdersRequestV2 { + orderId?: string; + clientOid?: string; + planType: 'normal_plan' | 'track_plan' | 'profit_loss'; + planStatus?: FuturesPlanStatusV2; + symbol?: string; + productType: FuturesProductTypeV2; + idLessThan?: string; + startTime?: string; + endTime?: string; + limit?: string; +} ⋮---- /** - * WebSocket client dedicated to the unified account (V3) WebSockets. * - * Your Bitget account needs to be upgraded to unified account mode, to use the account-level WebSocket topics. + * * Futures | Union Margin + * */ -export class WebsocketClientV3 extends BaseWebsocketClient< ⋮---- -WsRequestOperationBitget // subscribe requests have an "args" parameter with an object within +export interface GetUnionTransferLimitsRequestV2 { + coin: string; +} ⋮---- -/** - * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library - */ -public connectAll(): Promise[] +export interface UnionConvertRequestV2 { + coin: string; + amount: string; +} ⋮---- /** - * 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 -⋮---- -/** This call automatically ensures the connection is active AND authenticated before resolving */ + * + * * Futures | Account | Max Openable Quantity + * + */ ⋮---- -/** - * 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: CategoryV5}. - * - * - 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 | WsTopicV3) - | (WsTopicRequest | WsTopicV3)[], - wsKey: WsKey, -): Promise -⋮---- -/** - * 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 | WsTopicV3) - | (WsTopicRequest | WsTopicV3)[], - wsKey: WsKey, -) +export interface FuturesMaxOpenRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + posSide: 'long' | 'short'; + orderType: 'limit' | 'market'; + openPrice?: string; +} ⋮---- /** - * - * - * Internal methods required to integrate with the BaseWSClient - * - * - */ + * + * * Futures | Account | Liquidation Price + * + */ ⋮---- -protected sendPingEvent(wsKey: WsKey): void +export interface FuturesLiquidationPriceRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + posSide: 'long' | 'short'; + orderType: 'limit' | 'market'; + openAmount: string; + openPrice?: string; +} ⋮---- -protected sendPongEvent(wsKey: WsKey): void +/** + * + * * Futures | Account | Isolated Symbols + * + */ ⋮---- -protected isWsPing(data: any): boolean +export interface FuturesIsolatedSymbolsRequestV2 { + productType: FuturesProductTypeV2; +} + +================ +File: src/types/request/v3/broker.ts +================ +export interface CreateBrokerSubAccountRequestV3 { + subaccountName: string; + label: string; +} ⋮---- -protected isWsPong(data: any): boolean +export interface GetBrokerSubAccountListRequestV3 { + limit?: string; + cursor?: string; + status?: 'normal' | 'freeze'; +} ⋮---- -protected isPrivateTopicRequest( - _request: WsTopicRequest, - wsKey: WsKey, -): boolean +export interface ModifyBrokerSubAccountRequestV3 { + subUid: string; + status?: 'normal' | 'freeze'; + permList?: string[]; +} ⋮---- -protected getPrivateWSKeys(): WsKey[] +export interface BrokerSubWithdrawalRequestV3 { + subUid: string; + coin: string; + dest: 'on_chain' | 'internal_transfer'; + address: string; + amount: string; + chain?: string; + tag?: string; + clientOid?: string; +} ⋮---- -protected isAuthOnConnectWsKey(wsKey: WsKey): boolean +export interface GetBrokerSubDepositAddressRequestV3 { + subUid: string; + coin: string; + chain?: string; +} ⋮---- -protected async getWsUrl(wsKey: WsKey): Promise +export interface GetBrokerAllSubDepositWithdrawalRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; + status?: 'pending' | 'fail' | 'success'; +} ⋮---- -protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null +export interface GetBrokerCommissionRequestV3 { + startTime?: string; + endTime?: string; + pageSize?: string; + pageNo?: string; + bizType?: 'spot' | 'futures'; + subBizType?: + | 'spot_trade' + | 'spot_margin' + | 'usdt_futures' + | 'usdc_futures' + | 'coin_futures'; +} ⋮---- -/** - * @returns one or more correctly structured request events for performing a operations over WS. This can vary per exchange spec. - */ -protected async getWsRequestEvents( - operation: WSOperation, - requests: WsTopicRequest[], -): Promise>[]> +export interface CreateBrokerSubApiKeyRequestV3 { + subUid: string; + passphrase: string; + label: string; + ipList?: string[]; + permType: 'read_write' | 'read_only'; + permList: string[]; +} ⋮---- -// Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values +export interface ModifyBrokerSubApiKeyRequestV3 { + subUid: string; + passphrase: string; + apiKey: string; + label?: string; + ipList?: string[]; + permType?: 'read_write' | 'read_only'; + permList?: string[]; +} ⋮---- -/** - { - "op":"subscribe", - "args":[ - { - "instType":"spot", - "topic":"ticker", - "symbol":"BTCUSDT" - }, - { - "instType":"spot", - "topic":"candle5m", - "symbol":"BTCUSDT" - } - ] - } - */ +export interface DeleteBrokerSubApiKeyRequestV3 { + subUid: string; + apiKey: string; +} ⋮---- -// const request = { -// topic: 'ticker', -// payload: { instType: 'spot', symbol: 'BTCUSDT' }, -// }; -// becomes: -// const request = { -// topic: 'ticker', -// instType: 'spot', -// symbol: 'BTCUSDT', -// }; +export interface GetBrokerSubApiKeyRequestV3 { + subUid: string; +} + +================ +File: src/types/request/v3/strategy.ts +================ +export type StrategyOrderTypeV3 = 'tpsl' | 'trigger'; ⋮---- -private async getWsAuthSignature( - wsKey: WsKey, -): Promise< +export type StrategyOrderStatusV3 = + | 'pending' + | 'success' + | 'failed' + | 'cancelled' + | 'submitting'; ⋮---- -private async signMessage( - paramsStr: string, - secret: string, - method: 'hex' | 'base64', - algorithm: SignAlgorithm, -): Promise +export type StrategyTriggerByV3 = 'market' | 'mark'; ⋮---- -protected async getWsAuthRequestEvent( - wsKey: WsKey, -): Promise> +export type StrategyTriggerOrderTypeV3 = 'limit' | 'market'; ⋮---- -/** - * Abstraction called to sort ws events into emittable event types (response to a request, data update, etc) - */ -protected resolveEmittableEvents( - wsKey: WsKey, - event: MessageEventLike, -): EmittableEvent[] +export interface PlaceStrategyOrderRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol: string; + clientOid?: string; + type?: StrategyOrderTypeV3; + tpslMode?: 'full' | 'partial'; + /** Required when tpslMode=partial or for trigger orders */ + qty?: string; + side?: 'buy' | 'sell'; + posSide?: 'long' | 'short'; + reduceOnly?: 'yes' | 'no'; + tpTriggerBy?: StrategyTriggerByV3; + slTriggerBy?: StrategyTriggerByV3; + takeProfit?: string; + stopLoss?: string; + tpOrderType?: StrategyTriggerOrderTypeV3; + slOrderType?: StrategyTriggerOrderTypeV3; + tpLimitPrice?: string; + slLimitPrice?: string; + triggerBy?: StrategyTriggerByV3; + triggerPrice?: string; + triggerOrderType?: StrategyTriggerOrderTypeV3; + triggerOrderPrice?: string; +} ⋮---- -/** - * WS API response handling - */ +/** Required when tpslMode=partial or for trigger orders */ ⋮---- -// const eg1 = { -// event: 'error', -// id: '1', -// code: '43012', -// msg: 'Insufficient balance', -// }; +export interface ModifyStrategyOrderRequestV3 { + orderId?: string; + clientOid?: string; + qty: string; + tpTriggerBy?: StrategyTriggerByV3; + slTriggerBy?: StrategyTriggerByV3; + takeProfit?: string; + stopLoss?: string; + tpOrderType?: StrategyTriggerOrderTypeV3; + slOrderType?: StrategyTriggerOrderTypeV3; + tpLimitPrice?: string; + slLimitPrice?: string; + triggerBy?: StrategyTriggerByV3; + triggerPrice?: string; + triggerOrderType?: StrategyTriggerOrderTypeV3; + triggerOrderPrice?: string; +} ⋮---- -// WS API Success +export interface CancelStrategyOrderRequestV3 { + orderId?: string; + clientOid?: string; +} +⋮---- +export interface GetUnfilledStrategyOrdersRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + type?: StrategyOrderTypeV3; +} ⋮---- +export interface GetHistoryStrategyOrdersRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + type?: StrategyOrderTypeV3; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; +} + +================ +File: src/types/response/v2/futures.ts +================ /** - * V3 event handling for consumers - behaves the same as V2 - */ + * + * * Futures | Market + * + */ ⋮---- -// v2 authentication event +export interface FuturesVipFeeRateV2 { + level: string; + dealAmount: string; + assetAmount: string; + takerFeeRate: string; + makerFeeRate: string; + btcWithdrawAmount: string; + usdtWithdrawAmount: string; +} ⋮---- -// messageType: typeof msg, -// messageString: JSON.stringify(msg), +export interface FuturesHistoryInterestRateV2 { + ts: string; + annualInterestRate: string; + dailyInterestRate: string; +} ⋮---- -// Service upgrade (30033): Bitget sends this ~60s before disconnect. Log and let automatic reconnect handle when connection drops. +export interface FuturesInterestExchangeRateV2 { + tier: string; + minAmount: string; + maxAmount: string; + exchangeRate: string; +} ⋮---- -// messageType: typeof msg, -// messageString: JSON.stringify(msg), +export interface FuturesDiscountRateV2 { + tier: string; + minAmount: string; + maxAmount: string; + discountRate: string; +} ⋮---- -// fallback emit anyway +export interface FuturesDiscountRatesV2 { + coin: string; + userLimit: string; + totalLimit: string; + discountRateList: FuturesDiscountRateV2[]; +} ⋮---- -/** - * V3/UTA supports order placement via WebSockets. This is the WS API: - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel - * - * @returns a promise that resolves/rejects when a matching response arrives - */ -async sendWSAPIRequest< - TWSKey extends keyof WsAPIWsKeyTopicMap, - TWSOperation extends WsAPIWsKeyTopicMap[TWSKey], - TWSParams extends WsAPITopicRequestParamMap[TWSOperation], - TWSAPIResponse extends - WsAPIOperationResponseMap[TWSOperation] = WsAPIOperationResponseMap[TWSOperation], - >( - wsKey: WsKey, - operation: TWSOperation, - category: BitgetInstTypeV3, - params: TWSParams & { signRequest?: boolean }, - requestFlags?: WSAPIRequestFlags, -): Promise +export interface FuturesMergeDepthV2 { + asks: [number, number][]; + bids: [number, number][]; + ts: string; + scale: string; + precision: string; + isMaxPrecision: string; +} ⋮---- -// this.logger.trace('sendWSAPIRequest(): assertIsAuthenticated(${wsKey})...'); +export interface FuturesTickerV2 { + symbol: string; + lastPr: string; + askPr: string; + bidPr: string; + bidSz: string; + askSz: string; + high24h: string; + low24h: string; + ts: string; + change24h: string; + baseVolume: string; + quoteVolume: string; + usdtVolume: string; + openUtc: string; + changeUtc24h: string; + indexPrice: string; + fundingRate: string; + holdingAmount: string; + deliveryStartTime: string; + deliveryTime: string; + deliveryStatus: string; + open24h: string; + markPrice: string; +} ⋮---- -// this.logger.trace('sendWSAPIRequest(): assertIsAuthenticated(${wsKey}) ok'); +export interface FuturesFillV2 { + tradeId: string; + price: string; + size: string; + side: string; + ts: string; + symbol: string; +} ⋮---- -// Ensure "args" is always wrapped as array +export type FuturesCandlestickV2 = [ + string, // timestamp + string, // open + string, // high + string, // low + string, // close + string, // baseVolume + string, // usdtVolume + string, // quoteVolume +]; ⋮---- -// Store deferred promise, resolved within the "resolveEmittableEvents" method while parsing incoming events +string, // timestamp +string, // open +string, // high +string, // low +string, // close +string, // baseVolume +string, // usdtVolume +string, // quoteVolume ⋮---- -// eslint-disable-next-line @typescript-eslint/no-explicit-any +export interface FuturesOpenInterestV2 { + symbol: string; + size: string; +} ⋮---- -// Enrich returned promise with request context for easier debugging +export interface FuturesFundingTimeV2 { + symbol: string; + nextFundingTime: string; + ratePeriod: string; +} ⋮---- -// throw e; +export interface FuturesSymbolPriceV2 { + symbol: string; + price: string; + indexPrice: string; + markPrice: string; + ts: string; +} ⋮---- -// Send event +export interface FuturesHistoricalFundingRateV2 { + symbol: string; + fundingRate: string; + fundingTime: string; +} ⋮---- -// Return deferred promise, so caller can await this call - -================ -File: examples/V3 - UTA/WS-API/ws-api-client-trade.ts -================ -import { DefaultLogger, WebsocketAPIClient } from '../../../src/index.js'; +export interface FuturesContractConfigV2 { + symbol: string; + baseCoin: string; + quoteCoin: string; + buyLimitPriceRatio: string; + sellLimitPriceRatio: string; + feeRateUpRatio: string; + makerFeeRate: string; + takerFeeRate: string; + openCostUpRatio: string; + supportMarginCoins: string[]; + minTradeNum: string; + priceEndStep: string; + volumePlace: string; + pricePlace: string; + sizeMultiplier: string; + symbolType: string; + minTradeUSDT: string; + maxSymbolOrderNum: string; + maxProductOrderNum: string; + maxPositionNum: string; + symbolStatus: string; + offTime: string; + limitOpenTime: string; + deliveryTime: string; + deliveryStartTime: string; + launchTime: string; + fundInterval: string; + minLever: string; + maxLever: string; + posLimit: string; + maintainTime: string; + isRwa: string; +} ⋮---- -// or -// import { DefaultLogger, WS_KEY_MAP, WebsocketAPIClient } from 'bitget-api'; +/** + * + * * Futures | Account + * + */ ⋮---- -// function attachEventHandlers( -// wsClient: TWSClient, -// ): void { -// wsClient.on('update', (data) => { -// console.log('raw message received ', JSON.stringify(data)); -// }); -// wsClient.on('open', (data) => { -// console.log('ws connected', data.wsKey); -// }); -// wsClient.on('reconnect', ({ wsKey }) => { -// console.log('ws automatically reconnecting.... ', wsKey); -// }); -// wsClient.on('reconnected', (data) => { -// console.log('ws has reconnected ', data?.wsKey); -// }); -// wsClient.on('authenticated', (data) => { -// console.log('ws has authenticated ', data?.wsKey); -// }); -// } +export interface FuturesAccountV2 { + marginCoin: string; + locked: string; + available: string; + crossedMaxAvailable: string; + isolatedMaxAvailable: string; + maxTransferOut: string; + accountEquity: string; + usdtEquity: string; + btcEquity: string; + crossedRiskRate: string; + crossedMarginLeverage: string; + isolatedLongLever: string; + isolatedShortLever: string; + marginMode: string; + posMode: string; + unrealizedPL: string; + coupon: string; + crossedUnrealizedPL: string; + isolatedUnrealizedPL: string; + assetMode: string; +} ⋮---- -// If running from CLI in unix, you can pass env vars as such: -// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/ws-private.ts +export interface FuturesAccountsV2 { + marginCoin: string; + locked: string; + available: string; + crossedMaxAvailable: string; + isolatedMaxAvailable: string; + maxTransferOut: string; + accountEquity: string; + usdtEquity: string; + btcEquity: string; + crossedRiskRate: string; + unrealizedPL: string; + coupon: string; + unionTotalMagin: string; + unionAvailable: string; + unionMm: string; + assetList: { + coin: string; + balance: string; + }[]; + isolatedMargin: string; + crossedMargin: string; + crossedUnrealizedPL: string; + isolatedUnrealizedPL: string; + assetMode: string; +} ⋮---- -// Whether to use the demo trading wss connection -// demoTrading: true, +export interface FuturesSubAccountAssetV2 { + marginCoin: string; + locked: string; + available: string; + crossedMaxAvailable: string; + isolatedMaxAvailable: string; + maxTransferOut: string; + accountEquity: string; + usdtEquity: string; + btcEquity: string; + unrealizedPL: string; + coupon: string; +} ⋮---- -// If you want your own event handlers instead of the default ones with logs, -// disable this setting and see the `attachEventHandlers` example below: -// attachEventListeners: false +export interface FuturesInterestV2 { + coin: string; + liability: string; + interestFreeLimit: string; + interestLimit: string; + hourInterestRate: string; + interest: string; + cTime: string; +} +export interface FuturesInterestHistoryV2 { + nextSettleTime: string; + borrowAmount: string; + borrowLimit: string; + interestList: FuturesInterestV2[]; + endId: string; +} ⋮---- -logger, // Optional: inject a custom logger +export interface SetLeverageResponseV2 { + symbol: string; + marginCoin: string; + longLeverage: string; + shortLeverage: string; + crossMarginLeverage: string; + marginMode: string; +} ⋮---- -// Optional, see above "attachEventListeners". Attach basic event handlers, so nothing is left unhandled -// attachEventHandlers(wsClient.getWSClient()); +export interface SetMarginModeResponseV2 { + symbol: string; + marginCoin: string; + longLeverage: string; + shortLeverage: string; + marginMode: string; +} ⋮---- -// Optional: prepare the WebSocket API connection in advance. -// This happens automatically but you can do this early before making any API calls, to prevent delays from a cold start. +export interface FuturesAccountBillV2 { + billId: string; + symbol: string; + amount: string; + fee: string; + feeByCoupon: string; + businessType: string; + coin: string; + balance: string; + cTime: string; +} ⋮---- /** - * Bitget's WebSocket API be used like a REST API, through this SDK's WebsocketAPIClient. The WebsocketAPIClient is a utility class wrapped around WebsocketClientV3's sendWSAPIRequest() capabilities. - * - * Each request sent via the WebsocketAPIClient will automatically: - * - route via the active WS API connection - * - return a Promise, which automatically resolves/rejects when a matching response is received - * - * Note: this requires V3/UTA API keys! - */ + * + * * Futures | Position + * + */ ⋮---- -/** - * Place Order - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters - */ +export interface FuturesPositionTierV2 { + symbol: string; + level: string; + startUnit: string; + endUnit: string; + leverage: string; + keepMarginRate: string; +} ⋮---- -/** - const res = { - "event": "trade", - "id": "1750034396082", - "category": "spot", - "topic": "place-order", - "args": [ - { - "symbol": "BTCUSDT", - "orderId": "xxxxxxxx", - "clientOid": "xxxxxxxx", - "cTime": "1750034397008" - } - ], - "code": "0", - "msg": "success", - "ts": "1750034397076" - }; - */ +export interface FuturesPositionV2 { + marginCoin: string; + symbol: string; + holdSide: string; + openDelegateSize: string; + marginSize: string; + available: string; + locked: string; + total: string; + leverage: string; + achievedProfits: string; + openPriceAvg: string; + marginMode: string; + posMode: string; + unrealizedPL: string; + liquidationPrice: string; + keepMarginRate: string; + markPrice: string; + breakEvenPrice: string; + totalFee: string; + deductedFee: string; + marginRatio: string; + assetMode: string; + /** Cash dividend, USDT */ + cashDividend?: string; + uTime: string; + autoMargin: string; + cTime: string; +} ⋮---- -/** - * Batch Place Order Channel - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel - */ +/** Cash dividend, USDT */ ⋮---- -/** - * Note: batch place will never reject the request, even if all orders were rejected. Check the "code" and "msg" properties for individual orders in the response, to detect batch place errors. - */ +export interface FuturesPositionAdlRankV2 { + symbol: string; + marginCoin: string; + adlRank: string; + rank: string; + holdSide: string; +} ⋮---- -/** - const res = { - "event": "trade", - "id": "1750035029506", - "category": "spot", - "topic": "batch-place", - "args": [ - { - "code": "0", - "msg": "Success", - "symbol": "BTCUSDT", - "orderId": "xxxxxxxx", - "clientOid": "xxxxxxxx" - }, - { - "code": "0", - "msg": "Success", - "symbol": "BTCUSDT", - "orderId": "xxxxxxxx", - "clientOid": "xxxxxxxx" - } - ], - "code": "0", - "msg": "Success", - "ts": "1750035029925" - } - */ +export interface FuturesHistoryPositionV2 { + positionId: string; + marginCoin: string; + symbol: string; + holdSide: string; + openAvgPrice: string; + closeAvgPrice: string; + marginMode: string; + openTotalPos: string; + closeTotalPos: string; + pnl: string; + netProfit: string; + totalFunding: string; + openFee: string; + closeFee: string; + /** Cash dividend, USDT */ + cashDividend?: string; + cTime: string; + uTime: string; +} ⋮---- -/** - * Cancel Order - * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel - */ -⋮---- -/** - const res = { - "event": "trade", - "id": "1750034870205", - "topic": "cancel-order", - "args": [ - { - "orderId": "xxxxxxxx", - "clientOid": "xxxxxxxx" - } - ], - "code": "0", - "msg": "Success", - "ts": "1750034870597" - } - */ -⋮---- -/** - * Batch Cancel Order - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel - */ +/** Cash dividend, USDT */ ⋮---- -/** - const res = { - "event": "trade", - "id": "bb553cc0-c1fa-454e-956d-c96c8d715760", - "topic": "batch-cancel", - "args": [ - { - "code": "0", - "msg": "Success", - "orderId": "xxxxxxxxxxxxx" - }, - { - "code": "25204", - "msg": "Order does not exist", - "orderId": "xxxxxxxxxxxxx" - } - ], - "code": "0", - "msg": "Success", - "ts": "1751980011084" - } - */ - -================ -File: src/types/request/v2/broker.ts -================ /** * - * * Broker | Subaccount + * * Futures | Trade * */ ⋮---- -export interface GetSubAccountsRequestV2 { - limit?: string; - idLessThan?: string; - status?: 'normal' | 'freeze' | 'del'; - startTime?: string; - endTime?: string; +export interface FuturesBatchOrderResponseV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + errorCode: string; + }[]; } ⋮---- -export type SubAccountPermissionV2 = - | 'withdraw' - | 'transfer' - | 'spot_trade' - | 'contract_trade' - | 'read' - | 'deposit' - | 'margin_trade'; -⋮---- -export type SubAccountLanguageV2 = - | 'en_US' - | 'zh_CN' - | 'ja_JP' - | 'vi_VN' - | 'zh_TW' - | 'ru_RU' - | 'es_ES' - | 'tr_TR' - | 'fr_FR' - | 'de_DE' - | 'pt_PT' - | 'th_TH'; +export interface FuturesClosePositionResponseV2 { + successList: { + orderId: string; + clientOid: string; + symbol: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + symbol: string; + errorMsg: string; + errorCode: string; + }[]; +} ⋮---- -export type SubAccountStatusV2 = 'normal' | 'freeze'; +export interface FuturesOrderDetailV2 { + symbol: string; + size: string; + orderId: string; + clientOid: string; + baseVolume: string; + priceAvg: string; + fee: string; + price: string; + state: string; + side: string; + force: string; + totalProfits: string; + posSide: string; + marginCoin: string; + presetStopSurplusPrice: string; + presetStopLossPrice: string; + quoteVolume: string; + orderType: string; + leverage: string; + marginMode: string; + reduceOnly: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderSource: string; + cancelReason: string; + cTime: string; + uTime: string; +} ⋮---- -export interface ModifySubRequestV2 { - subUid: string; - permList: SubAccountPermissionV2[]; - status: SubAccountStatusV2; - language?: SubAccountLanguageV2; +export interface FuturesOrderFillV2 { + tradeId: string; + symbol: string; + orderId: string; + price: string; + baseVolume: string; + feeDetail: { + deduction: string; + feeCoin: string; + totalDeductionFee: string; + totalFee: string; + }[]; + side: string; + quoteVolume: string; + profit: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + tradeScope: string; + cTime: string; } ⋮---- -export interface SubWithdrawalRequestV2 { - subUid: string; - coin: string; - dest: 'on_chain' | 'internal_transfer'; - chain?: string; - address: string; - amount: string; - tag?: string; - clientOid?: string; +export interface FuturesOpenOrderV2 { + symbol: string; + size: string; + orderId: string; + clientOid: string; + baseVolume: string; + fee: string; + price: string; + priceAvg: string; + status: string; + side: string; + force: string; + totalProfits: string; + posSide: string; + marginCoin: string; + quoteVolume: string; + leverage: string; + marginMode: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderType: string; + orderSource: string; + cTime: string; + uTime: string; + presetStopSurplusPrice: string; + presetStopSurplusType: string; + presetStopSurplusExecutePrice: string; + presetStopLossPrice: string; + presetStopLossType: string; + presetStopLossExecutePrice: string; } ⋮---- -export interface SubDepositRecordsRequestV2 { - orderId?: string; - userId?: string; - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: string; +export interface FuturesHistoryOrderV2 { + symbol: string; + size: string; + orderId: string; + clientOid: string; + baseVolume: string; + fee: string; + price: string; + priceAvg: string; + status: string; + side: string; + force: string; + totalProfits: string; + posSide: string; + marginCoin: string; + quoteVolume: string; + leverage: string; + marginMode: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderType: string; + orderSource: string; + cTime: string; + uTime: string; + presetStopSurplusPrice: string; + presetStopLossPrice: string; + liqPrice: string; } ⋮---- -export interface SubWithdrawalRecordsRequestV2 { - orderId?: string; - userId?: string; - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: string; +export interface FuturesCancelAllOrdersV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + errorCode: string; + }[]; } ⋮---- /** * - * * Broker | Subaccount + * * Futures | Trigger Orders * */ ⋮---- -export interface CreateSubAccountApiKeyRequestV2 { - subUid: string; - passphrase: string; - label?: string; - ipList: string[]; - permType: string; - permList: string[]; +export interface FuturesTriggerSubOrderV2 { + orderId: string; + price: string; + type: string; + status: string; } ⋮---- -export interface ModifySubAccountApiKeyRequestV2 { - subUid: string; - apiKey: string; - label?: string; - passphrase: string; - ipList?: string[]; - permType?: string; - permList: string[]; +export interface FuturesPendingPlanOrderV2 { + planType: string; + symbol: string; + size: string; + orderId: string; + clientOid: string; + price: string; + executePrice: string; + callbackRatio: string; + triggerPrice: string; + triggerType: string; + planStatus: string; + side: string; + posSide: string; + marginCoin: string; + marginMode: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderType: string; + orderSource: string; + cTime: string; + uTime: string; + stopSurplusExecutePrice: string; + stopSurplusTriggerPrice: string; + stopSurplusTriggerType: string; + stopLossExecutePrice: string; + stopLossTriggerPrice: string; + stopLossTriggerType: string; } ⋮---- -/** - * - * * Broker | All Sub-accounts Deposit and Withdrawal Records - * - */ +export interface FuturesCancelPlanOrderV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + }[]; +} ⋮---- -export interface GetAllSubDepositWithdrawalRequestV2 { - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: string; - type?: 'all' | 'deposit' | 'withdrawal'; +export interface FuturesHistoryPlanOrderV2 { + planType: string; + symbol: string; + size: string; + orderId: string; + executeOrderId: string; + clientOid: string; + planStatus: string; + price: string; + executePrice: string; + priceAvg: string; + baseVolume: string; + callbackRatio: string; + triggerPrice: string; + triggerType: string; + side: string; + posSide: string; + marginCoin: string; + marginMode: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderType: string; + cTime: string; + uTime: string; + stopSurplusExecutePrice: string; + stopSurplusTriggerPrice: string; + stopSurplusTriggerType: string; + stopLossExecutePrice: string; + stopLossTriggerPrice: string; + stopLossTriggerType: string; } ⋮---- /** * - * * Broker | Subaccounts + * * Futures | Union Margin * */ ⋮---- -export interface GetBrokerSubaccountsRequestV2 { - startTime?: string; - endTime?: string; - pageSize?: string; - pageNo?: string; +export interface UnionTransferLimitsV2 { + coin: string; + maxTransferIn: string; } ⋮---- -/** - * - * * Broker | Commissions - * - */ -⋮---- -export interface GetBrokerCommissionsRequestV2 { - startTime?: string; - endTime?: string; - pageSize?: string; - pageNo?: string; - bizType?: 'spot' | 'futures'; - subBizType?: - | 'spot_trade' - | 'spot_margin' - | 'usdt_futures' - | 'usdc_futures' - | 'coin_futures'; +export interface UnionConfigV2 { + imr: string; + mmr: string; + individualLimit: string; + individualLimitRatio: string; } ⋮---- -/** - * - * * Broker | Trade Volume - * - */ +export interface UnionSwitchUsdtV2 { + usdtAmount: string; +} ⋮---- -export interface GetBrokerTradeVolumeRequestV2 { - startTime?: string; - endTime?: string; - pageSize?: string; - pageNo?: string; +export interface UnionConvertV2 { + usdtAmount: string; } ⋮---- /** * - * * Broker | Total Commission + * * Futures | Account | Max Openable Quantity * */ ⋮---- -export interface GetBrokerTotalCommissionRequestV2 { - startTime?: string; - endTime?: string; +export interface FuturesMaxOpenV2 { + maxOpen: string; } ⋮---- /** * - * * Broker | Order Commission + * * Futures | Account | Liquidation Price * */ ⋮---- -export interface GetBrokerOrderCommissionRequestV2 { - startTime?: string; - endTime?: string; - limit?: string; - uid?: string; - orderId?: string; - idLessThan?: string; +export interface FuturesLiquidationPriceV2 { + liqPrice: string; } ⋮---- /** * - * * Broker | Rebate Info + * * Futures | Account | Isolated Symbols * */ ⋮---- -export interface GetBrokerRebateInfoRequestV2 { - uid: string; +export interface FuturesIsolatedSymbolV2 { + symbol: string; + marginMode: 'isolated'; } -⋮---- + +================ +File: src/types/response/v2/spot.ts +================ /** * - * * Broker | Agent (affiliate) customer APIs + * * Spot | Market * */ ⋮---- -export interface GetAgentCustomerCommissionsRequestV2 { - startTime?: string; - endTime?: string; - idLessThan?: string; - limit?: string; - uid?: string; - coin?: string; - symbol?: string; - showSub?: 'yes' | 'no'; +export interface SpotCoinChainV2 { + chain: string; + needTag: boolean; + withdrawable: boolean; + rechargeable: boolean; + withdrawFee: string; + extraWithdrawFee: string; + depositConfirm: string; + withdrawConfirm: string; + minDepositAmount: string; + minWithdrawAmount: string; + browserUrl: string; + contractAddress: string; + withdrawStep: string; + withdrawMinScale: string; + congestion: string; } ⋮---- -export interface GetAgentSubCustomerListRequestV2 { - startTime?: string; - endTime?: string; - idLessThan?: string; - limit?: string; - uid?: string; - showSub?: 'yes' | 'no'; +export interface SpotCoinInfoV2 { + coinId: string; + coin: string; + transfer: boolean; + chains: SpotCoinChainV2[]; } ⋮---- -export interface AgentCustomerTradeVolumeRequestV2 { - startTime?: string; - endTime?: string; - pageNo?: string; - pageSize?: string; - uid?: string; - showSub?: 'yes' | 'no'; +export interface SpotSymbolInfoV2 { + symbol: string; + baseCoin: string; + quoteCoin: string; + minTradeAmount: string; + maxTradeAmount: string; + takerFeeRate: string; + makerFeeRate: string; + pricePrecision: string; + quantityPrecision: string; + quotePrecision: string; + minTradeUSDT: string; + status: string; + buyLimitPriceRatio: string; + sellLimitPriceRatio: string; + orderQuantity: string; + areaSymbol: string; + maxLimitOrderValue?: string; + maxMarketOrderValue?: string; } ⋮---- -export interface AgentCustomerListRequestV2 { - startTime?: string; - endTime?: string; - pageNo?: string; - pageSize?: string; - uid?: string; - referralCode?: string; - showSub?: 'yes' | 'no'; -} +export interface SpotVipFeeRateV2 { + level: number; + dealAmount: string; + assetAmount: string; + takerFeeRate: string; + makerFeeRate: string; + btcWithdrawAmount: string; + usdtWithdrawAmount: string; +} ⋮---- -export interface GetAgentCustomerKycResultRequestV2 { - startTime?: string; - endTime?: string; - idLessThan?: string; - limit?: string; - uid?: string; - showSub?: 'yes' | 'no'; +export interface SpotTickerV2 { + symbol: string; + high24h: string; + open: string; + low24h: string; + lastPr: string; + quoteVolume: string; + baseVolume: string; + usdtVolume: string; + bidPr: string; + askPr: string; + bidSz: string; + askSz: string; + openUtc: string; + ts: string; + changeUtc24h: string; + change24h: string; } ⋮---- -export interface AgentCustomerDepositRequestV2 { - startTime?: string; - endTime?: string; - pageNo?: string; - pageSize?: string; - uid?: string; - showSub?: 'yes' | 'no'; +export interface SpotCallAuctionV2 { + stage: string; + stageEndTime: string; + estOpeningPrice: string | null; + matchedVolume: string | null; + auctionEndTime: string; } ⋮---- -export interface AgentCustomerAssetRequestV2 { - pageNo?: string; - pageSize?: string; - uid?: string; - showSub?: 'yes' | 'no'; +export interface SpotMergeDepthV2 { + asks: [string, string][]; + bids: [string, string][]; + ts: string; + scale: string; + precision: string; + isMaxPrecision: string; } ⋮---- -export interface GetAgentCommissionDetailRequestV2 { - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: string; +export interface SpotOrderBookDepthV2 { + asks: [string, string][]; + bids: [string, string][]; + ts: string; } - -================ -File: src/types/request/v2/futures.ts -================ -import { FuturesPlanTypeV2, FuturesProductTypeV2 } from '../shared.js'; ⋮---- -export type FuturesKlineInterval = - | '1m' - | '3m' - | '5m' - | '15m' - | '30m' - | '1H' - | '2H' - | '4H' - | '6H' - | '12H' - | '1D' - | '3D' - | '1W' - | '1M' - | '6Hutc' - | '12Hutc' - | '1Dutc' - | '3Dutc' - | '1Wutc' - | '1Mutc'; +export type SpotCandlestickV2 = [ + string, // timestamp + string, // open + string, // high + string, // low + string, // close + string, // baseVolume + string, // usdtVolume + string, // quoteVolume +]; ⋮---- -export type FuturesKlineTypeV2 = 'MARKET' | 'MARK' | 'INDEX'; +string, // timestamp +string, // open +string, // high +string, // low +string, // close +string, // baseVolume +string, // usdtVolume +string, // quoteVolume ⋮---- -export interface FuturesAccountBillRequestV2 { - productType: FuturesProductTypeV2; - symbol?: string; - coin?: string; - businessType?: string; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; +export interface SpotTradeV2 { + symbol: string; + tradeId: string; + side: string; + price: string; + size: string; + ts: string; } ⋮---- /** * - * * Futures | Market + * * Spot | Trade * */ ⋮---- -export interface FuturesMergeDepthRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - precision?: 'scale0' | 'scale1' | 'scale2' | 'scale3'; - limit?: '1' | '5' | '15' | '50' | 'max'; +export interface CancelAndSubmitSpotOrderResponseV2 { + orderId: string; + clientOid: string | null; + success: string; + msg: string | null; } ⋮---- -export interface FuturesRecentTradesRequestV2 { +export interface SubmitSpotBatchOrdersResponseV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + errorCode?: string; + }[]; +} +⋮---- +export interface SpotOrderInfoV2 { + userId: string; symbol: string; - productType: FuturesProductTypeV2; - limit?: string; + orderId: string; + clientOid: string; + price: string; + size: string; + orderType: string; + side: string; + status: string; + priceAvg: string; + baseVolume: string; + quoteVolume: string; + enterPointSource: string; + feeDetail: { + BGB?: { + deduction: boolean; + feeCoinCode: string; + totalDeductionFee: string; + totalFee: string; + }; + newFees?: { + c: number; + d: number; + deduction: boolean; + r: string; + t: string; + totalDeductionFee: number; + }; + }; + orderSource: string; + cancelReason: string; + cTime: string; + uTime: string; } ⋮---- -export interface FuturesHistoricTradesRequestV2 { +export interface SpotOpenOrderV2 { + userId: string; symbol: string; - productType: FuturesProductTypeV2; - limit?: string; - idLessThan?: string; - startTime?: string; - endTime?: string; + orderId: string; + clientOid: string; + priceAvg: string; + size: string; + orderType: string; + side: string; + status: string; + basePrice: string; + baseVolume: string; + quoteVolume: string; + enterPointSource: string; + orderSource?: string; + presetTakeProfitPrice: string; + executeTakeProfitPrice: string; + presetStopLossPrice: string; + executeStopLossPrice: string; + cTime: string; + uTime?: string; + tpslType: string; + triggerPrice: string | null; } ⋮---- -export interface FuturesCandlesRequestV2 { +export interface SpotFillV2 { + userId: string; symbol: string; - productType: FuturesProductTypeV2; - granularity: FuturesKlineInterval; - startTime?: string; - endTime?: string; - kLineType?: FuturesKlineTypeV2; - limit?: string; + orderId: string; + tradeId: string; + orderType: string; + side: string; + priceAvg: string; + size: string; + amount: string; + feeDetail: { + deduction: string; + feeCoin: string; + totalDeductionFee: string; + totalFee: string; + }; + tradeScope: string; + cTime: string; + uTime: string; } ⋮---- /** * - * * Futures | Account + * * Spot | Trigger Orders * */ ⋮---- -export interface FuturesSingleAccountRequestV2 { +export interface SpotCurrentPlanOrderV2 { + orderId: string; + clientOid: string; symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; + size: string; + executePrice: string; + triggerPrice: string; + status: string; + orderType: string; + side: string; + planType: string; + triggerType: string; + enterPointSource: string; + uTime: string; + cTime: string; } ⋮---- -export interface FuturesInterestHistoryRequestV2 { - productType: 'USDT-FUTURES' | 'SUSDT-FUTURES'; - coin?: string; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; -} -⋮---- -export interface FuturesOpenCountRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - openAmount: string; - openPrice: string; - leverage?: string; -} -⋮---- -export interface FuturesSetAutoMarginRequestV2 { - symbol: string; - autoMargin: 'on' | 'off'; - marginCoin: string; - amount: string; - holdSide?: 'long' | 'short'; -} -⋮---- -export interface FuturesSetLeverageRequestV2 { +export interface SpotHistoryPlanOrderV2 { + orderId: string; + clientOid: string; symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - leverage: string; - holdSide?: 'long' | 'short'; + size: string; + executePrice: string; + triggerPrice: string; + status: string; + orderType: string; + side: string; + planType: string; + triggerType: string; + enterPointSource: string; + uTime: string; + cTime: string; } ⋮---- -export interface FuturesSetPositionMarginRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - holdSide: 'long' | 'short'; - amount: string; +export interface SpotPlanSubOrderV2 { + orderId: string; + price: string; + type: string; + status: string; } ⋮---- -export interface FuturesSetMarginModeRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - marginMode: 'isolated' | 'crossed'; +export interface SpotCancelPlanOrdersV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + }[]; } ⋮---- /** * - * * Futures | Position + * * Spot | Account * */ ⋮---- -export interface FuturesHistoricalPositionsRequestV2 { - symbol?: string; - productType?: FuturesProductTypeV2; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; +export interface SpotAccountInfoV2 { + userId: string; + inviterId: string; + ips: string; + authorities: string[]; + parentId: number; + traderType: string; + channelCode: string; + channel: string; + regisTime: string; } ⋮---- -/** - * - * * Futures | Trade - * - */ +export interface SpotAccountAssetV2 { + coin: string; + available: string; + frozen: string; + locked: string; + limitAvailable: string; + uTime: string; +} ⋮---- -export interface FuturesPlaceOrderRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginMode: 'isolated' | 'crossed'; - marginCoin: string; - size: string; - price?: string; - side: 'buy' | 'sell'; - tradeSide?: 'open' | 'close'; - orderType: 'limit' | 'market'; - force?: 'ioc' | 'fok' | 'gtc' | 'post_only'; - clientOid?: string; - reduceOnly?: 'YES' | 'NO'; - presetStopSurplusPrice?: string; - presetStopLossPrice?: string; - stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; +export interface SpotSubAccountAssetV2 { + coin: string; + available: string; + limitAvailable: string; + frozen: string; + locked: string; + uTime: string; +} +export interface SpotSubAccountAssetsV2 { + userId: number; + assetsList: SpotSubAccountAssetV2[]; } ⋮---- -export interface FuturesReversalOrderRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; +export interface SpotAccountBillV2 { + cTime: string; + coin: string; + groupType: string; + businessType: string; size: string; - side?: 'buy' | 'sell'; - tradeSide?: 'open' | 'close'; - clientOid?: string; + balance: string; + fees: string; + billId: string; } ⋮---- -interface FuturesBatchOrderItem { +export interface SpotMainSubTransferRecordV2 { + coin: string; + status: string; + toType: string; + fromType: string; size: string; - price?: string; - side: 'buy' | 'sell'; - tradeSide?: 'open' | 'close'; - orderType: 'limit' | 'market'; - force?: 'ioc' | 'fok' | 'gtc' | 'post_only'; - clientOid?: string; - reduceOnly?: 'YES' | 'NO'; - presetStopSurplusPrice?: string; - presetStopLossPrice?: string; - stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; + ts: string; + clientOid: string; + transferId: string; + fromUserId: string; + toUserId: string; } ⋮---- -export interface FuturesBatchOrderRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - marginMode: 'isolated' | 'crossed'; - orderList: FuturesBatchOrderItem[]; +export interface SpotTransferRecordV2 { + coin: string; + status: string; + toType: string; + toSymbol: string; + fromType: string; + fromSymbol: string; + size: string; + ts: string; + clientOid: string; + transferId: string; } ⋮---- -export interface FuturesModifyOrderRequestV2 { - orderId?: string; - clientOid?: string; - symbol: string; - productType: FuturesProductTypeV2; - newClientOid: string; - newSize?: string; - newPrice?: string; - newPresetStopSurplusPrice?: string; - newPresetStopLossPrice?: string; +export interface SpotDepositAddressV2 { + address: string; + chain: string; + coin: string; + tag: string; + url: string; } ⋮---- -export interface FuturesCancelOrderRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin?: string; - orderId?: string; +export interface SpotSubAccountDepositRecordV2 { + orderId: string; + tradeId: string; + coin: string; + size: string; + status: string; + toAddress: string; + dest: string; + chain: string; + fromAddress: string; clientOid?: string; + confirm?: string; + tag?: string; + cTime: string; + uTime: string; } ⋮---- -interface FuturesBatchCancelOrderItem { - orderId?: string; - clientOid?: string; +export interface SpotWithdrawalRecordV2 { + orderId: string; + tradeId: string; + coin: string; + dest: string; + clientOid: string; + type: string; + tag: string; + size: string; + fee: string; + status: string; + toAddress: string; + fromAddress: string; + confirm: string; + chain: string; + cTime: string; + uTime: string; } ⋮---- -export interface FuturesBatchCancelOrderRequestV2 { - orderIdList?: FuturesBatchCancelOrderItem[]; - symbol?: string; - productType: FuturesProductTypeV2; - marginCoin?: string; +export interface SpotDepositRecordV2 { + orderId: string; + tradeId: string; + coin: string; + type: string; + size: string; + status: string; + toAddress: string; + dest: string; + chain: string; + fromAddress: string; + cTime: string; + uTime: string; } -⋮---- -export interface FuturesFlashClosePositionsRequestV2 { - symbol?: string; - productType: FuturesProductTypeV2; - holdSide?: 'long' | 'short'; + +================ +File: src/types/response/v3/broker.ts +================ +export interface CreateBrokerSubAccountResponseV3 { + subUid: string; + subaccountName: string; + subaccountEmail: string; + status: 'normal' | 'freeze'; + permList: string[]; + label: string; + cTime: string; } ⋮---- -export interface FuturesGetOrderRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - orderId?: string; - clientOid?: string; +export interface BrokerSubAccountV3 { + subUid: string; + subaccountName: string; + subaccountEmail: string | null; + status: 'normal' | 'freeze'; + permList: string[]; + label: string; + language: string; + cTime: string; + uTime: string; } ⋮---- -export interface FuturesGetOrderFillsRequestV2 { - orderId?: string; - symbol?: string; - productType: FuturesProductTypeV2; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; +export interface GetBrokerSubAccountListResponseV3 { + subList: BrokerSubAccountV3[]; } ⋮---- -export interface FuturesGetHistoricalFillsRequestV2 { - orderId?: string; - symbol?: string; - productType: FuturesProductTypeV2; - startTime?: string; - endTime?: string; - idLessThan?: string; - limit?: string; +export interface ModifyBrokerSubAccountResponseV3 { + subUid: string; + subaccountName: string; + status: 'normal' | 'freeze'; + permList: string[]; + label: string; + cTime: string; + uTime: string; } ⋮---- -export interface FuturesGetOpenOrdersRequestV2 { - orderId?: string; - clientOid?: string; - symbol?: string; - productType: FuturesProductTypeV2; - status?: 'live' | 'partially_filled'; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; +export interface BrokerSubWithdrawalResponseV3 { + orderId: string; + clientOid: string; } ⋮---- -export type FuturesOrderSourceV2 = - | 'normal' - | 'market' - | 'profit_market' - | 'loss_market' - | 'Trader_delegate' - | 'trader_profit' - | 'trader_loss' - | 'reverse' - | 'trader_reverse' - | 'profit_limit' - | 'loss_limit' - | 'liquidation' - | 'delivery_close_long' - | 'delivery_close_short' - | 'pos_profit_limit' - | 'pos_profit_market' - | 'pos_loss_limit' - | 'pos_loss_market'; +export interface BrokerSubDepositAddressV3 { + subUid: string; + coin: string; + address: string; + chain: string; + tag: string | null; + url: string; + cTime: string; +} ⋮---- -export interface FuturesGetHistoryOrdersRequestV2 { - orderId?: string; - clientOid?: string; - symbol?: string; - productType: FuturesProductTypeV2; - idLessThan?: string; - orderSource?: FuturesOrderSourceV2; - startTime?: string; - endTime?: string; - limit?: string; +export interface BrokerSubDepositWithdrawalRecordV3 { + uid: string; + txId: string; + type: 'deposit' | 'withdrawal'; + subType: 'onchain' | 'internal' | 'fast'; + coin: string; + amount: string; + status: 'pending' | 'fail' | 'success'; + ts: string; } ⋮---- -export interface FuturesCancelAllOrdersRequestV2 { - symbol?: string; - productType: FuturesProductTypeV2; - marginCoin?: string; - requestTime?: string; - receiveWindow?: string; +export interface GetBrokerAllSubDepositWithdrawalResponseV3 { + list: BrokerSubDepositWithdrawalRecordV3[]; + endId: string; +} +⋮---- +export interface BrokerCommissionRecordV3 { + uid: string; + coin: string; + symbol: string; + dealtAmount: string; + totalFee: string; + deductedFee: string; + paidFee: string; + markUpFee: string; + totalCommission: string; +} +⋮---- +export interface CreateBrokerSubApiKeyResponseV3 { + subUid: string; + label: string; + apiKey: string; + secretKey: string; + permType: 'read_write' | 'read_only'; + permList: string[]; + ipList: string[] | null; +} +⋮---- +export interface ModifyBrokerSubApiKeyResponseV3 { + subUid: string; + label: string; + apiKey: string; + permType: 'read_write' | 'read_only'; + permList: string[]; + ipList: string[]; } ⋮---- +export interface GetBrokerSubApiKeyResponseV3 { + subUid: string; + label: string; + apiKey: string; + secretKey: string; + permType: 'read_write' | 'read_only'; + permList: string[]; + ipList: string[] | null; +} + +================ +File: src/types/response/v3/copytrading.ts +================ /** * - * * Futures | Trigger Orders + * + * Copy Trading | Futures (UTA) + * * */ ⋮---- -export type FuturesTriggerTypeV2 = 'fill_price' | 'mark_price'; -⋮---- -export type FuturesStpModeV2 = - | 'none' - | 'cancel_taker' - | 'cancel_maker' - | 'cancel_both'; -⋮---- -export interface FuturesTPSLOrderRequestV2 { +export interface CopyFuturesMarginDetailV3 { marginCoin: string; - productType: FuturesProductTypeV2; - symbol: string; - planType: FuturesPlanTypeV2; - triggerPrice: string; - triggerType?: FuturesTriggerTypeV2; - executePrice?: string; - holdSide: 'long' | 'short' | 'buy' | 'sell'; - size: string; - rangeRate?: string; - clientOid?: string; - stpMode?: FuturesStpModeV2; + maxLongCount: string; + remainingLongCount: string; + maxShortCount: string; + remainingShortCount: string; } ⋮---- -export type FuturesTriggerPriceTypeV2 = - | 'fill_price' - | 'mark_price' - | 'index_price'; -⋮---- -export interface FuturesPlanOrderRequestV2 { - planType: 'normal_plan' | 'track_plan'; +export interface CopyFuturesTradingPairV3 { symbol: string; - productType: FuturesProductTypeV2; - marginMode: 'isolated' | 'crossed'; - marginCoin: string; - size: string; - price?: string; - callbackRatio?: string; - triggerPrice: string; - triggerType: 'mark_price' | 'fill_price'; - side: 'buy' | 'sell'; - tradeSide?: 'open' | 'close'; - orderType: 'limit' | 'market'; - clientOid?: string; - reduceOnly?: 'YES' | 'NO'; - stopSurplusTriggerPrice?: string; - stopSurplusExecutePrice?: string; - stopSurplusTriggerType?: FuturesTriggerPriceTypeV2; - stopLossTriggerPrice?: string; - stopLossExecutePrice?: string; - stopLossTriggerType?: FuturesTriggerPriceTypeV2; - stpMode?: FuturesStpModeV2; + leverage: string; + marginDetails: CopyFuturesMarginDetailV3[]; } ⋮---- -export interface FuturesModifyTPSLOrderRequestV2 { - orderId?: string; - clientOid?: string; - marginCoin: string; - productType: FuturesProductTypeV2; +export interface CopyFuturesPositionSummaryV3 { + unrealizedPnl: string; + realizedPnl: string; + holdSize: string; + avgPrice: string; symbol: string; - triggerPrice: string; - triggerType?: 'fill_price' | 'mark_price'; - executePrice?: string; - size: string; - rangeRate?: string; + leverage: string; + marginMode: string; + liqPrice: string; + margin: string; + holdSide: string; + roi: string; + markPrice: string; + positionValue: string; } ⋮---- -export interface FuturesModifyPlanOrderRequestV2 { - planType: 'normal_plan' | 'track_plan'; - orderId?: string; - clientOid?: string; - symbol: string; - productType: FuturesProductTypeV2; - newSize?: string; - newPrice?: string; - newCallbackRatio?: string; - newTriggerPrice?: string; - newTriggerType?: 'fill_price' | 'mark_price'; - newStopSurplusTriggerPrice?: string; - newStopSurplusExecutePrice?: string; - newStopSurplusTriggerType?: FuturesTriggerPriceTypeV2; - newStopLossTriggerPrice?: string; - newStopLossExecutePrice?: string; - newStopLossTriggerType?: FuturesTriggerPriceTypeV2; -} -⋮---- -export interface FuturesGetPlanOrdersRequestV2 { - orderId?: string; - clientOid?: string; - symbol?: string; - planType: 'normal_plan' | 'track_plan' | 'profit_loss'; - productType: FuturesProductTypeV2; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; +export interface CopyFuturesMaxTransferableV3 { + maxTransferable: string; + available: string; } ⋮---- -interface FuturesCancelPlanOrderItemV2 { - orderId?: string; - clientOid?: string; +export interface CopyFuturesTransferResponseV3 { + transferId: string; } ⋮---- -export type FuturesPlanOrderTypeV2 = - | 'normal_plan' - | 'profit_plan' - | 'loss_plan' - | 'pos_profit' - | 'pos_loss' - | 'moving_plan'; +/** May be a single value or comma-separated values */ +export type CopyFuturesTransferAccountTypeV3 = + | 'spot' + | 'uta' + | 'lead' + | 'otc' + | string; ⋮---- -export interface FuturesCancelPlanOrderRequestV2 { - orderIdList?: FuturesCancelPlanOrderItemV2[]; - symbol?: string; - productType: FuturesProductTypeV2; - marginCoin?: string; - planType?: FuturesPlanOrderTypeV2; +export interface CopyFuturesTransferRecordV3 { + transferId: string; + fromType: CopyFuturesTransferAccountTypeV3; + toType: CopyFuturesTransferAccountTypeV3; + amount: string; + coin: string; + status: 'Successful' | 'Failed' | 'Processing'; + createdTime: string; } ⋮---- -export type FuturesPlanStatusV2 = 'executed' | 'fail_trigger' | 'cancelled'; -⋮---- -export interface FuturesGetHistoryPlanOrdersRequestV2 { - orderId?: string; - clientOid?: string; - planType: 'normal_plan' | 'track_plan' | 'profit_loss'; - planStatus?: FuturesPlanStatusV2; - symbol?: string; - productType: FuturesProductTypeV2; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; +export interface CopyFuturesTransferRecordListV3 { + list: CopyFuturesTransferRecordV3[]; } ⋮---- -/** - * - * * Futures | Union Margin - * - */ -⋮---- -export interface GetUnionTransferLimitsRequestV2 { - coin: string; +export interface CopyFuturesCurrentFollowerV3 { + followerName: string; + estimateAssets: string; + totalProfit: string; + totalShareProfit: string; + totalInvestment: string; + canRemove: 'yes' | 'no'; + followDays: string; + totalAssets: string; + startTime: string; } ⋮---- -export interface UnionConvertRequestV2 { - coin: string; - amount: string; +export interface CopyFuturesCurrentFollowersV3 { + list: CopyFuturesCurrentFollowerV3[]; } ⋮---- -/** - * - * * Futures | Account | Max Openable Quantity - * - */ -⋮---- -export interface FuturesMaxOpenRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - posSide: 'long' | 'short'; - orderType: 'limit' | 'market'; - openPrice?: string; +export interface CopyFuturesHistoryFollowerV3 { + followerName: string; + totalProfit: string; + totalShareProfit: string; + totalInvestment: string; + startTime: string; + endTime: string; } ⋮---- -/** - * - * * Futures | Account | Liquidation Price - * - */ +export interface CopyFuturesHistoryFollowersV3 { + list: CopyFuturesHistoryFollowerV3[]; +} ⋮---- -export interface FuturesLiquidationPriceRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - posSide: 'long' | 'short'; - orderType: 'limit' | 'market'; - openAmount: string; - openPrice?: string; +export interface CopyFuturesProfitSummaryV3 { + totalProfit: string; + totalAllocatedProfit: string; + totalPendingProfit: string; } ⋮---- -/** - * - * * Futures | Account | Isolated Symbols - * - */ +export interface CopyFuturesProfitDetailV3 { + followerName: string; + profit: string; + allocatedPnl: string; + pendingPnl: string; + shareRatio: string; + shareProfit: string; + reason: 'period' | 'unfollow' | string; + settleTime: string; +} ⋮---- -export interface FuturesIsolatedSymbolsRequestV2 { - productType: FuturesProductTypeV2; +export interface CopyFuturesProfitDetailsV3 { + list: CopyFuturesProfitDetailV3[]; + nextCursor: string; } ================ -File: src/types/request/v3/public.ts +File: src/types/response/v3/loan.ts ================ -export interface GetPublicFillsRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; - limit?: string; +export interface LoanTransfersV3 { + coin: string; + transfered: string; + userId: string; } ⋮---- -export interface GetCandlesRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +export interface LoanSymbolSettingV3 { symbol: string; - interval: - | '1m' - | '3m' - | '5m' - | '15m' - | '30m' - | '1H' - | '4H' - | '6H' - | '12H' - | '1D'; - startTime?: string; - endTime?: string; - type?: 'MARKET' | 'MARK' | 'INDEX'; - limit?: string; + leverage: string; } ⋮---- -export interface GetHistoryCandlesRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - interval: - | '1m' - | '3m' - | '5m' - | '15m' - | '30m' - | '1H' - | '4H' - | '6H' - | '12H' - | '1D'; - startTime?: string; - endTime?: string; - type?: 'MARKET' | 'MARK' | 'INDEX'; - limit?: string; +export interface LoanSymbolsV3 { + productId: string; + spotSymbols: string[]; + marginLeverage: string; + usdtContractLeverage: string; + coinContractLeverage: string; + usdcContractLeverage: string; + usdtContractSymbols: LoanSymbolSettingV3[]; + coinContractSymbols: LoanSymbolSettingV3[]; + usdcContractSymbols: LoanSymbolSettingV3[]; } ⋮---- -export interface GetContractsOiRequestV3 { - symbol?: string; - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +export interface RepaidHistoryItemV3 { + repayOrderId: string; + businessType: 'normal' | 'liquidation'; + repayType: 'all' | 'part'; + repaidTime: string; + coin: string; + repayAmount: string; + repayInterest: string; } ⋮---- -export interface GetCurrentFundingRateRequestV3 { - category?: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; +export interface LoanProductInfoV3 { + productId: string; + leverage: string; + supportUsdtContract: 'YES' | 'NO'; + supportCoinContract: 'YES' | 'NO'; + supportUsdcContract: 'YES' | 'NO'; + transferLine: string; + spotBuyLine: string; + usdtContractOpenLine: string; + coinContractOpenLine: string; + usdcContractOpenLine: string; + liquidationLine: string; + stopLiquidationLine: string; } ⋮---- -export interface GetLiquidationsRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - limit?: string; - cursor?: string; +export interface LoanOrderV3 { + orderId: string; + orderProductId: string; + uid: string; + loanTime: string; + loanCoin: string; + loanAmount: string; + unpaidAmount: string; + unpaidInterest: string; + repaidAmount: string; + repaidInterest: string; + reserve: string; + status: 'not_paid_off' | 'paid_off'; } ⋮---- -export interface GetHistoryFundingRateRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - cursor?: string; - limit?: string; +/** Tiered conversion rate item (when Tiered Discount Rate Model is enabled) */ +export interface ConvertRatioListItemV3 { + ladder: string; + convertRatio: string; } ⋮---- -export interface GetMarginLoansRequestV3 { +export interface CoinInfoV3 { coin: string; + convertRatio: string; + maxConvertValue: string; + /** Tiered conversion rate (when margin mode is Tiered Discount Rate Model) */ + convertRatioList?: ConvertRatioListItemV3[]; } ⋮---- -export interface GetOpenInterestRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; -} +/** Tiered conversion rate (when margin mode is Tiered Discount Rate Model) */ ⋮---- -export interface GetPositionTierRequestV3 { - category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - coin?: string; +export interface BindUidResponseV3 { + riskUnitId: string; + uid: string; + operate: 'bind' | 'unbind'; } ⋮---- -export interface GetRiskReserveRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - marginCoin?: string; +export interface UnpaidInfoV3 { + coin: string; + unpaidQty: string; + unpaidInterest: string; } ⋮---- -export interface GetRiskReserveAllRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +export interface BalanceInfoV3 { + coin: string; + price: string; + amount: string; + convertedUsdtAmount: string; } ⋮---- -export interface GetInstrumentsRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; +export interface LTVConvertResponseV3 { + ltv: string; + subAccountUids: string[]; + unpaidUsdtAmount: string; + usdtBalance: string; + unpaidInfo: UnpaidInfoV3[]; + balanceInfo: BalanceInfoV3[]; } ⋮---- -export interface GetMarketFeeGroupRequestV3 { - category: 'SPOT' | 'FUTURES'; - group?: 'DEFAULT' | 'GROUP_A' | 'GROUP_B' | 'GROUP_C'; +/* Unified Account Staking & Lending (Crypto Loans) - /api/v3/loan/* */ +⋮---- +export interface LoanCoinInfoV3 { + coin: string; + hourRateFlexible: string; + rateFlexible: string; + hourRate7D: string; + rate7D: string; + hourRate30D: string; + rate30D: string; + minBorrowAmount: string; + maxBorrowAmount: string; + minBorrowLimit: string; + maxBorrowLimit: string; } ⋮---- -export interface GetMarketScoreWeightsRequestV3 { - category?: 'SPOT' | 'FUTURES'; +export interface LoanPledgeInfoV3 { + coin: string; + initRate: string; + supRate: string; + forceRate: string; + minPledgeAmount: string; + maxPledgeAmount: string; } ⋮---- -export interface GetOrderBookRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - limit?: string; +export interface GetLoanCoinsResponseV3 { + loanInfos: LoanCoinInfoV3[]; + pledgeInfos: LoanPledgeInfoV3[]; } ⋮---- -export interface GetTickersRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; +export interface GetLoanInterestResponseV3 { + hourInterest: string; + loanAmount: string; } ⋮---- -export interface GetIndexComponentsRequestV3 { - symbol: string; +export interface LoanBorrowResponseV3 { + orderId: string; } ⋮---- -export interface GetRpiOrderBookRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - limit?: string; +export interface LoanBorrowOngoingItemV3 { + orderId: string; + loanCoin: string; + loanAmount: string; + interestAmount: string; + hourInterestRate: string; + pledgeCoin: string; + pledgeAmount: string; + pledgeRate: string; + supRate: string; + forceRate: string; + borrowTime: string; + expireTime: string; } ⋮---- -export interface GetCashDividendRecordsRequestV3 { - symbol: string; - type: 'pending' | 'paid'; - cursor?: string; - limit?: string; +export interface LoanBorrowHistoryItemV3 { + orderId: string; + loanCoin: string; + pledgeCoin: string; + initPledgeAmount: string; + initLoanAmount: string; + hourRate: string; + daily: string; + borrowTime: string; + status: string; } ⋮---- -export interface GetSpotWhaleFlowRequestV3 { - symbol: string; +export interface LoanRepayResponseV3 { + loanCoin: string; + pledgeCoin: string; + repayAmount: string; + payInterest: string; + repayLoanAmount: string; + repayUnlockAmount: string; } ⋮---- -export interface GetSpotFundFlowRequestV3 { - symbol: string; - period?: string; +export interface LoanRepayHistoryItemV3 { + orderId: string; + loanCoin: string; + pledgeCoin: string; + repayAmount: string; + payInterest: string; + repayLoanAmount: string; + repayUnlockAmount: string; + repayTime: string; } ⋮---- -export interface GetSpotNetFlowRequestV3 { - symbol: string; +export interface LoanRevisePledgeResponseV3 { + loanCoin: string; + pledgeCoin: string; + afterPledgeRate: string; } ⋮---- -export interface GetMarginLongShortRequestV3 { - symbol: string; - period?: '24h' | '30d'; - coin?: string; +export interface LoanPledgeRateHistoryItemV3 { + loanCoin: string; + pledgeCoin: string; + orderId: string; + reviseTime: string; + reviseSide: string; + reviseAmount: string; + afterPledgeRate: string; + beforePledgeRate: string; } ⋮---- -export interface GetMarginLoanGrowthRequestV3 { - symbol: string; - period?: string; - coin?: string; +export interface LoanDebtInfoV3 { + coin: string; + amount: string; + amountUsdt: string; } ⋮---- -export interface GetMarginIsolatedBorrowRequestV3 { - symbol: string; - period?: string; +export interface GetLoanDebtsResponseV3 { + pledgeInfos: LoanDebtInfoV3[]; + loanInfos: LoanDebtInfoV3[]; } ⋮---- -export interface GetFuturesTradingDataRequestV3 { - symbol: string; - period?: string; +export interface LoanReduceItemV3 { + orderId: string; + loanCoin: string; + pledgeCoin: string; + reduceTime: string; + pledgeRate: string; + pledgePrice: string; + status: string; + pledgeAmount: string; + reduceFee: string; + residueAmount: string; + runlockAmount: string; + repayLoanAmount: string; } ================ -File: src/types/response/v2/broker.ts +File: src/websocket-client-v3.ts ================ +import { + WsAPIOperationResponseMap, + WSAPIRequestBitgetV3, + WSAPIRequestFlags, + WsAPITopicRequestParamMap, + WsAPIWsKeyTopicMap, + WSOperation, + WSOperationLoginParams, + WsRequestOperationBitget, +} from './types/websockets/ws-api.js'; +import { MessageEventLike } from './types/websockets/ws-events.js'; +import { + BitgetInstTypeV3, + WsKey, + WsTopicV3, +} from './types/websockets/ws-general.js'; +import { + BaseWebsocketClient, + EmittableEvent, + MidflightWsRequestEvent, +} from './util/BaseWSClient.js'; +import { isWsPong } from './util/requestUtils.js'; +import { isWSAPIResponse } from './util/type-guards.js'; +import { SignAlgorithm, signMessage } from './util/webCryptoAPI.js'; +import { + getMaxTopicsPerSubscribeEvent, + getNormalisedTopicRequests, + getPromiseRefForWSAPIRequest, + getWsUrl, + WS_AUTH_ON_CONNECT_KEYS, + WS_KEY_MAP, + WS_LOGGER_CATEGORY, + WsTopicRequest, +} from './util/websocket-util.js'; +import { WSConnectedResult } from './util/WsStore.types.js'; +⋮---- /** + * WebSocket client dedicated to the unified account (V3) WebSockets. * - * * Broker | Subaccount - * + * Your Bitget account needs to be upgraded to unified account mode, to use the account-level WebSocket topics. */ +export class WebsocketClientV3 extends BaseWebsocketClient< ⋮---- -export interface CreateSubaccountResponseV2 { - subUid: string; - subaccountName: string; - status: string; - permList: string[]; - label: string; - cTime: string; -} +WsRequestOperationBitget // subscribe requests have an "args" parameter with an object within ⋮---- -export interface BrokerSubaccountV2 { - subUid: string; - subaccountName: string; - status: string; - permList: string[]; - label: string; - language: string; - cTime: string; - uTime: string; -} +/** + * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library + */ +public connectAll(): Promise[] ⋮---- -export interface ModifySubaccountResponseV2 { - subUid: string; - subaccountName: string; - status: string; - permList: string[]; - label: string; - language: string; - cTime: string; - uTime: string; -} -⋮---- -export interface SubaccountEmailV2 { - subUid: string; - subaccountName: string; - subaccountEmail: string; - cTime: string; - uTime: string; -} +/** + * 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 ⋮---- -export interface BrokerSubaccountSpotAssetV2 { - coin: string; - available: string; - frozen: string; - locked: string; - uTime: string; -} +/** This call automatically ensures the connection is active AND authenticated before resolving */ ⋮---- -export interface BrokerSubaccountFutureAssetV2 { - marginCoin: string; - available: string; - frozen: string; - locked: string; - crossedMaxAvailable: string; - isolatedMaxAvailable: string; - maxTransferOut: string; - accountEquity: string; - usdtEquity: string; - btcEquity: string; - uTime: string; -} +/** + * 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: CategoryV5}. + * + * - 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 | WsTopicV3) + | (WsTopicRequest | WsTopicV3)[], + wsKey: WsKey, +): Promise ⋮---- -export interface CreateSubaccountDepositAddressV2 { - subUid: string; - coin: string; - address: string; - chain: string; - tag: string; - url: string; - cTime: string; -} +/** + * 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 | WsTopicV3) + | (WsTopicRequest | WsTopicV3)[], + wsKey: WsKey, +) ⋮---- -export interface SubaccountDepositV2 { - orderId: string; - txId: string; - coin: string; - type: string; - dest: string; - amount: string; - status: string; - fromAddress: string; - toAddress: string; - fee: string; - chain: string; - confirm: string; - tag: string; - cTime: string; - uTime: string; -} +/** + * + * + * Internal methods required to integrate with the BaseWSClient + * + * + */ ⋮---- -export interface BrokerSubaccountWithdrawalV2 { - orderId: string; - txId: string; - coin: string; - type: string; - dest: string; - amount: string; - status: string; - fromAddress: string; - toAddress: string; - fee: string; - chain: string; - confirm: string; - tag: string; - userId: string; - cTime: string; - uTime: string; -} +protected sendPingEvent(wsKey: WsKey): void ⋮---- -/** - * - * Broker | Api Key - * - */ +protected sendPongEvent(wsKey: WsKey): void ⋮---- -export interface CreateSubaccountApiKeyResponseV2 { - subUid: string; - apiKey: string; - secretKey: string; - label: string; - ipList: string[]; - permType: string; - permList: string[]; -} +protected isWsPing(data: any): boolean ⋮---- -export interface SubaccountApiKeyV2 { - subUid: string; - label: string; - apiKey: string; - secretKey: string; - permType: string; - permList: string[]; - ipList: string[]; -} +protected isWsPong(data: any): boolean ⋮---- -export interface ModifySubaccountApiKeyResponseV2 { - subUid: string; - apiKey: string; - label: string; - ipList: string[]; - permType: string; - permList: string[]; -} +protected isPrivateTopicRequest( + _request: WsTopicRequest, + wsKey: WsKey, +): boolean ⋮---- -/** - * - * * Broker | All Sub-accounts Deposit and Withdrawal Records - * - */ +protected getPrivateWSKeys(): WsKey[] ⋮---- -export interface AllSubDepositWithdrawalRecordV2 { - uid: string; - txId: string; - type: 'deposit' | 'withdrawal'; - subType: 'onchain' | 'internal' | 'fast'; - coin: string; - amount: string; - status: 'pending' | 'fail' | 'success'; - ts: string; -} +protected isAuthOnConnectWsKey(wsKey: WsKey): boolean ⋮---- -/** - * - * * Broker | Subaccounts - * - */ +protected async getWsUrl(wsKey: WsKey): Promise ⋮---- -export interface BrokerSubaccountInfoV2 { - uid: string; - asset: string; - firstTimeDeposit: string; - firstTimeTrade: string; - registerTime: string; -} +protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null ⋮---- /** - * - * * Broker | Commissions - * - */ + * @returns one or more correctly structured request events for performing a operations over WS. This can vary per exchange spec. + */ +protected async getWsRequestEvents( + operation: WSOperation, + requests: WsTopicRequest[], +): Promise>[]> ⋮---- -export interface BrokerCommissionV2 { - uid: string; - coin: string; - symbol: string; - dealtAmount: string; - totalFee: string; - deductedFee: string; - paidFee: string; - markUpFee: string; - totalCommission: string; -} +// Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values ⋮---- /** - * - * * Broker | Trade Volume - * - */ + { + "op":"subscribe", + "args":[ + { + "instType":"spot", + "topic":"ticker", + "symbol":"BTCUSDT" + }, + { + "instType":"spot", + "topic":"candle5m", + "symbol":"BTCUSDT" + } + ] + } + */ ⋮---- -export interface BrokerTradeVolumeV2 { - uid: string; - volume: string; - spotVolume: string; - futureVolume: string; -} +// const request = { +// topic: 'ticker', +// payload: { instType: 'spot', symbol: 'BTCUSDT' }, +// }; +// becomes: +// const request = { +// topic: 'ticker', +// instType: 'spot', +// symbol: 'BTCUSDT', +// }; ⋮---- -/** - * - * * Broker | Total Commission - * - */ +private async getWsAuthSignature( + wsKey: WsKey, +): Promise< ⋮---- -export interface BrokerTotalCommissionV2 { - date: string; - totalTradingVolume: string; - totalActiveTraders: string; - totalCommission: string; - spot: { - spotTradingVolume: string; - spotTradingFee: string; - spotPureTradingFee: string; - spotCommission: string; - }; - futures: { - futuresTradingVolume: string; - futuresTradingFee: string; - futuresPureTradingFee: string; - futuresCommission: string; - }; -} +private async signMessage( + paramsStr: string, + secret: string, + method: 'hex' | 'base64', + algorithm: SignAlgorithm, +): Promise +⋮---- +protected async getWsAuthRequestEvent( + wsKey: WsKey, +): Promise> ⋮---- /** - * - * * Broker | Order Commission - * - */ + * Abstraction called to sort ws events into emittable event types (response to a request, data update, etc) + */ +protected resolveEmittableEvents( + wsKey: WsKey, + event: MessageEventLike, +): EmittableEvent[] ⋮---- -export interface BrokerOrderCommissionItemV2 { - fillId: string; - orderId: string; - ts: string; - clientOid: string; - bizType: 'spot' | 'futures'; - subBizType: - | 'spot_trade' - | 'spot_margin' - | 'usdt_futures' - | 'coin_futures' - | 'usdc_futures'; - symbol: string; - volume: string; - fee: string; - pureFee: string; - rebateAmount: string; -} +/** + * WS API response handling + */ ⋮---- -export interface BrokerOrderCommissionV2 { - commissionlist: BrokerOrderCommissionItemV2[]; - endId: string; -} +// const eg1 = { +// event: 'error', +// id: '1', +// code: '43012', +// msg: 'Insufficient balance', +// }; +⋮---- +// WS API Success ⋮---- /** - * - * * Broker | Rebate Info - * - */ + * V3 event handling for consumers - behaves the same as V2 + */ ⋮---- -export interface BrokerRebateInfoV2 { - affiliationType: 'affiliate' | 'official'; - userLevel: string; - clientSpotRebateRatio: string; - clientFuturesRebateRatio: string; -} +// v2 authentication event ⋮---- -/** - * - * * Broker | Agent (affiliate) customer APIs - * - */ +// messageType: typeof msg, +// messageString: JSON.stringify(msg), ⋮---- -export interface AgentCustomerCommissionItemV2 { - uid: string; - date: string; - coin: string; - symbol: string; - productType: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES' - | string; - dealAmount: string; - fee: string; - feeDeduction: string; - activityBonusDeduct: string; - spotCouponDeduct: string; - futuresCouponDeduct: string; - spotFeeDiscountDeduct: string; - negativeMakerFeeDeduct: string; - feePaid: string; - rebateAmount: string; - userTotalRebateAmount: string; - dayTotalRebateAmount: string; - totalRebateAmount: string; -} +// Service upgrade (30033): Bitget sends this ~60s before disconnect. Log and let automatic reconnect handle when connection drops. ⋮---- -export interface AgentCustomerCommissionsV2 { - endId: string; - commissionList: AgentCustomerCommissionItemV2[]; -} +// messageType: typeof msg, +// messageString: JSON.stringify(msg), ⋮---- -export interface AgentSubCustomerItemV2 { - uid: string; - registerTime: string; -} +// fallback emit anyway ⋮---- -export interface AgentSubCustomerListV2 { - list: AgentSubCustomerItemV2[]; - minId: string; -} +/** + * V3/UTA supports order placement via WebSockets. This is the WS API: + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel + * + * @returns a promise that resolves/rejects when a matching response arrives + */ +async sendWSAPIRequest< + TWSKey extends keyof WsAPIWsKeyTopicMap, + TWSOperation extends WsAPIWsKeyTopicMap[TWSKey], + TWSParams extends WsAPITopicRequestParamMap[TWSOperation], + TWSAPIResponse extends + WsAPIOperationResponseMap[TWSOperation] = WsAPIOperationResponseMap[TWSOperation], + >( + wsKey: WsKey, + operation: TWSOperation, + category: BitgetInstTypeV3, + params: TWSParams & { signRequest?: boolean }, + requestFlags?: WSAPIRequestFlags, +): Promise ⋮---- -export interface AgentCustomerTradeVolumeItemV2 { - uid: string; - /** API field name (Bitget spelling). */ - volumn: string; - spotVolume: string; - futuresVolume: string; - time: string; -} +// this.logger.trace('sendWSAPIRequest(): assertIsAuthenticated(${wsKey})...'); ⋮---- -/** API field name (Bitget spelling). */ +// this.logger.trace('sendWSAPIRequest(): assertIsAuthenticated(${wsKey}) ok'); ⋮---- -export interface AgentCustomerListItemV2 { - uid: string; - registerTime: string; -} +// Ensure "args" is always wrapped as array ⋮---- -export interface AgentCustomerKycItemV2 { - uid: string; - kycResult: 'passed' | 'not_passed' | string; -} +// Store deferred promise, resolved within the "resolveEmittableEvents" method while parsing incoming events ⋮---- -export interface AgentCustomerKycResultV2 { - userList: AgentCustomerKycItemV2[]; - endId: string; -} +// eslint-disable-next-line @typescript-eslint/no-explicit-any ⋮---- -export interface AgentCustomerDepositItemV2 { - orderId: string; - uid: string; - depositTime: string; - depositCoin: string; - depositAmount: string; -} +// Enrich returned promise with request context for easier debugging ⋮---- -export interface AgentCustomerAssetItemV2 { - balance: string; - uid: string; - uTime: string; - remark: string; -} +// throw e; ⋮---- -export interface AgentCommissionDetailItemV2 { - uid: string; - bizType: 'spot' | 'futures' | string; - subBizType: string; - symbol: string; - coin: string; - fee: string; - volume: string; - activityBonusDeduct: string; - spotCouponDeduct: string; - futuresCouponDeduct: string; - spotFeeDiscountDeduct: string; - negativeMakerFeeDeduct: string; - feePaid: string; - directCommission: string; - subCommission: string; - partnerCommission: string; - partnerActualCommission: string; - traderType: string; - apiType: string; - status: 'settled' | 'unsettled' | 'notIssued' | string; - startCalculationTime: string; - endCalculationTime: string; -} +// Send event ⋮---- -export interface AgentCommissionDetailV2 { - endId: string; - commissionList: AgentCommissionDetailItemV2[]; -} +// Return deferred promise, so caller can await this call ================ -File: src/types/response/v2/futures.ts +File: webpack/webpack.config.cjs ================ -/** - * - * * Futures | Market - * - */ -⋮---- -export interface FuturesVipFeeRateV2 { - level: string; - dealAmount: string; - assetAmount: string; - takerFeeRate: string; - makerFeeRate: string; - btcWithdrawAmount: string; - usdtWithdrawAmount: string; -} +function generateConfig(name) ⋮---- -export interface FuturesHistoryInterestRateV2 { - ts: string; - annualInterestRate: string; - dailyInterestRate: string; -} +// Add '.ts' and '.tsx' as resolvable extensions. ⋮---- -export interface FuturesInterestExchangeRateV2 { - tier: string; - minAmount: string; - maxAmount: string; - exchangeRate: string; -} +// Node.js core modules not available in browsers +// The REST client's https.Agent (for keepAlive) is Node.js-only and won't work in browsers ⋮---- -export interface FuturesDiscountRateV2 { - tier: string; - minAmount: string; - maxAmount: string; - discountRate: string; +// Code is already transpiled from TypeScript, no additional loaders needed + +================ +File: docs/BITGET_SDK_QUICKSTART_GUIDE.md +================ + +# Bitget API JavaScript Tutorial for Node.js and TypeScript + + +> [!TIP] +> This tutorial is available in a more readable format on our website: [Bitget JavaScript Tutorial](https://siebly.io/sdk/bitget/javascript/tutorial) + + +This guide shows how to connect to Bitget with our [`bitget-api`](https://www.npmjs.com/package/bitget-api) package - the Bitget Node.js, JavaScript, and TypeScript SDK by Siebly.io. You'll cover REST, WebSocket streams, the WebSocket API, and HTTP, HTTPS, and SOCKS proxy configuration. + +The SDK handles signing, routing, reconnects, and resubscribes so you don't have to. Below: install, public and private REST, live streams, demo trading, WebSocket API orders, V2/Classic where you still need it, and a few production notes. + +**Key links** + +- Bitget JavaScript SDK by Siebly: [`bitget-api`](https://www.npmjs.com/package/bitget-api) +- GitHub Repository: [`tiagosiebler/bitget-api`](https://github.com/tiagosiebler/bitget-api) +- SDK function-endpoint map: [Bitget JavaScript Endpoint Reference](./endpointFunctionList.md) +- SDK examples: [Bitget SDK examples](../examples) +- Bitget UTA docs: [Unified Trading Account](https://www.bitget.com/api-doc/uta/intro) +- Bitget UTA quick start: [Quick Start](https://www.bitget.com/api-doc/uta/guide) +- Bitget Classic REST quick start: [Classic REST API](https://www.bitget.com/api-doc/classic/quickStart/intro) +- Bitget Classic WebSocket quick start: [Classic WebSocket API](https://www.bitget.com/api-doc/classic/quickStart/websocket-intro) +- More Node.js, JavaScript & TypeScript SDKs for CryptoCurrency Exchange REST APIs & WebSockets: [Siebly JavaScript SDKs for Crypto APIs](https://siebly.io) + +--- + + +## Why use the SDK + +Bitget has several API surfaces, and they don't all work the same way: + +- V3/UTA REST APIs for current Unified Trading Account market data, account reads, transfers, positions, and order management. +- V3 public WebSocket streams for live market data. +- V3 private WebSocket streams for account, position, fill, and order updates. +- V3 WebSocket API commands for order placement and cancellation over a persistent WebSocket connection. +- V2/Classic REST and WebSocket APIs for accounts and workflows that have not moved to UTA. +- Demo trading endpoints and separate demo API keys for safer order testing. + +That adds up - auth, routing, WebSocket lifecycle, topic tracking, reconnects, typed request shapes. The SDK handles those parts. You focus on the work: pull market data, check balances, place orders, subscribe to updates, reconcile after reconnects. + +The main SDK surfaces are: + +| Use case | SDK surface | Common usage | +| ------------------------------ | -------------------- | -------------------------------------------------------------------------------------------------------- | +| Current REST API | `RestClientV3` | V3/UTA public market data, account reads, transfers, positions, orders, fills, and other endpoint groups | +| Current WebSocket streams | `WebsocketClientV3` | V3/UTA public market streams and private account streams | +| Current WebSocket API commands | `WebsocketAPIClient` | Promise-driven V3 order placement, batch placement, cancellation, and batch cancellation over WebSocket | +| Classic REST API | `RestClientV2` | V2/Classic public, private, and trading workflows | +| Classic WebSocket streams | `WebsocketClientV2` | V2/Classic public and private stream topics | + +For new UTA work, start with `RestClientV3`, `WebsocketClientV3`, and `WebsocketAPIClient`. Reach for `RestClientV2` and `WebsocketClientV2` only when the account or workflow is still on Bitget Classic. + +--- + + +## Installation & API Keys + +Install the SDK with npm: + +```bash +npm install bitget-api +``` + +Or use another npm-compatible package manager: + +```bash +pnpm install bitget-api +yarn add bitget-api +``` + +Public market data does not require API keys. Private REST API calls, private WebSocket streams, and WebSocket API order commands require three Bitget API credentials: + +| SDK option | Bitget credential | +| ----------- | ---------------------------------------------- | +| `apiKey` | API key | +| `apiSecret` | API secret | +| `apiPass` | API passphrase set when the API key is created | + +`apiPass` is the Bitget API passphrase, not the account login password. + +Use separate credentials for live and demo trading. Demo trading API calls need demo API keys plus `demoTrading: true` in the SDK options. + +Our private examples use environment variables for convenience - use whatever secret store fits your setup. + +When creating API keys, grant the minimum permissions you need. Dashboards usually only need read access. Trading needs read/write on orders. Withdrawal isn't required for anything here. Whitelist IPs if your server has fixed outbound addresses. + +--- + + +## Bitget concepts in this guide + +Bitget has a few naming differences across their API: + +| Surface | Product values shown in this guide | +| ------------------------------- | ---------------------------------------------------------------- | +| V3 REST `category` | `SPOT`, `MARGIN`, `USDT-FUTURES`, `USDC-FUTURES`, `COIN-FUTURES` | +| V3 public WebSocket `instType` | `spot`, `usdt-futures`, `usdc-futures`, `coin-futures` | +| V3 private WebSocket `instType` | `UTA` | +| V3 WebSocket API category | `spot`, `usdt-futures`, `usdc-futures`, `coin-futures` | +| V2 WebSocket `instType` | `SPOT`, `USDT-FUTURES`, `USDC-FUTURES`, `COIN-FUTURES` | + +REST, WebSocket streams, and the WebSocket API are separate integration flows: + +| Flow | SDK surface | Best for | What the SDK handles | +| ------------------------- | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | +| REST API | `RestClientV3` or `RestClientV2` | Request/response reads, writes, order reconciliation, broad endpoint coverage | Base URLs, timestamps, auth headers, signatures, response parsing | +| Public WebSocket streams | `WebsocketClientV3.subscribe` or `WebsocketClientV2.subscribeTopic` | Live market data such as tickers and order books | Connection routing, subscribe requests, heartbeats, reconnects, resubscribe | +| Private WebSocket streams | `WebsocketClientV3.subscribe` or `WebsocketClientV2.subscribeTopic` with credentials | Live account, order, fill, balance, and position updates | Authentication, private endpoint routing, reconnects, resubscribe | +| WebSocket API commands | `WebsocketAPIClient` | Awaitable order commands over a persistent V3 WebSocket connection | Connection setup, authentication, request IDs, promise resolution, response matching | + +Order option casing can differ by surface. V3 REST order requests use `reduceOnly: 'yes' | 'no'`. V3 WebSocket API and V2 futures request types use `reduceOnly: 'YES' | 'NO'`. When unsure, check the type definitions for the client you're using. + +--- + + +## Start building: first REST API calls + +Want the quickest path to something working? Start here. + +### 1. First public REST API request + +Public REST calls work without credentials. + + +```typescript +import { RestClientV3 } from 'bitget-api'; + +const client = new RestClientV3(); + +async function main() { + const serverTime = await client.getServerTime(); + const instruments = await client.getInstruments({ + category: 'SPOT', + symbol: 'BTCUSDT', + }); + const tickers = await client.getTickers({ + category: 'SPOT', + symbol: 'BTCUSDT', + }); + const orderBook = await client.getOrderBook({ + category: 'SPOT', + symbol: 'BTCUSDT', + limit: '5', + }); + const candles = await client.getCandles({ + category: 'SPOT', + symbol: 'BTCUSDT', + interval: '1m', + limit: '5', + }); + + console.log({ + serverTime: serverTime.data.serverTime, + instrument: instruments.data[0]?.symbol, + ticker: tickers.data[0], + bestBid: orderBook.data.b[0], + bestAsk: orderBook.data.a[0], + candles: candles.data, + }); } -⋮---- -export interface FuturesDiscountRatesV2 { - coin: string; - userLimit: string; - totalLimit: string; - discountRateList: FuturesDiscountRateV2[]; + +main().catch(console.error); +``` + +If that prints data, public REST is working. + +See also: [V3 public REST examples](../examples/V3%20-%20UTA/Rest) + +### 2. First private REST API request + +Private REST uses the same `RestClientV3` with credentials - the SDK signs requests for you. + + +```typescript +import { RestClientV3 } from 'bitget-api'; + +function readBitgetCredentials() { + const apiKey = process.env.BITGET_API_KEY; + const apiSecret = process.env.BITGET_API_SECRET; + const apiPass = process.env.BITGET_API_PASS; + + if (!apiKey || !apiSecret || !apiPass) { + throw new Error( + 'Set BITGET_API_KEY, BITGET_API_SECRET, and BITGET_API_PASS before running private examples.', + ); + } + + return { apiKey, apiSecret, apiPass }; } -⋮---- -export interface FuturesMergeDepthV2 { - asks: [number, number][]; - bids: [number, number][]; - ts: string; - scale: string; - precision: string; - isMaxPrecision: string; + +const client = new RestClientV3(readBitgetCredentials()); + +async function main() { + const balances = await client.getBalances(); + const settings = await client.getAccountSettings(); + + console.log({ + assetMode: settings.data.assetMode, + holdMode: settings.data.holdMode, + usdtEquity: balances.data.usdtEquity, + assets: balances.data.assets.slice(0, 5), + }); } -⋮---- -export interface FuturesTickerV2 { - symbol: string; - lastPr: string; - askPr: string; - bidPr: string; - bidSz: string; - askSz: string; - high24h: string; - low24h: string; - ts: string; - change24h: string; - baseVolume: string; - quoteVolume: string; - usdtVolume: string; - openUtc: string; - changeUtc24h: string; - indexPrice: string; - fundingRate: string; - holdingAmount: string; - deliveryStartTime: string; - deliveryTime: string; - deliveryStatus: string; - open24h: string; - markPrice: string; + +main().catch(console.error); +``` + +If you get balances back, auth is set up correctly. + +See also: [V3 private REST examples](../examples/V3%20-%20UTA/Rest) + +### 3. First public WebSocket stream + +`WebsocketClientV3` handles V3/UTA streams. Public ones don't need credentials. + + +```typescript +import { WebsocketClientV3, WS_KEY_MAP } from 'bitget-api'; + +const ws = new WebsocketClientV3({}); + +ws.on('open', (data) => { + console.log('connected', data.wsKey); +}); + +ws.on('response', (data) => { + console.log('response', JSON.stringify(data)); +}); + +ws.on('update', (data) => { + console.log('market update', JSON.stringify(data)); +}); + +ws.on('reconnect', ({ wsKey }) => { + console.log('reconnecting', wsKey); +}); + +ws.on('reconnected', (data) => { + console.log('reconnected', data?.wsKey); +}); + +ws.on('exception', console.error); + +ws.subscribe( + [ + { + topic: 'ticker', + payload: { + instType: 'spot', + symbol: 'BTCUSDT', + }, + }, + { + topic: 'books', + payload: { + instType: 'spot', + symbol: 'BTCUSDT', + }, + }, + ], + WS_KEY_MAP.v3Public, +); +``` + +The SDK keeps the connection up, reconnects on drops, and resubscribes automatically. + +See also: [V3 public WebSocket example](../examples/V3%20-%20UTA/Websocket/ws-public.ts) + +### 4. First private account WebSocket stream + +Private streams are where trading systems usually watch account and order changes instead of polling constantly. + + +```typescript +import { WebsocketClientV3, WS_KEY_MAP } from 'bitget-api'; + +function readBitgetCredentials() { + const apiKey = process.env.BITGET_API_KEY; + const apiSecret = process.env.BITGET_API_SECRET; + const apiPass = process.env.BITGET_API_PASS; + + if (!apiKey || !apiSecret || !apiPass) { + throw new Error( + 'Set BITGET_API_KEY, BITGET_API_SECRET, and BITGET_API_PASS before running private WebSocket examples.', + ); + } + + return { apiKey, apiSecret, apiPass }; } -⋮---- -export interface FuturesFillV2 { - tradeId: string; - price: string; - size: string; - side: string; - ts: string; - symbol: string; + +const ws = new WebsocketClientV3(readBitgetCredentials()); + +ws.on('authenticated', (data) => { + console.log('authenticated', data.wsKey); +}); + +ws.on('update', (data) => { + console.log('account update', JSON.stringify(data)); +}); + +ws.on('response', (data) => { + console.log('response', JSON.stringify(data)); +}); + +ws.on('reconnect', ({ wsKey }) => { + console.log('reconnecting', wsKey); +}); + +ws.on('reconnected', (data) => { + console.log('reconnected', data?.wsKey); + // After reconnect, use REST to reconcile balances, positions, open orders, or recent fills. +}); + +ws.on('exception', console.error); + +ws.subscribe( + [ + { topic: 'account', payload: { instType: 'UTA' } }, + { topic: 'position', payload: { instType: 'UTA' } }, + { topic: 'fill', payload: { instType: 'UTA' } }, + { topic: 'order', payload: { instType: 'UTA' } }, + ], + WS_KEY_MAP.v3Private, +); +``` + +For V3 private account streams, use `instType: 'UTA'`. + +See also: [V3 private WebSocket example](../examples/V3%20-%20UTA/Websocket/ws-private.ts) + +### 5. First REST API order in demo trading + +Test with demo keys before going live. Demo uses separate Bitget API keys. + +The snippet below sets `demoTrading: true` - leave it on while testing. A successful response means Bitget accepted the order, not that it filled. + + +```typescript +import { RestClientV3 } from 'bitget-api'; + +function readBitgetCredentials() { + const apiKey = process.env.BITGET_API_KEY; + const apiSecret = process.env.BITGET_API_SECRET; + const apiPass = process.env.BITGET_API_PASS; + + if (!apiKey || !apiSecret || !apiPass) { + throw new Error( + 'Set BITGET_API_KEY, BITGET_API_SECRET, and BITGET_API_PASS with demo API credentials before placing demo orders.', + ); + } + + return { apiKey, apiSecret, apiPass }; } -⋮---- -export type FuturesCandlestickV2 = [ - string, // timestamp - string, // open - string, // high - string, // low - string, // close - string, // baseVolume - string, // usdtVolume - string, // quoteVolume -]; -⋮---- -string, // timestamp -string, // open -string, // high -string, // low -string, // close -string, // baseVolume -string, // usdtVolume -string, // quoteVolume -⋮---- -export interface FuturesOpenInterestV2 { - symbol: string; - size: string; + +const credentials = readBitgetCredentials(); + +const client = new RestClientV3({ + apiKey: credentials.apiKey, + apiSecret: credentials.apiSecret, + apiPass: credentials.apiPass, + demoTrading: true, +}); + +async function main() { + const ticker = await client.getTickers({ + category: 'SPOT', + symbol: 'BTCUSDT', + }); + + const lastPrice = ticker.data[0]?.lastPrice; + + if (!lastPrice) { + throw new Error('No BTCUSDT ticker price returned.'); + } + + const orderRequest = { + category: 'SPOT', + symbol: 'BTCUSDT', + side: 'buy', + orderType: 'limit', + price: lastPrice, + qty: '0.001', + timeInForce: 'gtc', + clientOid: `demo-rest-${Date.now()}`, + } as const; + + const result = await client.submitNewOrder(orderRequest); + + console.log(result); } -⋮---- -export interface FuturesFundingTimeV2 { - symbol: string; - nextFundingTime: string; - ratePeriod: string; -} -⋮---- -export interface FuturesSymbolPriceV2 { - symbol: string; - price: string; - indexPrice: string; - markPrice: string; - ts: string; -} -⋮---- -export interface FuturesHistoricalFundingRateV2 { - symbol: string; - fundingRate: string; - fundingTime: string; -} -⋮---- -export interface FuturesContractConfigV2 { - symbol: string; - baseCoin: string; - quoteCoin: string; - buyLimitPriceRatio: string; - sellLimitPriceRatio: string; - feeRateUpRatio: string; - makerFeeRate: string; - takerFeeRate: string; - openCostUpRatio: string; - supportMarginCoins: string[]; - minTradeNum: string; - priceEndStep: string; - volumePlace: string; - pricePlace: string; - sizeMultiplier: string; - symbolType: string; - minTradeUSDT: string; - maxSymbolOrderNum: string; - maxProductOrderNum: string; - maxPositionNum: string; - symbolStatus: string; - offTime: string; - limitOpenTime: string; - deliveryTime: string; - deliveryStartTime: string; - launchTime: string; - fundInterval: string; - minLever: string; - maxLever: string; - posLimit: string; - maintainTime: string; - isRwa: string; -} -⋮---- -/** - * - * * Futures | Account - * - */ -⋮---- -export interface FuturesAccountV2 { - marginCoin: string; - locked: string; - available: string; - crossedMaxAvailable: string; - isolatedMaxAvailable: string; - maxTransferOut: string; - accountEquity: string; - usdtEquity: string; - btcEquity: string; - crossedRiskRate: string; - crossedMarginLeverage: string; - isolatedLongLever: string; - isolatedShortLever: string; - marginMode: string; - posMode: string; - unrealizedPL: string; - coupon: string; - crossedUnrealizedPL: string; - isolatedUnrealizedPL: string; - assetMode: string; + +main().catch(console.error); +``` + +Check order status via private streams or REST: `getOrderInfo`, `getUnfilledOrders`, `getHistoryOrders`, or `getTradeFills`. + +See also: [V3 spot trading example](../examples/V3%20-%20UTA/Rest/rest-trade-UTA-spot.ts) + +### 6. First WebSocket API order command + +The WebSocket API sends order commands over a persistent connection and waits for a response. `WebsocketAPIClient` wraps that in promises - write orders like normal `async` calls. + +This example uses `demoTrading: true` with demo API keys. + + +```typescript +import { WebsocketAPIClient } from 'bitget-api'; + +function readBitgetCredentials() { + const apiKey = process.env.BITGET_API_KEY; + const apiSecret = process.env.BITGET_API_SECRET; + const apiPass = process.env.BITGET_API_PASS; + + if (!apiKey || !apiSecret || !apiPass) { + throw new Error( + 'Set BITGET_API_KEY, BITGET_API_SECRET, and BITGET_API_PASS with demo API credentials before placing demo orders.', + ); + } + + return { apiKey, apiSecret, apiPass }; } -⋮---- -export interface FuturesAccountsV2 { - marginCoin: string; - locked: string; - available: string; - crossedMaxAvailable: string; - isolatedMaxAvailable: string; - maxTransferOut: string; - accountEquity: string; - usdtEquity: string; - btcEquity: string; - crossedRiskRate: string; - unrealizedPL: string; - coupon: string; - unionTotalMagin: string; - unionAvailable: string; - unionMm: string; - assetList: { - coin: string; - balance: string; - }[]; - isolatedMargin: string; - crossedMargin: string; - crossedUnrealizedPL: string; - isolatedUnrealizedPL: string; - assetMode: string; + +const credentials = readBitgetCredentials(); + +const wsApi = new WebsocketAPIClient({ + apiKey: credentials.apiKey, + apiSecret: credentials.apiSecret, + apiPass: credentials.apiPass, + demoTrading: true, +}); + +const ws = wsApi.getWSClient(); + +ws.on('open', (data) => console.log('ws open', data.wsKey)); +ws.on('authenticated', (data) => console.log('authenticated', data.wsKey)); +ws.on('exception', console.error); + +async function main() { + await ws.connectWSAPI(); + + const clientOid = `demo-wsapi-${Date.now()}`; + + const placed = await wsApi.submitNewOrder('spot', { + symbol: 'BTCUSDT', + side: 'buy', + orderType: 'limit', + price: '10000', + qty: '0.001', + timeInForce: 'gtc', + clientOid, + }); + + console.log('placed', placed); + + const cancelled = await wsApi.cancelOrder('spot', { + clientOid, + }); + + console.log('cancelled', cancelled); } -⋮---- -export interface FuturesSubAccountAssetV2 { - marginCoin: string; - locked: string; - available: string; - crossedMaxAvailable: string; - isolatedMaxAvailable: string; - maxTransferOut: string; - accountEquity: string; - usdtEquity: string; - btcEquity: string; - unrealizedPL: string; - coupon: string; + +main().catch(console.error); +``` + +`connectWSAPI()` is optional - call it before your first command if you want the connection warm and ready. + +See also: [V3 WebSocket API client example](../examples/V3%20-%20UTA/WS-API/ws-api-client-trade.ts) + +--- + + +## V3 REST API + +`RestClientV3` is the client for current Bitget UTA REST endpoints. + +### Create public and private clients + +Public client: + +```typescript +import { RestClientV3 } from 'bitget-api'; + +const publicClient = new RestClientV3(); +``` + +Private client: + +```typescript +import { RestClientV3 } from 'bitget-api'; + +const privateClient = new RestClientV3({ + apiKey: process.env.BITGET_API_KEY!, + apiSecret: process.env.BITGET_API_SECRET!, + apiPass: process.env.BITGET_API_PASS!, +}); +``` + +Demo trading client: + +```typescript +import { RestClientV3 } from 'bitget-api'; + +const demoClient = new RestClientV3({ + apiKey: process.env.BITGET_API_KEY!, + apiSecret: process.env.BITGET_API_SECRET!, + apiPass: process.env.BITGET_API_PASS!, + demoTrading: true, +}); +``` + +### Common public market data calls + +```typescript +import { RestClientV3 } from 'bitget-api'; + +const client = new RestClientV3(); + +async function main() { + const instruments = await client.getInstruments({ + category: 'SPOT', + symbol: 'BTCUSDT', + }); + + const tickers = await client.getTickers({ + category: 'USDT-FUTURES', + symbol: 'BTCUSDT', + }); + + const orderBook = await client.getOrderBook({ + category: 'SPOT', + symbol: 'BTCUSDT', + limit: '20', + }); + + const candles = await client.getCandles({ + category: 'SPOT', + symbol: 'BTCUSDT', + interval: '1m', + limit: '20', + }); + + const openInterest = await client.getOpenInterest({ + category: 'USDT-FUTURES', + symbol: 'BTCUSDT', + }); + + const fundingRate = await client.getCurrentFundingRate({ + symbol: 'BTCUSDT', + }); + + console.log({ + instrument: instruments.data[0], + ticker: tickers.data[0], + orderBook, + candles: candles.data.length, + openInterest, + fundingRate, + }); } -⋮---- -export interface FuturesInterestV2 { - coin: string; - liability: string; - interestFreeLimit: string; - interestLimit: string; - hourInterestRate: string; - interest: string; - cTime: string; + +main().catch(console.error); +``` + +### Common private account calls + +```typescript +import { RestClientV3 } from 'bitget-api'; + +const client = new RestClientV3({ + apiKey: process.env.BITGET_API_KEY!, + apiSecret: process.env.BITGET_API_SECRET!, + apiPass: process.env.BITGET_API_PASS!, +}); + +async function main() { + const settings = await client.getAccountSettings(); + const balances = await client.getBalances(); + const positions = await client.getCurrentPosition({ + category: 'USDT-FUTURES', + symbol: 'BTCUSDT', + }); + const openOrders = await client.getUnfilledOrders({ + category: 'SPOT', + symbol: 'BTCUSDT', + }); + const recentFills = await client.getTradeFills({ + limit: '20', + }); + + console.log({ + settings: settings.data, + balanceCount: balances.data.assets.length, + positions: positions.data.list, + openOrders: openOrders.data.list, + recentFills: recentFills.data.list, + }); } -export interface FuturesInterestHistoryV2 { - nextSettleTime: string; - borrowAmount: string; - borrowLimit: string; - interestList: FuturesInterestV2[]; - endId: string; + +main().catch(console.error); +``` + +### Common trading calls + +```typescript +import { RestClientV3 } from 'bitget-api'; + +const client = new RestClientV3({ + apiKey: process.env.BITGET_API_KEY!, + apiSecret: process.env.BITGET_API_SECRET!, + apiPass: process.env.BITGET_API_PASS!, + demoTrading: true, +}); + +async function main() { + const clientOid = `rest-${Date.now()}`; + + const placed = await client.submitNewOrder({ + category: 'SPOT', + symbol: 'BTCUSDT', + side: 'buy', + orderType: 'limit', + price: '10000', + qty: '0.001', + timeInForce: 'gtc', + clientOid, + }); + + const orderInfo = await client.getOrderInfo({ + clientOid, + }); + + const cancelled = await client.cancelOrder({ + clientOid, + }); + + console.log({ placed, orderInfo, cancelled }); } -⋮---- -export interface SetLeverageResponseV2 { - symbol: string; - marginCoin: string; - longLeverage: string; - shortLeverage: string; - crossMarginLeverage: string; - marginMode: string; + +main().catch(console.error); +``` + +For futures close-only orders, V3 REST uses lower-case `reduceOnly` values: + +```typescript +await client.submitNewOrder({ + category: 'USDT-FUTURES', + symbol: 'BTCUSDT', + side: 'sell', + orderType: 'limit', + price: '100000', + qty: '0.001', + timeInForce: 'gtc', + posSide: 'long', + reduceOnly: 'yes', +}); +``` + +--- + + +## V3 WebSocket streams + +For live market or account updates, use `WebsocketClientV3`. + +### Common events + +```typescript +import { WebsocketClientV3 } from 'bitget-api'; + +const ws = new WebsocketClientV3({}); + +ws.on('open', (data) => console.log('open', data.wsKey)); +ws.on('response', (data) => console.log('response', JSON.stringify(data))); +ws.on('update', (data) => console.log('update', JSON.stringify(data))); +ws.on('reconnect', (data) => console.log('reconnect', data.wsKey)); +ws.on('reconnected', (data) => console.log('reconnected', data?.wsKey)); +ws.on('authenticated', (data) => console.log('authenticated', data.wsKey)); +ws.on('exception', console.error); +``` + +`response` events are subscribe/control acks. `update` events carry stream data. + +### Public topics + +```typescript +import { WebsocketClientV3, WS_KEY_MAP } from 'bitget-api'; + +const ws = new WebsocketClientV3({}); + +ws.on('update', (data) => { + console.log('public update', JSON.stringify(data)); +}); + +ws.subscribe( + [ + { + topic: 'ticker', + payload: { + instType: 'spot', + symbol: 'BTCUSDT', + }, + }, + { + topic: 'books', + payload: { + instType: 'usdt-futures', + symbol: 'BTCUSDT', + }, + }, + ], + WS_KEY_MAP.v3Public, +); +``` + +V3 public `instType` values are lower-case: `spot`, `usdt-futures`, `usdc-futures`, and `coin-futures`. + +### Private topics + +```typescript +import { WebsocketClientV3, WS_KEY_MAP } from 'bitget-api'; + +const ws = new WebsocketClientV3({ + apiKey: process.env.BITGET_API_KEY!, + apiSecret: process.env.BITGET_API_SECRET!, + apiPass: process.env.BITGET_API_PASS!, +}); + +ws.on('update', (data) => { + console.log('private update', JSON.stringify(data)); +}); + +ws.subscribe( + [ + { topic: 'account', payload: { instType: 'UTA' } }, + { topic: 'position', payload: { instType: 'UTA' } }, + { topic: 'fill', payload: { instType: 'UTA' } }, + { topic: 'order', payload: { instType: 'UTA' } }, + ], + WS_KEY_MAP.v3Private, +); +``` + +V3 private account topics use `instType: 'UTA'`. + +### Unsubscribe + +```typescript +ws.unsubscribe( + { + topic: 'ticker', + payload: { + instType: 'spot', + symbol: 'BTCUSDT', + }, + }, + WS_KEY_MAP.v3Public, +); +``` + +The SDK remembers subscriptions per connection and resubscribes after reconnects. + +--- + + +## V3 WebSocket API + +`WebsocketAPIClient` sends V3 order commands over WebSocket and returns a promise for each response. + +```typescript +import { WebsocketAPIClient } from 'bitget-api'; + +const wsApi = new WebsocketAPIClient({ + apiKey: process.env.BITGET_API_KEY!, + apiSecret: process.env.BITGET_API_SECRET!, + apiPass: process.env.BITGET_API_PASS!, + demoTrading: true, +}); + +async function main() { + await wsApi.getWSClient().connectWSAPI(); + + const clientOid = `wsapi-${Date.now()}`; + + const placed = await wsApi.submitNewOrder('spot', { + symbol: 'BTCUSDT', + side: 'buy', + orderType: 'limit', + price: '10000', + qty: '0.001', + timeInForce: 'gtc', + clientOid, + }); + + const cancelled = await wsApi.cancelOrder('spot', { + clientOid, + }); + + console.log({ placed, cancelled }); } -⋮---- -export interface SetMarginModeResponseV2 { - symbol: string; - marginCoin: string; - longLeverage: string; - shortLeverage: string; - marginMode: string; + +main().catch(console.error); +``` + +The helper methods are: + +| Method | WebSocket API operation | +| ---------------------------------------- | ----------------------- | +| `submitNewOrder(category, orderRequest)` | `place-order` | +| `placeBatchOrders(category, orders)` | `batch-place` | +| `cancelOrder(category, cancelRequest)` | `cancel-order` | +| `cancelBatchOrders(category, cancels)` | `batch-cancel` | + +For batch operations, check each item in the returned `args` array - one batch can mix accepted and rejected orders. + +For futures close-only orders over the WebSocket API, use upper-case `reduceOnly` values: + +```typescript +await wsApi.submitNewOrder('usdt-futures', { + symbol: 'BTCUSDT', + side: 'sell', + orderType: 'limit', + price: '100000', + qty: '0.001', + timeInForce: 'gtc', + posSide: 'long', + reduceOnly: 'YES', +}); +``` + +--- + + +## V2/Classic APIs + +Reach for V2/Classic clients only when the account or workflow still uses Classic APIs. Don't mix V2 and V3 assumptions - category names, topics, request fields, and account modes all differ. + +### Classic public REST + +```typescript +import { RestClientV2 } from 'bitget-api'; + +const client = new RestClientV2(); + +async function main() { + const spotCandles = await client.getSpotCandles({ + symbol: 'BTCUSDT', + granularity: '1min', + limit: '100', + }); + + const futuresCandles = await client.getFuturesCandles({ + symbol: 'BTCUSDT', + productType: 'USDT-FUTURES', + granularity: '1m', + limit: '100', + }); + + console.log({ + spotCandles: spotCandles.data.length, + futuresCandles: futuresCandles.data.length, + }); } -⋮---- -export interface FuturesAccountBillV2 { - billId: string; - symbol: string; - amount: string; - fee: string; - feeByCoupon: string; - businessType: string; - coin: string; - balance: string; - cTime: string; + +main().catch(console.error); +``` + +See also: [V2 public REST examples](../examples/V2%20-%20Classic/Rest) + +### Classic WebSocket streams + +```typescript +import { WebsocketClientV2 } from 'bitget-api'; + +const ws = new WebsocketClientV2({}); + +ws.on('update', (data) => { + console.log('classic update', JSON.stringify(data)); +}); + +ws.on('response', (data) => { + console.log('classic response', JSON.stringify(data)); +}); + +ws.on('exception', console.error); + +ws.subscribeTopic('SPOT', 'ticker', 'BTCUSDT'); +``` + +V2 WebSocket `instType` values are upper-case, such as `SPOT`, `USDT-FUTURES`, `USDC-FUTURES`, and `COIN-FUTURES`. + +See also: [V2 WebSocket examples](../examples/V2%20-%20Classic/Websocket) + +--- + + +## 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 select V3/UTA, V2/Classic, demo trading, a product category, or a WebSocket `instType`. + +The broader [Using proxy with Siebly SDKs](https://siebly.io/blog/using-proxy-with-siebly-sdks) article covers the shared constructor pattern. The examples below use the current `bitget-api` V3 clients, and the same networking positions apply to the V2 clients. + +Proxy agents are a Node.js networking feature. Browser applications cannot select a raw socket agent. + +### HTTP or HTTPS proxy + +Install the agent: + +```bash +npm install bitget-api https-proxy-agent +``` + +Set `BITGET_PROXY_URL` to the full proxy URL, including URL-encoded credentials when required. + +This public check sends one V3 REST API call and one V3 ticker subscription through the same proxy: + + + +```typescript +import { HttpsProxyAgent } from 'https-proxy-agent'; +import { RestClientV3, WebsocketClientV3, WS_KEY_MAP } from 'bitget-api'; + +const proxyUrl = process.env.BITGET_PROXY_URL; + +if (!proxyUrl) { + throw new Error('Set BITGET_PROXY_URL before running this example.'); } -⋮---- -/** - * - * * Futures | Position - * - */ -⋮---- -export interface FuturesPositionTierV2 { - symbol: string; - level: string; - startUnit: string; - endUnit: string; - leverage: string; - keepMarginRate: string; + +const proxyAgent = new HttpsProxyAgent(proxyUrl); + +const rest = new RestClientV3( + {}, + { + httpsAgent: proxyAgent, + proxy: false, + }, +); + +const ws = new WebsocketClientV3({ + wsOptions: { + agent: proxyAgent, + }, +}); + +ws.on('open', ({ wsKey }) => { + console.log('WebSocket connected through proxy:', wsKey); +}); +ws.on('update', (event) => { + console.log('stream update', event); +}); +ws.on('exception', console.error); + +async function main() { + const serverTime = await rest.getServerTime(); + console.log('REST API connected through proxy:', serverTime); + + ws.subscribe( + { + topic: 'ticker', + payload: { + instType: 'spot', + symbol: 'BTCUSDT', + }, + }, + WS_KEY_MAP.v3Public, + ); } -⋮---- -export interface FuturesPositionV2 { - marginCoin: string; - symbol: string; - holdSide: string; - openDelegateSize: string; - marginSize: string; - available: string; - locked: string; - total: string; - leverage: string; - achievedProfits: string; - openPriceAvg: string; - marginMode: string; - posMode: string; - unrealizedPL: string; - liquidationPrice: string; - keepMarginRate: string; - markPrice: string; - breakEvenPrice: string; - totalFee: string; - deductedFee: string; - marginRatio: string; - assetMode: string; - uTime: string; - autoMargin: string; - cTime: string; + +process.once('SIGINT', () => { + ws.closeAll(); +}); + +main().catch(console.error); +``` + +REST API networking options belong in the second constructor argument for both `RestClientV3` and `RestClientV2`: + +- `httpsAgent` sends the HTTPS request through the agent. +- `proxy: false` prevents Axios from applying another proxy configuration on top of that agent. + +WebSocket networking options belong in `wsOptions.agent` for `WebsocketClientV3`, `WebsocketClientV2`, and `WebsocketAPIClient`. Bitget authenticates private streams and WebSocket API commands over the socket. The WebSocket clients do not fetch a separate authentication token through REST API. + +### Private streams and WebSocket API through a proxy + +This example authenticates a V3 private stream and a V3 WebSocket API connection without placing an order: + + + +```typescript +import { + WebsocketAPIClient, + WebsocketClientV3, + WS_KEY_MAP, +} from 'bitget-api'; +import { HttpsProxyAgent } from 'https-proxy-agent'; + +const proxyUrl = process.env.BITGET_PROXY_URL; + +if (!proxyUrl) { + throw new Error('Set BITGET_PROXY_URL before running this example.'); } -⋮---- -export interface FuturesHistoryPositionV2 { - positionId: string; - marginCoin: string; - symbol: string; - holdSide: string; - openAvgPrice: string; - closeAvgPrice: string; - marginMode: string; - openTotalPos: string; - closeTotalPos: string; - pnl: string; - netProfit: string; - totalFunding: string; - openFee: string; - closeFee: string; - cTime: string; - uTime: string; + +const apiKey = process.env.BITGET_API_KEY; +const apiSecret = process.env.BITGET_API_SECRET; +const apiPass = process.env.BITGET_API_PASS; + +if (!apiKey || !apiSecret || !apiPass) { + throw new Error( + 'Set BITGET_API_KEY, BITGET_API_SECRET, and BITGET_API_PASS before running this example.', + ); } -⋮---- -/** - * - * * Futures | Trade - * - */ -⋮---- -export interface FuturesBatchOrderResponseV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - errorCode: string; - }[]; + +const proxyAgent = new HttpsProxyAgent(proxyUrl); +const credentials = { apiKey, apiSecret, apiPass }; + +const streams = new WebsocketClientV3({ + ...credentials, + wsOptions: { + agent: proxyAgent, + }, +}); + +const wsApi = new WebsocketAPIClient({ + ...credentials, + attachEventListeners: false, + wsOptions: { + agent: proxyAgent, + }, +}); +const wsApiConnection = wsApi.getWSClient(); + +streams.on('authenticated', ({ wsKey }) => { + console.log('Private stream authenticated:', wsKey); +}); +streams.on('exception', console.error); +wsApiConnection.on('authenticated', ({ wsKey }) => { + console.log('WebSocket API authenticated:', wsKey); +}); +wsApiConnection.on('exception', console.error); + +async function main() { + streams.subscribe( + [ + { topic: 'account', payload: { instType: 'UTA' } }, + { topic: 'order', payload: { instType: 'UTA' } }, + ], + WS_KEY_MAP.v3Private, + ); + + await wsApiConnection.connectWSAPI(); + console.log('Private connections are ready'); } -⋮---- -export interface FuturesClosePositionResponseV2 { - successList: { - orderId: string; - clientOid: string; - symbol: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - symbol: string; - errorMsg: string; - errorCode: string; - }[]; + +process.once('SIGINT', () => { + streams.closeAll(); + wsApiConnection.closeAll(); +}); + +main().catch(console.error); +``` + +Add `demoTrading: true` to both clients when testing with Bitget demo keys. The proxy setting does not choose demo trading or convert V2/Classic request shapes into V3/UTA request shapes. + +### SOCKS5 proxy + +Install the SOCKS agent: + +```bash +npm install bitget-api socks-proxy-agent +``` + +Use `SocksProxyAgent` in the same REST API and WebSocket positions: + + + +```typescript +import { RestClientV3, WebsocketClientV3, WS_KEY_MAP } from 'bitget-api'; +import { SocksProxyAgent } from 'socks-proxy-agent'; + +const proxyUrl = process.env.BITGET_SOCKS_PROXY_URL; + +if (!proxyUrl) { + throw new Error('Set BITGET_SOCKS_PROXY_URL before running this example.'); } -⋮---- -export interface FuturesOrderDetailV2 { - symbol: string; - size: string; - orderId: string; - clientOid: string; - baseVolume: string; - priceAvg: string; - fee: string; - price: string; - state: string; - side: string; - force: string; - totalProfits: string; - posSide: string; - marginCoin: string; - presetStopSurplusPrice: string; - presetStopLossPrice: string; - quoteVolume: string; - orderType: string; - leverage: string; - marginMode: string; - reduceOnly: string; - enterPointSource: string; - tradeSide: string; - posMode: string; - orderSource: string; - cancelReason: string; - cTime: string; - uTime: string; + +const proxyAgent = new SocksProxyAgent(proxyUrl); + +const rest = new RestClientV3( + {}, + { + httpsAgent: proxyAgent, + proxy: false, + }, +); + +const ws = new WebsocketClientV3({ + wsOptions: { + agent: proxyAgent, + }, +}); + +async function main() { + const serverTime = await rest.getServerTime(); + console.log('REST API connected through SOCKS5:', serverTime); + + ws.subscribe( + { + topic: 'ticker', + payload: { + instType: 'spot', + symbol: 'BTCUSDT', + }, + }, + WS_KEY_MAP.v3Public, + ); } + +process.once('SIGINT', () => { + ws.closeAll(); +}); + +main().catch(console.error); +``` + +### Proxy checks + +- Keep proxy URLs and credentials in environment variables or a secret manager. +- URL-encode usernames and passwords when constructing a proxy URL from separate values. +- Make sure the proxy egress IP matches the Bitget API key's IP whitelist. +- Test a public REST API call and public WebSocket subscription before private authentication. +- Keep V3/UTA, V2/Classic, demo trading, category, and `instType` decisions separate from proxy configuration. +- Measure request, connection, and reconnect latency through the proxy. +- Treat repeated HTTP 407 responses, TLS errors, and WebSocket reconnect loops as network failures. +- Keep the host clock synchronized. Change `recvWindow` only after measuring timestamp failures and proxy latency. +- The SDK does not rotate proxy endpoints. Handle endpoint selection outside the client when rotation is required. + +--- + + +## Production notes + +### 1. Roll out in layers + +Public REST first, then private read-only REST, then public streams, private streams, demo trading, and finally small live tests. None of the examples here need withdrawal permissions. + +### 2. Use client-generated order IDs + +Set `clientOid` on every order and store it before you send. You'll need it to match state after retries, reconnects, or restarts. + +### 3. Reconcile after reconnects + +Reconnects happen. After a private stream comes back, hit REST for balances, positions, open orders, history, and recent fills before trusting local state. + +### 4. Check exchange acceptance + +A resolved promise means the SDK got a response - not that the trade worked. Check Bitget's `code`, per-item batch `code` values, and order status. Accepted ≠ filled. + +### 5. Keep clocks healthy + +Private requests are timestamp-sensitive. Keep the host clock synced. Only touch `recvWindow` if you know you have clock skew. + +### 6. Keep credentials scoped + +Separate live and demo keys. Read-only keys for dashboards. Trading permissions only where you actually submit orders. Never put private keys in frontend code. + +### 7. Log carefully + +`BITGETTRACE=true` is handy for local debugging - it logs raw requests and responses. Don't turn it on where logs might leak account data. + +--- + + +## FAQ + +### Do I need API keys for public market data? + +No. Public REST market data and public WebSocket streams can be used without API keys. + +### What is the Bitget API passphrase? + +The API passphrase is the passphrase set when creating the Bitget API key. In the SDK constructor it is passed as `apiPass`. + +### Which client should I use for a new project? + +Start with `RestClientV3`, `WebsocketClientV3`, and `WebsocketAPIClient` for current V3/UTA workflows. + +### When should I use V2/Classic clients? + +Use `RestClientV2` and `WebsocketClientV2` when the account or endpoint is still on Bitget Classic. Do not mix V2 and V3 request assumptions in the same snippet. + +### Why do category names have different casing? + +Bitget isn't consistent. V3 REST uses upper-case categories. V3 public WebSocket uses lower-case `instType`. Private account streams use `UTA`. V2 WebSocket uses upper-case `instType`. + +### What is the difference between WebSocket streams and the WebSocket API? + +Streams push updates - market data, account changes, fills. The WebSocket API is for sending commands (place/cancel orders) and getting a direct response. Watch state on streams; send orders on the WebSocket API. + +### Can I use this SDK from plain JavaScript? + +Yes. The SDK works in JavaScript and TypeScript. TypeScript users also get request and response types from the package. + +### Does the SDK support RSA keys? + +Yes. Pass your RSA private key as `apiSecret`; the SDK auto-detects RSA vs HMAC signing. See the [GitHub repository](https://github.com/tiagosiebler/bitget-api). + +### What should I do after a WebSocket reconnect? + +Normal - let the SDK reconnect and resubscribe. Then reconcile balances, orders, and fills over REST before acting on cached state. + +### Where can I find more examples? + +More in the repo: + +- [V3/UTA examples](../examples/V3%20-%20UTA) +- [V2/Classic examples](../examples/V2%20-%20Classic) +- [Auth examples](../examples/Auth) +- [Bitget JavaScript Endpoint Reference](./endpointFunctionList.md) + +--- + + +## Next steps + +- [Bitget JavaScript SDK page](https://siebly.io/sdk/bitget/javascript) +- [`bitget-api` on npm](https://www.npmjs.com/package/bitget-api) +- [GitHub repo](https://github.com/tiagosiebler/bitget-api) +- [Endpoint reference](./endpointFunctionList.md) +- Bitget docs: [UTA](https://www.bitget.com/api-doc/uta/intro) · [Classic](https://www.bitget.com/api-doc/classic/quickStart/intro) +- [More exchange SDKs on Siebly.io](https://siebly.io) + +================ +File: examples/V3 - UTA/WS-API/ws-api-client-trade.ts +================ +import { DefaultLogger, WebsocketAPIClient } from '../../../src/index.js'; ⋮---- -export interface FuturesOrderFillV2 { - tradeId: string; - symbol: string; - orderId: string; - price: string; - baseVolume: string; - feeDetail: { - deduction: string; - feeCoin: string; - totalDeductionFee: string; - totalFee: string; - }[]; - side: string; - quoteVolume: string; - profit: string; - enterPointSource: string; - tradeSide: string; - posMode: string; - tradeScope: string; - cTime: string; -} +// or +// import { DefaultLogger, WS_KEY_MAP, WebsocketAPIClient } from 'bitget-api'; ⋮---- -export interface FuturesOpenOrderV2 { - symbol: string; - size: string; - orderId: string; - clientOid: string; - baseVolume: string; - fee: string; - price: string; - priceAvg: string; - status: string; - side: string; - force: string; - totalProfits: string; - posSide: string; - marginCoin: string; - quoteVolume: string; - leverage: string; - marginMode: string; - enterPointSource: string; - tradeSide: string; - posMode: string; - orderType: string; - orderSource: string; - cTime: string; - uTime: string; - presetStopSurplusPrice: string; - presetStopSurplusType: string; - presetStopSurplusExecutePrice: string; - presetStopLossPrice: string; - presetStopLossType: string; - presetStopLossExecutePrice: string; -} +// function attachEventHandlers( +// wsClient: TWSClient, +// ): void { +// wsClient.on('update', (data) => { +// console.log('raw message received ', JSON.stringify(data)); +// }); +// wsClient.on('open', (data) => { +// console.log('ws connected', data.wsKey); +// }); +// wsClient.on('reconnect', ({ wsKey }) => { +// console.log('ws automatically reconnecting.... ', wsKey); +// }); +// wsClient.on('reconnected', (data) => { +// console.log('ws has reconnected ', data?.wsKey); +// }); +// wsClient.on('authenticated', (data) => { +// console.log('ws has authenticated ', data?.wsKey); +// }); +// } ⋮---- -export interface FuturesHistoryOrderV2 { - symbol: string; - size: string; - orderId: string; - clientOid: string; - baseVolume: string; - fee: string; - price: string; - priceAvg: string; - status: string; - side: string; - force: string; - totalProfits: string; - posSide: string; - marginCoin: string; - quoteVolume: string; - leverage: string; - marginMode: string; - enterPointSource: string; - tradeSide: string; - posMode: string; - orderType: string; - orderSource: string; - cTime: string; - uTime: string; - presetStopSurplusPrice: string; - presetStopLossPrice: string; - liqPrice: string; -} -⋮---- -export interface FuturesCancelAllOrdersV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - errorCode: string; - }[]; -} +// If running from CLI in unix, you can pass env vars as such: +// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/ws-private.ts ⋮---- -/** - * - * * Futures | Trigger Orders - * - */ +// Whether to use the demo trading wss connection +// demoTrading: true, ⋮---- -export interface FuturesTriggerSubOrderV2 { - orderId: string; - price: string; - type: string; - status: string; -} +// If you want your own event handlers instead of the default ones with logs, +// disable this setting and see the `attachEventHandlers` example below: +// attachEventListeners: false ⋮---- -export interface FuturesPendingPlanOrderV2 { - planType: string; - symbol: string; - size: string; - orderId: string; - clientOid: string; - price: string; - executePrice: string; - callbackRatio: string; - triggerPrice: string; - triggerType: string; - planStatus: string; - side: string; - posSide: string; - marginCoin: string; - marginMode: string; - enterPointSource: string; - tradeSide: string; - posMode: string; - orderType: string; - orderSource: string; - cTime: string; - uTime: string; - stopSurplusExecutePrice: string; - stopSurplusTriggerPrice: string; - stopSurplusTriggerType: string; - stopLossExecutePrice: string; - stopLossTriggerPrice: string; - stopLossTriggerType: string; -} +logger, // Optional: inject a custom logger ⋮---- -export interface FuturesCancelPlanOrderV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - }[]; -} +// Optional, see above "attachEventListeners". Attach basic event handlers, so nothing is left unhandled +// attachEventHandlers(wsClient.getWSClient()); ⋮---- -export interface FuturesHistoryPlanOrderV2 { - planType: string; - symbol: string; - size: string; - orderId: string; - executeOrderId: string; - clientOid: string; - planStatus: string; - price: string; - executePrice: string; - priceAvg: string; - baseVolume: string; - callbackRatio: string; - triggerPrice: string; - triggerType: string; - side: string; - posSide: string; - marginCoin: string; - marginMode: string; - enterPointSource: string; - tradeSide: string; - posMode: string; - orderType: string; - cTime: string; - uTime: string; - stopSurplusExecutePrice: string; - stopSurplusTriggerPrice: string; - stopSurplusTriggerType: string; - stopLossExecutePrice: string; - stopLossTriggerPrice: string; - stopLossTriggerType: string; -} +// Optional: prepare the WebSocket API connection in advance. +// This happens automatically but you can do this early before making any API calls, to prevent delays from a cold start. ⋮---- /** - * - * * Futures | Union Margin - * - */ -⋮---- -export interface UnionTransferLimitsV2 { - coin: string; - maxTransferIn: string; -} + * Bitget's WebSocket API be used like a REST API, through this SDK's WebsocketAPIClient. The WebsocketAPIClient is a utility class wrapped around WebsocketClientV3's sendWSAPIRequest() capabilities. + * + * Each request sent via the WebsocketAPIClient will automatically: + * - route via the active WS API connection + * - return a Promise, which automatically resolves/rejects when a matching response is received + * + * Note: this requires V3/UTA API keys! + */ ⋮---- -export interface UnionConfigV2 { - imr: string; - mmr: string; - individualLimit: string; - individualLimitRatio: string; -} +/** + * Place Order + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters + */ ⋮---- -export interface UnionSwitchUsdtV2 { - usdtAmount: string; -} +/** + const res = { + "event": "trade", + "id": "1750034396082", + "category": "spot", + "topic": "place-order", + "args": [ + { + "symbol": "BTCUSDT", + "orderId": "xxxxxxxx", + "clientOid": "xxxxxxxx", + "cTime": "1750034397008" + } + ], + "code": "0", + "msg": "success", + "ts": "1750034397076" + }; + */ ⋮---- -export interface UnionConvertV2 { - usdtAmount: string; -} +/** + * Batch Place Order Channel + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel + */ ⋮---- /** - * - * * Futures | Account | Max Openable Quantity - * - */ + * Note: batch place will never reject the request, even if all orders were rejected. Check the "code" and "msg" properties for individual orders in the response, to detect batch place errors. + */ ⋮---- -export interface FuturesMaxOpenV2 { - maxOpen: string; -} +/** + const res = { + "event": "trade", + "id": "1750035029506", + "category": "spot", + "topic": "batch-place", + "args": [ + { + "code": "0", + "msg": "Success", + "symbol": "BTCUSDT", + "orderId": "xxxxxxxx", + "clientOid": "xxxxxxxx" + }, + { + "code": "0", + "msg": "Success", + "symbol": "BTCUSDT", + "orderId": "xxxxxxxx", + "clientOid": "xxxxxxxx" + } + ], + "code": "0", + "msg": "Success", + "ts": "1750035029925" + } + */ ⋮---- /** - * - * * Futures | Account | Liquidation Price - * - */ + * Cancel Order + * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel + */ ⋮---- -export interface FuturesLiquidationPriceV2 { - liqPrice: string; -} +/** + const res = { + "event": "trade", + "id": "1750034870205", + "topic": "cancel-order", + "args": [ + { + "orderId": "xxxxxxxx", + "clientOid": "xxxxxxxx" + } + ], + "code": "0", + "msg": "Success", + "ts": "1750034870597" + } + */ ⋮---- /** - * - * * Futures | Account | Isolated Symbols - * - */ + * Batch Cancel Order + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel + */ ⋮---- -export interface FuturesIsolatedSymbolV2 { - symbol: string; - marginMode: 'isolated'; -} +/** + const res = { + "event": "trade", + "id": "bb553cc0-c1fa-454e-956d-c96c8d715760", + "topic": "batch-cancel", + "args": [ + { + "code": "0", + "msg": "Success", + "orderId": "xxxxxxxxxxxxx" + }, + { + "code": "25204", + "msg": "Order does not exist", + "orderId": "xxxxxxxxxxxxx" + } + ], + "code": "0", + "msg": "Success", + "ts": "1751980011084" + } + */ ================ -File: src/types/response/v3/account.ts +File: src/types/request/v3/trade.ts ================ -// Account Management Response Types -import type { CollateralTypeV3 } from '../../request/v3/account.js'; -⋮---- -export interface AccountSymbolConfigV3 { - category: string; - symbol: string; - marginMode: string; - leverage: string; +export interface BatchModifyOrderRequestV3 { + orderId?: string; + clientOid?: string; + qty?: string; + price?: string; + autoCancel?: 'yes' | 'no'; } ⋮---- -export interface AccountCoinConfigV3 { - coin: string; - leverage: string; +export interface CancelAllOrdersRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; } ⋮---- -export type AccountPermissionV3 = - | 'uta_mgt' - | 'uta_trade' - | 'withdraw' - | 'copy_futures_position' - | 'copy_futures_order'; -⋮---- -export interface AccountInfoV3 { - userId: string; - inviterId: string; - /** Only set when the calling account is a sub-account */ - parentId: string; - channelCode: string; - channel: string; - ips: string; - permType: 'read-only' | 'read-and-write'; - permissions: AccountPermissionV3[]; - regisTime: string; +export interface CancelBatchOrdersRequestV3 { + orderId?: string; + clientOid?: string; + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol: string; } ⋮---- -/** Only set when the calling account is a sub-account */ +export interface CloseAllPositionsRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + posSide?: 'long' | 'short'; +} ⋮---- -export type AccountLevelV3 = 'basic' | 'advanced' | 'isolated' | 'delta'; +export interface CancelOrderRequestV3 { + orderId?: string; + clientOid?: string; + category?: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; +} ⋮---- -export interface AccountSettingsV3 { - uid: string; - accountMode: 'unified' | 'hybrid' | 'upgrading' | 'switching'; - assetMode: string; - accountLevel: AccountLevelV3; - holdMode: string; - stpMode: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; - symbolConfigList: AccountSymbolConfigV3[]; - coinConfigList: AccountCoinConfigV3[]; +export interface GetMaxOpenAvailableRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol: string; + orderType: 'limit' | 'market'; + side: 'buy' | 'sell'; + price?: string; + size?: string; } ⋮---- -export interface AccountDeltaCoinPositionV3 { - coin: string; - positionRatio: string; +export interface GetOrderInfoRequestV3 { + orderId?: string; + clientOid?: string; } ⋮---- -/** Delta-neutral mode metrics. Only available when accountLevel is delta. */ -export interface AccountDeltaInfoV3 { - deltaEquityRatio: string; - deltaThreshold: string; - positionThreshold: string; - list: AccountDeltaCoinPositionV3[]; +export interface GetFillsRequestV3 { + category?: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + orderId?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface AccountAssetV3 { - coin: string; - equity: string; - usdValue: string; - balance: string; - available: string; - debt: string; - locked: string; - /** Position value in USD */ - positionValue?: string; - /** Account leverage (non-negative) */ - leverage?: string; +export interface GetUnfilledOrdersRequestV3 { + category?: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -/** Position value in USD */ +export interface GetHistoryOrdersRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; +} ⋮---- -/** Account leverage (non-negative) */ +export interface GetPositionHistoryRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; +} ⋮---- -export interface AccountAssetsV3 { - accountEquity: string; - usdtEquity: string; - btcEquity: string; - unrealisedPnl: string; - usdtUnrealisedPnl: string; - btcUnrealizedPnl: string; - effEquity: string; - mmr: string; - imr: string; - mgnRatio: string; - positionMgnRatio: string; - assets: AccountAssetV3[]; +export interface GetCurrentPositionRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + posSide?: 'long' | 'short'; } ⋮---- -export interface ConvertRecordV3 { - fromCoin: string; - fromCoinSize: string; - toCoin: string; - toCoinSize: string; - price: string; - ts: string; +export interface ModifyOrderRequestV3 { + orderId?: string; + clientOid?: string; + qty?: string; + price?: string; + autoCancel?: 'yes' | 'no'; + symbol?: string; + category?: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + tpTriggerBy?: 'market' | 'mark'; + slTriggerBy?: 'market' | 'mark'; + takeProfit?: string; + stopLoss?: string; + tpOrderType?: 'limit' | 'market'; + slOrderType?: 'limit' | 'market'; + tpLimitPrice?: string; + slLimitPrice?: string; } ⋮---- -export interface FinancialRecordV3 { - category: string; - id: string; +export interface PlaceRealityOrderRequestV3 { + category?: 'SPOT' | 'MARGIN'; symbol: string; - coin: string; - type: string; - amount: string; - fee: string; - balance: string; - ts: string; - /** crossed | isolated */ - positionType?: string; - positionAmount?: string; - positionBalance?: string; + side: 'buy' | 'sell'; + orderType: 'limit' | 'market'; + qty: string; + price?: string; + clientOid?: string; } ⋮---- -/** crossed | isolated */ -⋮---- -export interface PaymentCoinV3 { - coin: string; - size: string; - amount: string; -} -⋮---- -export interface RepayableCoinV3 { - coin: string; - size: string; - amount: string; -} -⋮---- -export interface RepayResponseV3 { - result: string; - repayAmount: string; -} -⋮---- -// Sub-account Management Response Types -⋮---- -export interface CreateSubAccountApiKeyResponseV3 { - note: string; - apiKey: string; - secret: string; - type: string; - permissions: string[]; - ips: string[]; -} -export interface SubAccountApiKeyV3 { - apiKey: string; - note: string; - type: string; - permissions: string[]; - ips: string[]; - ts?: string; +export interface CancelRealityOrderRequestV3 { + category?: 'SPOT' | 'MARGIN'; + symbol: string; + orderId?: string; + clientOid?: string; } ⋮---- -export interface UpdateSubAccountApiKeyResponseV3 { - note: string; - apiKey: string; - type: string; - permissions: string[]; - ips: string[]; +export interface PlaceBatchOrdersRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol: string; + qty: string; + price?: string; + side: 'buy' | 'sell'; + orderType: 'limit' | 'market'; + timeInForce?: 'ioc' | 'fok' | 'gtc' | 'post_only'; + posSide?: 'long' | 'short'; + clientOid?: string; + reduceOnly?: 'yes' | 'no'; } ⋮---- -export interface CreateSubAccountResponseV3 { - username: string; - subUid: string; - status: string; - note: string; - createdTime: string; - updatedTime: string; -} +export type FuturesMarginModeV3 = 'crossed' | 'isolated'; ⋮---- -export interface SubAccountV3 { - subUid: string; - username: string; - status: string; - accountMode: string; - type: 'normal' | 'virtual' | 'custodian'; - note: string; - createdTime: string; - updatedTime: string; +export interface PlaceOrderRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol: string; + qty: string; + price?: string; + side: 'buy' | 'sell'; + orderType: 'limit' | 'market'; + timeInForce?: 'ioc' | 'fok' | 'gtc' | 'post_only'; + posSide?: 'long' | 'short'; + clientOid?: string; + reduceOnly?: 'yes' | 'no'; + /** Futures only. Defaults to crossed */ + marginMode?: FuturesMarginModeV3; + stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; + tpTriggerBy?: 'market' | 'mark'; + slTriggerBy?: 'market' | 'mark'; + takeProfit?: string; + stopLoss?: string; + tpOrderType?: 'limit' | 'market'; + slOrderType?: 'limit' | 'market'; + tpLimitPrice?: string; + slLimitPrice?: string; } ⋮---- -export interface WithdrawAddressBookEntryV3 { - coin: string; - chain: string; - address: string; - countryCode: string; - label: string; - memo: string; - type: 'regular' | 'EVM' | 'universal' | 'internal'; - internalType: '' | 'uid' | 'mobile' | 'email'; - createdTime: string; -} +/** Futures only. Defaults to crossed */ ⋮---- -export interface WithdrawAddressBookV3 { - addressList: WithdrawAddressBookEntryV3[]; - cursor?: string; +export interface CountdownCancelAllRequestV3 { + countdown: string; // seconds until auto-cancel (5-60, or 0 to disable) } ⋮---- -// Transfer Response Types -⋮---- -export interface AllSymbolFeeRateV3 { - symbol: string; - makerFeeRate: string; - takerFeeRate: string; +countdown: string; // seconds until auto-cancel (5-60, or 0 to disable) + +================ +File: src/types/response/v3/trade.ts +================ +export interface BatchModifyOrderResponseV3 { + orderId: string; + clientOid: string; } ⋮---- -export interface TransferResponseV3 { - transferId: string; - clientOid?: string; +export interface CancelAllOrdersResponseV3 { + list: { + orderId: string; + clientOid: string; + code: string; + msg: string; + }[]; } ⋮---- -export interface SubTransferRecordV3 { - transferId: string; - oldTransferId?: string; - fromType: string; - toType: string; - amount: string; - coin: string; - fromUserId: string; - toUserId: string; - status: string; +export interface CancelBatchOrdersResponseV3 { + orderId: string; clientOid: string; - createdTime: string; - updatedTime: string; -} -⋮---- -export interface SubUnifiedAssetV3 { - coin: string; - equity: string; - usdValue: string; - balance: string; - available: string; - debt: string; - locked: string; + code?: string; + msg?: string; } ⋮---- -export interface SubUnifiedAssetV3 { - subUid: string; - cursor: string; - assets: SubUnifiedAssetV3[]; +export interface CloseAllPositionsResponseV3 { + list: { + orderId: string; + clientOid: string; + code: string; + msg: string; + }[]; } ⋮---- -export interface GetFeeRateResponseV3 { - makerFeeRate: string; - takerFeeRate: string; +export interface CancelOrderResponseV3 { + orderId: string; + clientOid: string; } ⋮---- -export interface FundingAssetV3 { - coin: string; +export interface GetMaxOpenAvailableResponseV3 { available: string; - frozen: string; - balance: string; + maxOpen: string; + buyOpenCost: string; + sellOpenCost: string; + maxBuyOpen: string; + maxSellOpen: string; } ⋮---- -// Deposit Response Types -⋮---- -export interface DepositAddressV3 { - address: string; - chain: string; - coin: string; - tag: string; - url: string; +export interface FeeDetailV3 { + feeCoin: string; + fee: string; } ⋮---- -export interface DepositRecordV3 { +export interface OrderInfoV3 { orderId: string; - recordId: string; - coin: string; - type: 'deposit'; - dest: 'on_chain' | 'internal_transfer'; - size: string; - status: 'pending' | 'success' | 'fail'; - fromAddress: string; - toAddress: string; - chain: string; + clientOid: string; + category: string; + symbol: string; + orderType: string; + side: string; + price: string; + qty: string; + amount: string; + cumExecQty: string; + cumExecValue: string; + avgPrice: string; + timeInForce: string; + orderStatus: string; + posSide: string; + holdMode: string; + delegateType?: string; + reduceOnly: string; + feeDetail: FeeDetailV3[]; + cancelReason: string; + execType: string; + stpMode?: string; createdTime: string; updatedTime: string; } ⋮---- -// Withdraw Response Types +export type FillCategoryV3 = + | 'spot' + | 'margin' + | 'usdt-futures' + | 'coin-futures' + | 'usdc-futures' + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; ⋮---- -export interface WithdrawResponseV3 { - orderId: string; +export interface FillV3 { + execId: string; + orderId: string; + category: FillCategoryV3; + symbol: string; + orderType: string; + side: string; + execPrice: string; + execQty: string; + execValue: string; + tradeScope: string; + feeDetail: FeeDetailV3[]; + execPnl?: string; + tradeSide?: string; + createdTime: string; + updatedTime: string; +} +⋮---- +export interface UnfilledOrderV3 { + orderId: string; clientOid: string; + category: string; + symbol: string; + orderType: string; + side: string; + price: string; + qty: string; + amount: string; + cumExecQty: string; + cumExecValue: string; + avgPrice: string; + timeInForce: string; + orderStatus: string; + posSide: string; + holdMode: string; + delegateType?: string; + reduceOnly: string; + feeDetail: FeeDetailV3[]; + stpMode?: string; + createdTime: string; + updatedTime: string; } ⋮---- -export interface WithdrawRecordV3 { +export interface HistoryOrderV3 { orderId: string; clientOid: string; - recordId: string; - coin: string; - type: 'withdraw'; - dest: 'on_chain' | 'internal_transfer'; - size: string; - status: 'pending' | 'success' | 'fail'; - fromAddress: string; - toAddress: string; - chain: string; - fee: string; - confirm: string; - tag: string; + category: string; + symbol: string; + orderType: string; + side: string; + price: string; + qty: string; + amount: string; + cumExecQty: string; + cumExecValue: string; + avgPrice: string; + timeInForce: string; + orderStatus: string; + posSide: string; + holdMode: string; + delegateType?: string; + reduceOnly: string; + feeDetail: FeeDetailV3[]; + cancelReason: string; + execType: string; + stpMode?: string; createdTime: string; updatedTime: string; } ⋮---- -export interface MaxTransferableV3 { - coin: string; - maxTransfer: string; - borrowMaxTransfer: string; +export interface PositionHistoryV3 { + positionId: string; + category: string; + symbol: string; + marginCoin: string; + holdMode: string; + posSide: string; + marginMode: string; + openPriceAvg: string; + closePriceAvg: string; + openTotalPos: string; + closeTotalPos: string; + cumRealisedPnl: string; + netProfit: string; + totalFunding: string; + openFeeTotal: string; + closeFeeTotal: string; + /** Cash dividend, USDT */ + cashDividend?: string; + createdTime: string; + updatedTime: string; } ⋮---- -export interface OpenInterestLimitV3 { +/** Cash dividend, USDT */ +⋮---- +export interface CurrentPositionV3 { + category: string; symbol: string; - singleUserLimit: string; - masterSubLimit: string; - marketMakerLimit: string; + marginCoin: string; + holdMode: string; + posSide: string; + marginMode: string; + positionBalance: string; + available: string; + frozen: string; + total: string; + leverage: string; + curRealisedPnl: string; + avgPrice: string; + positionStatus: string; + unrealisedPnl: string; + liquidationPrice: string; + mmr: string; + profitRate: string; + markPrice: string; + breakEvenPrice: string; + totalFunding: string; + openFeeTotal: string; + closeFeeTotal: string; + /** Cash dividend, USDT */ + cashDividend?: string; + createdTime: string; + updatedTime: string; } ⋮---- -export interface TaxRecordV3 { - id: string; +/** Cash dividend, USDT */ +⋮---- +export interface LoanDataDebtCoinV3 { coin: string; - type: string; - amount: string; - fee: string; - balance: string; - ts: string; + debt: string; + interestFreeAmount: string; + interestRateNextHour: string; } ⋮---- -export interface CollateralTypeConfigV3 { - collateralType: CollateralTypeV3; - /** Returned when collateralType=custom */ - collateralCoins?: string; +export interface LoanDataV3 { + currentLoans: string; + interestPaymentTime: string; + debtCoinList: LoanDataDebtCoinV3[]; } ⋮---- -/** Returned when collateralType=custom */ +export interface ModifyOrderResponseV3 { + orderId: string; + clientOid: string; +} ⋮---- -export interface CustomCollateralCoinV3 { - collateralCoin: string; +export interface PlaceBatchOrdersResponseV3 { + orderId: string; + clientOid: string; + code?: string; + msg?: string; } ⋮---- -export interface PreSetLeverageV3 { - estMaxOpen?: string; - estMaxBorrowable?: string; - requiredMargin: string; - marginChange: string; +export interface PlaceOrderResponseV3 { + orderId: string; + clientOid: string; } ⋮---- -export interface MaxWithdrawalV3 { - coin: string; - otcMaxWithdrawal: string; - spotMaxWithdrawal: string; - utaMaxWithdrawal: string; - totalMaxWithdrawal: string; +export interface PositionAdlRankV3 { + symbol: string; + marginCoin: string; + adlRank: string; + holdSide: 'long' | 'short'; } ================ -File: src/types/websockets/ws-general.ts +File: src/types/request/v3/public.ts ================ -import type { ClientRequestArgs } from 'http'; -import WebSocket from 'isomorphic-ws'; -⋮---- -import { RestClientOptions } from '../../util/requestUtils.js'; -import { WS_KEY_MAP } from '../../util/websocket-util.js'; -import { FuturesProductTypeV2 } from '../request/shared.js'; +export interface GetPublicFillsRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; + limit?: string; +} ⋮---- -export type BitgetInstType = 'SP' | 'SPBL' | 'MC' | 'UMCBL' | 'DMCBL'; -export type BitgetInstTypeV2 = 'SPOT' | FuturesProductTypeV2; -export type BitgetInstTypeV3 = - | 'UTA' // for account-level topics - | 'spot' - | 'usdt-futures' - | 'coin-futures' - | 'usdc-futures'; +export interface GetCandlesRequestV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + interval: + | '1m' + | '3m' + | '5m' + | '15m' + | '30m' + | '1H' + | '4H' + | '6H' + | '12H' + | '1D'; + startTime?: string; + endTime?: string; + type?: 'MARKET' | 'MARK' | 'INDEX'; + limit?: string; +} ⋮---- -| 'UTA' // for account-level topics +export interface GetHistoryCandlesRequestV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + interval: + | '1m' + | '3m' + | '5m' + | '15m' + | '30m' + | '1H' + | '4H' + | '6H' + | '12H' + | '1D'; + startTime?: string; + endTime?: string; + type?: 'MARKET' | 'MARK' | 'INDEX'; + limit?: string; +} ⋮---- -/** - * - * V1 list of topics for WebSocket consumers - * - */ +export interface GetContractsOiRequestV3 { + symbol?: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +} ⋮---- -export type WsPublicSpotTopic = - | 'ticker' - | 'candle1W' - | 'candle1D' - | 'candle12H' - | 'candle4H' - | 'candle1H' - | 'candle30m' - | 'candle15m' - | 'candle5m' - | 'candle1m' - | 'books' - | 'books5' - | 'trade'; +export interface GetCurrentFundingRateRequestV3 { + category?: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; +} ⋮---- -// Futures currently has the same public topics as spot -export type WsPublicFuturesTopic = WsPublicSpotTopic; -export type WsPrivateSpotTopic = 'account' | 'orders'; +export interface GetLiquidationsRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + limit?: string; + cursor?: string; +} ⋮---- -export type WsPrivateFuturesTopic = - | 'account' - | 'positions' - | 'orders' - | 'ordersAlgo'; +export interface GetHistoryFundingRateRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + cursor?: string; + limit?: string; +} ⋮---- -export type WsPublicTopic = WsPublicSpotTopic | WsPublicFuturesTopic; +export interface GetMarginLoansRequestV3 { + coin: string; +} ⋮---- -export type WsPrivateTopic = WsPrivateSpotTopic | WsPrivateFuturesTopic; -export type WsTopic = WsPublicTopic | WsPrivateTopic; +export interface GetOpenInterestRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; +} ⋮---- -/** - * - * V2 list of topics for WebSocket consumers - * - */ +export interface GetPositionTierRequestV3 { + category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + coin?: string; +} ⋮---- -export type WsPublicTopicV2 = - | 'index-price' // margin only - | 'ticker' - | 'candle1m' - | 'candle5m' - | 'candle15m' - | 'candle30m' - | 'candle1H' - | 'candle4H' - | 'candle6H' - | 'candle12H' - | 'candle1D' - | 'candle3D' - | 'candle1W' - | 'candle1M' - | 'candle6Hutc' - | 'candle12Hutc' - | 'candle1Dutc' - | 'candle3Dutc' - | 'candle1Wutc' - | 'candle1Mutc' - | 'trade' - | 'books' - | 'books1' - | 'books5' - | 'books15'; +export interface GetRiskReserveRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + marginCoin?: string; +} ⋮---- -| 'index-price' // margin only +export interface GetRiskReserveAllRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +} ⋮---- -// Also update PRIVATE_TOPICS_V2 if this is updated -export type WSPrivateTopicFuturesV2 = - | 'positions' - | 'orders-algo' - | 'positions-history'; +export interface GetInstrumentsRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; +} ⋮---- -// Also update PRIVATE_TOPICS_V2 if this is updated -export type WSPrivateTopicMarginV2 = - | 'orders-crossed' - | 'account-crossed' - | 'account-isolated' - | 'orders-isolated'; +export interface GetMarketFeeGroupRequestV3 { + category: 'SPOT' | 'FUTURES'; + group?: 'DEFAULT' | 'GROUP_A' | 'GROUP_B' | 'GROUP_C'; +} ⋮---- -// Also update PRIVATE_TOPICS_V2 if this is updated -export type WsPrivateTopicV2 = - | 'account' - | 'orders' - | WSPrivateTopicFuturesV2 - | WSPrivateTopicMarginV2; +export interface GetMarketScoreWeightsRequestV3 { + category?: 'SPOT' | 'FUTURES'; +} ⋮---- -export type WsTopicV2 = WsPublicTopicV2 | WsPrivateTopicV2; +export interface GetOrderBookRequestV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + limit?: string; +} ⋮---- -/** - * - * V3 / UTA list of topics for WebSocket consumers - * - */ -export type WsPublicTopicV3 = 'ticker' | 'kline' | 'books' | 'publicTrade'; -// Also update PRIVATE_TOPICS_V3 if this is updated -export type WsPrivateTopicV3 = - | 'account' - | 'position' - | 'fill' - | 'order' - | 'strategy-order'; -export type WsTopicV3 = WsPublicTopicV3 | WsPrivateTopicV3; +export interface GetTickersRequestV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; +} ⋮---- -/** This is used to differentiate between each of the available websocket streams */ -export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP]; +export interface GetIndexComponentsRequestV3 { + symbol: string; +} ⋮---- -/** - * Event args for subscribing/unsubscribing - */ +export interface GetRpiOrderBookRequestV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + limit?: string; +} ⋮---- -export interface WsTopicSubscribeEventArgs { - instType: BitgetInstType; - channel: WsTopic; - instId?: string; +export interface GetCashDividendRecordsRequestV3 { + symbol: string; + type: 'pending' | 'paid'; + cursor?: string; + limit?: string; } ⋮---- -export type WsTopicSubscribePublicArgsV2 = { - instType: BitgetInstTypeV2; - channel: WsPublicTopicV2; - /** The symbol, e.g. "BTCUSDT" */ - instId: string; -}; +export interface GetSpotWhaleFlowRequestV3 { + symbol: string; +} ⋮---- -/** The symbol, e.g. "BTCUSDT" */ +export interface GetSpotFundFlowRequestV3 { + symbol: string; + period?: string; +} ⋮---- -export type WsInstIdChannelsV2 = - | 'orders' - | WSPrivateTopicFuturesV2 - | 'orders-crossed' - | 'orders-isolated'; +export interface GetSpotNetFlowRequestV3 { + symbol: string; +} ⋮---- -export type WsTopicSubscribePrivateInstIdArgsV2 = { - instType: BitgetInstTypeV2; - channel: WsInstIdChannelsV2; - /** The symbol, e.g. "BTCUSDT" */ - instId?: string; -}; +export interface GetMarginLongShortRequestV3 { + symbol: string; + period?: '24h' | '30d'; + coin?: string; +} ⋮---- -/** The symbol, e.g. "BTCUSDT" */ +export interface GetMarginLoanGrowthRequestV3 { + symbol: string; + period?: string; + coin?: string; +} ⋮---- -export type WsCoinChannelsV2 = - | 'account' - | 'account-crossed' - | 'account-isolated'; +export interface GetMarginIsolatedBorrowRequestV3 { + symbol: string; + period?: string; +} ⋮---- -export type WsTopicSubscribePrivateCoinArgsV2 = { - instType: BitgetInstTypeV2; - channel: WsCoinChannelsV2; - coin: 'default' | string; -}; +export interface GetFuturesTradingDataRequestV3 { + symbol: string; + period?: string; +} + +================ +File: src/types/response/v3/account.ts +================ +// Account Management Response Types +import type { CollateralTypeV3 } from '../../request/v3/account.js'; ⋮---- -export type WsTopicSubscribePrivateArgsV2 = - | WsTopicSubscribePrivateInstIdArgsV2 - | WsTopicSubscribePrivateCoinArgsV2; +export interface AccountSymbolConfigV3 { + category: string; + symbol: string; + marginMode: string; + leverage: string; +} ⋮---- -export type WsTopicSubscribeEventArgsV2 = - | WsTopicSubscribePublicArgsV2 - | WsTopicSubscribePrivateArgsV2; +export interface AccountCoinConfigV3 { + coin: string; + leverage: string; +} ⋮---- -/** General configuration for the WebsocketClient */ -export interface WSClientConfigurableOptions { - /** Your API key */ - apiKey?: string; - - /** Your API secret */ - apiSecret?: string; - - /** The passphrase you set when creating the API Key (NOT your account password) */ - apiPass?: string; - - /** - * Set to `true` to connect to Bitget's demo trading WebSockets: - * - * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket - * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading - */ - demoTrading?: boolean; - - /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ - recvWindow?: number; - - // Disable ping/pong ws heartbeat mechanism (not recommended) - disableHeartbeat?: boolean; - - /** 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; - - requestOptions?: RestClientOptions; - - wsOptions?: { - protocols?: string[]; - agent?: any; - } & Partial; - - wsUrl?: 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. - */ - customSignMessageFn?: (message: string, secret: string) => Promise; -} +export type AccountPermissionV3 = + | 'uta_mgt' + | 'uta_trade' + | 'withdraw' + | 'copy_futures_position' + | 'copy_futures_order'; ⋮---- -/** Your API key */ +export interface AccountInfoV3 { + userId: string; + inviterId: string; + /** Only set when the calling account is a sub-account */ + parentId: string; + channelCode: string; + channel: string; + ips: string; + permType: 'read-only' | 'read-and-write'; + permissions: AccountPermissionV3[]; + regisTime: string; +} ⋮---- -/** Your API secret */ +/** Only set when the calling account is a sub-account */ ⋮---- -/** The passphrase you set when creating the API Key (NOT your account password) */ +export type AccountLevelV3 = 'basic' | 'advanced' | 'isolated' | 'delta'; ⋮---- -/** - * Set to `true` to connect to Bitget's demo trading WebSockets: - * - * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket - * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading - */ +export interface AccountSettingsV3 { + uid: string; + accountMode: 'unified' | 'hybrid' | 'upgrading' | 'switching'; + assetMode: string; + accountLevel: AccountLevelV3; + holdMode: string; + stpMode: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; + symbolConfigList: AccountSymbolConfigV3[]; + coinConfigList: AccountCoinConfigV3[]; +} ⋮---- -/** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ +export interface AccountDeltaCoinPositionV3 { + coin: string; + positionRatio: string; +} ⋮---- -// Disable ping/pong ws heartbeat mechanism (not recommended) +/** Delta-neutral mode metrics. Only available when accountLevel is delta. */ +export interface AccountDeltaInfoV3 { + deltaEquityRatio: string; + deltaThreshold: string; + positionThreshold: string; + list: AccountDeltaCoinPositionV3[]; +} ⋮---- -/** How often to check if the connection is alive */ +export interface AccountAssetV3 { + coin: string; + equity: string; + usdValue: string; + balance: string; + available: string; + debt: string; + locked: string; + /** Position value in USD */ + positionValue?: string; + /** Account leverage (non-negative) */ + leverage?: string; + /** USDT bonus amount */ + bonus?: string; +} ⋮---- -/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ +/** Position value in USD */ ⋮---- -/** Delay in milliseconds before respawning the connection */ +/** Account leverage (non-negative) */ ⋮---- -/** - * 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. - */ +/** USDT bonus amount */ ⋮---- -export interface WebsocketClientOptions extends WSClientConfigurableOptions { - pingInterval: number; - pongTimeout: number; - reconnectTimeout: number; - recvWindow: number; - authPrivateConnectionsOnConnect: boolean; - authPrivateRequests: boolean; +export interface AccountAssetsV3 { + accountEquity: string; + usdtEquity: string; + btcEquity: string; + unrealisedPnl: string; + usdtUnrealisedPnl: string; + btcUnrealizedPnl: string; + effEquity: string; + mmr: string; + imr: string; + mgnRatio: string; + positionMgnRatio: string; + assets: AccountAssetV3[]; } - -================ -File: src/types/request/v3/account.ts -================ -// Account Management Request Types ⋮---- -export type AccountAdjustModeV3 = 'basic' | 'advanced' | 'delta' | 'isolated'; -⋮---- -export interface AdjustAccountModeRequestV3 { - mode: AccountAdjustModeV3; - /** Sub-account UID when the master account switches mode for a sub-account */ - targetUid?: string; +export interface ConvertRecordV3 { + fromCoin: string; + fromCoinSize: string; + toCoin: string; + toCoinSize: string; + price: string; + ts: string; } ⋮---- -/** Sub-account UID when the master account switches mode for a sub-account */ -⋮---- -export interface SetLeverageRequestV3 { - category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - leverage: string; - coin?: string; - posSide?: 'long' | 'short'; - /** Futures only. Defaults to crossed */ - marginMode?: 'crossed' | 'isolated'; - /** Isolated two-way mode: long leverage. Takes priority over leverage when both set */ - longLeverage?: string; - /** Isolated two-way mode: short leverage. Takes priority over leverage when both set */ - shortLeverage?: string; +export interface FinancialRecordV3 { + category: string; + id: string; + symbol: string; + coin: string; + type: string; + amount: string; + fee: string; + balance: string; + ts: string; + /** crossed | isolated */ + positionType?: string; + positionAmount?: string; + positionBalance?: string; } ⋮---- -/** Futures only. Defaults to crossed */ -⋮---- -/** Isolated two-way mode: long leverage. Takes priority over leverage when both set */ -⋮---- -/** Isolated two-way mode: short leverage. Takes priority over leverage when both set */ -⋮---- -export interface GetAllFeeRatesRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; -} +/** crossed | isolated */ ⋮---- -export interface GetConvertRecordsRequestV3 { - fromCoin?: string; - toCoin?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +export interface PaymentCoinV3 { + coin: string; + size: string; + amount: string; } ⋮---- -export interface GetFinancialRecordsRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - coin?: string; - type?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +export interface RepayableCoinV3 { + coin: string; + size: string; + amount: string; } ⋮---- -export interface RepayRequestV3 { - repayableCoinList: string[]; - paymentCoinList: string[]; +export interface RepayResponseV3 { + result: string; + repayAmount: string; } ⋮---- -// Sub-account Management Request Types +// Sub-account Management Response Types ⋮---- -export interface CreateSubAccountApiKeyRequestV3 { - subUid: string; +export interface CreateSubAccountApiKeyResponseV3 { note: string; - type: 'read_write' | 'read_only'; - passphrase: string; + apiKey: string; + secret: string; + type: string; + permissions: string[]; + ips: string[]; +} +export interface SubAccountApiKeyV3 { + apiKey: string; + note: string; + type: string; permissions: string[]; ips: string[]; + ts?: string; } ⋮---- -export interface DeleteSubAccountApiKeyRequestV3 { +export interface UpdateSubAccountApiKeyResponseV3 { + note: string; apiKey: string; + type: string; + permissions: string[]; + ips: string[]; } ⋮---- -export interface GetSubAccountApiKeysRequestV3 { +export interface CreateSubAccountResponseV3 { + username: string; subUid: string; - limit?: string; - cursor?: string; + status: string; + note: string; + createdTime: string; + updatedTime: string; } ⋮---- -export interface UpdateSubAccountApiKeyRequestV3 { +export interface CreateAgentSubAccountResponseV3 { + username: string; + subUid: string; apiKey: string; - passphrase: string; - type?: 'read_write' | 'read_only'; - permissions?: string[]; - ips?: string[]; + secret: string; + note: string; + createdTime: string; } ⋮---- -export interface CreateSubAccountRequestV3 { +export interface SubAccountV3 { + subUid: string; username: string; - accountMode?: 'classic' | 'unified'; - note?: string; + status: string; + accountMode: string; + type: 'normal' | 'virtual' | 'custodian'; + note: string; + createdTime: string; + updatedTime: string; } ⋮---- -export interface FreezeSubAccountRequestV3 { - subUid: string; - operation: 'freeze' | 'unfreeze'; +export interface WithdrawAddressBookEntryV3 { + coin: string; + chain: string; + address: string; + countryCode: string; + label: string; + memo: string; + type: 'regular' | 'EVM' | 'universal' | 'internal'; + internalType: '' | 'uid' | 'mobile' | 'email'; + createdTime: string; } ⋮---- -export interface GetSubAccountListRequestV3 { - limit?: string; +export interface WithdrawAddressBookV3 { + addressList: WithdrawAddressBookEntryV3[]; cursor?: string; } ⋮---- -// Transfer Request Types -⋮---- -export interface TransferRequestV3 { - clientOid?: string; - fromType: - | 'spot' - | 'p2p' - | 'coin-futures' - | 'usdt-futures' - | 'usdc-futures' - | 'crossed-margin' - | 'isolated-margin' - | 'uta'; - toType: - | 'spot' - | 'p2p' - | 'coin-futures' - | 'usdt-futures' - | 'usdc-futures' - | 'crossed-margin' - | 'isolated-margin' - | 'uta'; - amount: string; - coin: string; - symbol?: string; - /** Enable automatic margin borrowing when balance insufficient. yes | no */ - allowBorrow?: 'yes' | 'no'; -} -⋮---- -/** Enable automatic margin borrowing when balance insufficient. yes | no */ +// Transfer Response Types ⋮---- -export interface GetTransferableCoinsRequestV3 { - fromType: - | 'spot' - | 'p2p' - | 'coin-futures' - | 'usdt-futures' - | 'usdc-futures' - | 'crossed-margin' - | 'isolated-margin' - | 'uta'; - toType: - | 'spot' - | 'p2p' - | 'coin-futures' - | 'usdt-futures' - | 'usdc-futures' - | 'crossed-margin' - | 'isolated-margin' - | 'uta'; +export interface AllSymbolFeeRateV3 { + symbol: string; + makerFeeRate: string; + takerFeeRate: string; } ⋮---- -export interface GetSubTransferRecordsRequestV3 { - subUid?: string; - role?: 'initiator' | 'receiver'; - coin?: string; - startTime?: string; - endTime?: string; +export interface TransferResponseV3 { + transferId: string; clientOid?: string; - limit?: string; - cursor?: string; } ⋮---- -export interface SubAccountTransferRequestV3 { - fromType: - | 'spot' - | 'p2p' - | 'usdt_futures' - | 'coin_futures' - | 'usdc_futures' - | 'crossed_margin' - | 'uta'; - toType: - | 'spot' - | 'p2p' - | 'usdt_futures' - | 'coin_futures' - | 'usdc_futures' - | 'crossed_margin' - | 'uta'; +export interface SubTransferRecordV3 { + transferId: string; + oldTransferId?: string; + fromType: string; + toType: string; amount: string; coin: string; fromUserId: string; toUserId: string; + status: string; clientOid: string; - /** Enable automatic margin borrowing when balance insufficient. yes | no */ - allowBorrow?: 'yes' | 'no'; + createdTime: string; + updatedTime: string; } ⋮---- -/** Enable automatic margin borrowing when balance insufficient. yes | no */ -⋮---- -export interface GetSubUnifiedAssetsRequestV3 { - subUid?: string; - cursor?: string; - limit?: string; +export interface SubUnifiedAssetV3 { + coin: string; + equity: string; + usdValue: string; + balance: string; + available: string; + debt: string; + locked: string; } ⋮---- -export interface GetFeeRateRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol: string; +export interface SubUnifiedAssetV3 { + subUid: string; + cursor: string; + assets: SubUnifiedAssetV3[]; } ⋮---- -export interface GetFundingAssetsRequestV3 { - coin?: string; +export interface GetFeeRateResponseV3 { + makerFeeRate: string; + takerFeeRate: string; } ⋮---- -export interface SwitchDeductRequestV3 { - deduct: 'on' | 'off'; +export interface FundingAssetV3 { + coin: string; + available: string; + frozen: string; + balance: string; } ⋮---- -// Deposit Request Types +// Deposit Response Types ⋮---- -export interface GetDepositAddressRequestV3 { +export interface DepositAddressV3 { + address: string; + chain: string; coin: string; - chain?: string; - size?: string; + tag: string; + url: string; } ⋮---- -export interface GetSubDepositAddressRequestV3 { - subUid: string; +export interface DepositRecordV3 { + orderId: string; + recordId: string; coin: string; - chain?: string; - size?: string; + type: 'deposit'; + dest: 'on_chain' | 'internal_transfer'; + size: string; + status: 'pending' | 'success' | 'fail'; + fromAddress: string; + toAddress: string; + chain: string; + createdTime: string; + updatedTime: string; } ⋮---- -export interface GetDepositRecordsRequestV3 { - coin?: string; - orderId?: string; - startTime: string; - endTime: string; - limit?: string; - cursor?: string; -} +// Withdraw Response Types ⋮---- -export interface GetSubDepositRecordsRequestV3 { - coin?: string; - subUid: string; - startTime: string; - endTime: string; - limit?: string; - cursor?: string; +export interface WithdrawResponseV3 { + orderId: string; + clientOid: string; } ⋮---- -// Withdraw Request Types -⋮---- -export interface WithdrawRequestV3 { +export interface WithdrawRecordV3 { + orderId: string; + clientOid: string; + recordId: string; coin: string; - chain?: string; - /** Deduct from funding, uta, and/or otc accounts (comma-separated). Order: funding -> otc -> uta */ - accountType?: string; - transferType: 'on_chain' | 'internal_transfer'; - address: string; - innerToType?: 'uid' | 'email' | 'mobile'; - areaCode?: string; - tag?: string; + type: 'withdraw'; + dest: 'on_chain' | 'internal_transfer'; size: string; - remark?: string; - clientOid?: string; - memberCode?: 'bithumb' | 'korbit' | 'coinone'; - identityType?: 'company' | 'user'; - companyName?: string; - firstName?: string; - lastName?: string; + status: 'pending' | 'success' | 'fail'; + fromAddress: string; + toAddress: string; + chain: string; + fee: string; + confirm: string; + tag: string; + createdTime: string; + updatedTime: string; } ⋮---- -/** Deduct from funding, uta, and/or otc accounts (comma-separated). Order: funding -> otc -> uta */ +export interface MaxTransferableV3 { + coin: string; + maxTransfer: string; + borrowMaxTransfer: string; +} ⋮---- -export interface GetWithdrawRecordsRequestV3 { - coin?: string; - orderId?: string; - clientOid?: string; - startTime: string; - endTime: string; - limit?: string; - cursor?: string; +export interface OpenInterestLimitV3 { + symbol: string; + singleUserLimit: string; + masterSubLimit: string; + marketMakerLimit: string; } ⋮---- -export interface GetWithdrawAddressBookRequestV3 { - coin?: string; - type?: 'EVM' | 'regular' | 'universal' | 'internal'; - limit?: string; - cursor?: string; -} -⋮---- -export interface CancelWithdrawalRequestV3 { - orderId?: string; - clientOid?: string; -} -⋮---- -export interface SetDepositAccountRequestV3 { - coin: string; - accountType: 'funding' | 'unified' | 'otc'; -} -⋮---- -export interface GetMaxTransferableRequestV3 { +export interface TaxRecordV3 { + id: string; coin: string; + type: string; + amount: string; + fee: string; + balance: string; + ts: string; } ⋮---- -export interface GetOpenInterestLimitRequestV3 { - symbol: string; - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; -} -⋮---- -export interface GetTaxRecordsRequestV3 { - bizType: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES' - | 'OTHER'; - marginType?: 'isolated' | 'crossed'; - coin?: string; - startTime: string; - endTime: string; - limit?: string; - cursor?: string; -} -⋮---- -export type CollateralTypeV3 = 'mainstream' | 'all' | 'custom'; -⋮---- -export interface SetCollateralTypeRequestV3 { +export interface CollateralTypeConfigV3 { collateralType: CollateralTypeV3; - /** Required when collateralType=custom. Comma-separated coin names */ + /** Returned when collateralType=custom */ collateralCoins?: string; } ⋮---- -/** Required when collateralType=custom. Comma-separated coin names */ +/** Returned when collateralType=custom */ ⋮---- -export interface PreSetLeverageRequestV3 { - category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - coin?: string; - marginMode: 'isolated' | 'cross'; - leverage?: string; - longLeverage?: string; - shortLeverage?: string; +export interface CustomCollateralCoinV3 { + collateralCoin: string; } ⋮---- -export interface SetMarginRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - posSide: 'long' | 'short'; - operation: 'add' | 'remove'; - amount: string; +export interface PreSetLeverageV3 { + estMaxOpen?: string; + estMaxBorrowable?: string; + requiredMargin: string; + marginChange: string; } ⋮---- -export interface GetMaxWithdrawalRequestV3 { +export interface MaxWithdrawalV3 { coin: string; -} - -================ -File: src/types/response/v3/public.ts -================ -export interface PublicFillV3 { - execId: string; - price: string; - size: string; - side: 'sell' | 'buy'; - ts: string; + otcMaxWithdrawal: string; + spotMaxWithdrawal: string; + utaMaxWithdrawal: string; + totalMaxWithdrawal: string; } ⋮---- -export interface CandlestickV3 extends Array { - 0: string; // timestamp - 1: string; // open price - 2: string; // high price - 3: string; // low price - 4: string; // close price - 5: string; // volume - 6: string; // turnover +export interface MovePositionOrderResultV3 { + orderId: string; + clientOid: string; + code: string; + msg: string; } ⋮---- -0: string; // timestamp -1: string; // open price -2: string; // high price -3: string; // low price -4: string; // close price -5: string; // volume -6: string; // turnover +export interface MovePositionsResponseV3 { + closePosition: MovePositionOrderResultV3[]; + openPosition: MovePositionOrderResultV3[]; +} ⋮---- -export interface ContractOiV3 { +export interface MovePositionHistoryV3 { + category: string; + fromUid: string; + toUid: string; + orderId: string; + openExecId: string; + closeExecId: string; symbol: string; - notionalValue: string; - totalNotionalValue: string; + posSide: 'long' | 'short'; + qty: string; + price: string; + status: 'processing' | 'completed' | 'failed'; + createdTime: string; + updatedTime: string; } ⋮---- -export interface CurrentFundingRateV3 { +export interface EligibleSymbolV3 { symbol: string; - fundingRate: string; - fundingRateInterval: string; - nextUpdate: string; - minFundingRate: string; - maxFundingRate: string; - cashDividend?: string; - cashDividendNextUpdate?: string; + category: string; + baseCoin: string; + quoteCoin: string; + symbolType?: string; + buyLimitPriceRatio: string; + sellLimitPriceRatio: string; + minOrderQty: string; + maxOrderQty: string; + pricePrecision: string; + quantityPrecision: string; + quotePrecision: string; + minOrderAmount: string; + maxSymbolOrderNum: string; + maxProductOrderNum: string; + status: string; + maintainTime: string; + areaSymbol?: string; + maxPositionNum?: string; + isReality?: string; + launchTime?: string; } ⋮---- -export interface DiscountRateTierV3 { - tierStartValue: string; - discountRate: string; +export interface EligibleMarginTierItemV3 { + tier: string; + minTierValue: string; + maxTierValue: string; + leverage: string; + mmr: string; } ⋮---- -export interface DiscountRateV3 { +export interface EligibleMarginTierV3 { coin: string; - list: DiscountRateTierV3[]; + tiers: EligibleMarginTierItemV3[]; } ⋮---- -export interface HistoryFundingRateV3 { - symbol: string; - fundingRate: string; - fundingRateTimestamp: string; -} -⋮---- -export interface MarginLoanV3 { - dailyInterest: string; - annualInterest: string; +export interface EligibleLoanInfoV3 { limit: string; + masterSubLimit: string; + /** Bitget spelling */ + platformRemaingQuota: string; } ⋮---- -export interface OpenInterestItemV3 { - symbol: string; - openInterest: string; -} +/** Bitget spelling */ ⋮---- -export interface OpenInterestV3 { - list: OpenInterestItemV3[]; - ts: string; +export interface RateLimitQuotaItemV3 { + uid: string; + quota: string; } ⋮---- -export interface PositionTierV3 { - tier: string; - minTierValue: string; - maxTierValue: string; - leverage: string; - mmr: string; +export interface RateLimitQuotaV3 { + category: 'spot' | 'futures' | string; + quotaList: RateLimitQuotaItemV3[]; + masterSubQuota: string; + masterSubCap: string; + cursor: string; } + +================ +File: src/types/websockets/ws-general.ts +================ +import type { ClientRequestArgs } from 'http'; +import WebSocket from 'isomorphic-ws'; ⋮---- -export interface RiskReserveRecordV3 { - balance: string; - amount: string; - ts: string; - type?: string; -} +import { RestClientOptions } from '../../util/requestUtils.js'; +import { WS_KEY_MAP } from '../../util/websocket-util.js'; +import { FuturesProductTypeV2 } from '../request/shared.js'; ⋮---- -export interface RiskReserveV3 { - totalBalance?: string; - coin: string; - riskReserveRecords: RiskReserveRecordV3[]; -} +export type BitgetInstType = 'SP' | 'SPBL' | 'MC' | 'UMCBL' | 'DMCBL'; +export type BitgetInstTypeV2 = 'SPOT' | FuturesProductTypeV2; +export type BitgetInstTypeV3 = + | 'UTA' // for account-level topics + | 'spot' + | 'usdt-futures' + | 'coin-futures' + | 'usdc-futures'; ⋮---- -export interface RiskReserveHourRecordV3 { - amount: string; - balance: string; - ts: string; -} +| 'UTA' // for account-level topics ⋮---- -export interface RiskReserveHourV3 { - coin: string; - riskReserveRecords: RiskReserveHourRecordV3[]; -} +/** + * + * V1 list of topics for WebSocket consumers + * + */ ⋮---- -export interface RiskReserveAllItemV3 { - symbols: string[]; - coin: string; - balance: string; -} +export type WsPublicSpotTopic = + | 'ticker' + | 'candle1W' + | 'candle1D' + | 'candle12H' + | 'candle4H' + | 'candle1H' + | 'candle30m' + | 'candle15m' + | 'candle5m' + | 'candle1m' + | 'books' + | 'books5' + | 'trade'; ⋮---- -export interface RiskReserveAllV3 { - list: RiskReserveAllItemV3[]; -} +// Futures currently has the same public topics as spot +export type WsPublicFuturesTopic = WsPublicSpotTopic; +export type WsPrivateSpotTopic = 'account' | 'orders'; ⋮---- -export interface InstrumentV3 { - symbol: string; - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - baseCoin: string; - quoteCoin: string; - buyLimitPriceRatio: string; - sellLimitPriceRatio: string; - feeRateUpRatio: string; - minOrderQty: string; - maxOrderQty: string; - maxMarketOrderQty: string; - pricePrecision: string; - quantityPrecision: string; - quotePrecision: string; - minOrderAmount: string; - maxSymbolOrderNum: string; - maxProductOrderNum: string; - status: - | 'listed' - | 'online' - | 'limit_open' - | 'limit_close' - | 'offline' - | 'restrictedAPI'; - offTime: string; - limitOpenTime: string; - maintainTime: string; - areaSymbol?: string; - - /** yes = Reality stock token, no = non-Reality stock token */ - isReality?: 'yes' | 'no'; - - // Futures specific fields - makerFeeRate?: string; - takerFeeRate?: string; - openCostUpRatio?: string; - priceMultiplier?: string; - quantityMultiplier?: string; - symbolType?: 'perpetual' | 'delivery'; - maxPositionNum?: string; - deliveryTime?: string; - deliveryStartTime?: string; - deliveryPeriod?: string; - /** Launch time - Unix millisecond timestamp. Null for some margin pairs. */ - launchTime?: string | null; - fundInterval?: string; - minLeverage?: string; - maxLeverage?: string; - - // Margin specific fields - isIsolatedBaseBorrowable?: 'YES' | 'NO'; - isIsolatedQuotedBorrowable?: 'YES' | 'NO'; - warningRiskRatio?: string; - liquidationRiskRatio?: string; - maxCrossedLeverage?: string; - maxIsolatedLeverage?: string; - userMinBorrow?: string; -} +export type WsPrivateFuturesTopic = + | 'account' + | 'positions' + | 'orders' + | 'ordersAlgo'; ⋮---- -/** yes = Reality stock token, no = non-Reality stock token */ +export type WsPublicTopic = WsPublicSpotTopic | WsPublicFuturesTopic; ⋮---- -// Futures specific fields +export type WsPrivateTopic = WsPrivateSpotTopic | WsPrivateFuturesTopic; +export type WsTopic = WsPublicTopic | WsPrivateTopic; ⋮---- -/** Launch time - Unix millisecond timestamp. Null for some margin pairs. */ +/** + * + * V2 list of topics for WebSocket consumers + * + */ ⋮---- -// Margin specific fields +export type WsPublicTopicV2 = + | 'index-price' // margin only + | 'ticker' + | 'candle1m' + | 'candle5m' + | 'candle15m' + | 'candle30m' + | 'candle1H' + | 'candle4H' + | 'candle6H' + | 'candle12H' + | 'candle1D' + | 'candle3D' + | 'candle1W' + | 'candle1M' + | 'candle6Hutc' + | 'candle12Hutc' + | 'candle1Dutc' + | 'candle3Dutc' + | 'candle1Wutc' + | 'candle1Mutc' + | 'trade' + | 'books' + | 'books1' + | 'books5' + | 'books15'; ⋮---- -export interface MarketFeeGroupLabelV3 { - weight: string; - label: string; - symbols: string[]; -} +| 'index-price' // margin only ⋮---- -export interface MarketFeeGroupTierV3 { - level: string; - makerFeeRate: string; - /** PRO1~PRO6 only. Taker fee rate in decimal form */ - takerFeeRate?: string; -} +// Also update PRIVATE_TOPICS_V2 if this is updated +export type WSPrivateTopicFuturesV2 = + | 'positions' + | 'orders-algo' + | 'positions-history'; ⋮---- -/** PRO1~PRO6 only. Taker fee rate in decimal form */ +// Also update PRIVATE_TOPICS_V2 if this is updated +export type WSPrivateTopicMarginV2 = + | 'orders-crossed' + | 'account-crossed' + | 'account-isolated' + | 'orders-isolated'; ⋮---- -export interface MarketFeeGroupV3 { - category: string; - group: string; - labelList: MarketFeeGroupLabelV3[]; - tierList: MarketFeeGroupTierV3[]; -} +// Also update PRIVATE_TOPICS_V2 if this is updated +export type WsPrivateTopicV2 = + | 'account' + | 'orders' + | WSPrivateTopicFuturesV2 + | WSPrivateTopicMarginV2; ⋮---- -export interface MarketScoreWeightV3 { - category: string; - label: string; - symbol: string; - requiredSpread: string; - minMakerVolume: string; - weight: string; -} +export type WsTopicV2 = WsPublicTopicV2 | WsPrivateTopicV2; ⋮---- -export interface LiquidationV3 { - symbol: string; - side: 'buy' | 'sell'; - price: string; - amount: string; - ts: string; -} +/** + * + * V3 / UTA list of topics for WebSocket consumers + * + */ +export type WsPublicTopicV3 = 'ticker' | 'kline' | 'books' | 'publicTrade'; +// Also update PRIVATE_TOPICS_V3 if this is updated +export type WsPrivateTopicV3 = + | 'account' + | 'position' + | 'fill' + | 'order' + | 'strategy-order' + | 'reality-orderbook'; +export type WsTopicV3 = WsPublicTopicV3 | WsPrivateTopicV3; ⋮---- -export interface LiquidationsV3 { - list: LiquidationV3[]; - cursor?: string; -} +/** This is used to differentiate between each of the available websocket streams */ +export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP]; ⋮---- -export interface OrderBookV3 { - a: string[][]; // asks - [price, size] - b: string[][]; // bids - [price, size] - ts: string; +/** + * Event args for subscribing/unsubscribing + */ +⋮---- +export interface WsTopicSubscribeEventArgs { + instType: BitgetInstType; + channel: WsTopic; + instId?: string; } ⋮---- -a: string[][]; // asks - [price, size] -b: string[][]; // bids - [price, size] +export type WsTopicSubscribePublicArgsV2 = { + instType: BitgetInstTypeV2; + channel: WsPublicTopicV2; + /** The symbol, e.g. "BTCUSDT" */ + instId: string; +}; ⋮---- -export interface TickerV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - lastPrice: string; - openPrice24h: string; - highPrice24h: string; - lowPrice24h: string; - ask1Price: string; - bid1Price: string; - bid1Size: string; - ask1Size: string; - price24hPcnt: string; - volume24h: string; - turnover24h: string; - - // Futures specific fields - indexPrice?: string; - markPrice?: string; - fundingRate?: string; - openInterest?: string; - deliveryStartTime?: string; - deliveryTime?: string; - deliveryStatus?: string; -} +/** The symbol, e.g. "BTCUSDT" */ ⋮---- -// Futures specific fields +export type WsInstIdChannelsV2 = + | 'orders' + | WSPrivateTopicFuturesV2 + | 'orders-crossed' + | 'orders-isolated'; ⋮---- -export interface ProofOfReservesV3 { - merkleRootHash: string; - totalReserveRatio: string; - list: { - coin: string; - userAssets: string; - platformAssets: string; - reserveRatio: string; - }[]; -} +export type WsTopicSubscribePrivateInstIdArgsV2 = { + instType: BitgetInstTypeV2; + channel: WsInstIdChannelsV2; + /** The symbol, e.g. "BTCUSDT" */ + instId?: string; +}; ⋮---- -export interface IndexComponentV3 { - exchange: string; - spotPair: string; - equivalentPrice: string; - weight: string; -} +/** The symbol, e.g. "BTCUSDT" */ ⋮---- -export interface IndexPriceComponentsV3 { - symbol: string; - componentList: IndexComponentV3[]; -} +export type WsCoinChannelsV2 = + | 'account' + | 'account-crossed' + | 'account-isolated'; ⋮---- -export interface RpiSymbolV3 { - category: 'spot' | 'usdt-futures' | 'coin-futures' | 'usdc-futures'; - symbol: string; -} +export type WsTopicSubscribePrivateCoinArgsV2 = { + instType: BitgetInstTypeV2; + channel: WsCoinChannelsV2; + coin: 'default' | string; +}; ⋮---- -/** RPI order book depth: [price, nonRpiQty, rpiQty] */ -export interface RpiOrderBookV3 { - a: [string, string, string][]; - b: [string, string, string][]; - ts: string; +export type WsTopicSubscribePrivateArgsV2 = + | WsTopicSubscribePrivateInstIdArgsV2 + | WsTopicSubscribePrivateCoinArgsV2; +⋮---- +export type WsTopicSubscribeEventArgsV2 = + | WsTopicSubscribePublicArgsV2 + | WsTopicSubscribePrivateArgsV2; +⋮---- +/** General configuration for the WebsocketClient */ +export interface WSClientConfigurableOptions { + /** Your API key */ + apiKey?: string; + + /** Your API secret */ + apiSecret?: string; + + /** The passphrase you set when creating the API Key (NOT your account password) */ + apiPass?: string; + + /** + * Set to `true` to connect to Bitget's demo trading WebSockets: + * + * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket + * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading + */ + demoTrading?: boolean; + + /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ + recvWindow?: number; + + // Disable ping/pong ws heartbeat mechanism (not recommended) + disableHeartbeat?: boolean; + + /** 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; + + requestOptions?: RestClientOptions; + + wsOptions?: { + protocols?: string[]; + agent?: any; + } & ( + | Omit, 'agent'> + | Omit, 'agent'> + ); + + wsUrl?: 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. + */ + customSignMessageFn?: (message: string, secret: string) => Promise; } ⋮---- -export interface CashDividendRecordV3 { - symbol: string; - exDividendDate: string; - cashDividendPerShare: string; - cashDividendTimestamp: string; +/** Your API key */ +⋮---- +/** Your API secret */ +⋮---- +/** The passphrase you set when creating the API Key (NOT your account password) */ +⋮---- +/** + * Set to `true` to connect to Bitget's demo trading WebSockets: + * + * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket + * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading + */ +⋮---- +/** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ +⋮---- +// Disable ping/pong ws heartbeat mechanism (not recommended) +⋮---- +/** How often to check if the connection is alive */ +⋮---- +/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ +⋮---- +/** Delay in milliseconds before respawning the connection */ +⋮---- +/** + * 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 WebsocketClientOptions extends WSClientConfigurableOptions { + pingInterval: number; + pongTimeout: number; + reconnectTimeout: number; + recvWindow: number; + authPrivateConnectionsOnConnect: boolean; + authPrivateRequests: boolean; } + +================ +File: src/index.ts +================ + + +================ +File: src/types/request/v3/account.ts +================ +// Account Management Request Types ⋮---- -export interface SpotWhaleFlowV3 { - volume: string; - date: string; +export type AccountAdjustModeV3 = 'basic' | 'advanced' | 'delta' | 'isolated'; +⋮---- +export interface AdjustAccountModeRequestV3 { + mode: AccountAdjustModeV3; + /** Sub-account UID when the master account switches mode for a sub-account */ + targetUid?: string; } ⋮---- -export interface SpotNetFlowV3 { - netFlow: string; - ts: string; +/** Sub-account UID when the master account switches mode for a sub-account */ +⋮---- +export interface SetLeverageRequestV3 { + category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + leverage: string; + coin?: string; + posSide?: 'long' | 'short'; + /** Futures only. Defaults to crossed */ + marginMode?: 'crossed' | 'isolated'; + /** Isolated two-way mode: long leverage. Takes priority over leverage when both set */ + longLeverage?: string; + /** Isolated two-way mode: short leverage. Takes priority over leverage when both set */ + shortLeverage?: string; } ⋮---- -export interface SpotFundFlowV3 { - whaleBuyVolume: string; - dolphinBuyVolume: string; - fishBuyVolume: string; - whaleSellVolume: string; - dolphinSellVolume: string; - fishSellVolume: string; - whaleBuyRatio: string; - dolphinBuyRatio: string; - fishBuyRatio: string; - whaleSellRatio: string; - dolphinSellRatio: string; - fishSellRatio: string; +/** Futures only. Defaults to crossed */ +⋮---- +/** Isolated two-way mode: long leverage. Takes priority over leverage when both set */ +⋮---- +/** Isolated two-way mode: short leverage. Takes priority over leverage when both set */ +⋮---- +export interface GetAllFeeRatesRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; } ⋮---- -export interface MarginLongShortV3 { - longShortRatio: string; - ts: string; +export interface GetConvertRecordsRequestV3 { + fromCoin?: string; + toCoin?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface MarginLoanGrowthV3 { - growthRate: string; - ts: string; +export interface GetFinancialRecordsRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + coin?: string; + type?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface MarginIsolatedBorrowV3 { - borrowRate: string; - ts: string; +export interface RepayRequestV3 { + repayableCoinList: string[]; + paymentCoinList: string[]; } ⋮---- -export interface FuturesActiveBuySellV3 { - buyVolume: string; - sellVolume: string; - ts: string; +// Sub-account Management Request Types +⋮---- +export interface CreateSubAccountApiKeyRequestV3 { + subUid: string; + note: string; + type: 'read_write' | 'read_only'; + passphrase: string; + permissions: string[]; + ips: string[]; } ⋮---- -export interface FuturesLongShortV3 { - longRatio: string; - shortRatio: string; - longShortRatio: string; - ts: string; +export interface DeleteSubAccountApiKeyRequestV3 { + apiKey: string; } ⋮---- -export interface FuturesPositionLongShortV3 { - longPositionRatio: string; - shortPositionRatio: string; - longShortPositionRatio: string; - ts: string; +export interface GetSubAccountApiKeysRequestV3 { + subUid: string; + limit?: string; + cursor?: string; } ⋮---- -export interface FuturesAccountLongShortV3 { - longAccountRatio: string; - shortAccountRatio: string; - longShortAccountRatio: string; - ts: string; +export interface UpdateSubAccountApiKeyRequestV3 { + apiKey: string; + passphrase: string; + type?: 'read_write' | 'read_only'; + permissions?: string[]; + ips?: string[]; +} +⋮---- +export interface CreateSubAccountRequestV3 { + username: string; + accountMode?: 'classic' | 'unified'; + note?: string; +} +⋮---- +export interface FreezeSubAccountRequestV3 { + subUid: string; + operation: 'freeze' | 'unfreeze'; +} +⋮---- +export interface GetSubAccountListRequestV3 { + limit?: string; + cursor?: string; +} +⋮---- +// Transfer Request Types +⋮---- +export interface TransferRequestV3 { + clientOid?: string; + fromType: + | 'spot' + | 'p2p' + | 'coin_futures' + | 'usdt_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'isolated_margin' + | 'uta'; + toType: + | 'spot' + | 'p2p' + | 'coin_futures' + | 'usdt_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'isolated_margin' + | 'uta'; + amount: string; + coin: string; + symbol?: string; + /** Enable automatic margin borrowing when balance insufficient. yes | no */ + allowBorrow?: 'yes' | 'no'; +} +⋮---- +/** Enable automatic margin borrowing when balance insufficient. yes | no */ +⋮---- +export interface GetTransferableCoinsRequestV3 { + fromType: + | 'spot' + | 'p2p' + | 'coin_futures' + | 'usdt_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'isolated_margin' + | 'uta'; + toType: + | 'spot' + | 'p2p' + | 'coin_futures' + | 'usdt_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'isolated_margin' + | 'uta'; +} +⋮---- +export interface GetSubTransferRecordsRequestV3 { + subUid?: string; + role?: 'initiator' | 'receiver'; + coin?: string; + startTime?: string; + endTime?: string; + clientOid?: string; + limit?: string; + cursor?: string; +} +⋮---- +export interface SubAccountTransferRequestV3 { + fromType: + | 'spot' + | 'p2p' + | 'usdt_futures' + | 'coin_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'uta'; + toType: + | 'spot' + | 'p2p' + | 'usdt_futures' + | 'coin_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'uta'; + amount: string; + coin: string; + fromUserId: string; + toUserId: string; + clientOid: string; + /** Enable automatic margin borrowing when balance insufficient. yes | no */ + allowBorrow?: 'yes' | 'no'; +} +⋮---- +/** Enable automatic margin borrowing when balance insufficient. yes | no */ +⋮---- +export interface GetSubUnifiedAssetsRequestV3 { + subUid?: string; + cursor?: string; + limit?: string; +} +⋮---- +export interface GetFeeRateRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol: string; +} +⋮---- +export interface GetFundingAssetsRequestV3 { + coin?: string; +} +⋮---- +export interface SwitchDeductRequestV3 { + deduct: 'on' | 'off'; +} +⋮---- +// Deposit Request Types +⋮---- +export interface GetDepositAddressRequestV3 { + coin: string; + chain?: string; + size?: string; +} +⋮---- +export interface GetSubDepositAddressRequestV3 { + subUid: string; + coin: string; + chain?: string; + size?: string; +} +⋮---- +export interface GetDepositRecordsRequestV3 { + coin?: string; + orderId?: string; + startTime: string; + endTime: string; + limit?: string; + cursor?: string; +} +⋮---- +export interface GetSubDepositRecordsRequestV3 { + coin?: string; + subUid: string; + startTime: string; + endTime: string; + limit?: string; + cursor?: string; +} +⋮---- +// Withdraw Request Types +⋮---- +export interface WithdrawRequestV3 { + coin: string; + chain?: string; + /** Deduct from funding, uta, and/or otc accounts (comma-separated). Order: funding -> otc -> uta */ + accountType?: string; + transferType: 'on_chain' | 'internal_transfer'; + address: string; + innerToType?: 'uid' | 'email' | 'mobile'; + areaCode?: string; + tag?: string; + size: string; + remark?: string; + clientOid?: string; + memberCode?: 'bithumb' | 'korbit' | 'coinone'; + identityType?: 'company' | 'user'; + companyName?: string; + firstName?: string; + lastName?: string; +} +⋮---- +/** Deduct from funding, uta, and/or otc accounts (comma-separated). Order: funding -> otc -> uta */ +⋮---- +export interface GetWithdrawRecordsRequestV3 { + coin?: string; + orderId?: string; + clientOid?: string; + startTime: string; + endTime: string; + limit?: string; + cursor?: string; +} +⋮---- +export interface GetWithdrawAddressBookRequestV3 { + coin?: string; + type?: 'EVM' | 'regular' | 'universal' | 'internal'; + limit?: string; + cursor?: string; +} +⋮---- +export interface CancelWithdrawalRequestV3 { + orderId?: string; + clientOid?: string; +} +⋮---- +export interface SetDepositAccountRequestV3 { + coin: string; + accountType: 'funding' | 'unified' | 'otc'; +} +⋮---- +export interface GetMaxTransferableRequestV3 { + coin: string; +} +⋮---- +export interface GetOpenInterestLimitRequestV3 { + symbol: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +} +⋮---- +export interface GetTaxRecordsRequestV3 { + bizType: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES' + | 'OTHER'; + marginType?: 'isolated' | 'crossed'; + coin?: string; + startTime: string; + endTime: string; + limit?: string; + cursor?: string; +} +⋮---- +export type CollateralTypeV3 = 'mainstream' | 'all' | 'custom'; +⋮---- +export interface SetCollateralTypeRequestV3 { + collateralType: CollateralTypeV3; + /** Required when collateralType=custom. Comma-separated coin names */ + collateralCoins?: string; +} +⋮---- +/** Required when collateralType=custom. Comma-separated coin names */ +⋮---- +export interface PreSetLeverageRequestV3 { + category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + coin?: string; + marginMode: 'isolated' | 'cross'; + leverage?: string; + longLeverage?: string; + shortLeverage?: string; +} +⋮---- +export interface SetMarginRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + posSide: 'long' | 'short'; + operation: 'add' | 'remove'; + amount: string; +} +⋮---- +export interface GetMaxWithdrawalRequestV3 { + coin: string; +} +⋮---- +export interface GetRealityOrderBookRequestV3 { + symbol: string; +} +⋮---- +export interface GetRealityFillsRequestV3 { + symbol: string; + limit?: string; +} +⋮---- +export interface SubMasterTransferRequestV3 { + fromType: 'spot' | 'uta'; + toType: 'spot' | 'p2p' | 'uta'; + amount: string; + coin: string; + clientOid?: string; +} +⋮---- +export interface CreateAgentSubAccountRequestV3 { + username: string; + passphrase: string; + note?: string; +} +⋮---- +export interface MovePositionItemRequestV3 { + symbol: string; + side: 'buy' | 'sell'; + qty: string; +} +⋮---- +export interface MovePositionsRequestV3 { + fromUid: string; + toUid: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + positionList: MovePositionItemRequestV3[]; +} +⋮---- +export interface GetMovePositionHistoryRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + startTime?: string; + endTime?: string; + cursor?: string; + limit?: string; +} +⋮---- +export interface GetEligibleSymbolsRequestV3 { + symbol?: string; +} +⋮---- +export interface GetEligibleMarginTierRequestV3 { + coin?: string; +} +⋮---- +export interface GetEligibleLoanInfoRequestV3 { + coin?: string; +} +⋮---- +export interface GetRateLimitQuotaRequestV3 { + category: 'spot' | 'futures'; + uid?: string; + cursor?: string; + limit?: string; +} +⋮---- +export interface SetRateLimitQuotaRequestV3 { + category: 'spot' | 'futures'; + uids: string[]; + quota: string; } - -================ -File: src/index.ts -================ - - -================ -File: README.md -================ -# Node.js & Typescript Bitget API SDK - -[![Build & Test](https://github.com/tiagosiebler/bitget-api/actions/workflows/e2etests.yml/badge.svg?branch=master)](https://github.com/tiagosiebler/bitget-api/actions/workflows/e2etests.yml) -[![npm version](https://img.shields.io/npm/v/bitget-api)][1] -[![npm size](https://img.shields.io/bundlephobia/min/bitget-api/latest)][1] -[![npm downloads](https://img.shields.io/npm/dt/bitget-api)][1] -[![last commit](https://img.shields.io/github/last-commit/tiagosiebler/bitget-api)][1] -[![CodeFactor](https://www.codefactor.io/repository/github/tiagosiebler/bitget-api/badge)](https://www.codefactor.io/repository/github/tiagosiebler/bitget-api) -[![Telegram](https://img.shields.io/badge/chat-on%20telegram-blue.svg)](https://t.me/nodetraders) -[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/tiagosiebler/bitget-api) - -

- - - - SDK Logo - - -

- -[1]: https://www.npmjs.com/package/bitget-api - -> [!TIP] -> Upcoming change: As part of the [Siebly.io](https://siebly.io/) brand, this SDK will soon be hosted under the [Siebly.io GitHub organisation](https://github.com/sieblyio). The migration is seamless and requires no user changes. - -Updated & performant JavaScript & Node.js SDK for the Bitget V2 REST APIs and WebSockets: - -- Professional, robust & performant Bitget SDK with extensive production use in live trading environments. -- Complete integration with all Bitget APIs. - - [x] Supports V2 REST APIs & WebSockets - - [x] Supports V3/UTA REST APIs & WebSockets (latest) - - [x] Supports order placement via V3 WebSocket API -- Complete TypeScript support (with type declarations for all API requests & responses). - - Strongly typed requests and responses. - - Automated end-to-end tests on most API calls, ensuring no breaking changes are released to npm. -- Actively maintained with a modern, promise-driven interface. -- Over 100 integration tests making real API calls & WebSocket connections, validating any changes before they reach npm. -- Robust WebSocket integration with configurable connection heartbeats & automatic reconnect then resubscribe workflows. - - Event driven messaging. - - Smart WebSocket persistence with automatic reconnection handling. - - Emit `reconnected` event when dropped connection is restored. - - Optional beautification of WebSocket events for improved readability. -- Officially listed Node.js SDK in [Bitget API docs](https://bitgetlimited.github.io/apidoc/en/spot/#sdk-code-example). -- Browser support (via webpack bundle - see "Browser Usage" below). -- Support all authentication methods supported by Bitget: - - [x] HMAC - - [x] RSA -- Heavy automated end-to-end testing with real API calls. - - End-to-end testing before any release. - - Real API calls in e2e tests. -- Proxy support via axios integration. -- Active community support & collaboration in telegram: [Node.js Algo Traders](https://t.me/nodetraders). -- QuickStart Guide: https://siebly.io/sdk/bitget/javascript - -## Table of Contents - -- [Installation](#installation) -- [Examples](#examples) -- [Issues & Discussion](#issues--discussion) -- [Related Projects](#related-projects) -- [Documentation](#documentation) -- [Structure](#structure) -- [Usage](#usage) - - [REST API Clients](#rest-api-clients) - - [V3 REST APIs (Unified Trading Account)](#v3-rest-apis) - - [V2 REST APIs](#v2-rest-apis) - - [WebSockets](#websockets) - - [V3 Unified Trading Account](#v3-unified-trading-account) - - [Sending Orders via WebSockets](#sending-orders-via-websockets) - - [Receiving Realtime Data](#receiving-realtime-data) - - [V2 WebSockets](#v2-websockets) - - [Customise Logging](#logging) - - [Custom Logger](#customise-logging) - - [Debug HTTP Requests](#debug-http-requests) - - [Frontend Usage](#browser-usage) - - [Import](#import) - - [Webpack](#webpack) -- [LLMs & AI](#use-with-llms--ai) -- [Used By](#used-by) -- [Contributions & Thanks](#contributions--thanks) - -## Installation - -`npm install --save bitget-api` - -## Examples - -Refer to the [examples](./examples) folder for implementation demos. - -## Issues & Discussion - -- Issues? Check the [issues tab](https://github.com/tiagosiebler/bitget-api/issues). -- Discuss & collaborate with other node devs? Join our [Node.js Algo Traders](https://t.me/nodetraders) engineering community on telegram. -- Follow our announcement channel for real-time updates on [X/Twitter](https://x.com/sieblyio) - - - -## Related Projects - -Check out our JavaScript/TypeScript/Node.js SDKs & Projects: - -- Visit our website: [https://Siebly.io](https://siebly.io/) -- Try our REST API & WebSocket SDKs published on npmjs: - - [Bybit Node.js SDK: bybit-api](https://www.npmjs.com/package/bybit-api) - - [Kraken Node.js SDK: @siebly/kraken-api](https://www.npmjs.com/package/@siebly/kraken-api) - - [OKX Node.js SDK: okx-api](https://www.npmjs.com/package/okx-api) - - [Binance Node.js SDK: binance](https://www.npmjs.com/package/binance) - - [Gate (gate.com) Node.js SDK: gateio-api](https://www.npmjs.com/package/gateio-api) - - [Bitget Node.js SDK: bitget-api](https://www.npmjs.com/package/bitget-api) - - [Kucoin Node.js SDK: kucoin-api](https://www.npmjs.com/package/kucoin-api) - - [Coinbase Node.js SDK: coinbase-api](https://www.npmjs.com/package/coinbase-api) - - [Bitmart Node.js SDK: bitmart-api](https://www.npmjs.com/package/bitmart-api) -- Try my misc utilities: - - [OrderBooks Node.js: orderbooks](https://www.npmjs.com/package/orderbooks) - - [Crypto Exchange Account State Cache: accountstate](https://www.npmjs.com/package/accountstate) -- Check out my examples: - - [awesome-crypto-examples Node.js](https://github.com/tiagosiebler/awesome-crypto-examples) - - -## Documentation - -Most methods accept JS objects. These can be populated using parameters specified by Bitget's API documentation, or check the type definition in each class within this repository (see table below for convenient links to each class). - -- Bitget API Documentation - - [V3/UTA API Documentation](https://www.bitget.com/api-doc/uta/intro) (Latest - Unified Trading Account) - - [V2 API Documentation](https://www.bitget.com/api-doc/common/intro) -- [REST Endpoint Function List](./docs/endpointFunctionList.md) -- [TSDoc Documentation (autogenerated using typedoc)](https://tsdocs.dev/docs/bitget-api) - -## Structure - -This connector is fully compatible with both TypeScript and pure JavaScript projects, while the connector is written in TypeScript. A pure JavaScript version can be built using `npm run build`, which is also the version published to [npm](https://www.npmjs.com/package/bitget-api). - -The version on npm is the output from the `build` command and can be used in projects without TypeScript (although TypeScript is definitely recommended). - -- [src](./src) - the whole connector written in TypeScript -- [lib](./lib) - the JavaScript version of the project (built from TypeScript). This should not be edited directly, as it will be overwritten with each release. -- [dist](./dist) - the webpack bundle of the project for use in browser environments (see guidance on webpack below). -- [examples](./examples) - some implementation examples & demonstrations. Contributions are welcome! - ---- - -# Usage - -Create API credentials at Bitget: - -- [Livenet API Management](https://www.bitget.com/en/support/articles/360011132814-How-to-create-API) -- [Demo Trading Environment](https://www.bitget.com/en/demo-trading) - -## REST API Clients - -Each REST API group has a dedicated REST client. To avoid confusion, here are the available REST clients and the corresponding API groups: -| Class | Description | -|:------------------------------------: |:---------------------------------------------------------------------------------------------: | -| [RestClientV3](src/rest-client-v3.ts) | [V3/UTA REST APIs for Bitget's Unified Trading Account](https://www.bitget.com/api-doc/uta/intro) | -| [WebsocketClientV3](src/websocket-client-v3.ts) | Universal WS client for Bitget's V3/UTA WebSockets | -| [WebsocketAPIClient](src/websocket-api-client.ts) | Websocket API Client, for RESTlike order placement via Bitget's V3/UTA WebSocket API | -| [RestClientV2](src/rest-client-v2.ts) | [V2 REST APIs](https://www.bitget.com/api-doc/common/intro) | -| [WebsocketClientV2](src/websocket-client-v2.ts) | Universal WS client for all Bitget's V2 WebSockets | - -Examples for using each client can be found in: - -- the [examples](./examples) folder. -- the [awesome-crypto-examples](https://github.com/tiagosiebler/awesome-crypto-examples) repository. - -If you're missing an example, you're welcome to request one. Priority will be given to [github sponsors](https://github.com/sponsors/tiagosiebler). - -### Getting Started - -All REST APIs are integrated in each dedicated Rest Client class. See the above table for which REST client to use. If you've upgraded to the Unified Trading Account, you should use the V3 REST APIs and WebSockets. - -There are several REST API modules as there are some differences in each API group: - -1. `RestClientV3` for the latest V3/UTA APIs (Unified Trading Account) - recommended for new projects. -2. `RestClientV2` for V2 APIs - use if you haven't upgraded to UTA yet. - -More Node.js & JavaScript examples for Bitget's REST APIs & WebSockets can be found in the [examples](./examples) folder on GitHub. - -#### V3 REST APIs - -These are only available if you have upgraded to the Unified Trading Account. If not, use the V2 APIs instead. - -```javascript -import { RestClientV3 } from 'bitget-api'; -// or if you prefer require: -// const { RestClientV3 } = require('bitget-api'); - -// note the single quotes, preventing special characters such as $ from being incorrectly passed -const client = new RestClientV3({ - apiKey: process.env.API_KEY_COM || 'insert_api_key_here', - apiSecret: process.env.API_SECRET_COM || 'insert_api_secret_here', - apiPass: process.env.API_PASS_COM || 'insert_api_pass_here', -}); - -(async () => { - try { - console.log(await client.getBalances()); - - const newOrder = await client.submitNewOrder({ - category: 'USDT-FUTURES', - orderType: 'market', - side: 'buy', - qty: '0.001', - symbol: 'BTCUSDT', - }); - - console.log('Order submitted: ', newOrder); - } catch (e) { - console.error('request failed: ', e); - } -})(); -``` - -#### V2 REST APIs - -Not sure which function to call or which parameters to use? Click the class name in the table above to look at all the function names (they are in the same order as the official API docs), and check the API docs for a list of endpoints/parameters/responses. - -If you found the method you're looking for in the API docs, you can also search for the endpoint in the [RestClientV2](src/rest-client-v2.ts) class. This class has all V2 endpoints available. - -```javascript -import { RestClientV2 } from 'bitget-api'; -// or if you prefer require: -// const { RestClientV2 } = require('bitget-api'); - -const API_KEY = 'xxx'; -const API_SECRET = 'yyy'; -const API_PASS = 'zzz'; - -const client = new RestClientV2({ - apiKey: API_KEY, - apiSecret: API_SECRET, - apiPass: API_PASS, -}); - -// For public-only API calls, simply don't provide a key & secret or set them to undefined -// const client = new RestClientV2(); - -client - .getSpotAccount() - .then((result) => { - console.log('getSpotAccount result: ', result); - }) - .catch((err) => { - console.error('getSpotAccount error: ', err); - }); - -client - .getSpotCandles({ - symbol: 'BTCUSDT', - granularity: '1min', - limit: '1000', - }) - .then((result) => { - console.log('getCandles result: ', result); - }) - .catch((err) => { - console.error('getCandles error: ', err); - }); -``` - -## WebSockets - -All WebSocket functionality is supported via the WebsocketClient. Since there are currently 2 generations of Bitget's API, there are 2 WebsocketClient classes in this Node.js, JavaScript & TypeScript SDK for Bitget. - -Use the following guidance to decide which one to use: - -- **Unified Trading Account / V3** (latest generation): - - For receiving data, use the [WebsocketClientV3](./src/websocket-client-v3.ts). - - For sending orders via WebSockets, use the [WebsocketAPIClient](./src/websocket-api-client.ts). -- **V2** (not upgraded to Unified Trading Account yet) - - Use the [WebsocketClientV2](./src/websocket-client-v2.ts). - -All WebSocket clients support: - -- Event driven messaging -- Smart WebSocket persistence with automatic reconnection -- Heartbeat mechanisms to detect disconnections -- Automatic resubscription after reconnection -- Error handling and connection monitoring -- Optional data beautification - -Higher level examples below, while more thorough examples can be found in the examples folder on GitHub. - -##### V3 Unified Trading Account - -###### Sending orders via WebSockets - -The V3 / Unified Trading Account APIs introduce order placement via a persisted WebSocket connection. This Bitget Node.js, JavaScript & TypeScript SDK supports Bitget's full V3 API offering, including the WebSocket API. - -There are two approaches to placing orders via the Bitget WebSocket APIs. The recommended route is to use the dedicated WebsocketAPIClient class, included with this SDK. - -This integration looks & feels like a REST API client, but uses WebSockets, via the WebsocketClient's sendWSAPIRequest method. It returns promises and has end to end types. - -A simple example is below, but for a more thorough example, check the example here: [./examples/V3/ws-api-client-trade.ts](./examples/V3/ws-api-client-trade.ts) - -```typescript -import { WebsocketAPIClient } from 'bitget-api'; -// or if you prefer require: -// const { WebsocketAPIClient } = require("bitget-api"); - -// Make an instance of the WS API Client class with your API keys -const wsClient = new WebsocketAPIClient({ - apiKey: API_KEY, - apiSecret: API_SECRET, - apiPass: API_PASS, - - // Whether to use the demo trading wss connection - // demoTrading: true, -}); - -async function start() { - // Start using it like a REST API. All actions are sent via a persisted WebSocket connection. - - /** - * Place Order - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters - */ - try { - const res = await wsClient.submitNewOrder('spot', { - orderType: 'limit', - price: '100', - qty: '0.1', - side: 'buy', - symbol: 'BTCUSDT', - timeInForce: 'gtc', - }); - - console.log(new Date(), 'WS API "submitNewOrder()" result: ', res); - } catch (e) { - console.error(new Date(), 'Exception with WS API "submitNewOrder()": ', e); - } -} - -start().catch((e) => console.error('Exception in example: '.e)); -``` - -###### Receiving realtime data - -Use the WebsocketClientV3 to receive data via the V3 WebSockets - -```typescript -import { WebsocketClientV3 } from "bitget-api"; -// or if you prefer require: -// const { WebsocketClientV3 } = require("bitget-api"); - -const API_KEY = "yourAPIKeyHere"; -const API_SECRET = "yourAPISecretHere; -const API_PASS = "yourAPIPassHere"; - -const wsClient = new WebsocketClientV3( - { - // Only necessary if you plan on using private/account websocket topics - apiKey: API_KEY, - apiSecret: API_SECRET, - apiPass: API_PASS, - } -); - -// Connect event handlers to process incoming events -wsClient.on('update', (data) => { - console.log('WS raw message received ', data); - // console.log('WS raw message received ', JSON.stringify(data, null, 2)); -}); - -wsClient.on('open', (data) => { - console.log('WS connection opened:', data.wsKey); -}); -wsClient.on('response', (data) => { - console.log('WS response: ', JSON.stringify(data, null, 2)); -}); -wsClient.on('reconnect', ({ wsKey }) => { - console.log('WS automatically reconnecting.... ', wsKey); -}); -wsClient.on('reconnected', (data) => { - console.log('WS reconnected ', data?.wsKey); -}); -wsClient.on('exception', (data) => { - console.log('WS error', data); -}); - -/** - * Subscribe to topics as you wish - */ - -// You can subscribe to one topic at a time -wsClient.subscribe( - { - topic: 'account', - payload: { - instType: 'UTA', // Note: all account events go on the UTA instType - }, - }, - WS_KEY_MAP.v3Private, // This parameter points to private or public -); - -// Note: all account events go on the UTA instType -const ACCOUNT_INST_TYPE = 'UTA'; -const ACCOUNT_WS_KEY = WS_KEY_MAP.v3Private; - -// Or multiple at once: -wsClient.subscribe( - [ - { - topic: 'account', - payload: { - instType: ACCOUNT_INST_TYPE, - }, - }, - { - topic: 'position', - payload: { - instType: ACCOUNT_INST_TYPE, - }, - }, - { - topic: 'fill', - payload: { - instType: ACCOUNT_INST_TYPE, - }, - }, - { - topic: 'order', - payload: { - instType: ACCOUNT_INST_TYPE, - }, - }, - ], - ACCOUNT_WS_KEY, -); - -// Example public events -wsClient.subscribe( - [ - { - topic: 'ticker', - payload: { - instType: 'spot', - symbol: 'BTCUSDT', - }, - }, - { - topic: 'ticker', - payload: { - instType: 'spot', - symbol: 'ETHUSDT', - }, - }, - { - topic: 'ticker', - payload: { - instType: 'spot', - symbol: 'XRPUSDT', - }, - }, - { - topic: 'ticker', - payload: { - instType: 'usdt-futures', - symbol: 'BTCUSDT', - }, - }, - { - topic: 'ticker', - payload: { - instType: 'usdt-futures', - symbol: 'BTCUSDT', - }, - }, - ], - WS_KEY_MAP.v3Public, -); -``` - -For more examples, including how to use websockets with Bitget, check the [examples](./examples/) and [test](./test/) folders. - -### V2 WebSockets - -If you haven't upgraded to the Unified Trading Account, use the V2 WebSocket client: - -```javascript -import { WebsocketClientV2 } from 'bitget-api'; -// or if you prefer require: -// const { WebsocketClientV2 } = require('bitget-api'); - -const API_KEY = 'xxx'; -const API_SECRET = 'yyy'; -const API_PASS = 'zzz'; - -const wsClient = new WebsocketClientV2({ - apiKey: API_KEY, - apiSecret: API_SECRET, - apiPass: API_PASS, - // Optional: connect to demo trading environment - // demoTrading: true, -}); - -// Handle incoming messages -wsClient.on('update', (data) => { - console.log('WS update received: ', data); -}); - -wsClient.on('open', (data) => { - console.log('WS connection opened: ', data.wsKey); -}); - -wsClient.on('reconnected', (data) => { - console.log('WS reconnected: ', data?.wsKey); -}); - -wsClient.on('exception', (data) => { - console.log('WS error: ', data); -}); - -// Subscribe to public data streams -wsClient.subscribeTopic('SPOT', 'ticker', symbol); - -// Subscribe to private data streams (requires authentication) -wsClient.subscribeTopic('SPOT', 'account'); -``` - ---- - -## Logging - -### Customise logging - -Pass a custom logger which supports the log methods `trace`, `info` and `error`, or override methods from the default logger as desired. - -```javascript -import { WebsocketClientV2, DefaultLogger } from 'bitget-api'; -// or if you prefer require: -// const { WebsocketClientV2, DefaultLogger } = require('bitget-api'); - -// Disable all logging on the trace level (less console logs) -const customLogger = { - ...DefaultLogger, - trace: () => {}, -}; - -const ws = new WebsocketClientV2( - { - apiKey: 'API_KEY', - apiSecret: 'API_SECRET', - apiPass: 'API_PASS', - }, - customLogger, -); -``` - -### Debug HTTP requests - -In rare situations, you may want to see the raw HTTP requets being built as well as the API response. These can be enabled by setting the `BITGETTRACE` env var to `true`. - -## Browser Usage - -### Import - -This is the "modern" way, allowing the package to be directly imported into frontend projects with full typescript support. - -1. Install these dependencies - ```sh - npm install crypto-browserify stream-browserify - ``` -2. Add this to your `tsconfig.json` - ```json - { - "compilerOptions": { - "paths": { - "crypto": [ - "./node_modules/crypto-browserify" - ], - "stream": [ - "./node_modules/stream-browserify" - ] - } - ``` -3. Declare this in the global context of your application (ex: in polyfills for angular) - ```js - (window as any).global = window; - ``` - -### Webpack - -This is the "old" way of using this package on webpages. This will build a minified js bundle that can be pulled in using a script tag on a website. - -Build a bundle using webpack: - -- `npm install` -- `npm build` -- `npm pack` - -The bundle can be found in `dist/`. Altough usage should be largely consistent, smaller differences will exist. Documentation is still TODO - contributions welcome. - -## Use with LLMs & AI - -This SDK includes a bundled `llms.txt` file in the root of the repository. If you're developing with LLMs, use the included `llms.txt` with your LLM - it will significantly improve the LLMs understanding of how to correctly use this SDK. - -This file contains AI optimised structure of all the functions in this package, and their parameters for easier use with any learning models or artificial intelligence. - ---- - -## Used By - -[![Repository Users Preview Image](https://dependents.info/tiagosiebler/bitget-api/image)](https://github.com/tiagosiebler/bitget-api/network/dependents) - ---- - - - -### Contributions & Thanks - -Have my projects helped you? Share the love, there are many ways you can show your thanks: - -- Star & share my projects. -- Are my projects useful? Sponsor me on Github and support my effort to maintain & improve them: https://github.com/sponsors/tiagosiebler -- Have an interesting project? Get in touch & invite me to it. -- Or buy me all the coffee: - - ETH(ERC20): `0xA3Bda8BecaB4DCdA539Dc16F9C54a592553Be06C` -- Sign up with my referral links: - - OKX (receive a 20% fee discount!): https://www.okx.com/join/42013004 - - Binance (receive a 20% fee discount!): https://accounts.binance.com/register?ref=OKFFGIJJ - - HyperLiquid (receive a 4% fee discount!): https://app.hyperliquid.xyz/join/SDK - - Gate: https://www.gate.io/signup/NODESDKS?ref_type=103 - - - - -### Contributions & Pull Requests - -Contributions are encouraged, I will review any incoming pull requests. See the issues tab for todo items. - - - -## Star History - -[![Star History Chart](https://api.star-history.com/svg?repos=tiagosiebler/bybit-api,tiagosiebler/okx-api,tiagosiebler/binance,tiagosiebler/bitget-api,tiagosiebler/bitmart-api,tiagosiebler/gateio-api,tiagosiebler/kucoin-api,tiagosiebler/coinbase-api,tiagosiebler/orderbooks,tiagosiebler/accountstate,tiagosiebler/awesome-crypto-examples&type=Date)](https://star-history.com/#tiagosiebler/bybit-api&tiagosiebler/okx-api&tiagosiebler/binance&tiagosiebler/bitget-api&tiagosiebler/bitmart-api&tiagosiebler/gateio-api&tiagosiebler/kucoin-api&tiagosiebler/coinbase-api&tiagosiebler/orderbooks&tiagosiebler/accountstate&tiagosiebler/awesome-crypto-examples&Date) - - ================ File: src/rest-client-v2.ts @@ -11717,6 +13120,7 @@ import { AgentCustomerListRequestV2, AgentCustomerTradeVolumeRequestV2, CreateSubAccountApiKeyRequestV2, + DeleteSubAccountApiKeyRequestV2, GetAgentCommissionDetailRequestV2, GetAgentCustomerCommissionsRequestV2, GetAgentCustomerKycResultRequestV2, @@ -11741,6 +13145,7 @@ import { CreateAgentSubaccountRequestV2, CreateVirtualSubApiKeyRequestV2, CreateVirtualSubRequestV2, + GetAllTradeRatesRequestV2, GetAnnouncementsRequestV2, GetConvertBGBHistoryRequestV2, GetConvertHistoryRequestV2, @@ -11824,9 +13229,12 @@ import { FuturesModifyOrderRequestV2, FuturesModifyPlanOrderRequestV2, FuturesModifyTPSLOrderRequestV2, + FuturesOiLimitRequestV2, FuturesOpenCountRequestV2, FuturesPlaceOrderRequestV2, FuturesPlanOrderRequestV2, + FuturesPositionAdlRankRequestV2, + FuturesPositionTPSLOrderRequestV2, FuturesRecentTradesRequestV2, FuturesReversalOrderRequestV2, FuturesSetAutoMarginRequestV2, @@ -11838,6 +13246,14 @@ import { GetUnionTransferLimitsRequestV2, UnionConvertRequestV2, } from './types/request/v2/futures.js'; +import { + GetInstLoanLTVConvertRequestV2, + GetInstLoanMarginCoinInfoRequestV2, + GetInstLoanOrderRequestV2, + GetInstLoanProductInfoRequestV2, + GetInstLoanRepaidHistoryRequestV2, + GetInstLoanSymbolsRequestV2, +} from './types/request/v2/instloan.js'; import { GetBorrowHistoryRequestV2, GetFinancialHistoryRequestV2, @@ -11866,6 +13282,7 @@ import { SpotAccountTypeV2, SpotBatchCancelOrderRequestV2, SpotBatchOrderRequestV2, + SpotCallAuctionRequestV2, SpotCancelandSubmitOrderRequestV2, SpotCancelOrderRequestV2, SpotCandlesRequestV2, @@ -12025,6 +13442,7 @@ import { FuturesOrderDetailV2, FuturesOrderFillV2, FuturesPendingPlanOrderV2, + FuturesPositionAdlRankV2, FuturesPositionTierV2, FuturesPositionV2, FuturesSubAccountAssetV2, @@ -12039,6 +13457,14 @@ import { UnionSwitchUsdtV2, UnionTransferLimitsV2, } from './types/response/v2/futures.js'; +import { + InstLoanCoinInfoV2, + InstLoanLTVConvertV2, + InstLoanOrderV2, + InstLoanProductInfoV2, + InstLoanRepaidHistoryItemV2, + InstLoanSymbolsV2, +} from './types/response/v2/instloan.js'; import { CrossInterestRateAndLimitResponseV2, CrossMaxBorrowableResponseV2, @@ -12066,6 +13492,7 @@ import { SpotAccountAssetV2, SpotAccountBillV2, SpotAccountInfoV2, + SpotCallAuctionV2, SpotCancelPlanOrdersV2, SpotCandlestickV2, SpotCoinInfoV2, @@ -12096,2209 +13523,3367 @@ import { REST_CLIENT_TYPE_ENUM } from './util/requestUtils.js'; import { assertMarginType } from './util/type-guards.js'; ⋮---- /** - * REST API client for all V2 endpoints - */ -export class RestClientV2 extends BaseRestClient + * REST API client for all V2 endpoints + */ +export class RestClientV2 extends BaseRestClient +⋮---- +getClientType() +⋮---- +/** + * + * Custom SDK functions + * + */ +⋮---- +/** + * 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 +⋮---- +// Adjust server time by adding estimated one-way latency +⋮---- +// Calculate time difference between adjusted server time and local time +⋮---- +async fetchServerTime(): Promise +⋮---- +/** + * + * Bitget misc functions + * + */ +⋮---- +/** + * + * + * Common + * + * + */ +⋮---- +/** + * + * * Common | Notice + * + */ +⋮---- +getAnnouncements( + params?: GetAnnouncementsRequestV2, +): Promise> +⋮---- +/** + * + * * Common | Public + * + */ +⋮---- +getServerTime(): Promise< + APIResponse<{ + serverTime: string; + }> + > { + return this.get('/api/v2/public/time'); +⋮---- +getTradeRate(params: GetTradeRateRequestV2): Promise< + APIResponse<{ + makerFeeRate: string; + takerFeeRate: string; + }> + > { + return this.getPrivate('/api/v2/common/trade-rate', params); +⋮---- +getAllTradeRates(params: GetAllTradeRatesRequestV2): Promise< + APIResponse< + { + symbol: string; + makerFeeRate: string; + takerFeeRate: string; + }[] + > + > { + return this.getPrivate('/api/v2/common/all-trade-rate', params); +⋮---- +/** + * + * * Common | Tax + * + */ ⋮---- -getClientType() +getSpotTransactionRecords( + params: GetSpotTransactionsRequestV2, +): Promise> +⋮---- +getFuturesTransactionRecords( + params: GetFuturesTransactionsRequestV2, +): Promise> +⋮---- +getMarginTransactionRecords( + params: GetMarginTransactionsRequestV2, +): Promise> +⋮---- +getP2PTransactionRecords( + params: GetP2PTransactionsRequestV2, +): Promise> ⋮---- /** * - * Custom SDK functions + * * Common | P2P * */ ⋮---- +getP2PMerchantList(params?: GetP2PMerchantsRequestV2): Promise< + APIResponse<{ + merchantList: P2PMerchantV2[]; + minMerchantId: string; + }> + > { + return this.getPrivate('/api/v2/p2p/merchantList', params); +⋮---- +getP2PMerchantInfo(): Promise> +⋮---- +getP2PMerchantOrders(params: GetMerchantP2POrdersRequestV2): Promise< + APIResponse<{ + orderList: P2PMerchantOrderV2[]; + minOrderId: string; + }> + > { + return this.getPrivate('/api/v2/p2p/orderList', params); +⋮---- +getP2PMerchantAdvertisementList( + params: GetMerchantAdvertisementsRequestV2, + ): Promise< + APIResponse<{ + advList: P2PMerchantAdvertismentV2[]; + minAdvId: string; + }> + > { + return this.getPrivate('/api/v2/p2p/advList', params); +⋮---- /** - * 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. + * + * * Common | Trading insights + * */ -async fetchLatencySummary(): Promise ⋮---- -// Adjust server time by adding estimated one-way latency +getSpotWhaleNetFlowData(params: { + symbol: string; +}): Promise> ⋮---- -// Calculate time difference between adjusted server time and local time +getFuturesActiveTakerBuySellVolumeData(params: { + symbol: string; + period?: string; +}): Promise> ⋮---- -async fetchServerTime(): Promise +getFuturesActiveLongShortPositionData(params: { + symbol: string; + period?: string; +}): Promise> +⋮---- +getFuturesLongShortRatio(params: { + symbol: string; + period?: string; + coin?: string; +}): Promise> +⋮---- +getMarginLoanGrowthRate(params: { + symbol: string; + period?: string; + coin?: string; +}): Promise> +⋮---- +getIsolatedMarginBorrowingRatio(params: { + symbol: string; + period?: string; +}): Promise> +⋮---- +getFuturesActiveBuySellVolumeData(params: { + symbol: string; + period?: string; +}): Promise> +⋮---- +getSpotFundFlow(params: { + symbol: string; + period?: string; +}): Promise> +⋮---- +getTradeDataSupportSymbols(): Promise< + APIResponse<{ + spotList: string[]; + futureList: string[]; + }> + > { + return this.get('/api/v2/spot/market/support-symbols'); +⋮---- +getSpotFundNetFlowData(params: { symbol: string }): Promise< + APIResponse< + { + netFlow: string; + ts: string; + }[] + > + > { + return this.get('/api/v2/spot/market/fund-net-flow', params); +⋮---- +getFuturesActiveLongShortAccountData(params: { + symbol: string; + period?: string; +}): Promise> +⋮---- +/** + * + * * Common | Virtual Subaccount + * + */ +⋮---- +createVirtualSubaccount(params: { + subAccountList: string[]; +}): Promise> +⋮---- +modifyVirtualSubaccount(params: ModifyVirtualSubRequestV2): Promise< + APIResponse<{ + result: string; + }> + > { + return this.postPrivate('/api/v2/user/modify-virtual-subaccount', params); +⋮---- +batchCreateVirtualSubaccountAndAPIKey( + params: CreateVirtualSubRequestV2, +): Promise> +⋮---- +getVirtualSubaccounts(params?: { + limit?: string; + idLessThan?: string; + status?: 'normal' | 'freeze'; + }): Promise< + APIResponse<{ + endId: string; + subAccountList: VirtualSubAccountV2[]; + }> + > { + return this.getPrivate('/api/v2/user/virtual-subaccount-list', params); +⋮---- +createVirtualSubaccountAPIKey( + params: CreateVirtualSubApiKeyRequestV2, +): Promise> +⋮---- +modifyVirtualSubaccountAPIKey( + params: ModifyVirtualSubApiKeyRequestV2, +): Promise> +⋮---- +getVirtualSubaccountAPIKeys(params: { + subAccountUid: string; +}): Promise> +⋮---- +/** + * Create a dedicated sub-account for an AI Agent instance. + * Frequency limit: 1/s per UID. Agent sub-accounts cannot be edited after creation. + */ +createAgentSubaccount( + params: CreateAgentSubaccountRequestV2, +): Promise> +⋮---- +/** + * + * * Common | Assets + * + */ +getFundingAssets(params?: { + coin?: string; +}): Promise> +⋮---- +getBotAccount(params?: { + accountType?: string; +}): Promise> +⋮---- +/** Get assets overview */ +getBalances(): Promise< + APIResponse< + { + accountType: string; + usdtBalance: string; + }[] + > + > { + return this.getPrivate('/api/v2/account/all-account-balance'); +⋮---- +/** + * + * * Common | Convert + * + */ +⋮---- +getConvertCoins(): Promise> +⋮---- +getConvertQuotedPrice( + params: ConvertQuoteRequestV2, +): Promise> +⋮---- +convert( + params: ConvertRequestV2, +): Promise> +⋮---- +getConvertHistory(params: GetConvertHistoryRequestV2): Promise< + APIResponse<{ + dataList: ConvertRecordV2[]; + endId: string; + }> + > { + return this.getPrivate('/api/v2/convert/convert-record', params); +⋮---- +/** + * + * * Common | BGB Convert + * + */ +⋮---- +getConvertBGBCoins(): Promise< + APIResponse<{ + coinList: BGBConvertCoinV2[]; + }> + > { + return this.getPrivate('/api/v2/convert/bgb-convert-coin-list'); +⋮---- +convertBGB(params: { + coinList: string; +}): Promise> ⋮---- -/** - * - * Bitget misc functions - * - */ +getConvertBGBHistory( + params: GetConvertBGBHistoryRequestV2, +): Promise> ⋮---- /** * * - * Common + * Spot * * */ ⋮---- /** * - * * Common | Notice + * * Spot | Market * */ ⋮---- -getAnnouncements( - params?: GetAnnouncementsRequestV2, -): Promise> +getSpotCoinInfo(params?: { + coin?: string; +}): Promise> +⋮---- +getSpotSymbolInfo(params?: { + symbol?: string; +}): Promise> +⋮---- +getSpotVIPFeeRate(): Promise> +⋮---- +getSpotTicker(params?: { + symbol?: string; +}): Promise> +⋮---- +getSpotMergeDepth(params: { + symbol: string; + precision?: string; + limit?: string; +}): Promise> +⋮---- +getSpotOrderBookDepth(params: { + symbol: string; + type?: string; + limit?: string; +}): Promise> +⋮---- +getSpotCandles( + params: SpotCandlesRequestV2, +): Promise> +⋮---- +getSpotHistoricCandles( + params: SpotHistoricCandlesRequestV2, +): Promise> +⋮---- +getSpotRecentTrades(params: { + symbol: string; + limit?: string; +}): Promise> +⋮---- +getSpotHistoricTrades( + params: SpotHistoricTradesRequestV2, +): Promise> +⋮---- +getSpotCallAuction( + params: SpotCallAuctionRequestV2, +): Promise> ⋮---- /** * - * * Common | Public + * * Spot | Trade * */ ⋮---- -getServerTime(): Promise< +spotSubmitOrder(params: SpotOrderRequestV2): Promise< APIResponse<{ - serverTime: string; + orderId: string; + clientOid: string; }> > { - return this.get('/api/v2/public/time'); + return this.postPrivate('/api/v2/spot/trade/place-order', params); ⋮---- -getTradeRate(params: GetTradeRateRequestV2): Promise< +spotCancelandSubmitOrder( + params: SpotCancelandSubmitOrderRequestV2, +): Promise> +⋮---- +spotBatchCancelandSubmitOrder(params: { + orderList: SpotCancelandSubmitOrderRequestV2[]; +}): Promise> +⋮---- +spotCancelOrder(params: SpotCancelOrderRequestV2): Promise< APIResponse<{ - makerFeeRate: string; - takerFeeRate: string; + orderId: string; + clientOid: string; }> > { - return this.getPrivate('/api/v2/common/trade-rate', params); + return this.postPrivate('/api/v2/spot/trade/cancel-order', params); ⋮---- -/** - * - * * Common | Tax - * - */ +spotBatchSubmitOrders( + params: SpotBatchOrderRequestV2, +): Promise> ⋮---- -getSpotTransactionRecords( - params: GetSpotTransactionsRequestV2, -): Promise> +spotBatchCancelOrders( + params: SpotBatchCancelOrderRequestV2, +): Promise> ⋮---- -getFuturesTransactionRecords( - params: GetFuturesTransactionsRequestV2, -): Promise> +spotCancelSymbolOrder(params: { symbol: string }): Promise< + APIResponse<{ + symbol: string; + }> + > { + return this.postPrivate('/api/v2/spot/trade/cancel-symbol-order', params); ⋮---- -getMarginTransactionRecords( - params: GetMarginTransactionsRequestV2, -): Promise> +getSpotOrder( + params?: GetSpotOrderInfoRequestV2, +): Promise> ⋮---- -getP2PTransactionRecords( - params: GetP2PTransactionsRequestV2, -): Promise> +getSpotOpenOrders( + params?: GetSpotOpenOrdersRequestV2, +): Promise> +⋮---- +getSpotHistoricOrders( + params?: GetSpotHistoryOrdersRequestV2, +): Promise> +⋮---- +getSpotFills( + params: GetSpotFillsRequestV2, +): Promise> ⋮---- /** * - * * Common | P2P + * * Spot | Trigger Orders * */ ⋮---- -getP2PMerchantList(params?: GetP2PMerchantsRequestV2): Promise< +spotSubmitPlanOrder(params: SpotPlanOrderRequestV2): Promise< APIResponse<{ - merchantList: P2PMerchantV2[]; - minMerchantId: string; + orderId: string; + clientOid: string; }> > { - return this.getPrivate('/api/v2/p2p/merchantList', params); -⋮---- -getP2PMerchantInfo(): Promise> + return this.postPrivate('/api/v2/spot/trade/place-plan-order', params); ⋮---- -getP2PMerchantOrders(params: GetMerchantP2POrdersRequestV2): Promise< +spotModifyPlanOrder(params: SpotModifyPlanOrderRequestV2): Promise< APIResponse<{ - orderList: P2PMerchantOrderV2[]; - minOrderId: string; + orderId: string; + clientOid: string; }> > { - return this.getPrivate('/api/v2/p2p/orderList', params); + return this.postPrivate('/api/v2/spot/trade/modify-plan-order', params); ⋮---- -getP2PMerchantAdvertisementList( - params: GetMerchantAdvertisementsRequestV2, - ): Promise< +spotCancelPlanOrder(params: { + clientOid?: string; + orderId?: string; + }): Promise< APIResponse<{ - advList: P2PMerchantAdvertismentV2[]; - minAdvId: string; + result: string; }> > { - return this.getPrivate('/api/v2/p2p/advList', params); -⋮---- -/** - * - * * Common | Trading insights - * - */ -⋮---- -getSpotWhaleNetFlowData(params: { - symbol: string; -}): Promise> -⋮---- -getFuturesActiveTakerBuySellVolumeData(params: { - symbol: string; - period?: string; -}): Promise> -⋮---- -getFuturesActiveLongShortPositionData(params: { - symbol: string; - period?: string; -}): Promise> -⋮---- -getFuturesLongShortRatio(params: { - symbol: string; - period?: string; - coin?: string; -}): Promise> -⋮---- -getMarginLoanGrowthRate(params: { - symbol: string; - period?: string; - coin?: string; -}): Promise> -⋮---- -getIsolatedMarginBorrowingRatio(params: { - symbol: string; - period?: string; -}): Promise> -⋮---- -getFuturesActiveBuySellVolumeData(params: { - symbol: string; - period?: string; -}): Promise> -⋮---- -getSpotFundFlow(params: { - symbol: string; - period?: string; -}): Promise> + return this.postPrivate('/api/v2/spot/trade/cancel-plan-order', params); ⋮---- -getTradeDataSupportSymbols(): Promise< +getSpotCurrentPlanOrders(params: GetSpotCurrentPlanOrdersRequestV2): Promise< APIResponse<{ - spotList: string[]; - futureList: string[]; + nextFlag: boolean; + idLessThan: string; + orderList: SpotCurrentPlanOrderV2[]; }> > { - return this.get('/api/v2/spot/market/support-symbols'); + return this.getPrivate('/api/v2/spot/trade/current-plan-order', params); ⋮---- -getSpotFundNetFlowData(params: { symbol: string }): Promise< - APIResponse< - { - netFlow: string; - ts: string; - }[] - > +getSpotPlanSubOrder(params: { + planOrderId: string; +}): Promise> +⋮---- +getSpotHistoricPlanOrders(params: GetSpotHistoryPlanOrdersRequestV2): Promise< + APIResponse<{ + nextFlag: boolean; + idLessThan: string; + orderList: SpotHistoryPlanOrderV2[]; + }> > { - return this.get('/api/v2/spot/market/fund-net-flow', params); + return this.getPrivate('/api/v2/spot/trade/history-plan-order', params); ⋮---- -getFuturesActiveLongShortAccountData(params: { - symbol: string; - period?: string; -}): Promise> +spotCancelPlanOrders(params?: { + symbolList?: string[]; +}): Promise> ⋮---- /** * - * * Common | Virtual Subaccount + * * Spot | Account * */ ⋮---- -createVirtualSubaccount(params: { - subAccountList: string[]; -}): Promise> +getSpotAccount(): Promise> +⋮---- +getSpotAccountAssets(params?: { + coin?: string; + assetType?: string; +}): Promise> +⋮---- +getSpotSubAccountAssets(): Promise> +⋮---- +spotModifyDepositAccount(params: { + accountType: string; + coin: string; +}): Promise> +⋮---- +getSpotAccountBills( + params?: GetSpotAccountBillsRequestV2, +): Promise> ⋮---- -modifyVirtualSubaccount(params: ModifyVirtualSubRequestV2): Promise< +spotTransfer(params: SpotTransferRequestV2): Promise< APIResponse<{ - result: string; + transferId: string; + clientOid: string; }> > { - return this.postPrivate('/api/v2/user/modify-virtual-subaccount', params); + return this.postPrivate('/api/v2/spot/wallet/transfer', params); ⋮---- -batchCreateVirtualSubaccountAndAPIKey( - params: CreateVirtualSubRequestV2, -): Promise> +getSpotTransferableCoins(params: { + fromType: SpotAccountTypeV2; + toType: SpotAccountTypeV2; +}): Promise> ⋮---- -getVirtualSubaccounts(params?: { - limit?: string; - idLessThan?: string; - status?: 'normal' | 'freeze'; - }): Promise< +spotSubTransfer(params: SpotSubAccountTransferRequestV2): Promise< APIResponse<{ - endId: string; - subAccountList: VirtualSubAccountV2[]; + transferId: string; + clientOid: string; }> > { - return this.getPrivate('/api/v2/user/virtual-subaccount-list', params); + return this.postPrivate('/api/v2/spot/wallet/subaccount-transfer', params); ⋮---- -createVirtualSubaccountAPIKey( - params: CreateVirtualSubApiKeyRequestV2, -): Promise> +spotWithdraw(params: SpotWithdrawalRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/spot/wallet/withdrawal', params); ⋮---- -modifyVirtualSubaccountAPIKey( - params: ModifyVirtualSubApiKeyRequestV2, -): Promise> +getSpotMainSubTransferRecord( + params: SpotMainSubTransferRecordRequestV2, +): Promise> ⋮---- -getVirtualSubaccountAPIKeys(params: { - subAccountUid: string; -}): Promise> +getSpotTransferHistory( + params: GetSpotTransferRecordRequestV2, +): Promise> ⋮---- -/** - * Create a dedicated sub-account for an AI Agent instance. - * Frequency limit: 1/s per UID. Agent sub-accounts cannot be edited after creation. - */ -createAgentSubaccount( - params: CreateAgentSubaccountRequestV2, -): Promise> +spotSwitchBGBDeduct(params: { + deduct: boolean; +}): Promise> ⋮---- -/** - * - * * Common | Assets - * - */ -getFundingAssets(params?: { - coin?: string; -}): Promise> +getSpotDepositAddress(params: { + coin: string; + chain?: string; + size: string; +}): Promise> ⋮---- -getBotAccount(params?: { - accountType?: string; -}): Promise> +getSpotSubDepositAddress(params: { + subUid: string; + coin: string; + chain?: string; + size: string; +}): Promise> ⋮---- -/** Get assets overview */ -getBalances(): Promise< - APIResponse< - { - accountType: string; - usdtBalance: string; - }[] - > +getSpotBGBDeductInfo(): Promise< + APIResponse<{ + deduct: string; + }> > { - return this.getPrivate('/api/v2/account/all-account-balance'); -⋮---- -/** - * - * * Common | Convert - * - */ + return this.getPrivate('/api/v2/spot/account/deduct-info'); ⋮---- -getConvertCoins(): Promise> +spotCancelWithdrawal(params: { + orderId: string; +}): Promise> ⋮---- -getConvertQuotedPrice( - params: ConvertQuoteRequestV2, -): Promise> +getSubAccountDepositRecords( + params: GetSpotSubAccountDepositRecordRequestV2, +): Promise> ⋮---- -convert( - params: ConvertRequestV2, -): Promise> +getSpotWithdrawalHistory( + params: GetSpotWithdrawalRecordRequestV2, +): Promise> ⋮---- -getConvertHistory(params: GetConvertHistoryRequestV2): Promise< - APIResponse<{ - dataList: ConvertRecordV2[]; - endId: string; - }> - > { - return this.getPrivate('/api/v2/convert/convert-record', params); +getSpotDepositHistory( + params: GetSpotDepositRecordRequestV2, +): Promise> ⋮---- /** - * - * * Common | BGB Convert - * + * Upgrade Account - Upgrade to unified account mode + * No account type restrictions; both parent and sub-accounts are supported. + * This interface is only used for upgrading to the unified account mode. + * Please note that as the account upgrade process takes approximately 1 minute, + * the successful response you receive only indicates that the request has been received, + * and does not mean that the account has been successfully upgraded to a unified account. + * Please use the query upgrade status interface to confirm whether the account upgrade is successful. */ +upgradeToUnifiedAccount(params?: { + subUid?: string; +}): Promise> ⋮---- -getConvertBGBCoins(): Promise< +/** + * Get Upgrade Status - Get account upgrade status + * No account type restrictions; both parent and sub-accounts are supported. + */ +getUnifiedAccountSwitchStatus(params?: { subUid?: string }): Promise< APIResponse<{ - coinList: BGBConvertCoinV2[]; + status: 'processProcessing' | 'successSuccess' | 'failFailed'; }> > { - return this.getPrivate('/api/v2/convert/bgb-convert-coin-list'); -⋮---- -convertBGB(params: { - coinList: string; -}): Promise> -⋮---- -getConvertBGBHistory( - params: GetConvertBGBHistoryRequestV2, -): Promise> + return this.getPrivate('/api/v2/spot/account/upgrade-status', params); ⋮---- /** * * - * Spot + * Futures * * */ ⋮---- /** * - * * Spot | Market + * * Futures | Market * */ ⋮---- -getSpotCoinInfo(params?: { - coin?: string; -}): Promise> +getFuturesVIPFeeRate(): Promise> ⋮---- -getSpotSymbolInfo(params?: { - symbol?: string; -}): Promise> +getFuturesInterestRateHistory(params: { coin: string }): Promise< + APIResponse<{ + coin: string; + historyInterestRateList: FuturesHistoryInterestRateV2[]; + }> + > { + return this.get('/api/v2/mix/market/union-interest-rate-history', params); ⋮---- -getSpotVIPFeeRate(): Promise> +getFuturesInterestExchangeRate(): Promise< + APIResponse< + { + coin: string; + exchangeRateList: FuturesInterestExchangeRateV2[]; + }[] + > + > { + return this.get('/api/v2/mix/market/exchange-rate'); ⋮---- -getSpotTicker(params?: { - symbol?: string; -}): Promise> +getFuturesDiscountRate(): Promise> ⋮---- -getSpotMergeDepth(params: { +getFuturesMergeDepth( + params: FuturesMergeDepthRequestV2, +): Promise> +⋮---- +getFuturesTicker(params: { symbol: string; - precision?: string; - limit?: string; -}): Promise> + productType: FuturesProductTypeV2; +}): Promise> +⋮---- +getFuturesAllTickers(params: { + productType: FuturesProductTypeV2; +}): Promise> +⋮---- +getFuturesRecentTrades( + params: FuturesRecentTradesRequestV2, +): Promise> +⋮---- +getFuturesHistoricTrades( + params: FuturesHistoricTradesRequestV2, +): Promise> +⋮---- +getFuturesCandles( + params: FuturesCandlesRequestV2, +): Promise> +⋮---- +getFuturesHistoricCandles( + params: FuturesCandlesRequestV2, +): Promise> +⋮---- +getFuturesHistoricIndexPriceCandles( + params: FuturesCandlesRequestV2, +): Promise> +⋮---- +getFuturesHistoricMarkPriceCandles( + params: FuturesCandlesRequestV2, +): Promise> +⋮---- +getFuturesOpenInterest(params: { + symbol: string; + productType: FuturesProductTypeV2; + }): Promise< + APIResponse<{ + openInterestList: FuturesOpenInterestV2[]; + ts: string; + }> + > { + return this.get('/api/v2/mix/market/open-interest', params); +⋮---- +getFuturesNextFundingTime(params: { + symbol: string; + productType: FuturesProductTypeV2; +}): Promise> +⋮---- +getFuturesSymbolPrice(params: { + symbol: string; + productType: FuturesProductTypeV2; +}): Promise> ⋮---- -getSpotOrderBookDepth(params: { +getFuturesHistoricFundingRates(params: { symbol: string; - type?: string; - limit?: string; -}): Promise> + productType: FuturesProductTypeV2; + pageSize?: string; + pageNo?: string; +}): Promise> ⋮---- -getSpotCandles( - params: SpotCandlesRequestV2, -): Promise> +getFuturesCurrentFundingRate(params: { + symbol?: string; + productType: FuturesProductTypeV2; + }): Promise< + APIResponse< + { + symbol: string; + fundingRate: string; // '0.0001'; + fundingRateInterval: string; // hours, example: '1' | '2' | '4' | '8'; + nextUpdate: string; // timestamp in milliseconds + minFundingRate: string; + maxFundingRate: string; + }[] + > + > { + return this.get('/api/v2/mix/market/current-fund-rate', params); ⋮---- -getSpotHistoricCandles( - params: SpotHistoricCandlesRequestV2, -): Promise> +fundingRate: string; // '0.0001'; +fundingRateInterval: string; // hours, example: '1' | '2' | '4' | '8'; +nextUpdate: string; // timestamp in milliseconds ⋮---- -getSpotRecentTrades(params: { - symbol: string; - limit?: string; -}): Promise> +getFuturesContractConfig(params: { + symbol?: string; + productType: FuturesProductTypeV2; +}): Promise> ⋮---- -getSpotHistoricTrades( - params: SpotHistoricTradesRequestV2, -): Promise> +getFuturesOiLimit(params: FuturesOiLimitRequestV2): Promise< + APIResponse< + { + symbol: string; + notionalValue: string; + totalNotionalValue: string; + }[] + > + > { + return this.get('/api/v2/mix/market/oi-limit', params); ⋮---- /** * - * * Spot | Trade + * * Futures | Account * */ ⋮---- -spotSubmitOrder(params: SpotOrderRequestV2): Promise< +getFuturesAccountAsset( + params: FuturesSingleAccountRequestV2, +): Promise> +⋮---- +getFuturesAccountAssets(params: { + productType: FuturesProductTypeV2; +}): Promise> +⋮---- +getFuturesSubAccountAssets(params: { + productType: FuturesProductTypeV2; + }): Promise< + APIResponse< + { + userId: number; + assetList: FuturesSubAccountAssetV2[]; + }[] + > + > { + return this.getPrivate('/api/v2/mix/account/sub-account-assets', params); +⋮---- +getFuturesInterestHistory( + params: FuturesInterestHistoryRequestV2, +): Promise> +⋮---- +getFuturesOpenCount(params: FuturesOpenCountRequestV2): Promise< APIResponse<{ - orderId: string; - clientOid: string; + size: string; }> > { - return this.postPrivate('/api/v2/spot/trade/place-order', params); + return this.getPrivate('/api/v2/mix/account/open-count', params); ⋮---- -spotCancelandSubmitOrder( - params: SpotCancelandSubmitOrderRequestV2, -): Promise> +setFuturesPositionAutoMargin( + params: FuturesSetAutoMarginRequestV2, +): Promise> ⋮---- -spotBatchCancelandSubmitOrder(params: { - orderList: SpotCancelandSubmitOrderRequestV2[]; -}): Promise> +setFuturesLeverage( + params: FuturesSetLeverageRequestV2, +): Promise> ⋮---- -spotCancelOrder(params: SpotCancelOrderRequestV2): Promise< +setFuturesPositionMargin( + params: FuturesSetPositionMarginRequestV2, +): Promise> +⋮---- +setFuturesAssetMode(params: { + productType: 'USDT-FUTURES' | 'SUSDT-FUTURES'; + assetMode: 'single' | 'union'; +}): Promise> +⋮---- +setFuturesMarginMode( + params: FuturesSetMarginModeRequestV2, +): Promise> +⋮---- +setFuturesPositionMode(params: { + productType: FuturesProductTypeV2; + posMode: 'one_way_mode' | 'hedge_mode'; + }): Promise< APIResponse<{ - orderId: string; - clientOid: string; + posMode: 'one_way_mode' | 'hedge_mode'; }> > { - return this.postPrivate('/api/v2/spot/trade/cancel-order', params); -⋮---- -spotBatchSubmitOrders( - params: SpotBatchOrderRequestV2, -): Promise> -⋮---- -spotBatchCancelOrders( - params: SpotBatchCancelOrderRequestV2, -): Promise> + return this.postPrivate('/api/v2/mix/account/set-position-mode', params); ⋮---- -spotCancelSymbolOrder(params: { symbol: string }): Promise< +getFuturesAccountBills(params: FuturesAccountBillRequestV2): Promise< APIResponse<{ - symbol: string; + bills: FuturesAccountBillV2[]; + endId: string; }> > { - return this.postPrivate('/api/v2/spot/trade/cancel-symbol-order', params); + return this.getPrivate('/api/v2/mix/account/bill', params); ⋮---- -getSpotOrder( - params?: GetSpotOrderInfoRequestV2, -): Promise> +/** + * Get Union Transfer Limits + * + * - Rate limit: 1 time/1s (uid) + * - Get union margin currency transfer limits + */ +getUnionTransferLimits( + params: GetUnionTransferLimitsRequestV2, +): Promise> ⋮---- -getSpotOpenOrders( - params?: GetSpotOpenOrdersRequestV2, -): Promise> +/** + * Get Union Config + * + * - Rate limit: 1 time/1s (uid) + * - Get API for union margin configuration parameters (Liability Initial Margin Rate, Liability Maintenance Margin Rate, Personal Liability Limit, Personal Liability Limit Ratio) + */ +getUnionConfig(): Promise> ⋮---- -getSpotHistoricOrders( - params?: GetSpotHistoryOrdersRequestV2, -): Promise> +/** + * Get Switch Union USDT + * + * - Rate limit: 1 time/1s (uid) + * - Get USDT quota for switching from union margin to single margin + */ +getSwitchUnionUsdt(): Promise> ⋮---- -getSpotFills( - params: GetSpotFillsRequestV2, -): Promise> +/** + * Union Convert + * + * - Rate limit: 1 time/1s (uid) + * - Union margin exchange + */ +unionConvert( + params: UnionConvertRequestV2, +): Promise> ⋮---- /** + * Get Max Openable Quantity * - * * Spot | Trigger Orders + * - Rate limit: 20 req/sec/UID + * - Get Max Openable Quantity + */ +getFuturesMaxOpenableQuantity( + params: FuturesMaxOpenRequestV2, +): Promise> +⋮---- +/** + * Get Liquidation Price * + * - Rate limit: 20 req/sec/UID + * - Get Liquidation Price */ +getFuturesLiquidationPrice( + params: FuturesLiquidationPriceRequestV2, +): Promise> ⋮---- -spotSubmitPlanOrder(params: SpotPlanOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - return this.postPrivate('/api/v2/spot/trade/place-plan-order', params); +/** + * Get Isolated Symbols + * + * - Rate limits: 10 time/1s (uid) + * - Retrieve trading pairs with isolated margin mode under the account. + */ +getFuturesIsolatedSymbols( + params: FuturesIsolatedSymbolsRequestV2, +): Promise> ⋮---- -spotModifyPlanOrder(params: SpotModifyPlanOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - return this.postPrivate('/api/v2/spot/trade/modify-plan-order', params); +/** + * + * * Futures | Position + * + */ ⋮---- -spotCancelPlanOrder(params: { - clientOid?: string; - orderId?: string; - }): Promise< - APIResponse<{ - result: string; - }> - > { - return this.postPrivate('/api/v2/spot/trade/cancel-plan-order', params); +getFuturesPositionTier(params: { + productType: FuturesProductTypeV2; + symbol: string; +}): Promise> ⋮---- -getSpotCurrentPlanOrders(params: GetSpotCurrentPlanOrdersRequestV2): Promise< - APIResponse<{ - nextFlag: boolean; - idLessThan: string; - orderList: SpotCurrentPlanOrderV2[]; - }> - > { - return this.getPrivate('/api/v2/spot/trade/current-plan-order', params); +getFuturesPosition(params: { + productType: FuturesProductTypeV2; + symbol: string; + marginCoin: string; +}): Promise> ⋮---- -getSpotPlanSubOrder(params: { - planOrderId: string; -}): Promise> +getFuturesPositions(params: { + productType: FuturesProductTypeV2; + marginCoin?: string; +}): Promise> ⋮---- -getSpotHistoricPlanOrders(params: GetSpotHistoryPlanOrdersRequestV2): Promise< +getFuturesHistoricPositions( + params?: FuturesHistoricalPositionsRequestV2, + ): Promise< APIResponse<{ - nextFlag: boolean; - idLessThan: string; - orderList: SpotHistoryPlanOrderV2[]; + list: FuturesHistoryPositionV2[]; + endId: string; }> > { - return this.getPrivate('/api/v2/spot/trade/history-plan-order', params); + return this.getPrivate('/api/v2/mix/position/history-position', params); ⋮---- -spotCancelPlanOrders(params?: { - symbolList?: string[]; -}): Promise> +getFuturesPositionAdlRank( + params: FuturesPositionAdlRankRequestV2, +): Promise> ⋮---- /** * - * * Spot | Account + * * Futures | Trade * */ ⋮---- -getSpotAccount(): Promise> -⋮---- -getSpotAccountAssets(params?: { - coin?: string; - assetType?: string; -}): Promise> -⋮---- -getSpotSubAccountAssets(): Promise> -⋮---- -spotModifyDepositAccount(params: { - accountType: string; - coin: string; -}): Promise> -⋮---- -getSpotAccountBills( - params?: GetSpotAccountBillsRequestV2, -): Promise> +futuresSubmitOrder(params: FuturesPlaceOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/mix/order/place-order', params); ⋮---- -spotTransfer(params: SpotTransferRequestV2): Promise< +futuresSubmitReversal(params: FuturesReversalOrderRequestV2): Promise< APIResponse<{ - transferId: string; + orderId: string; clientOid: string; }> > { - return this.postPrivate('/api/v2/spot/wallet/transfer', params); + return this.postPrivate('/api/v2/mix/order/click-backhand', params); ⋮---- -getSpotTransferableCoins(params: { - fromType: SpotAccountTypeV2; - toType: SpotAccountTypeV2; -}): Promise> +futuresBatchSubmitOrders( + params: FuturesBatchOrderRequestV2, +): Promise> ⋮---- -spotSubTransfer(params: SpotSubAccountTransferRequestV2): Promise< +futuresModifyOrder(params: FuturesModifyOrderRequestV2): Promise< APIResponse<{ - transferId: string; + orderId: string; clientOid: string; }> > { - return this.postPrivate('/api/v2/spot/wallet/subaccount-transfer', params); + return this.postPrivate('/api/v2/mix/order/modify-order', params); ⋮---- -spotWithdraw(params: SpotWithdrawalRequestV2): Promise< +futuresCancelOrder(params: FuturesCancelOrderRequestV2): Promise< APIResponse<{ orderId: string; clientOid: string; }> > { - return this.postPrivate('/api/v2/spot/wallet/withdrawal', params); -⋮---- -getSpotMainSubTransferRecord( - params: SpotMainSubTransferRecordRequestV2, -): Promise> -⋮---- -getSpotTransferHistory( - params: GetSpotTransferRecordRequestV2, -): Promise> + return this.postPrivate('/api/v2/mix/order/cancel-order', params); ⋮---- -spotSwitchBGBDeduct(params: { - deduct: boolean; -}): Promise> +futuresBatchCancelOrders( + params: FuturesBatchCancelOrderRequestV2, +): Promise> ⋮---- -getSpotDepositAddress(params: { - coin: string; - chain?: string; - size: string; -}): Promise> +futuresFlashClosePositions( + params: FuturesFlashClosePositionsRequestV2, +): Promise> ⋮---- -getSpotSubDepositAddress(params: { - subUid: string; - coin: string; - chain?: string; - size: string; -}): Promise> +getFuturesOrder( + params: FuturesGetOrderRequestV2, +): Promise> ⋮---- -getSpotBGBDeductInfo(): Promise< +getFuturesFills(params: FuturesGetOrderFillsRequestV2): Promise< APIResponse<{ - deduct: string; + fillList: FuturesOrderFillV2[]; + endId: string; }> > { - return this.getPrivate('/api/v2/spot/account/deduct-info'); -⋮---- -spotCancelWithdrawal(params: { - orderId: string; -}): Promise> -⋮---- -getSubAccountDepositRecords( - params: GetSpotSubAccountDepositRecordRequestV2, -): Promise> -⋮---- -getSpotWithdrawalHistory( - params: GetSpotWithdrawalRecordRequestV2, -): Promise> + return this.getPrivate('/api/v2/mix/order/fills', params); ⋮---- -getSpotDepositHistory( - params: GetSpotDepositRecordRequestV2, -): Promise> +getFuturesHistoricOrderFills( + params: FuturesGetHistoricalFillsRequestV2, + ): Promise< + APIResponse<{ + fillList: FuturesOrderFillV2[]; + endId: string; + }> + > { + return this.getPrivate('/api/v2/mix/order/fill-history', params); ⋮---- -/** - * Upgrade Account - Upgrade to unified account mode - * No account type restrictions; both parent and sub-accounts are supported. - * This interface is only used for upgrading to the unified account mode. - * Please note that as the account upgrade process takes approximately 1 minute, - * the successful response you receive only indicates that the request has been received, - * and does not mean that the account has been successfully upgraded to a unified account. - * Please use the query upgrade status interface to confirm whether the account upgrade is successful. - */ -upgradeToUnifiedAccount(params?: { - subUid?: string; -}): Promise> +getFuturesOpenOrders(params: FuturesGetOpenOrdersRequestV2): Promise< + APIResponse<{ + entrustedList: FuturesOpenOrderV2[]; + endId: string; + }> + > { + return this.getPrivate('/api/v2/mix/order/orders-pending', params); ⋮---- -/** - * Get Upgrade Status - Get account upgrade status - * No account type restrictions; both parent and sub-accounts are supported. - */ -getUnifiedAccountSwitchStatus(params?: { subUid?: string }): Promise< +getFuturesHistoricOrders(params: FuturesGetHistoryOrdersRequestV2): Promise< APIResponse<{ - status: 'processProcessing' | 'successSuccess' | 'failFailed'; + entrustedList: FuturesHistoryOrderV2[]; + endId: string; }> > { - return this.getPrivate('/api/v2/spot/account/upgrade-status', params); + return this.getPrivate('/api/v2/mix/order/orders-history', params); ⋮---- -/** - * - * - * Futures - * - * - */ +futuresCancelAllOrders( + params: FuturesCancelAllOrdersRequestV2, +): Promise> ⋮---- /** * - * * Futures | Market + * * Futures | Trigger Orders * */ ⋮---- -getFuturesVIPFeeRate(): Promise> +getFuturesTriggerSubOrder(params: { + planType: 'normal_plan' | 'track_plan'; + planOrderId: string; + productType: FuturesProductTypeV2; +}): Promise> ⋮---- -getFuturesInterestRateHistory(params: { coin: string }): Promise< +futuresSubmitTPSLOrder(params: FuturesTPSLOrderRequestV2): Promise< APIResponse<{ - coin: string; - historyInterestRateList: FuturesHistoryInterestRateV2[]; + orderId: string; + clientOid: string; }> > { - return this.get('/api/v2/mix/market/union-interest-rate-history', params); + return this.postPrivate('/api/v2/mix/order/place-tpsl-order', params); ⋮---- -getFuturesInterestExchangeRate(): Promise< +futuresSubmitPositionTPSL(params: FuturesPositionTPSLOrderRequestV2): Promise< APIResponse< { - coin: string; - exchangeRateList: FuturesInterestExchangeRateV2[]; + orderId: string; + stopSurplusClientOid: string; + stopLossClientOid: string; }[] > > { - return this.get('/api/v2/mix/market/exchange-rate'); -⋮---- -getFuturesDiscountRate(): Promise> -⋮---- -getFuturesMergeDepth( - params: FuturesMergeDepthRequestV2, -): Promise> + return this.postPrivate('/api/v2/mix/order/place-pos-tpsl', params); ⋮---- -getFuturesTicker(params: { - symbol: string; - productType: FuturesProductTypeV2; -}): Promise> -⋮---- -getFuturesAllTickers(params: { - productType: FuturesProductTypeV2; -}): Promise> -⋮---- -getFuturesRecentTrades( - params: FuturesRecentTradesRequestV2, -): Promise> -⋮---- -getFuturesHistoricTrades( - params: FuturesHistoricTradesRequestV2, -): Promise> +futuresSubmitPlanOrder(params: FuturesPlanOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/mix/order/place-plan-order', params); ⋮---- -getFuturesCandles( - params: FuturesCandlesRequestV2, -): Promise> +futuresModifyTPSLPOrder(params: FuturesModifyTPSLOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/mix/order/modify-tpsl-order', params); ⋮---- -getFuturesHistoricCandles( - params: FuturesCandlesRequestV2, -): Promise> +futuresModifyPlanOrder(params: FuturesModifyPlanOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/mix/order/modify-plan-order', params); ⋮---- -getFuturesHistoricIndexPriceCandles( - params: FuturesCandlesRequestV2, -): Promise> +getFuturesPlanOrders(params: FuturesGetPlanOrdersRequestV2): Promise< + APIResponse<{ + entrustedList: FuturesPendingPlanOrderV2[]; + endId: string; + }> + > { + return this.getPrivate('/api/v2/mix/order/orders-plan-pending', params); ⋮---- -getFuturesHistoricMarkPriceCandles( - params: FuturesCandlesRequestV2, -): Promise> +futuresCancelPlanOrder( + params: FuturesCancelPlanOrderRequestV2, +): Promise> ⋮---- -getFuturesOpenInterest(params: { - symbol: string; - productType: FuturesProductTypeV2; - }): Promise< +getFuturesHistoricPlanOrders( + params: FuturesGetHistoryPlanOrdersRequestV2, + ): Promise< APIResponse<{ - openInterestList: FuturesOpenInterestV2[]; - ts: string; + entrustedList: FuturesHistoryPlanOrderV2[]; + endId: string; }> > { - return this.get('/api/v2/mix/market/open-interest', params); + return this.getPrivate('/api/v2/mix/order/orders-plan-history', params); ⋮---- -getFuturesNextFundingTime(params: { - symbol: string; - productType: FuturesProductTypeV2; -}): Promise> +/** + * + * + * Broker + * + * + */ ⋮---- -getFuturesSymbolPrice(params: { - symbol: string; - productType: FuturesProductTypeV2; -}): Promise> +/** + * + * * Broker | Subaccount + * + */ ⋮---- -getFuturesHistoricFundingRates(params: { - symbol: string; - productType: FuturesProductTypeV2; - pageSize?: string; - pageNo?: string; -}): Promise> +modifySubaccountEmail(params: { + subUid: string; + subaccountEmail: string; +}): Promise> ⋮---- -getFuturesCurrentFundingRate(params: { - symbol?: string; - productType: FuturesProductTypeV2; - }): Promise< - APIResponse< - { - symbol: string; - fundingRate: string; // '0.0001'; - fundingRateInterval: string; // hours, example: '1' | '2' | '4' | '8'; - nextUpdate: string; // timestamp in milliseconds - minFundingRate: string; - maxFundingRate: string; - }[] - > +getBrokerInfo(): Promise< + APIResponse<{ + subAccountSize: string; + maxSubAccountSize: string; + uTime: string; + }> > { - return this.get('/api/v2/mix/market/current-fund-rate', params); + return this.getPrivate('/api/v2/broker/account/info'); ⋮---- -fundingRate: string; // '0.0001'; -fundingRateInterval: string; // hours, example: '1' | '2' | '4' | '8'; -nextUpdate: string; // timestamp in milliseconds +createSubaccount(params: { + subaccountName: string; + label: string; +}): Promise> ⋮---- -getFuturesContractConfig(params: { - symbol?: string; - productType: FuturesProductTypeV2; -}): Promise> +getSubaccounts(params?: GetSubAccountsRequestV2): Promise< + APIResponse<{ + hasNextPage: boolean; + idLessThan: number; + subList: BrokerSubaccountV2[]; + }> + > { + return this.getPrivate('/api/v2/broker/account/subaccount-list', params); ⋮---- -/** - * - * * Futures | Account - * - */ +modifySubaccount( + params: ModifySubRequestV2, +): Promise> ⋮---- -getFuturesAccountAsset( - params: FuturesSingleAccountRequestV2, -): Promise> +getSubaccountEmail(params: { + subUid: string; +}): Promise> ⋮---- -getFuturesAccountAssets(params: { - productType: FuturesProductTypeV2; -}): Promise> +getSubaccountSpotAssets(params: { + subUid: string; + coin?: string; + assetType?: 'hold_only' | 'all'; + }): Promise< + APIResponse<{ + assetsList: BrokerSubaccountSpotAssetV2[]; + }> + > { + return this.getPrivate( + '/api/v2/broker/account/subaccount-spot-assets', + params, + ); ⋮---- -getFuturesSubAccountAssets(params: { +getSubaccountFuturesAssets(params: { + subUid: string; productType: FuturesProductTypeV2; }): Promise< - APIResponse< - { - userId: number; - assetList: FuturesSubAccountAssetV2[]; - }[] - > + APIResponse<{ + assetsList: BrokerSubaccountFutureAssetV2[]; + }> > { - return this.getPrivate('/api/v2/mix/account/sub-account-assets', params); + return this.getPrivate( + '/api/v2/broker/account/subaccount-future-assets', + params, + ); ⋮---- -getFuturesInterestHistory( - params: FuturesInterestHistoryRequestV2, -): Promise> +createSubaccountDepositAddress(params: { + subUid: string; + coin: string; + chain?: string; +}): Promise> ⋮---- -getFuturesOpenCount(params: FuturesOpenCountRequestV2): Promise< +subaccountWithdrawal(params: SubWithdrawalRequestV2): Promise< APIResponse<{ - size: string; + orderId: string; + clientOid: string; }> > { - return this.getPrivate('/api/v2/mix/account/open-count', params); -⋮---- -setFuturesPositionAutoMargin( - params: FuturesSetAutoMarginRequestV2, -): Promise> -⋮---- -setFuturesLeverage( - params: FuturesSetLeverageRequestV2, -): Promise> -⋮---- -setFuturesPositionMargin( - params: FuturesSetPositionMarginRequestV2, -): Promise> + return this.postPrivate( + '/api/v2/broker/account/subaccount-withdrawal', + params, + ); ⋮---- -setFuturesAssetMode(params: { - productType: 'USDT-FUTURES' | 'SUSDT-FUTURES'; - assetMode: 'single' | 'union'; +subaccountSetAutoTransfer(params: { + subUid: string; + coin: string; + toAccountType: string; }): Promise> ⋮---- -setFuturesMarginMode( - params: FuturesSetMarginModeRequestV2, -): Promise> +/** + * Sub Deposit Records + * + * - Only applicable for ND broker main-account to get ND sub-accounts deposit record + */ +subaccountDepositRecords( + params: SubDepositRecordsRequestV2, +): Promise> ⋮---- -setFuturesPositionMode(params: { - productType: FuturesProductTypeV2; - posMode: 'one_way_mode' | 'hedge_mode'; - }): Promise< +/** + * Sub Withdrawal Records + * + * - Only applicable for ND broker main-account + */ +subaccountWithdrawalRecords(params: SubWithdrawalRecordsRequestV2): Promise< APIResponse<{ - posMode: 'one_way_mode' | 'hedge_mode'; + resultList: BrokerSubaccountWithdrawalV2[]; + endId: string; }> > { - return this.postPrivate('/api/v2/mix/account/set-position-mode', params); + return this.getPrivate('/api/v2/broker/subaccount-withdrawal', params); ⋮---- -getFuturesAccountBills(params: FuturesAccountBillRequestV2): Promise< +/** + * + * Broker | Api Key + * + */ +⋮---- +createSubaccountApiKey( + params: CreateSubAccountApiKeyRequestV2, +): Promise> +⋮---- +getSubaccountApiKey(params: { + subUid: string; +}): Promise> +⋮---- +modifySubaccountApiKey( + params: ModifySubAccountApiKeyRequestV2, +): Promise> +⋮---- +deleteSubaccountApiKey( + params: DeleteSubAccountApiKeyRequestV2, +): Promise> +⋮---- +/** + * Get All Sub-accounts Deposit and Withdrawal Records + * + * - Only applicable for ND broker main-account + * - Rate limit: 5 req/sec/UID + * - Able to get ND sub-accounts deposit and withdrawal records within 90 days + */ +getAllSubDepositWithdrawalRecords( + params?: GetAllSubDepositWithdrawalRequestV2, + ): Promise< APIResponse<{ - bills: FuturesAccountBillV2[]; + list: AllSubDepositWithdrawalRecordV2[]; endId: string; }> > { - return this.getPrivate('/api/v2/mix/account/bill', params); + return this.getPrivate('/api/v2/broker/all-sub-deposit-withdrawal', params); ⋮---- /** - * Get Union Transfer Limits + * Get Broker Subaccounts * - * - Rate limit: 1 time/1s (uid) - * - Get union margin currency transfer limits + * - Rate limit: 5 req/sec/UID + * - Please contact your BD or RM to apply for access permissions */ -getUnionTransferLimits( - params: GetUnionTransferLimitsRequestV2, -): Promise> +getBrokerSubaccounts( + params?: GetBrokerSubaccountsRequestV2, +): Promise> ⋮---- /** - * Get Union Config + * Get Broker Subaccounts Commissions * - * - Rate limit: 1 time/1s (uid) - * - Get API for union margin configuration parameters (Liability Initial Margin Rate, Liability Maintenance Margin Rate, Personal Liability Limit, Personal Liability Limit Ratio) + * - Rate limit: 5 req/sec/UID + * - Please contact your BD or RM to apply for access permissions */ -getUnionConfig(): Promise> +getBrokerCommissions( + params?: GetBrokerCommissionsRequestV2, +): Promise> +⋮---- +/** + * Get Broker Trade Volume + * + * - Rate limit: 5 req/sec/UID + * - Please contact your BD or RM to apply for access permissions + */ +getBrokerTradeVolume( + params?: GetBrokerTradeVolumeRequestV2, +): Promise> ⋮---- /** - * Get Switch Union USDT + * Get Total Commission * - * - Rate limit: 1 time/1s (uid) - * - Get USDT quota for switching from union margin to single margin + * - Rate limit: 20 req/sec/UID + * - Data retention: 365 days + * - Historical data available from: 2025/6/1 + * - Data granularity: daily + * - Data update granularity: daily, previous day's data is updated on the current day + * - Time zone: UTC+8 + * - startTime and endTime should either both be set or both left unset + * - This API supports retrieving data within the past 365 days (data is available starting from 2025/6/1 at the earliest) + * - If startTime and endTime are not set in the request, the default returned information will be for yesterday (00:00-23:59 UTC+8) + * - Data update frequency: T+1 (UTC+8) */ -getSwitchUnionUsdt(): Promise> +getBrokerTotalCommission( + params?: GetBrokerTotalCommissionRequestV2, +): Promise> ⋮---- /** - * Union Convert + * Get Order Commission * - * - Rate limit: 1 time/1s (uid) - * - Union margin exchange + * - Rate limit: 20 req/sec/UID + * - Data storage: 30 days + * - Historical data backtracking: 2025/9/1 + * - Data granularity: daily + * - Data update frequency: daily, previous day's data is updated on the current day + * - Time zone: UTC+8 + * - startTime and endTime should either both be set or both not set + * - The maximum time span supported for startTime and endTime is 30 days + * - This API supports retrieving data within the past 30 days + * - If startTime and endTime are not set in the request, the default return will be information for yesterday (00:00-23:59 UTC+8) + * - This API data is updated on a T+1 basis + * - Transaction details only show those marked with broker channel id */ -unionConvert( - params: UnionConvertRequestV2, -): Promise> +getBrokerOrderCommission( + params?: GetBrokerOrderCommissionRequestV2, +): Promise> ⋮---- /** - * Get Max Openable Quantity + * Get Rebate Info * * - Rate limit: 20 req/sec/UID - * - Get Max Openable Quantity + * - Data retention: 30 days + * - Real-time data */ -getFuturesMaxOpenableQuantity( - params: FuturesMaxOpenRequestV2, -): Promise> +getBrokerRebateInfo( + params: GetBrokerRebateInfoRequestV2, +): Promise> ⋮---- /** - * Get Liquidation Price * - * - Rate limit: 20 req/sec/UID - * - Get Liquidation Price + * * Broker | Agent (affiliate) customer APIs + * */ -getFuturesLiquidationPrice( - params: FuturesLiquidationPriceRequestV2, -): Promise> +⋮---- +getAgentCustomerCommissions( + params?: GetAgentCustomerCommissionsRequestV2, +): Promise> ⋮---- /** - * Get Isolated Symbols - * - * - Rate limits: 10 time/1s (uid) - * - Retrieve trading pairs with isolated margin mode under the account. + * Without startTime/endTime, returns all registered sub-customers (no time restriction). */ -getFuturesIsolatedSymbols( - params: FuturesIsolatedSymbolsRequestV2, -): Promise> +getAgentSubCustomerList( + params?: GetAgentSubCustomerListRequestV2, +): Promise> +⋮---- +getAgentCustomerTradeVolume( + params?: AgentCustomerTradeVolumeRequestV2, +): Promise> ⋮---- /** - * - * * Futures | Position - * + * Without startTime/endTime, returns all registered customers (no time restriction). */ +getAgentCustomerList( + params?: AgentCustomerListRequestV2, +): Promise> ⋮---- -getFuturesPositionTier(params: { - productType: FuturesProductTypeV2; - symbol: string; -}): Promise> +getAgentCustomerKycResult( + params?: GetAgentCustomerKycResultRequestV2, +): Promise> ⋮---- -getFuturesPosition(params: { - productType: FuturesProductTypeV2; - symbol: string; - marginCoin: string; -}): Promise> +getAgentCustomerDeposits( + params?: AgentCustomerDepositRequestV2, +): Promise> ⋮---- -getFuturesPositions(params: { - productType: FuturesProductTypeV2; - marginCoin?: string; -}): Promise> +getAgentCustomerAssets( + params?: AgentCustomerAssetRequestV2, +): Promise> ⋮---- -getFuturesHistoricPositions( - params?: FuturesHistoricalPositionsRequestV2, - ): Promise< - APIResponse<{ - list: FuturesHistoryPositionV2[]; - endId: string; - }> - > { - return this.getPrivate('/api/v2/mix/position/history-position', params); +getAgentCommissionDetail( + params?: GetAgentCommissionDetailRequestV2, +): Promise> ⋮---- /** * - * * Futures | Trade + * + * Margin + * * */ ⋮---- -futuresSubmitOrder(params: FuturesPlaceOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - return this.postPrivate('/api/v2/mix/order/place-order', params); -⋮---- -futuresSubmitReversal(params: FuturesReversalOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - return this.postPrivate('/api/v2/mix/order/click-backhand', params); +/** + * + * * Margin | Common + * + */ ⋮---- -futuresBatchSubmitOrders( - params: FuturesBatchOrderRequestV2, -): Promise> +getMarginCurrencies(): Promise> ⋮---- -futuresModifyOrder(params: FuturesModifyOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - return this.postPrivate('/api/v2/mix/order/modify-order', params); +/** + * + * * Margin | Cross/Isolated | Order Record + * + */ ⋮---- -futuresCancelOrder(params: FuturesCancelOrderRequestV2): Promise< +getMarginBorrowHistory( + marginType: MarginType, + params: GetBorrowHistoryRequestV2, + ): Promise< APIResponse<{ - orderId: string; - clientOid: string; + resultList: MarginBorrowHistoryItemV2[]; + maxId: string; + minId: string; }> > { - return this.postPrivate('/api/v2/mix/order/cancel-order', params); -⋮---- -futuresBatchCancelOrders( - params: FuturesBatchCancelOrderRequestV2, -): Promise> -⋮---- -futuresFlashClosePositions( - params: FuturesFlashClosePositionsRequestV2, -): Promise> -⋮---- -getFuturesOrder( - params: FuturesGetOrderRequestV2, -): Promise> + assertMarginType(marginType); ⋮---- -getFuturesFills(params: FuturesGetOrderFillsRequestV2): Promise< +getMarginRepayHistory( + marginType: MarginType, + params: GetRepayHistoryRequestV2, + ): Promise< APIResponse<{ - fillList: FuturesOrderFillV2[]; - endId: string; + resultList: MarginRepaymentHistoryItemV2[]; + maxId: string; + minId: string; }> > { - return this.getPrivate('/api/v2/mix/order/fills', params); + assertMarginType(marginType); ⋮---- -getFuturesHistoricOrderFills( - params: FuturesGetHistoricalFillsRequestV2, +getMarginInterestHistory( + marginType: MarginType, + params: GetInterestHistoryRequestV2, ): Promise< APIResponse<{ - fillList: FuturesOrderFillV2[]; - endId: string; + resultList: MarginInterestHistoryItemV2[]; + maxId: string; + minId: string; }> > { - return this.getPrivate('/api/v2/mix/order/fill-history', params); + assertMarginType(marginType); ⋮---- -getFuturesOpenOrders(params: FuturesGetOpenOrdersRequestV2): Promise< +getMarginLiquidationHistory( + marginType: MarginType, + params: GetLiquidationHistoryRequestV2, + ): Promise< APIResponse<{ - entrustedList: FuturesOpenOrderV2[]; - endId: string; + resultList: MarginLiquidationHistoryItemV2[]; + maxId: string; + minId: string; }> > { - return this.getPrivate('/api/v2/mix/order/orders-pending', params); + assertMarginType(marginType); ⋮---- -getFuturesHistoricOrders(params: FuturesGetHistoryOrdersRequestV2): Promise< +getMarginFinancialHistory( + marginType: MarginType, + params: GetFinancialHistoryRequestV2, + ): Promise< APIResponse<{ - entrustedList: FuturesHistoryOrderV2[]; - endId: string; + resultList: MarginFinancialHistoryItemV2[]; + maxId: string; + minId: string; }> > { - return this.getPrivate('/api/v2/mix/order/orders-history', params); -⋮---- -futuresCancelAllOrders( - params: FuturesCancelAllOrdersRequestV2, -): Promise> + assertMarginType(marginType); ⋮---- /** * - * * Futures | Trigger Orders + * * Margin | Cross/Isolated | Account * */ ⋮---- -getFuturesTriggerSubOrder(params: { - planType: 'normal_plan' | 'track_plan'; - planOrderId: string; - productType: FuturesProductTypeV2; -}): Promise> +getMarginAccountAssets( + marginType: MarginType, + params?: { coin?: string }, +): Promise> ⋮---- -futuresSubmitTPSLOrder(params: FuturesTPSLOrderRequestV2): Promise< +marginBorrow( + marginType: MarginType, + params: { + loanId: string; + symbol: string; + coin: string; + borrowAmount: string; + }, + ): Promise< APIResponse<{ - orderId: string; - clientOid: string; + loanId: string; + symbol: string; + coin: string; + borrowAmount: string; }> > { - return this.postPrivate('/api/v2/mix/order/place-tpsl-order', params); + assertMarginType(marginType); ⋮---- -futuresSubmitPlanOrder(params: FuturesPlanOrderRequestV2): Promise< +marginRepay( + marginType: MarginType, + params: { + remainDebtAmount: string; + symbol: string; + repayId: string; + coin: string; + repayAmount: string; + }, + ): Promise< APIResponse<{ - orderId: string; - clientOid: string; + symbol: string; + coin: string; + repayId: string; + remainDebtAmount: string; + repayAmount: string; }> > { - return this.postPrivate('/api/v2/mix/order/place-plan-order', params); + assertMarginType(marginType); ⋮---- -futuresModifyTPSLPOrder(params: FuturesModifyTPSLOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> +getMarginRiskRate(marginType: MarginType): Promise< + APIResponse< + { + symbol: string; + riskRateRatio: string; + }[] + > > { - return this.postPrivate('/api/v2/mix/order/modify-tpsl-order', params); + assertMarginType(marginType); ⋮---- -futuresModifyPlanOrder(params: FuturesModifyPlanOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> +getMarginMaxBorrowable( + marginType: MarginType, + params: { coin: string }, + ): Promise< + APIResponse > { - return this.postPrivate('/api/v2/mix/order/modify-plan-order', params); + assertMarginType(marginType); ⋮---- -getFuturesPlanOrders(params: FuturesGetPlanOrdersRequestV2): Promise< - APIResponse<{ - entrustedList: FuturesPendingPlanOrderV2[]; - endId: string; - }> +getMarginMaxTransferable( + marginType: MarginType, + params: { coin: string }, + ): Promise< + APIResponse< + CrossMaxTransferableResponseV2 | IsolatedMaxTransferableResponseV2 + > > { - return this.getPrivate('/api/v2/mix/order/orders-plan-pending', params); + assertMarginType(marginType); ⋮---- -futuresCancelPlanOrder( - params: FuturesCancelPlanOrderRequestV2, -): Promise> +getMarginInterestRateAndMaxBorrowable( + marginType: MarginType, + params: { coin: string }, + ): Promise< + APIResponse< + | IsolatedInterestRateAndLimitResponseV2[] + | CrossInterestRateAndLimitResponseV2[] + > + > { + assertMarginType(marginType); ⋮---- -getFuturesHistoricPlanOrders( - params: FuturesGetHistoryPlanOrdersRequestV2, +getMarginTierConfiguration( + marginType: MarginType, + params: { coin: string }, + ): Promise< + APIResponse< + CrossTierConfigurationResponseV2[] | IsolatedTierConfigurationResponseV2[] + > + > { + assertMarginType(marginType); +⋮---- +marginFlashRepay( + marginType: MarginType, + params: { coin: string }, ): Promise< APIResponse<{ - entrustedList: FuturesHistoryPlanOrderV2[]; - endId: string; + repayId: string; + coin?: string; + symbol?: string; + result?: string; }> > { - return this.getPrivate('/api/v2/mix/order/orders-plan-history', params); + assertMarginType(marginType); ⋮---- -/** - * - * - * Broker - * - * - */ +getMarginFlashRepayResult( + marginType: MarginType, + params: { idList: string }, + ): Promise< + APIResponse< + { + repayId: string; + status: string; + }[] + > + > { + assertMarginType(marginType); ⋮---- /** * - * * Broker | Subaccount + * * Margin | Cross/Isolated | Trade * */ ⋮---- -modifySubaccountEmail(params: { - subUid: string; - subaccountEmail: string; -}): Promise> -⋮---- -getBrokerInfo(): Promise< +marginSubmitOrder( + marginType: MarginType, + params: MarginPlaceOrderRequestV2, + ): Promise< APIResponse<{ - subAccountSize: string; - maxSubAccountSize: string; - uTime: string; + orderId: string; + clientOid: string; }> > { - return this.getPrivate('/api/v2/broker/account/info'); + assertMarginType(marginType); ⋮---- -createSubaccount(params: { - subaccountName: string; - label: string; -}): Promise> +marginBatchSubmitOrders( + marginType: MarginType, + params: MarginBatchOrdersRequestV2, +): Promise> ⋮---- -getSubaccounts(params?: GetSubAccountsRequestV2): Promise< +marginCancelOrder( + marginType: MarginType, + params: { + symbol: string; + orderId?: string; + clientOid?: string; + }, + ): Promise< APIResponse<{ - hasNextPage: boolean; - idLessThan: number; - subList: BrokerSubaccountV2[]; + orderId: string; + clientOid: string; }> > { - return this.getPrivate('/api/v2/broker/account/subaccount-list', params); -⋮---- -modifySubaccount( - params: ModifySubRequestV2, -): Promise> + assertMarginType(marginType); ⋮---- -getSubaccountEmail(params: { - subUid: string; -}): Promise> +marginBatchCancelOrders( + marginType: MarginType, + params: { + symbol: string; + orderIdList: string[]; + }, +): Promise> ⋮---- -getSubaccountSpotAssets(params: { - subUid: string; - coin?: string; - assetType?: 'hold_only' | 'all'; - }): Promise< +getMarginOpenOrders( + marginType: MarginType, + params: GetMarginCurrentOrdersRequestV2, + ): Promise< APIResponse<{ - assetsList: BrokerSubaccountSpotAssetV2[]; + orderList: MarginCurrentOrderV2[]; + maxId: string; + minId: string; }> > { - return this.getPrivate( - '/api/v2/broker/account/subaccount-spot-assets', - params, - ); + assertMarginType(marginType); ⋮---- -getSubaccountFuturesAssets(params: { - subUid: string; - productType: FuturesProductTypeV2; - }): Promise< +getMarginHistoricOrders( + marginType: MarginType, + params: GetHistoryOrdersRequestV2, + ): Promise< APIResponse<{ - assetsList: BrokerSubaccountFutureAssetV2[]; + orderList: MarginHistoryOrderV2[]; + maxId: string; + minId: string; }> > { - return this.getPrivate( - '/api/v2/broker/account/subaccount-future-assets', - params, - ); -⋮---- -createSubaccountDepositAddress(params: { - subUid: string; - coin: string; - chain?: string; -}): Promise> + assertMarginType(marginType); ⋮---- -subaccountWithdrawal(params: SubWithdrawalRequestV2): Promise< +getMarginHistoricOrderFills( + marginType: MarginType, + params: GetMarginOrderFillsRequestV2, + ): Promise< APIResponse<{ - orderId: string; - clientOid: string; + fills: MarginOrderFillV2[]; + minId: string; + maxId: string; }> > { - return this.postPrivate( - '/api/v2/broker/account/subaccount-withdrawal', - params, - ); -⋮---- -subaccountSetAutoTransfer(params: { - subUid: string; - coin: string; - toAccountType: string; -}): Promise> + assertMarginType(marginType); ⋮---- -/** - * Sub Deposit Records - * - * - Only applicable for ND broker main-account to get ND sub-accounts deposit record - */ -subaccountDepositRecords( - params: SubDepositRecordsRequestV2, -): Promise> +getMarginLiquidationOrders( + marginType: MarginType, + params: GetMarginLiquidationOrdersRequestV2, + ): Promise< + APIResponse<{ + resultList: MarginLiquidationOrderV2[]; + idLessThan: string; + }> + > { + assertMarginType(marginType); ⋮---- /** - * Sub Withdrawal Records * - * - Only applicable for ND broker main-account + * + * Copy Trading + * + * */ -subaccountWithdrawalRecords(params: SubWithdrawalRecordsRequestV2): Promise< - APIResponse<{ - resultList: BrokerSubaccountWithdrawalV2[]; - endId: string; - }> - > { - return this.getPrivate('/api/v2/broker/subaccount-withdrawal', params); ⋮---- /** * - * Broker | Api Key + * + * Copy Trading | Future copy trading | Trader Api + * * */ ⋮---- -createSubaccountApiKey( - params: CreateSubAccountApiKeyRequestV2, -): Promise> +getFuturesTraderCurrentOrder( + params: GetFuturesTraderCurrentOrdersRequestV2, +): Promise> ⋮---- -getSubaccountApiKey(params: { - subUid: string; -}): Promise> +getFuturesTraderHistoryOrders( + params: GetFuturesTraderHistoryOrdersRequestV2, +): Promise> ⋮---- -modifySubaccountApiKey( - params: ModifySubAccountApiKeyRequestV2, -): Promise> +modifyFuturesTraderOrderTPSL( + params: ModifyFuturesTraderOrderTPSLRequestV2, +): Promise> ⋮---- -/** - * Get All Sub-accounts Deposit and Withdrawal Records - * - * - Only applicable for ND broker main-account - * - Rate limit: 5 req/sec/UID - * - Able to get ND sub-accounts deposit and withdrawal records within 90 days - */ -getAllSubDepositWithdrawalRecords( - params?: GetAllSubDepositWithdrawalRequestV2, - ): Promise< - APIResponse<{ - list: AllSubDepositWithdrawalRecordV2[]; - endId: string; - }> +getFuturesTraderOrder(): Promise< + APIResponse > { - return this.getPrivate('/api/v2/broker/all-sub-deposit-withdrawal', params); + return this.getPrivate('/api/v2/copy/mix-trader/order-total-detail'); ⋮---- -/** - * Get Broker Subaccounts - * - * - Rate limit: 5 req/sec/UID - * - Please contact your BD or RM to apply for access permissions - */ -getBrokerSubaccounts( - params?: GetBrokerSubaccountsRequestV2, -): Promise> +getFuturesTraderProfitHistory(): Promise< + APIResponse + > { + return this.getPrivate('/api/v2/copy/mix-trader/profit-history-summarys'); ⋮---- -/** - * Get Broker Subaccounts Commissions - * - * - Rate limit: 5 req/sec/UID - * - Please contact your BD or RM to apply for access permissions - */ -getBrokerCommissions( - params?: GetBrokerCommissionsRequestV2, -): Promise> +getFuturesTraderProfitShareHistory( + params: GetFuturesTraderProfitShareDetailRequestV2, +): Promise> ⋮---- -/** - * Get Broker Trade Volume - * - * - Rate limit: 5 req/sec/UID - * - Please contact your BD or RM to apply for access permissions - */ -getBrokerTradeVolume( - params?: GetBrokerTradeVolumeRequestV2, -): Promise> +closeFuturesTraderOrder(params: { + trackingNo: string; + symbol: string; + productType: CopyTradingProductTypeV2; + }): Promise< + APIResponse< + { + trackingNo: string; + symbol: string; + productType: string; + }[] + > + > { + return this.postPrivate( + '/api/v2/copy/mix-trader/order-close-positions', + params, + ); ⋮---- -/** - * Get Total Commission - * - * - Rate limit: 20 req/sec/UID - * - Data retention: 365 days - * - Historical data available from: 2025/6/1 - * - Data granularity: daily - * - Data update granularity: daily, previous day's data is updated on the current day - * - Time zone: UTC+8 - * - startTime and endTime should either both be set or both left unset - * - This API supports retrieving data within the past 365 days (data is available starting from 2025/6/1 at the earliest) - * - If startTime and endTime are not set in the request, the default returned information will be for yesterday (00:00-23:59 UTC+8) - * - Data update frequency: T+1 (UTC+8) - */ -getBrokerTotalCommission( - params?: GetBrokerTotalCommissionRequestV2, -): Promise> +getFuturesTraderProfitShare(params?: { + coin?: string; + pageSize?: string; + pageNo?: string; + }): Promise< + APIResponse< + { + coin: string; + profit: string; + nickName: string; + }[] + > + > { + return this.getPrivate('/api/v2/copy/mix-trader/profit-details', params); ⋮---- -/** - * Get Order Commission - * - * - Rate limit: 20 req/sec/UID - * - Data storage: 30 days - * - Historical data backtracking: 2025/9/1 - * - Data granularity: daily - * - Data update frequency: daily, previous day's data is updated on the current day - * - Time zone: UTC+8 - * - startTime and endTime should either both be set or both not set - * - The maximum time span supported for startTime and endTime is 30 days - * - This API supports retrieving data within the past 30 days - * - If startTime and endTime are not set in the request, the default return will be information for yesterday (00:00-23:59 UTC+8) - * - This API data is updated on a T+1 basis - * - Transaction details only show those marked with broker channel id - */ -getBrokerOrderCommission( - params?: GetBrokerOrderCommissionRequestV2, -): Promise> +getFuturesTraderProfitShareGroup(params?: { + pageSize?: string; + pageNo?: string; + }): Promise< + APIResponse< + { + coin: string; + profit: string; + profitTime: string; + }[] + > + > { + return this.getPrivate( + '/api/v2/copy/mix-trader/profits-group-coin-date', + params, + ); ⋮---- -/** - * Get Rebate Info - * - * - Rate limit: 20 req/sec/UID - * - Data retention: 30 days - * - Real-time data - */ -getBrokerRebateInfo( - params: GetBrokerRebateInfoRequestV2, -): Promise> +getFuturesTraderSymbolSettings(params: { + productType: CopyTradingProductTypeV2; +}): Promise> +⋮---- +updateFuturesTraderSymbolSettings(params: { + settingList: FuturesTraderSymbolSettingRequestV2[]; +}): Promise> +⋮---- +updateFuturesTraderGlobalSettings(params?: { + enable?: 'YES' | 'NO'; + showTotalEquity?: 'YES' | 'NO'; + showTpsl?: 'YES' | 'NO'; +}): Promise> +⋮---- +getFuturesTraderFollowers( + params?: GetFuturesTraderFollowersRequestV2, +): Promise> +⋮---- +removeFuturesTraderFollower(params: { + followerUid: string; +}): Promise> ⋮---- /** * - * * Broker | Agent (affiliate) customer APIs + * + * Copy Trading | Future copy trading | Follower Api + * * */ ⋮---- -getAgentCustomerCommissions( - params?: GetAgentCustomerCommissionsRequestV2, -): Promise> +getFuturesFollowerCurrentOrders( + params: GetFollowerFuturesCurrentTrackingOrdersRequestV2, +): Promise> ⋮---- -/** - * Without startTime/endTime, returns all registered sub-customers (no time restriction). - */ -getAgentSubCustomerList( - params?: GetAgentSubCustomerListRequestV2, -): Promise> +getFuturesFollowerHistoryOrders( + params: GetFollowerFuturesHistoryTrackingOrdersRequestV2, +): Promise> ⋮---- -getAgentCustomerTradeVolume( - params?: AgentCustomerTradeVolumeRequestV2, -): Promise> +updateFuturesFollowerTPSL( + params: UpdateFuturesFollowerTPSLRequestV2, +): Promise> ⋮---- -/** - * Without startTime/endTime, returns all registered customers (no time restriction). - */ -getAgentCustomerList( - params?: AgentCustomerListRequestV2, -): Promise> +updateFuturesFollowerSettings( + params: UpdateFuturesFollowerSettingsRequestV2, +): Promise> ⋮---- -getAgentCustomerKycResult( - params?: GetAgentCustomerKycResultRequestV2, -): Promise> +getFuturesFollowerSettings(params: { + traderId: string; +}): Promise> +⋮---- +closeFuturesFollowerPositions( + params: CloseFuturesFollowerPositionsRequestV2, + ): Promise< + APIResponse<{ + orderIdList: string[]; + }> + > { + return this.postPrivate( + '/api/v2/copy/mix-follower/close-positions', + params, + ); ⋮---- -getAgentCustomerDeposits( - params?: AgentCustomerDepositRequestV2, -): Promise> +getFuturesFollowerTraders( + params: GetFuturesFollowerTradersRequestV2, +): Promise> ⋮---- -getAgentCustomerAssets( - params?: AgentCustomerAssetRequestV2, -): Promise> +getFuturesFollowerFollowLimit(params: { + symbol: string; + productType: CopyTradingProductTypeV2; + }): Promise< + APIResponse< + { + maxFollowSize: string; + minFollowSize: string; + symbol: string; + }[] + > + > { + return this.getPrivate( + '/api/v2/copy/mix-follower/query-quantity-limit', + params, + ); ⋮---- -getAgentCommissionDetail( - params?: GetAgentCommissionDetailRequestV2, -): Promise> +unfollowFuturesTrader(params: { + traderId: string; +}): Promise> ⋮---- /** * * - * Margin + * Copy Trading | Future copy trading | Broker api * * */ ⋮---- -/** - * - * * Margin | Common - * - */ +getBrokerTraders(params: object): Promise> ⋮---- -getMarginCurrencies(): Promise> +getBrokerTradersHistoricalOrders(params: object): Promise> +⋮---- +getBrokerTradersPendingOrders(params: object): Promise> ⋮---- /** * - * * Margin | Cross/Isolated | Order Record + * + * Copy Trading | Spot copy trading | Trader api + * * */ ⋮---- -getMarginBorrowHistory( - marginType: MarginType, - params: GetBorrowHistoryRequestV2, - ): Promise< - APIResponse<{ - resultList: MarginBorrowHistoryItemV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); +getSpotTraderProfit(): Promise> ⋮---- -getMarginRepayHistory( - marginType: MarginType, - params: GetRepayHistoryRequestV2, - ): Promise< - APIResponse<{ - resultList: MarginRepaymentHistoryItemV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); +getSpotTraderHistoryProfit( + params: GetSpotTraderHistoryProfitRequestV2, +): Promise> ⋮---- -getMarginInterestHistory( - marginType: MarginType, - params: GetInterestHistoryRequestV2, - ): Promise< - APIResponse<{ - resultList: MarginInterestHistoryItemV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); +getSpotTraderUnrealizedProfit(params?: { + coin?: string; + pageNo?: string; + pageSize?: string; +}): Promise> ⋮---- -getMarginLiquidationHistory( - marginType: MarginType, - params: GetLiquidationHistoryRequestV2, - ): Promise< - APIResponse<{ - resultList: MarginLiquidationHistoryItemV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); +getSpotTraderOrder(): Promise> ⋮---- -getMarginFinancialHistory( - marginType: MarginType, - params: GetFinancialHistoryRequestV2, - ): Promise< - APIResponse<{ - resultList: MarginFinancialHistoryItemV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); +modifySpotTraderOrderTPSL(params: { + trackingNo: string; + stopSurplusPrice?: string; + stopLossPrice?: string; +}): Promise> ⋮---- -/** - * - * * Margin | Cross/Isolated | Account - * - */ +getSpotTraderHistoryOrders( + params: GetSpotTraderHistoryOrdersRequestV2, +): Promise> ⋮---- -getMarginAccountAssets( - marginType: MarginType, - params?: { coin?: string }, -): Promise> +getSpotTraderCurrentOrders( + params: GetSpotTraderCurrentOrdersRequestV2, +): Promise> ⋮---- -marginBorrow( - marginType: MarginType, - params: { - loanId: string; - symbol: string; - coin: string; - borrowAmount: string; - }, - ): Promise< - APIResponse<{ - loanId: string; - symbol: string; - coin: string; - borrowAmount: string; - }> - > { - assertMarginType(marginType); +sellSpotTrader(params: { + trackingNoList: string[]; + symbol: string; +}): Promise> ⋮---- -marginRepay( - marginType: MarginType, - params: { - remainDebtAmount: string; - symbol: string; - repayId: string; - coin: string; - repayAmount: string; - }, - ): Promise< - APIResponse<{ - symbol: string; - coin: string; - repayId: string; - remainDebtAmount: string; - repayAmount: string; - }> - > { - assertMarginType(marginType); +getSpotTraderSymbolSettings(params: { + symbolList: string[]; + settingType: 'add' | 'delete'; +}): Promise> ⋮---- -getMarginRiskRate(marginType: MarginType): Promise< - APIResponse< - { - symbol: string; - riskRateRatio: string; - }[] - > - > { - assertMarginType(marginType); +removeSpotTraderFollowers(params: { + followerUid: string; +}): Promise> ⋮---- -getMarginMaxBorrowable( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse - > { - assertMarginType(marginType); +getSpotTraderConfiguration(): Promise> ⋮---- -getMarginMaxTransferable( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse< - CrossMaxTransferableResponseV2 | IsolatedMaxTransferableResponseV2 - > - > { - assertMarginType(marginType); +getSpotTraderFollowers( + params: GetSpotTraderFollowersRequestV2, +): Promise> ⋮---- -getMarginInterestRateAndMaxBorrowable( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse< - | IsolatedInterestRateAndLimitResponseV2[] - | CrossInterestRateAndLimitResponseV2[] - > - > { - assertMarginType(marginType); +/** + * + * + * Copy Trading | Spot copy trading | Follower api + * + * + */ ⋮---- -getMarginTierConfiguration( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse< - CrossTierConfigurationResponseV2[] | IsolatedTierConfigurationResponseV2[] - > - > { - assertMarginType(marginType); +cancelSpotFollowerOrder(params: { + trackingNoList: string[]; +}): Promise> +⋮---- +updateSpotFollowerSettings(params: { + traderId: string; + autoCopy?: 'on' | 'off'; + mode?: 'basic' | 'advanced'; + settings: SpotFollowerCopyTradeSettingV2[]; +}): Promise> +⋮---- +updateSpotFollowerTPSL(params: { + trackingNo: string; + stopSurplusPrice?: string; + stopLossPrice?: string; +}): Promise> +⋮---- +getSpotFollowerTraders(params?: { + pageNo?: string; + pageSize?: string; + startTime?: string; + endTime?: string; +}): Promise> ⋮---- -marginFlashRepay( - marginType: MarginType, - params: { coin: string }, - ): Promise< +getSpotFollowerCurrentTraderSymbols(params: { traderId: string }): Promise< APIResponse<{ - repayId: string; - coin?: string; - symbol?: string; - result?: string; + currentTradingList: string[]; }> > { - assertMarginType(marginType); + return this.getPrivate( + '/api/v2/copy/spot-follower/query-trader-symbols', + params, + ); ⋮---- -getMarginFlashRepayResult( - marginType: MarginType, - params: { idList: string }, - ): Promise< - APIResponse< - { - repayId: string; - status: string; - }[] - > - > { - assertMarginType(marginType); +getSpotFollowerSettings(params: { + traderId: string; +}): Promise> +⋮---- +getSpotFollowerHistoryOrders( + params: GetSpotFollowerHistoryOrdersRequestV2, +): Promise> +⋮---- +getSpotFollowerOpenOrders( + params: GetSpotFollowerOpenOrdersRequestV2, +): Promise> +⋮---- +sellSpotFollower(params: { + trackingNoList: string[]; + symbol: string; +}): Promise> +⋮---- +unfollowSpotTrader(params: { + traderId: string; +}): Promise> ⋮---- /** * - * * Margin | Cross/Isolated | Trade + * + * Earn | Savings + * * */ ⋮---- -marginSubmitOrder( - marginType: MarginType, - params: MarginPlaceOrderRequestV2, - ): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - assertMarginType(marginType); +getEarnSavingsProducts(params?: { + coin?: string; + filter?: string; +}): Promise> ⋮---- -marginBatchSubmitOrders( - marginType: MarginType, - params: MarginBatchOrdersRequestV2, -): Promise> +getEarnSavingsAccount(): Promise> ⋮---- -marginCancelOrder( - marginType: MarginType, - params: { - symbol: string; - orderId?: string; - clientOid?: string; - }, - ): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - assertMarginType(marginType); +getEarnSavingsAssets( + params: GetEarnSavingsAssetsRequestV2, +): Promise> ⋮---- -marginBatchCancelOrders( - marginType: MarginType, - params: { - symbol: string; - orderIdList: string[]; - }, -): Promise> +getEarnSavingsRecords( + params: GetEarnSavingsRecordsRequestV2, +): Promise> ⋮---- -getMarginOpenOrders( - marginType: MarginType, - params: GetMarginCurrentOrdersRequestV2, - ): Promise< +getEarnSavingsSubscription(params: { + productId: string; + periodType: string; +}): Promise> +⋮---- +earnSubscribeSavings(params: { + productId: string; + periodType: string; + amount: string; + }): Promise< APIResponse<{ - orderList: MarginCurrentOrderV2[]; - maxId: string; - minId: string; + orderId: string; + status: string; }> > { - assertMarginType(marginType); + return this.postPrivate('/api/v2/earn/savings/subscribe', params); ⋮---- -getMarginHistoricOrders( - marginType: MarginType, - params: GetHistoryOrdersRequestV2, - ): Promise< +getEarnSavingsSubscriptionResult(params: { + productId: string; + periodType: string; + }): Promise< APIResponse<{ - orderList: MarginHistoryOrderV2[]; - maxId: string; - minId: string; + result: 'success' | 'fail'; + msg: string; }> > { - assertMarginType(marginType); + return this.getPrivate('/api/v2/earn/savings/subscribe-result', params); ⋮---- -getMarginHistoricOrderFills( - marginType: MarginType, - params: GetMarginOrderFillsRequestV2, - ): Promise< +earnRedeemSavings(params: RedeemSavingsRequestV2): Promise< APIResponse<{ - fills: MarginOrderFillV2[]; - minId: string; - maxId: string; + orderId: string; + status: string; }> > { - assertMarginType(marginType); + return this.postPrivate('/api/v2/earn/savings/redeem', params); ⋮---- -getMarginLiquidationOrders( - marginType: MarginType, - params: GetMarginLiquidationOrdersRequestV2, - ): Promise< +getEarnSavingsRedemptionResult(params: { + orderId: string; + periodType: string; + }): Promise< APIResponse<{ - resultList: MarginLiquidationOrderV2[]; - idLessThan: string; + result: 'success' | 'fail'; + msg: string; }> > { - assertMarginType(marginType); + return this.getPrivate('/api/v2/earn/savings/redeem-result', params); ⋮---- /** * * - * Copy Trading + * Earn | Earn Account * * */ ⋮---- +getEarnAccount(params?: { coin?: string }): Promise< + APIResponse< + { + coin: string; + amount: string; + }[] + > + > { + return this.getPrivate('/api/v2/earn/account/assets', params); +⋮---- /** * * - * Copy Trading | Future copy trading | Trader Api + * Earn | On-Chain Elite * * */ ⋮---- -getFuturesTraderCurrentOrder( - params: GetFuturesTraderCurrentOrdersRequestV2, -): Promise> -⋮---- -getFuturesTraderHistoryOrders( - params: GetFuturesTraderHistoryOrdersRequestV2, -): Promise> -⋮---- -modifyFuturesTraderOrderTPSL( - params: ModifyFuturesTraderOrderTPSLRequestV2, -): Promise> -⋮---- -getFuturesTraderOrder(): Promise< - APIResponse - > { - return this.getPrivate('/api/v2/copy/mix-trader/order-total-detail'); -⋮---- -getFuturesTraderProfitHistory(): Promise< - APIResponse - > { - return this.getPrivate('/api/v2/copy/mix-trader/profit-history-summarys'); -⋮---- -getFuturesTraderProfitShareHistory( - params: GetFuturesTraderProfitShareDetailRequestV2, -): Promise> -⋮---- -closeFuturesTraderOrder(params: { - trackingNo: string; - symbol: string; - productType: CopyTradingProductTypeV2; - }): Promise< - APIResponse< - { - trackingNo: string; - symbol: string; - productType: string; - }[] - > - > { - return this.postPrivate( - '/api/v2/copy/mix-trader/order-close-positions', - params, - ); +getEarnEliteProducts(): Promise> ⋮---- -getFuturesTraderProfitShare(params?: { - coin?: string; - pageSize?: string; - pageNo?: string; - }): Promise< - APIResponse< - { - coin: string; - profit: string; - nickName: string; - }[] - > - > { - return this.getPrivate('/api/v2/copy/mix-trader/profit-details', params); +getEarnEliteAssets(): Promise> ⋮---- -getFuturesTraderProfitShareGroup(params?: { - pageSize?: string; - pageNo?: string; - }): Promise< - APIResponse< - { - coin: string; - profit: string; - profitTime: string; - }[] - > - > { - return this.getPrivate( - '/api/v2/copy/mix-trader/profits-group-coin-date', - params, - ); +getEarnEliteRecords( + params: GetEarnEliteRecordsRequestV2, +): Promise> ⋮---- -getFuturesTraderSymbolSettings(params: { - productType: CopyTradingProductTypeV2; -}): Promise> +getEarnEliteSubscribeInfo( + params: GetEarnEliteSubscribeInfoRequestV2, +): Promise> ⋮---- -updateFuturesTraderSymbolSettings(params: { - settingList: FuturesTraderSymbolSettingRequestV2[]; -}): Promise> +subscribeEarnElite( + params: EarnEliteSubscribeRequestV2, +): Promise> ⋮---- -updateFuturesTraderGlobalSettings(params?: { - enable?: 'YES' | 'NO'; - showTotalEquity?: 'YES' | 'NO'; - showTpsl?: 'YES' | 'NO'; -}): Promise> +getEarnEliteSubscribeResult( + params: GetEarnEliteSubscribeResultRequestV2, +): Promise> ⋮---- -getFuturesTraderFollowers( - params?: GetFuturesTraderFollowersRequestV2, -): Promise> +getEarnEliteRedeemInfo( + params: GetEarnEliteRedeemInfoRequestV2, +): Promise> ⋮---- -removeFuturesTraderFollower(params: { - followerUid: string; -}): Promise> +redeemEarnElite( + params: RedeemEarnEliteRequestV2, +): Promise> ⋮---- /** * * - * Copy Trading | Future copy trading | Follower Api + * Earn | Shark Fin * * */ ⋮---- -getFuturesFollowerCurrentOrders( - params: GetFollowerFuturesCurrentTrackingOrdersRequestV2, -): Promise> +getSharkfinProducts(params: { + coin: string; + limit?: string; + idLessThan?: string; +}): Promise> ⋮---- -getFuturesFollowerHistoryOrders( - params: GetFollowerFuturesHistoryTrackingOrdersRequestV2, -): Promise> +getSharkfinAccount(): Promise> ⋮---- -updateFuturesFollowerTPSL( - params: UpdateFuturesFollowerTPSLRequestV2, -): Promise> +getSharkfinAssets( + params: GetSharkfinAssetsRequestV2, +): Promise> ⋮---- -updateFuturesFollowerSettings( - params: UpdateFuturesFollowerSettingsRequestV2, -): Promise> +getSharkfinRecords( + params: GetSharkfinRecordsRequestV2, +): Promise> ⋮---- -getFuturesFollowerSettings(params: { - traderId: string; -}): Promise> +getSharkfinSubscription(params: { + productId: string; +}): Promise> ⋮---- -closeFuturesFollowerPositions( - params: CloseFuturesFollowerPositionsRequestV2, +subscribeSharkfin(params: { productId: string; amount: string }): Promise< + APIResponse<{ + orderId: string; + status: string; + }> + > { + return this.postPrivate('/api/v2/earn/sharkfin/subscribe', params); +⋮---- +getSharkfinSubscriptionResult(params: { orderId: string }): Promise< + APIResponse<{ + result: 'success' | 'fail'; + msg: string; + }> + > { + return this.getPrivate('/api/v2/earn/sharkfin/subscribe-result', params); +⋮---- +/** + * + * + * Earn | Loan + * + * + */ +⋮---- +getLoanCurrencies(params?: { + coin?: string; +}): Promise> +⋮---- +getLoanEstInterestAndBorrowable( + params: GetLoanEstInterestAndBorrowableRequestV2, ): Promise< APIResponse<{ - orderIdList: string[]; + hourInterest: string; + loanAmount: string; }> > { - return this.postPrivate( - '/api/v2/copy/mix-follower/close-positions', - params, - ); + return this.get('/api/v2/earn/loan/public/hour-interest', params); ⋮---- -getFuturesFollowerTraders( - params: GetFuturesFollowerTradersRequestV2, -): Promise> +borrowLoan(params: BorrowLoanRequestV2): Promise< + APIResponse<{ + orderId: string; + }> + > { + return this.postPrivate('/api/v2/earn/loan/borrow', params); ⋮---- -getFuturesFollowerFollowLimit(params: { - symbol: string; - productType: CopyTradingProductTypeV2; - }): Promise< - APIResponse< - { - maxFollowSize: string; - minFollowSize: string; - symbol: string; - }[] - > +getOngoingLoanOrders(params?: { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; +}): Promise> +⋮---- +repayLoan( + params: RepayLoanRequestV2, +): Promise> +⋮---- +getRepayHistory( + params: GetLoanRepayHistoryRequestV2, +): Promise> +⋮---- +updateLoanPledgeRate(params: ModifyLoanPledgeRateRequestV2): Promise< + APIResponse<{ + loanCoin: string; + pledgeCoin: string; + afterPledgeRate: string; + }> > { - return this.getPrivate( - '/api/v2/copy/mix-follower/query-quantity-limit', - params, - ); + return this.postPrivate('/api/v2/earn/loan/revise-pledge', params); ⋮---- -unfollowFuturesTrader(params: { - traderId: string; -}): Promise> +getLoanPledgeRateHistory( + params: GetLoanPledgeRateHistoryRequestV2, +): Promise> +⋮---- +getLoanHistory( + params: GetLoanHistoryRequestV2, +): Promise> +⋮---- +getLoanDebts(): Promise> +⋮---- +getLoanLiquidationRecords( + params: GetLiquidationRecordsRequestV2, +): Promise> ⋮---- /** * - * - * Copy Trading | Future copy trading | Broker api - * + * * Inst Loan | Product Info * */ ⋮---- -getBrokerTraders(params: object): Promise> +getLoanProductInfo( + params: GetInstLoanProductInfoRequestV2, +): Promise> ⋮---- -getBrokerTradersHistoricalOrders(params: object): Promise> +getLoanSymbols( + params: GetInstLoanSymbolsRequestV2, +): Promise> ⋮---- -getBrokerTradersPendingOrders(params: object): Promise> +getLoanMarginCoinInfo(params: GetInstLoanMarginCoinInfoRequestV2): Promise< + APIResponse<{ + productId: string; + coinInfo: InstLoanCoinInfoV2[]; + }> + > { + return this.getPrivate( + '/api/v2/spot/ins-loan/ensure-coins-convert', + params, + ); ⋮---- /** * + * * Inst Loan | Account * - * Copy Trading | Spot copy trading | Trader api + */ +⋮---- +getLoanRiskUnit(): Promise< + APIResponse<{ + riskUnitId: string[]; + }> + > { + return this.getPrivate('/api/v2/spot/ins-loan/risk-unit'); +⋮---- +getLoanLTVConvert( + params?: GetInstLoanLTVConvertRequestV2, +): Promise> +⋮---- +/** * + * * Inst Loan | Orders * */ ⋮---- -getSpotTraderProfit(): Promise> +getLoanRepaidHistory( + params?: GetInstLoanRepaidHistoryRequestV2, +): Promise> +⋮---- +getLoanOrder( + params?: GetInstLoanOrderRequestV2, +): Promise> + +================ +File: src/types/response/v3/public.ts +================ +export interface PublicFillV3 { + execId: string; + price: string; + size: string; + side: 'sell' | 'buy'; + ts: string; +} +⋮---- +export interface CandlestickV3 extends Array { + 0: string; // timestamp + 1: string; // open price + 2: string; // high price + 3: string; // low price + 4: string; // close price + 5: string; // volume + 6: string; // turnover +} +⋮---- +0: string; // timestamp +1: string; // open price +2: string; // high price +3: string; // low price +4: string; // close price +5: string; // volume +6: string; // turnover +⋮---- +export interface ContractOiV3 { + symbol: string; + notionalValue: string; + totalNotionalValue: string; +} +⋮---- +export interface CurrentFundingRateV3 { + symbol: string; + fundingRate: string; + fundingRateInterval: string; + nextUpdate: string; + minFundingRate: string; + maxFundingRate: string; + cashDividend?: string; + cashDividendNextUpdate?: string; +} +⋮---- +export interface DiscountRateTierV3 { + tierStartValue: string; + discountRate: string; +} +⋮---- +export interface DiscountRateV3 { + coin: string; + list: DiscountRateTierV3[]; +} +⋮---- +export interface HistoryFundingRateV3 { + symbol: string; + fundingRate: string; + fundingRateTimestamp: string; +} +⋮---- +export interface MarginLoanV3 { + dailyInterest: string; + annualInterest: string; + limit: string; + masterSubLimit?: string; + /** Bitget spelling */ + platformRemaingQuota?: string; +} ⋮---- -getSpotTraderHistoryProfit( - params: GetSpotTraderHistoryProfitRequestV2, -): Promise> +/** Bitget spelling */ ⋮---- -getSpotTraderUnrealizedProfit(params?: { - coin?: string; - pageNo?: string; - pageSize?: string; -}): Promise> +export interface OpenInterestItemV3 { + symbol: string; + openInterest: string; +} ⋮---- -getSpotTraderOrder(): Promise> +export interface OpenInterestV3 { + list: OpenInterestItemV3[]; + ts: string; +} ⋮---- -modifySpotTraderOrderTPSL(params: { - trackingNo: string; - stopSurplusPrice?: string; - stopLossPrice?: string; -}): Promise> +export interface PositionTierV3 { + tier: string; + minTierValue: string; + maxTierValue: string; + leverage: string; + mmr: string; +} ⋮---- -getSpotTraderHistoryOrders( - params: GetSpotTraderHistoryOrdersRequestV2, -): Promise> +export interface RiskReserveRecordV3 { + balance: string; + amount: string; + ts: string; + type?: string; +} ⋮---- -getSpotTraderCurrentOrders( - params: GetSpotTraderCurrentOrdersRequestV2, -): Promise> +export interface RiskReserveV3 { + totalBalance?: string; + coin: string; + riskReserveRecords: RiskReserveRecordV3[]; +} ⋮---- -sellSpotTrader(params: { - trackingNoList: string[]; - symbol: string; -}): Promise> +export interface RiskReserveHourRecordV3 { + amount: string; + balance: string; + ts: string; +} ⋮---- -getSpotTraderSymbolSettings(params: { - symbolList: string[]; - settingType: 'add' | 'delete'; -}): Promise> +export interface RiskReserveHourV3 { + coin: string; + riskReserveRecords: RiskReserveHourRecordV3[]; +} ⋮---- -removeSpotTraderFollowers(params: { - followerUid: string; -}): Promise> +export interface RiskReserveAllItemV3 { + symbols: string[]; + coin: string; + balance: string; +} ⋮---- -getSpotTraderConfiguration(): Promise> +export interface RiskReserveAllV3 { + list: RiskReserveAllItemV3[]; +} ⋮---- -getSpotTraderFollowers( - params: GetSpotTraderFollowersRequestV2, -): Promise> +export interface InstrumentV3 { + symbol: string; + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + baseCoin: string; + quoteCoin: string; + buyLimitPriceRatio: string; + sellLimitPriceRatio: string; + feeRateUpRatio: string; + minOrderQty: string; + maxOrderQty: string; + maxMarketOrderQty: string; + pricePrecision: string; + quantityPrecision: string; + quotePrecision: string; + minOrderAmount: string; + maxSymbolOrderNum: string; + maxProductOrderNum: string; + status: + | 'listed' + | 'online' + | 'limit_open' + | 'limit_close' + | 'offline' + | 'restrictedAPI'; + offTime: string; + limitOpenTime: string; + maintainTime: string; + areaSymbol?: string; + + isRwa?: 'YES' | 'NO'; + /** yes = Reality stock token, no = non-Reality stock token */ + isReality?: 'yes' | 'no'; + + // Futures specific fields + makerFeeRate?: string; + takerFeeRate?: string; + openCostUpRatio?: string; + priceMultiplier?: string; + quantityMultiplier?: string; + type?: 'perpetual' | 'delivery'; + symbolType?: 'crypto' | 'metal' | 'stock' | 'commodity'; + maxPositionNum?: string; + deliveryTime?: string; + deliveryStartTime?: string; + deliveryPeriod?: string; + /** Launch time - Unix millisecond timestamp. Null for some margin pairs. */ + launchTime?: string | null; + fundInterval?: string; + minLeverage?: string; + maxLeverage?: string; + + // Margin specific fields + isIsolatedBaseBorrowable?: 'YES' | 'NO'; + isIsolatedQuotedBorrowable?: 'YES' | 'NO'; + warningRiskRatio?: string; + liquidationRiskRatio?: string; + maxCrossedLeverage?: string; + maxIsolatedLeverage?: string; + userMinBorrow?: string; +} ⋮---- -/** - * - * - * Copy Trading | Spot copy trading | Follower api - * - * - */ +/** yes = Reality stock token, no = non-Reality stock token */ ⋮---- -cancelSpotFollowerOrder(params: { - trackingNoList: string[]; -}): Promise> +// Futures specific fields ⋮---- -updateSpotFollowerSettings(params: { - traderId: string; - autoCopy?: 'on' | 'off'; - mode?: 'basic' | 'advanced'; - settings: SpotFollowerCopyTradeSettingV2[]; -}): Promise> +/** Launch time - Unix millisecond timestamp. Null for some margin pairs. */ ⋮---- -updateSpotFollowerTPSL(params: { - trackingNo: string; - stopSurplusPrice?: string; - stopLossPrice?: string; -}): Promise> +// Margin specific fields ⋮---- -getSpotFollowerTraders(params?: { - pageNo?: string; - pageSize?: string; - startTime?: string; - endTime?: string; -}): Promise> +export interface MarketFeeGroupLabelV3 { + weight: string; + label: string; + symbols: string[]; +} ⋮---- -getSpotFollowerCurrentTraderSymbols(params: { traderId: string }): Promise< - APIResponse<{ - currentTradingList: string[]; - }> - > { - return this.getPrivate( - '/api/v2/copy/spot-follower/query-trader-symbols', - params, - ); +export interface MarketFeeGroupTierV3 { + level: string; + makerFeeRate: string; + /** PRO1~PRO6 only. Taker fee rate in decimal form */ + takerFeeRate?: string; +} ⋮---- -getSpotFollowerSettings(params: { - traderId: string; -}): Promise> +/** PRO1~PRO6 only. Taker fee rate in decimal form */ ⋮---- -getSpotFollowerHistoryOrders( - params: GetSpotFollowerHistoryOrdersRequestV2, -): Promise> +export interface MarketFeeGroupV3 { + category: string; + group: string; + labelList: MarketFeeGroupLabelV3[]; + tierList: MarketFeeGroupTierV3[]; +} ⋮---- -getSpotFollowerOpenOrders( - params: GetSpotFollowerOpenOrdersRequestV2, -): Promise> +export interface MarketScoreWeightV3 { + category: string; + label: string; + symbol: string; + requiredSpread: string; + minMakerVolume: string; + weight: string; +} ⋮---- -sellSpotFollower(params: { - trackingNoList: string[]; - symbol: string; -}): Promise> +export interface LiquidationV3 { + symbol: string; + side: 'buy' | 'sell'; + price: string; + amount: string; + ts: string; +} ⋮---- -unfollowSpotTrader(params: { - traderId: string; -}): Promise> +export interface LiquidationsV3 { + list: LiquidationV3[]; + cursor?: string; +} ⋮---- -/** - * - * - * Earn | Savings - * - * - */ +export interface OrderBookV3 { + a: string[][]; // asks - [price, size] + b: string[][]; // bids - [price, size] + ts: string; +} ⋮---- -getEarnSavingsProducts(params?: { - coin?: string; - filter?: string; -}): Promise> +a: string[][]; // asks - [price, size] +b: string[][]; // bids - [price, size] ⋮---- -getEarnSavingsAccount(): Promise> +export interface RealityOrderBookV3 { + symbol: string; + a: string[][]; + b: string[][]; + ts: string; +} ⋮---- -getEarnSavingsAssets( - params: GetEarnSavingsAssetsRequestV2, -): Promise> +export interface RealityFillV3 { + execId: string; + price: string; + size: string; + side: 'buy' | 'sell'; + ts: string; +} ⋮---- -getEarnSavingsRecords( - params: GetEarnSavingsRecordsRequestV2, -): Promise> +export interface TickerV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + lastPrice: string; + openPrice24h: string; + highPrice24h: string; + lowPrice24h: string; + ask1Price: string; + bid1Price: string; + bid1Size: string; + ask1Size: string; + price24hPcnt: string; + volume24h: string; + turnover24h: string; + /** 24h platform turnover; only available for rtoken */ + platformTurnover24h?: string; + + // Futures specific fields + indexPrice?: string; + markPrice?: string; + fundingRate?: string; + openInterest?: string; + deliveryStartTime?: string; + deliveryTime?: string; + deliveryStatus?: string; +} ⋮---- -getEarnSavingsSubscription(params: { - productId: string; - periodType: string; -}): Promise> +/** 24h platform turnover; only available for rtoken */ ⋮---- -earnSubscribeSavings(params: { - productId: string; - periodType: string; - amount: string; - }): Promise< - APIResponse<{ - orderId: string; - status: string; - }> - > { - return this.postPrivate('/api/v2/earn/savings/subscribe', params); +// Futures specific fields ⋮---- -getEarnSavingsSubscriptionResult(params: { - productId: string; - periodType: string; - }): Promise< - APIResponse<{ - result: 'success' | 'fail'; - msg: string; - }> - > { - return this.getPrivate('/api/v2/earn/savings/subscribe-result', params); +export interface ProofOfReservesV3 { + merkleRootHash: string; + totalReserveRatio: string; + list: { + coin: string; + userAssets: string; + platformAssets: string; + reserveRatio: string; + }[]; +} ⋮---- -earnRedeemSavings(params: RedeemSavingsRequestV2): Promise< - APIResponse<{ - orderId: string; - status: string; - }> - > { - return this.postPrivate('/api/v2/earn/savings/redeem', params); +export interface IndexComponentV3 { + exchange: string; + spotPair: string; + equivalentPrice: string; + weight: string; +} ⋮---- -getEarnSavingsRedemptionResult(params: { - orderId: string; - periodType: string; - }): Promise< - APIResponse<{ - result: 'success' | 'fail'; - msg: string; - }> - > { - return this.getPrivate('/api/v2/earn/savings/redeem-result', params); +export interface IndexPriceComponentsV3 { + symbol: string; + componentList: IndexComponentV3[]; +} ⋮---- -/** - * - * - * Earn | Earn Account - * - * - */ +export interface RpiSymbolV3 { + category: 'spot' | 'usdt-futures' | 'coin-futures' | 'usdc-futures'; + symbol: string; +} ⋮---- -getEarnAccount(params?: { coin?: string }): Promise< - APIResponse< - { - coin: string; - amount: string; - }[] - > - > { - return this.getPrivate('/api/v2/earn/account/assets', params); +/** RPI order book depth: [price, nonRpiQty, rpiQty] */ +export interface RpiOrderBookV3 { + a: [string, string, string][]; + b: [string, string, string][]; + ts: string; +} ⋮---- -/** - * - * - * Earn | On-Chain Elite - * - * - */ +export interface CashDividendRecordV3 { + symbol: string; + exDividendDate: string; + cashDividendPerShare: string; + cashDividendTimestamp: string; +} ⋮---- -getEarnEliteProducts(): Promise> +export interface SpotWhaleFlowV3 { + volume: string; + date: string; +} ⋮---- -getEarnEliteAssets(): Promise> +export interface SpotNetFlowV3 { + netFlow: string; + ts: string; +} ⋮---- -getEarnEliteRecords( - params: GetEarnEliteRecordsRequestV2, -): Promise> +export interface SpotFundFlowV3 { + whaleBuyVolume: string; + dolphinBuyVolume: string; + fishBuyVolume: string; + whaleSellVolume: string; + dolphinSellVolume: string; + fishSellVolume: string; + whaleBuyRatio: string; + dolphinBuyRatio: string; + fishBuyRatio: string; + whaleSellRatio: string; + dolphinSellRatio: string; + fishSellRatio: string; +} ⋮---- -getEarnEliteSubscribeInfo( - params: GetEarnEliteSubscribeInfoRequestV2, -): Promise> +export interface MarginLongShortV3 { + longShortRatio: string; + ts: string; +} ⋮---- -subscribeEarnElite( - params: EarnEliteSubscribeRequestV2, -): Promise> +export interface MarginLoanGrowthV3 { + growthRate: string; + ts: string; +} ⋮---- -getEarnEliteSubscribeResult( - params: GetEarnEliteSubscribeResultRequestV2, -): Promise> +export interface MarginIsolatedBorrowV3 { + borrowRate: string; + ts: string; +} ⋮---- -getEarnEliteRedeemInfo( - params: GetEarnEliteRedeemInfoRequestV2, -): Promise> +export interface FuturesActiveBuySellV3 { + buyVolume: string; + sellVolume: string; + ts: string; +} ⋮---- -redeemEarnElite( - params: RedeemEarnEliteRequestV2, -): Promise> +export interface FuturesLongShortV3 { + longRatio: string; + shortRatio: string; + longShortRatio: string; + ts: string; +} ⋮---- -/** - * - * - * Earn | Shark Fin - * - * +export interface FuturesPositionLongShortV3 { + longPositionRatio: string; + shortPositionRatio: string; + longShortPositionRatio: string; + ts: string; +} +⋮---- +export interface FuturesAccountLongShortV3 { + longAccountRatio: string; + shortAccountRatio: string; + longShortAccountRatio: string; + ts: string; +} + +================ +File: README.md +================ +# Node.js & Typescript Bitget API SDK + +[![Build & Test](https://github.com/sieblyio/bitget-api/actions/workflows/e2etests.yml/badge.svg?branch=master)](https://github.com/sieblyio/bitget-api/actions/workflows/e2etests.yml) +[![npm version](https://img.shields.io/npm/v/bitget-api)][1] +[![npm size](https://img.shields.io/bundlephobia/min/bitget-api/latest)][1] +[![npm downloads](https://img.shields.io/npm/dt/bitget-api)][1] +[![last commit](https://img.shields.io/github/last-commit/sieblyio/bitget-api)][1] +[![CodeFactor](https://www.codefactor.io/repository/github/sieblyio/bitget-api/badge)](https://www.codefactor.io/repository/github/sieblyio/bitget-api) +[![Telegram](https://img.shields.io/badge/chat-on%20telegram-blue.svg)](https://t.me/nodetraders) +[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/sieblyio/bitget-api) + +

+ + + + SDK Logo + + +

+ +[1]: https://www.npmjs.com/package/bitget-api + +> [!TIP] +> Upcoming change: As part of the [Siebly.io](https://siebly.io/) brand, this SDK is now hosted under our [Siebly.io GitHub organisation](https://github.com/sieblyio). The migration is seamless and requires no user changes. + +Updated & performant JavaScript & Node.js SDK for the Bitget V2 REST APIs and WebSockets: + +- Professional, robust & performant Bitget SDK with extensive production use in live trading environments. +- Complete integration with all Bitget APIs. + - [x] Supports V2 REST APIs & WebSockets + - [x] Supports V3/UTA REST APIs & WebSockets (latest) + - [x] Supports order placement via V3 WebSocket API +- Complete TypeScript support (with type declarations for all API requests & responses). + - Strongly typed requests and responses. + - Automated end-to-end tests on most API calls, ensuring no breaking changes are released to npm. +- Actively maintained with a modern, promise-driven interface. +- Over 100 integration tests making real API calls & WebSocket connections, validating any changes before they reach npm. +- Robust WebSocket integration with configurable connection heartbeats & automatic reconnect then resubscribe workflows. + - Event driven messaging. + - Smart WebSocket persistence with automatic reconnection handling. + - Emit `reconnected` event when dropped connection is restored. + - Optional beautification of WebSocket events for improved readability. +- Officially listed Node.js SDK in [Bitget API docs](https://bitgetlimited.github.io/apidoc/en/spot/#sdk-code-example). +- Browser support (via webpack bundle - see "Browser Usage" below). +- Support all authentication methods supported by Bitget: + - [x] HMAC + - [x] RSA +- Heavy automated end-to-end testing with real API calls. + - End-to-end testing before any release. + - Real API calls in e2e tests. +- Proxy support via axios integration. +- Active community support & collaboration in telegram: [Node.js Algo Traders](https://t.me/nodetraders). +- QuickStart Guide: https://siebly.io/sdk/bitget/javascript + +## Table of Contents + +- [Installation](#installation) +- [Examples](#examples) +- [Issues & Discussion](#issues--discussion) +- [Related Projects](#related-projects) +- [Documentation](#documentation) +- [Structure](#structure) +- [Usage](#usage) + - [REST API Clients](#rest-api-clients) + - [V3 REST APIs (Unified Trading Account)](#v3-rest-apis) + - [V2 REST APIs](#v2-rest-apis) + - [WebSockets](#websockets) + - [V3 Unified Trading Account](#v3-unified-trading-account) + - [Sending Orders via WebSockets](#sending-orders-via-websockets) + - [Receiving Realtime Data](#receiving-realtime-data) + - [V2 WebSockets](#v2-websockets) + - [Customise Logging](#logging) + - [Custom Logger](#customise-logging) + - [Debug HTTP Requests](#debug-http-requests) + - [Frontend Usage](#browser-usage) + - [Import](#import) + - [Webpack](#webpack) +- [LLMs & AI](#use-with-llms--ai) +- [Used By](#used-by) +- [Contributions & Thanks](#contributions--thanks) + +## Installation + +`npm install --save bitget-api` + +## Examples + +Refer to the [examples](./examples) folder for implementation demos. + +## Issues & Discussion + +- Issues? Check the [issues tab](https://github.com/sieblyio/bitget-api/issues). +- Discuss & collaborate with other node devs? Join our [Node.js Algo Traders](https://t.me/nodetraders) engineering community on telegram. +- Follow our announcement channel for real-time updates on [X/Twitter](https://x.com/sieblyio) + + + +## Related Projects + +Check out our JavaScript/TypeScript/Node.js SDKs & Projects: + +- Visit our website: [https://Siebly.io](https://siebly.io/) +- Try our REST API & WebSocket SDKs published on npmjs: + - [Bybit JavaScript SDK: bybit-api](https://www.npmjs.com/package/bybit-api) + - [Kraken JavaScript SDK: @siebly/kraken-api](https://www.npmjs.com/package/@siebly/kraken-api) + - [OKX JavaScript SDK: okx-api](https://www.npmjs.com/package/okx-api) + - [Binance JavaScript SDK: binance](https://www.npmjs.com/package/binance) + - [Gate (gate.com) JavaScript SDK: gateio-api](https://www.npmjs.com/package/gateio-api) + - [Bitget JavaScript SDK: bitget-api](https://www.npmjs.com/package/bitget-api) + - [Kucoin JavaScript SDK: kucoin-api](https://www.npmjs.com/package/kucoin-api) + - [Coinbase JavaScript SDK: coinbase-api](https://www.npmjs.com/package/coinbase-api) + - [HTX JavaScript SDK: @siebly/htx-api](https://www.npmjs.com/package/@siebly/htx-api) +- Try my misc utilities: + - [OrderBooks Node.js: orderbooks](https://www.npmjs.com/package/orderbooks) + - [Crypto Exchange Account State Cache: accountstate](https://www.npmjs.com/package/accountstate) +- Check out my examples: + - [awesome-crypto-examples Node.js](https://github.com/sieblyio/awesome-crypto-examples) + + +## Documentation + +Most methods accept JS objects. These can be populated using parameters specified by Bitget's API documentation, or check the type definition in each class within this repository (see table below for convenient links to each class). + +- Bitget API Documentation + - [V3/UTA API Documentation](https://www.bitget.com/api-doc/uta/intro) (Latest - Unified Trading Account) + - [V2 API Documentation](https://www.bitget.com/api-doc/common/intro) +- [REST Endpoint Function List](./docs/endpointFunctionList.md) +- [TSDoc Documentation (autogenerated using typedoc)](https://tsdocs.dev/docs/bitget-api) + +## Structure + +This connector is fully compatible with both TypeScript and pure JavaScript projects, while the connector is written in TypeScript. A pure JavaScript version can be built using `npm run build`, which is also the version published to [npm](https://www.npmjs.com/package/bitget-api). + +The version on npm is the output from the `build` command and can be used in projects without TypeScript (although TypeScript is definitely recommended). + +- [src](./src) - the whole connector written in TypeScript +- [lib](./lib) - the JavaScript version of the project (built from TypeScript). This should not be edited directly, as it will be overwritten with each release. +- [dist](./dist) - the webpack bundle of the project for use in browser environments (see guidance on webpack below). +- [examples](./examples) - some implementation examples & demonstrations. Contributions are welcome! + +--- + +# Usage + +Create API credentials at Bitget: + +- [Livenet API Management](https://www.bitget.com/en/support/articles/360011132814-How-to-create-API) +- [Demo Trading Environment](https://www.bitget.com/en/demo-trading) + +## REST API Clients + +Each REST API group has a dedicated REST client. To avoid confusion, here are the available REST clients and the corresponding API groups: +| Class | Description | +|:------------------------------------: |:---------------------------------------------------------------------------------------------: | +| [RestClientV3](src/rest-client-v3.ts) | [V3/UTA REST APIs for Bitget's Unified Trading Account](https://www.bitget.com/api-doc/uta/intro) | +| [WebsocketClientV3](src/websocket-client-v3.ts) | Universal WS client for Bitget's V3/UTA WebSockets | +| [WebsocketAPIClient](src/websocket-api-client.ts) | Websocket API Client, for RESTlike order placement via Bitget's V3/UTA WebSocket API | +| [RestClientV2](src/rest-client-v2.ts) | [V2 REST APIs](https://www.bitget.com/api-doc/common/intro) | +| [WebsocketClientV2](src/websocket-client-v2.ts) | Universal WS client for all Bitget's V2 WebSockets | + +Examples for using each client can be found in: + +- the [examples](./examples) folder. +- the [awesome-crypto-examples](https://github.com/tiagosiebler/awesome-crypto-examples) repository. + +If you're missing an example, you're welcome to request one. Priority will be given to [github sponsors](https://github.com/sponsors/tiagosiebler). + +### Getting Started + +All REST APIs are integrated in each dedicated Rest Client class. See the above table for which REST client to use. If you've upgraded to the Unified Trading Account, you should use the V3 REST APIs and WebSockets. + +There are several REST API modules as there are some differences in each API group: + +1. `RestClientV3` for the latest V3/UTA APIs (Unified Trading Account) - recommended for new projects. +2. `RestClientV2` for V2 APIs - use if you haven't upgraded to UTA yet. + +More Node.js & JavaScript examples for Bitget's REST APIs & WebSockets can be found in the [examples](./examples) folder on GitHub. + +#### V3 REST APIs + +These are only available if you have upgraded to the Unified Trading Account. If not, use the V2 APIs instead. + +```javascript +import { RestClientV3 } from 'bitget-api'; +// or if you prefer require: +// const { RestClientV3 } = require('bitget-api'); + +// note the single quotes, preventing special characters such as $ from being incorrectly passed +const client = new RestClientV3({ + apiKey: process.env.API_KEY_COM || 'insert_api_key_here', + apiSecret: process.env.API_SECRET_COM || 'insert_api_secret_here', + apiPass: process.env.API_PASS_COM || 'insert_api_pass_here', +}); + +(async () => { + try { + console.log(await client.getBalances()); + + const newOrder = await client.submitNewOrder({ + category: 'USDT-FUTURES', + orderType: 'market', + side: 'buy', + qty: '0.001', + symbol: 'BTCUSDT', + }); + + console.log('Order submitted: ', newOrder); + } catch (e) { + console.error('request failed: ', e); + } +})(); +``` + +#### V2 REST APIs + +Not sure which function to call or which parameters to use? Click the class name in the table above to look at all the function names (they are in the same order as the official API docs), and check the API docs for a list of endpoints/parameters/responses. + +If you found the method you're looking for in the API docs, you can also search for the endpoint in the [RestClientV2](src/rest-client-v2.ts) class. This class has all V2 endpoints available. + +```javascript +import { RestClientV2 } from 'bitget-api'; +// or if you prefer require: +// const { RestClientV2 } = require('bitget-api'); + +const API_KEY = 'xxx'; +const API_SECRET = 'yyy'; +const API_PASS = 'zzz'; + +const client = new RestClientV2({ + apiKey: API_KEY, + apiSecret: API_SECRET, + apiPass: API_PASS, +}); + +// For public-only API calls, simply don't provide a key & secret or set them to undefined +// const client = new RestClientV2(); + +client + .getSpotAccount() + .then((result) => { + console.log('getSpotAccount result: ', result); + }) + .catch((err) => { + console.error('getSpotAccount error: ', err); + }); + +client + .getSpotCandles({ + symbol: 'BTCUSDT', + granularity: '1min', + limit: '1000', + }) + .then((result) => { + console.log('getCandles result: ', result); + }) + .catch((err) => { + console.error('getCandles error: ', err); + }); +``` + +## WebSockets + +All WebSocket functionality is supported via the WebsocketClient. Since there are currently 2 generations of Bitget's API, there are 2 WebsocketClient classes in this Node.js, JavaScript & TypeScript SDK for Bitget. + +Use the following guidance to decide which one to use: + +- **Unified Trading Account / V3** (latest generation): + - For receiving data, use the [WebsocketClientV3](./src/websocket-client-v3.ts). + - For sending orders via WebSockets, use the [WebsocketAPIClient](./src/websocket-api-client.ts). +- **V2** (not upgraded to Unified Trading Account yet) + - Use the [WebsocketClientV2](./src/websocket-client-v2.ts). + +All WebSocket clients support: + +- Event driven messaging +- Smart WebSocket persistence with automatic reconnection +- Heartbeat mechanisms to detect disconnections +- Automatic resubscription after reconnection +- Error handling and connection monitoring +- Optional data beautification + +Higher level examples below, while more thorough examples can be found in the examples folder on GitHub. + +##### V3 Unified Trading Account + +###### Sending orders via WebSockets + +The V3 / Unified Trading Account APIs introduce order placement via a persisted WebSocket connection. This Bitget Node.js, JavaScript & TypeScript SDK supports Bitget's full V3 API offering, including the WebSocket API. + +There are two approaches to placing orders via the Bitget WebSocket APIs. The recommended route is to use the dedicated WebsocketAPIClient class, included with this SDK. + +This integration looks & feels like a REST API client, but uses WebSockets, via the WebsocketClient's sendWSAPIRequest method. It returns promises and has end to end types. + +A simple example is below, but for a more thorough example, check the example here: [./examples/V3/ws-api-client-trade.ts](./examples/V3/ws-api-client-trade.ts) + +```typescript +import { WebsocketAPIClient } from 'bitget-api'; +// or if you prefer require: +// const { WebsocketAPIClient } = require("bitget-api"); + +// Make an instance of the WS API Client class with your API keys +const wsClient = new WebsocketAPIClient({ + apiKey: API_KEY, + apiSecret: API_SECRET, + apiPass: API_PASS, + + // Whether to use the demo trading wss connection + // demoTrading: true, +}); + +async function start() { + // Start using it like a REST API. All actions are sent via a persisted WebSocket connection. + + /** + * Place Order + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters */ -⋮---- -getSharkfinProducts(params: { - coin: string; - limit?: string; - idLessThan?: string; -}): Promise> -⋮---- -getSharkfinAccount(): Promise> -⋮---- -getSharkfinAssets( - params: GetSharkfinAssetsRequestV2, -): Promise> -⋮---- -getSharkfinRecords( - params: GetSharkfinRecordsRequestV2, -): Promise> -⋮---- -getSharkfinSubscription(params: { - productId: string; -}): Promise> -⋮---- -subscribeSharkfin(params: { productId: string; amount: string }): Promise< - APIResponse<{ - orderId: string; - status: string; - }> - > { - return this.postPrivate('/api/v2/earn/sharkfin/subscribe', params); -⋮---- -getSharkfinSubscriptionResult(params: { orderId: string }): Promise< - APIResponse<{ - result: 'success' | 'fail'; - msg: string; - }> - > { - return this.getPrivate('/api/v2/earn/sharkfin/subscribe-result', params); -⋮---- + try { + const res = await wsClient.submitNewOrder('spot', { + orderType: 'limit', + price: '100', + qty: '0.1', + side: 'buy', + symbol: 'BTCUSDT', + timeInForce: 'gtc', + }); + + console.log(new Date(), 'WS API "submitNewOrder()" result: ', res); + } catch (e) { + console.error(new Date(), 'Exception with WS API "submitNewOrder()": ', e); + } +} + +start().catch((e) => console.error('Exception in example: '.e)); +``` + +###### Receiving realtime data + +Use the WebsocketClientV3 to receive data via the V3 WebSockets + +```typescript +import { WebsocketClientV3 } from "bitget-api"; +// or if you prefer require: +// const { WebsocketClientV3 } = require("bitget-api"); + +const API_KEY = "yourAPIKeyHere"; +const API_SECRET = "yourAPISecretHere; +const API_PASS = "yourAPIPassHere"; + +const wsClient = new WebsocketClientV3( + { + // Only necessary if you plan on using private/account websocket topics + apiKey: API_KEY, + apiSecret: API_SECRET, + apiPass: API_PASS, + } +); + +// Connect event handlers to process incoming events +wsClient.on('update', (data) => { + console.log('WS raw message received ', data); + // console.log('WS raw message received ', JSON.stringify(data, null, 2)); +}); + +wsClient.on('open', (data) => { + console.log('WS connection opened:', data.wsKey); +}); +wsClient.on('response', (data) => { + console.log('WS response: ', JSON.stringify(data, null, 2)); +}); +wsClient.on('reconnect', ({ wsKey }) => { + console.log('WS automatically reconnecting.... ', wsKey); +}); +wsClient.on('reconnected', (data) => { + console.log('WS reconnected ', data?.wsKey); +}); +wsClient.on('exception', (data) => { + console.log('WS error', data); +}); + /** - * - * - * Earn | Loan - * - * - */ -⋮---- -getLoanCurrencies(params?: { - coin?: string; -}): Promise> -⋮---- -getLoanEstInterestAndBorrowable( - params: GetLoanEstInterestAndBorrowableRequestV2, - ): Promise< - APIResponse<{ - hourInterest: string; - loanAmount: string; - }> - > { - return this.get('/api/v2/earn/loan/public/hour-interest', params); -⋮---- -borrowLoan(params: BorrowLoanRequestV2): Promise< - APIResponse<{ - orderId: string; - }> - > { - return this.postPrivate('/api/v2/earn/loan/borrow', params); -⋮---- -getOngoingLoanOrders(params?: { - orderId?: string; - loanCoin?: string; - pledgeCoin?: string; -}): Promise> -⋮---- -repayLoan( - params: RepayLoanRequestV2, -): Promise> -⋮---- -getRepayHistory( - params: GetLoanRepayHistoryRequestV2, -): Promise> -⋮---- -updateLoanPledgeRate(params: ModifyLoanPledgeRateRequestV2): Promise< - APIResponse<{ - loanCoin: string; - pledgeCoin: string; - afterPledgeRate: string; - }> - > { - return this.postPrivate('/api/v2/earn/loan/revise-pledge', params); -⋮---- -getLoanPledgeRateHistory( - params: GetLoanPledgeRateHistoryRequestV2, -): Promise> -⋮---- -getLoanHistory( - params: GetLoanHistoryRequestV2, -): Promise> -⋮---- -getLoanDebts(): Promise> -⋮---- -getLoanLiquidationRecords( - params: GetLiquidationRecordsRequestV2, -): Promise> + * Subscribe to topics as you wish + */ + +// You can subscribe to one topic at a time +wsClient.subscribe( + { + topic: 'account', + payload: { + instType: 'UTA', // Note: all account events go on the UTA instType + }, + }, + WS_KEY_MAP.v3Private, // This parameter points to private or public +); + +// Note: all account events go on the UTA instType +const ACCOUNT_INST_TYPE = 'UTA'; +const ACCOUNT_WS_KEY = WS_KEY_MAP.v3Private; + +// Or multiple at once: +wsClient.subscribe( + [ + { + topic: 'account', + payload: { + instType: ACCOUNT_INST_TYPE, + }, + }, + { + topic: 'position', + payload: { + instType: ACCOUNT_INST_TYPE, + }, + }, + { + topic: 'fill', + payload: { + instType: ACCOUNT_INST_TYPE, + }, + }, + { + topic: 'order', + payload: { + instType: ACCOUNT_INST_TYPE, + }, + }, + ], + ACCOUNT_WS_KEY, +); + +// Example public events +wsClient.subscribe( + [ + { + topic: 'ticker', + payload: { + instType: 'spot', + symbol: 'BTCUSDT', + }, + }, + { + topic: 'ticker', + payload: { + instType: 'spot', + symbol: 'ETHUSDT', + }, + }, + { + topic: 'ticker', + payload: { + instType: 'spot', + symbol: 'XRPUSDT', + }, + }, + { + topic: 'ticker', + payload: { + instType: 'usdt-futures', + symbol: 'BTCUSDT', + }, + }, + { + topic: 'ticker', + payload: { + instType: 'usdt-futures', + symbol: 'BTCUSDT', + }, + }, + ], + WS_KEY_MAP.v3Public, +); +``` + +For more examples, including how to use websockets with Bitget, check the [examples](./examples/) and [test](./test/) folders. + +### V2 WebSockets + +If you haven't upgraded to the Unified Trading Account, use the V2 WebSocket client: + +```javascript +import { WebsocketClientV2 } from 'bitget-api'; +// or if you prefer require: +// const { WebsocketClientV2 } = require('bitget-api'); + +const API_KEY = 'xxx'; +const API_SECRET = 'yyy'; +const API_PASS = 'zzz'; + +const wsClient = new WebsocketClientV2({ + apiKey: API_KEY, + apiSecret: API_SECRET, + apiPass: API_PASS, + // Optional: connect to demo trading environment + // demoTrading: true, +}); + +// Handle incoming messages +wsClient.on('update', (data) => { + console.log('WS update received: ', data); +}); + +wsClient.on('open', (data) => { + console.log('WS connection opened: ', data.wsKey); +}); + +wsClient.on('reconnected', (data) => { + console.log('WS reconnected: ', data?.wsKey); +}); + +wsClient.on('exception', (data) => { + console.log('WS error: ', data); +}); + +// Subscribe to public data streams +wsClient.subscribeTopic('SPOT', 'ticker', symbol); + +// Subscribe to private data streams (requires authentication) +wsClient.subscribeTopic('SPOT', 'account'); +``` + +--- + +## Logging + +### Customise logging + +Pass a custom logger which supports the log methods `trace`, `info` and `error`, or override methods from the default logger as desired. + +```javascript +import { WebsocketClientV2, DefaultLogger } from 'bitget-api'; +// or if you prefer require: +// const { WebsocketClientV2, DefaultLogger } = require('bitget-api'); + +// Disable all logging on the trace level (less console logs) +const customLogger = { + ...DefaultLogger, + trace: () => {}, +}; + +const ws = new WebsocketClientV2( + { + apiKey: 'API_KEY', + apiSecret: 'API_SECRET', + apiPass: 'API_PASS', + }, + customLogger, +); +``` + +### Debug HTTP requests + +In rare situations, you may want to see the raw HTTP requets being built as well as the API response. These can be enabled by setting the `BITGETTRACE` env var to `true`. + +## Browser Usage + +### Import + +This is the "modern" way, allowing the package to be directly imported into frontend projects with full typescript support. + +1. Install these dependencies + ```sh + npm install crypto-browserify stream-browserify + ``` +2. Add this to your `tsconfig.json` + ```json + { + "compilerOptions": { + "paths": { + "crypto": [ + "./node_modules/crypto-browserify" + ], + "stream": [ + "./node_modules/stream-browserify" + ] + } + ``` +3. Declare this in the global context of your application (ex: in polyfills for angular) + ```js + (window as any).global = window; + ``` + +### Webpack + +This is the "old" way of using this package on webpages. This will build a minified js bundle that can be pulled in using a script tag on a website. + +Build a bundle using webpack: + +- `npm install` +- `npm build` +- `npm pack` + +The bundle can be found in `dist/`. Altough usage should be largely consistent, smaller differences will exist. Documentation is still TODO - contributions welcome. + +## Use with LLMs & AI + +This SDK includes a bundled `llms.txt` file in the root of the repository. If you're developing with LLMs, use the included `llms.txt` with your LLM - it will significantly improve the LLMs understanding of how to correctly use this SDK. + +This file contains AI optimised structure of all the functions in this package, and their parameters for easier use with any learning models or artificial intelligence. + +--- + +## Used By + +[![Repository Users Preview Image](https://dependents.info/sieblyio/bitget-api/image)](https://github.com/sieblyio/bitget-api/network/dependents) + +--- + + + +### Contributions & Thanks + +Have my projects helped you? Share the love, there are many ways you can show your thanks: + +- Star & share my projects. +- Are my projects useful? Sponsor me on Github and support my effort to maintain & improve them: https://github.com/sponsors/tiagosiebler +- Have an interesting project? Get in touch & invite me to it. +- Or buy me all the coffee: + - ETH(ERC20): `0xA3Bda8BecaB4DCdA539Dc16F9C54a592553Be06C` +- Sign up with my referral links: + - OKX (receive a 20% fee discount!): https://www.okx.com/join/42013004 + - Binance (receive a 20% fee discount!): https://accounts.binance.com/register?ref=OKFFGIJJ + - HyperLiquid (receive a 4% fee discount!): https://app.hyperliquid.xyz/join/SIEBLY + - Gate: https://www.gate.io/signup/NODESDKS?ref_type=103 + + + + +### Contributions & Pull Requests + +Contributions are encouraged, I will review any incoming pull requests. See the issues tab for todo items. + + + +## Star History + +[![Star History Chart](https://api.star-history.com/svg?repos=sieblyio/bybit-api,sieblyio/okx-api,sieblyio/binance,sieblyio/bitget-api,sieblyio/bitmart-api,sieblyio/gateio-api,sieblyio/kucoin-api,sieblyio/coinbase-api,sieblyio/orderbooks,sieblyio/accountstate,sieblyio/awesome-crypto-examples&type=Date)](https://star-history.com/#sieblyio/bybit-api&sieblyio/okx-api&sieblyio/binance&sieblyio/bitget-api&sieblyio/bitmart-api&sieblyio/gateio-api&sieblyio/kucoin-api&sieblyio/coinbase-api&sieblyio/orderbooks&sieblyio/accountstate&sieblyio/awesome-crypto-examples&Date) + + ================ File: src/rest-client-v3.ts @@ -14306,6 +16891,7 @@ File: src/rest-client-v3.ts import { AdjustAccountModeRequestV3, CancelWithdrawalRequestV3, + CreateAgentSubAccountRequestV3, CreateSubAccountApiKeyRequestV3, CreateSubAccountRequestV3, DeleteSubAccountApiKeyRequestV3, @@ -14314,12 +16900,19 @@ import { GetConvertRecordsRequestV3, GetDepositAddressRequestV3, GetDepositRecordsRequestV3, + GetEligibleLoanInfoRequestV3, + GetEligibleMarginTierRequestV3, + GetEligibleSymbolsRequestV3, GetFeeRateRequestV3, GetFinancialRecordsRequestV3, GetFundingAssetsRequestV3, GetMaxTransferableRequestV3, GetMaxWithdrawalRequestV3, + GetMovePositionHistoryRequestV3, GetOpenInterestLimitRequestV3, + GetRateLimitQuotaRequestV3, + GetRealityFillsRequestV3, + GetRealityOrderBookRequestV3, GetSubAccountApiKeysRequestV3, GetSubAccountListRequestV3, GetSubDepositAddressRequestV3, @@ -14330,13 +16923,16 @@ import { GetTransferableCoinsRequestV3, GetWithdrawAddressBookRequestV3, GetWithdrawRecordsRequestV3, + MovePositionsRequestV3, PreSetLeverageRequestV3, RepayRequestV3, SetCollateralTypeRequestV3, SetDepositAccountRequestV3, SetLeverageRequestV3, SetMarginRequestV3, + SetRateLimitQuotaRequestV3, SubAccountTransferRequestV3, + SubMasterTransferRequestV3, SwitchDeductRequestV3, TransferRequestV3, UpdateSubAccountApiKeyRequestV3, @@ -14357,7 +16953,9 @@ import { } from './types/request/v3/broker.js'; import { CopyFuturesTransferRequestV3, + GetCopyFuturesFollowersRequestV3, GetCopyFuturesMaxTransferableRequestV3, + GetCopyFuturesProfitDetailsRequestV3, GetCopyFuturesTransferRecordRequestV3, } from './types/request/v3/copytrading.js'; import { @@ -14433,6 +17031,32 @@ import { GetSpotWhaleFlowRequestV3, GetTickersRequestV3, } from './types/request/v3/public.js'; +import { + CancelStockPlusOrderRequestV3, + GetStockPlusAccountRequestV3, + GetStockPlusCandlestickRequestV3, + GetStockPlusCashFlowRequestV3, + GetStockPlusDepthRequestV3, + GetStockPlusHistoryCandlestickRequestV3, + GetStockPlusHistoryExecutionsRequestV3, + GetStockPlusHistoryOrdersRequestV3, + GetStockPlusIntradayRequestV3, + GetStockPlusOptionChainInfoRequestV3, + GetStockPlusOptionExpiryDateRequestV3, + GetStockPlusOptionQuoteRequestV3, + GetStockPlusOptionVolumeRequestV3, + GetStockPlusOrderDetailRequestV3, + GetStockPlusQuoteRequestV3, + GetStockPlusStaticInfoRequestV3, + GetStockPlusStockPositionRequestV3, + GetStockPlusTodayExecutionsRequestV3, + GetStockPlusTodayOrdersRequestV3, + GetStockPlusTradeDetailRequestV3, + GetStockPlusTransferRecordsRequestV3, + ModifyStockPlusOrderRequestV3, + PlaceStockPlusOrderRequestV3, + StockPlusTransferRequestV3, +} from './types/request/v3/stockplus.js'; import { CancelStrategyOrderRequestV3, GetHistoryStrategyOrdersRequestV3, @@ -14468,18 +17092,25 @@ import { AllSymbolFeeRateV3, CollateralTypeConfigV3, ConvertRecordV3, + CreateAgentSubAccountResponseV3, CreateSubAccountApiKeyResponseV3, CreateSubAccountResponseV3, CustomCollateralCoinV3, DepositAddressV3, DepositRecordV3, + EligibleLoanInfoV3, + EligibleMarginTierV3, + EligibleSymbolV3, FinancialRecordV3, FundingAssetV3, MaxTransferableV3, MaxWithdrawalV3, + MovePositionHistoryV3, + MovePositionsResponseV3, OpenInterestLimitV3, PaymentCoinV3, PreSetLeverageV3, + RateLimitQuotaV3, RepayableCoinV3, RepayResponseV3, SubAccountApiKeyV3, @@ -14506,8 +17137,12 @@ import { ModifyBrokerSubApiKeyResponseV3, } from './types/response/v3/broker.js'; import { + CopyFuturesCurrentFollowersV3, + CopyFuturesHistoryFollowersV3, CopyFuturesMaxTransferableV3, CopyFuturesPositionSummaryV3, + CopyFuturesProfitDetailsV3, + CopyFuturesProfitSummaryV3, CopyFuturesTradingPairV3, CopyFuturesTransferRecordListV3, CopyFuturesTransferResponseV3, @@ -14584,6 +17219,8 @@ import { PositionTierV3, ProofOfReservesV3, PublicFillV3, + RealityFillV3, + RealityOrderBookV3, RiskReserveAllV3, RiskReserveHourV3, RiskReserveV3, @@ -14594,6 +17231,32 @@ import { SpotWhaleFlowV3, TickerV3, } from './types/response/v3/public.js'; +import { + StockPlusAccountV3, + StockPlusCancelOrderResponseV3, + StockPlusCandlestickV3, + StockPlusCashFlowV3, + StockPlusDepthV3, + StockPlusHistoryCandlestickV3, + StockPlusHistoryExecutionsV3, + StockPlusHistoryOrdersV3, + StockPlusIntradayV3, + StockPlusModifyOrderResponseV3, + StockPlusOptionChainInfoV3, + StockPlusOptionExpiryDateV3, + StockPlusOptionQuoteV3, + StockPlusOptionVolumeV3, + StockPlusOrderDetailV3, + StockPlusOrdersV3, + StockPlusPlaceOrderResponseV3, + StockPlusQuoteV3, + StockPlusStaticInfoV3, + StockPlusStockPositionV3, + StockPlusTodayExecutionsV3, + StockPlusTradeDetailV3, + StockPlusTransferRecordsV3, + StockPlusTransferResponseV3, +} from './types/response/v3/stockplus.js'; import { ModifyStrategyOrderResponseV3, PlaceStrategyOrderResponseV3, @@ -14900,6 +17563,20 @@ getIndexComponents( params: GetIndexComponentsRequestV3, ): Promise> ⋮---- +/** + * Get Reality OrderBook + */ +getRealityOrderBook( + params: GetRealityOrderBookRequestV3, +): Promise> +⋮---- +/** + * Get Reality Fills + */ +getRealityFills( + params: GetRealityFillsRequestV3, +): Promise> +⋮---- /** * * =====Copy Trading | Futures===== @@ -14950,6 +17627,125 @@ getCopyFuturesTransferRecords( params?: GetCopyFuturesTransferRecordRequestV3, ): Promise> ⋮---- +getCopyFuturesCurrentFollowers( + params?: GetCopyFuturesFollowersRequestV3, +): Promise> +⋮---- +getCopyFuturesHistoryFollowers( + params?: GetCopyFuturesFollowersRequestV3, +): Promise> +⋮---- +getCopyFuturesProfitSummary(): Promise< + APIResponse + > { + return this.getPrivate('/api/v3/copy/futures/profit-summary'); +⋮---- +getCopyFuturesProfitDetails( + params?: GetCopyFuturesProfitDetailsRequestV3, +): Promise> +⋮---- +/** + * + * =====Stock+===== + * + */ +⋮---- +getStockPlusOptionQuote( + params: GetStockPlusOptionQuoteRequestV3, +): Promise> +⋮---- +getStockPlusOptionChainInfo( + params: GetStockPlusOptionChainInfoRequestV3, +): Promise> +⋮---- +getStockPlusOptionExpiryDate( + params: GetStockPlusOptionExpiryDateRequestV3, +): Promise> +⋮---- +getStockPlusOptionVolume( + params: GetStockPlusOptionVolumeRequestV3, +): Promise> +⋮---- +getStockPlusStaticInfo( + params: GetStockPlusStaticInfoRequestV3, +): Promise> +⋮---- +getStockPlusQuote( + params: GetStockPlusQuoteRequestV3, +): Promise> +⋮---- +getStockPlusTradeDetail( + params: GetStockPlusTradeDetailRequestV3, +): Promise> +⋮---- +getStockPlusIntraday( + params: GetStockPlusIntradayRequestV3, +): Promise> +⋮---- +getStockPlusHistoryCandlestick( + params: GetStockPlusHistoryCandlestickRequestV3, +): Promise> +⋮---- +getStockPlusCandlestick( + params: GetStockPlusCandlestickRequestV3, +): Promise> +⋮---- +getStockPlusDepth( + params: GetStockPlusDepthRequestV3, +): Promise> +⋮---- +placeStockPlusOrder( + params: PlaceStockPlusOrderRequestV3, +): Promise> +⋮---- +cancelStockPlusOrder( + params: CancelStockPlusOrderRequestV3, +): Promise> +⋮---- +modifyStockPlusOrder( + params: ModifyStockPlusOrderRequestV3, +): Promise> +⋮---- +getStockPlusTodayOrders( + params?: GetStockPlusTodayOrdersRequestV3, +): Promise> +⋮---- +getStockPlusHistoryOrders( + params?: GetStockPlusHistoryOrdersRequestV3, +): Promise> +⋮---- +getStockPlusOrderDetail( + params: GetStockPlusOrderDetailRequestV3, +): Promise> +⋮---- +getStockPlusTodayExecutions( + params?: GetStockPlusTodayExecutionsRequestV3, +): Promise> +⋮---- +getStockPlusHistoryExecutions( + params?: GetStockPlusHistoryExecutionsRequestV3, +): Promise> +⋮---- +getStockPlusAccount( + params?: GetStockPlusAccountRequestV3, +): Promise> +⋮---- +getStockPlusCashFlow( + params: GetStockPlusCashFlowRequestV3, +): Promise> +⋮---- +getStockPlusStockPosition( + params?: GetStockPlusStockPositionRequestV3, +): Promise> +⋮---- +stockPlusTransfer( + params: StockPlusTransferRequestV3, +): Promise> +⋮---- +getStockPlusTransferRecords( + params?: GetStockPlusTransferRecordsRequestV3, +): Promise> +⋮---- /** * * =====Account======= endpoints @@ -15154,6 +17950,18 @@ getOpenInterestLimit( params: GetOpenInterestLimitRequestV3, ): Promise> ⋮---- +getEligibleSymbols( + params?: GetEligibleSymbolsRequestV3, +): Promise> +⋮---- +getEligibleMarginTier( + params?: GetEligibleMarginTierRequestV3, +): Promise> +⋮---- +getEligibleLoanInfo( + params?: GetEligibleLoanInfoRequestV3, +): Promise> +⋮---- /** * Switch Account - Switch to classic account mode * Only supports parent accounts. @@ -15201,6 +18009,13 @@ createSubAccount( params: CreateSubAccountRequestV3, ): Promise> ⋮---- +/** + * Create Agent Sub-account + */ +createAgentSubAccount( + params: CreateAgentSubAccountRequestV3, +): Promise> +⋮---- /** * Freeze/Unfreeze Sub-account */ @@ -15260,6 +18075,14 @@ getSubAccountApiKeys(params: GetSubAccountApiKeysRequestV3): Promise< > { return this.getPrivate('/api/v3/user/sub-api-list', params); ⋮---- +getRateLimitQuota( + params: GetRateLimitQuotaRequestV3, +): Promise> +⋮---- +setRateLimitQuota( + params: SetRateLimitQuotaRequestV3, +): Promise>> +⋮---- /** * * =====Transfer======= endpoints @@ -15302,6 +18125,17 @@ getSubTransferRecords(params?: GetSubTransferRecordsRequestV3): Promise< > { return this.getPrivate('/api/v3/account/sub-transfer-record', params); ⋮---- +/** + * Sub-Main Account Transfer + */ +subMasterTransfer(params: SubMasterTransferRequestV3): Promise< + APIResponse<{ + transferId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v3/account/sub-master-transfer', params); +⋮---- /** * * =====Deposit======= endpoints @@ -15480,6 +18314,24 @@ getHistoryOrders(params: GetHistoryOrdersRequestV3): Promise< > { return this.getPrivate('/api/v3/trade/history-orders', params); ⋮---- +/** + * Move Positions - Transfer positions between master and sub-accounts + */ +movePositions( + params: MovePositionsRequestV3, +): Promise> +⋮---- +/** + * Get Move Position History + */ +getMovePositionHistory(params: GetMovePositionHistoryRequestV3): Promise< + APIResponse<{ + list: MovePositionHistoryV3[]; + cursor: string; + }> + > { + return this.getPrivate('/api/v3/account/move-position-history', params); +⋮---- /** * Get Fill History */ @@ -15963,7 +18815,7 @@ File: package.json ================ { "name": "bitget-api", - "version": "3.1.11", + "version": "3.2.2", "description": "Complete Node.js & JavaScript SDK for Bitget V1-V3 REST APIs & WebSockets, with TypeScript & end-to-end tests.", "scripts": { "test": "jest", @@ -15975,7 +18827,9 @@ File: package.json "build:clean": "npm run clean && npm run build", "build:watch": "npm run clean && tsc --watch", "pack": "webpack --config webpack/webpack.config.cjs", - "lint": "eslint src", + "lint": "eslint src && npm run lint:apidoc", + "lint:apidoc": "prettier --check \"examples/apidoc/**/*.js\"", + "format:apidoc": "prettier --write \"examples/apidoc/**/*.js\"", "prepublish": "npm run build:clean", "betapublish": "npm publish --tag beta" }, @@ -15997,14 +18851,14 @@ File: package.json "author": "Tiago Siebler (https://siebly.io)", "contributors": [], "dependencies": { + "@types/ws": "^8.18.1", "axios": "^1.13.2", "isomorphic-ws": "^5.0.0", - "ws": "^8.18.3" + "ws": "8.21.1" }, "devDependencies": { "@types/jest": "^29.0.3", "@types/node": "^22.10.2", - "@types/ws": "^8.18.1", "@typescript-eslint/eslint-plugin": "^8.18.0", "@typescript-eslint/parser": "^8.18.0", "eslint": "^8.24.0", @@ -16019,7 +18873,6 @@ File: package.json "source-map-loader": "^4.0.0", "ts-loader": "^9.5.4", "webpack": "^5.74.0", - "webpack-bundle-analyzer": "^5.1.1", "webpack-cli": "^4.10.0" }, "keywords": [ @@ -16051,12 +18904,12 @@ File: package.json "license": "MIT", "repository": { "type": "git", - "url": "https://github.com/tiagosiebler/bitget-api" + "url": "git+https://github.com/sieblyio/bitget-api.git" }, "bugs": { - "url": "https://github.com/tiagosiebler/bitget-api/issues" + "url": "https://github.com/sieblyio/bitget-api/issues" }, - "homepage": "https://github.com/tiagosiebler/bitget-api#readme" + "homepage": "https://github.com/sieblyio/bitget-api#readme" } diff --git a/package-lock.json b/package-lock.json index 62fa4ee..49157d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bitget-api", - "version": "3.2.1", + "version": "3.2.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bitget-api", - "version": "3.2.1", + "version": "3.2.2", "license": "MIT", "dependencies": { "@types/ws": "^8.18.1", diff --git a/package.json b/package.json index d8f761e..86adbce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bitget-api", - "version": "3.2.1", + "version": "3.2.2", "description": "Complete Node.js & JavaScript SDK for Bitget V1-V3 REST APIs & WebSockets, with TypeScript & end-to-end tests.", "scripts": { "test": "jest", diff --git a/src/index.ts b/src/index.ts index 66a91d2..b9e7180 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,6 +16,7 @@ export * from './types/request/v3/earn.js'; export * from './types/request/v3/loan.js'; export * from './types/request/v3/p2p.js'; export * from './types/request/v3/public.js'; +export * from './types/request/v3/stockplus.js'; export * from './types/request/v3/strategy.js'; export * from './types/request/v3/trade.js'; export * from './types/response/v2/broker.js'; @@ -32,6 +33,7 @@ export * from './types/response/v3/earn.js'; export * from './types/response/v3/loan.js'; export * from './types/response/v3/p2p.js'; export * from './types/response/v3/public.js'; +export * from './types/response/v3/stockplus.js'; export * from './types/response/v3/strategy.js'; export * from './types/response/v3/trade.js'; export * from './types/shared.js'; diff --git a/src/rest-client-v3.ts b/src/rest-client-v3.ts index 7277d5b..19b4c6b 100644 --- a/src/rest-client-v3.ts +++ b/src/rest-client-v3.ts @@ -10,6 +10,9 @@ import { GetConvertRecordsRequestV3, GetDepositAddressRequestV3, GetDepositRecordsRequestV3, + GetEligibleLoanInfoRequestV3, + GetEligibleMarginTierRequestV3, + GetEligibleSymbolsRequestV3, GetFeeRateRequestV3, GetFinancialRecordsRequestV3, GetFundingAssetsRequestV3, @@ -17,6 +20,7 @@ import { GetMaxWithdrawalRequestV3, GetMovePositionHistoryRequestV3, GetOpenInterestLimitRequestV3, + GetRateLimitQuotaRequestV3, GetRealityFillsRequestV3, GetRealityOrderBookRequestV3, GetSubAccountApiKeysRequestV3, @@ -36,6 +40,7 @@ import { SetDepositAccountRequestV3, SetLeverageRequestV3, SetMarginRequestV3, + SetRateLimitQuotaRequestV3, SubAccountTransferRequestV3, SubMasterTransferRequestV3, SwitchDeductRequestV3, @@ -58,7 +63,9 @@ import { } from './types/request/v3/broker.js'; import { CopyFuturesTransferRequestV3, + GetCopyFuturesFollowersRequestV3, GetCopyFuturesMaxTransferableRequestV3, + GetCopyFuturesProfitDetailsRequestV3, GetCopyFuturesTransferRecordRequestV3, } from './types/request/v3/copytrading.js'; import { @@ -134,6 +141,32 @@ import { GetSpotWhaleFlowRequestV3, GetTickersRequestV3, } from './types/request/v3/public.js'; +import { + CancelStockPlusOrderRequestV3, + GetStockPlusAccountRequestV3, + GetStockPlusCandlestickRequestV3, + GetStockPlusCashFlowRequestV3, + GetStockPlusDepthRequestV3, + GetStockPlusHistoryCandlestickRequestV3, + GetStockPlusHistoryExecutionsRequestV3, + GetStockPlusHistoryOrdersRequestV3, + GetStockPlusIntradayRequestV3, + GetStockPlusOptionChainInfoRequestV3, + GetStockPlusOptionExpiryDateRequestV3, + GetStockPlusOptionQuoteRequestV3, + GetStockPlusOptionVolumeRequestV3, + GetStockPlusOrderDetailRequestV3, + GetStockPlusQuoteRequestV3, + GetStockPlusStaticInfoRequestV3, + GetStockPlusStockPositionRequestV3, + GetStockPlusTodayExecutionsRequestV3, + GetStockPlusTodayOrdersRequestV3, + GetStockPlusTradeDetailRequestV3, + GetStockPlusTransferRecordsRequestV3, + ModifyStockPlusOrderRequestV3, + PlaceStockPlusOrderRequestV3, + StockPlusTransferRequestV3, +} from './types/request/v3/stockplus.js'; import { CancelStrategyOrderRequestV3, GetHistoryStrategyOrdersRequestV3, @@ -175,6 +208,9 @@ import { CustomCollateralCoinV3, DepositAddressV3, DepositRecordV3, + EligibleLoanInfoV3, + EligibleMarginTierV3, + EligibleSymbolV3, FinancialRecordV3, FundingAssetV3, MaxTransferableV3, @@ -184,6 +220,7 @@ import { OpenInterestLimitV3, PaymentCoinV3, PreSetLeverageV3, + RateLimitQuotaV3, RepayableCoinV3, RepayResponseV3, SubAccountApiKeyV3, @@ -210,8 +247,12 @@ import { ModifyBrokerSubApiKeyResponseV3, } from './types/response/v3/broker.js'; import { + CopyFuturesCurrentFollowersV3, + CopyFuturesHistoryFollowersV3, CopyFuturesMaxTransferableV3, CopyFuturesPositionSummaryV3, + CopyFuturesProfitDetailsV3, + CopyFuturesProfitSummaryV3, CopyFuturesTradingPairV3, CopyFuturesTransferRecordListV3, CopyFuturesTransferResponseV3, @@ -300,6 +341,32 @@ import { SpotWhaleFlowV3, TickerV3, } from './types/response/v3/public.js'; +import { + StockPlusAccountV3, + StockPlusCancelOrderResponseV3, + StockPlusCandlestickV3, + StockPlusCashFlowV3, + StockPlusDepthV3, + StockPlusHistoryCandlestickV3, + StockPlusHistoryExecutionsV3, + StockPlusHistoryOrdersV3, + StockPlusIntradayV3, + StockPlusModifyOrderResponseV3, + StockPlusOptionChainInfoV3, + StockPlusOptionExpiryDateV3, + StockPlusOptionQuoteV3, + StockPlusOptionVolumeV3, + StockPlusOrderDetailV3, + StockPlusOrdersV3, + StockPlusPlaceOrderResponseV3, + StockPlusQuoteV3, + StockPlusStaticInfoV3, + StockPlusStockPositionV3, + StockPlusTodayExecutionsV3, + StockPlusTradeDetailV3, + StockPlusTransferRecordsV3, + StockPlusTransferResponseV3, +} from './types/response/v3/stockplus.js'; import { ModifyStrategyOrderResponseV3, PlaceStrategyOrderResponseV3, @@ -799,6 +866,192 @@ export class RestClientV3 extends BaseRestClient { return this.getPrivate('/api/v3/copy/futures/transfer-record', params); } + getCopyFuturesCurrentFollowers( + params?: GetCopyFuturesFollowersRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/copy/futures/current-follower', params); + } + + getCopyFuturesHistoryFollowers( + params?: GetCopyFuturesFollowersRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/copy/futures/history-follower', params); + } + + getCopyFuturesProfitSummary(): Promise< + APIResponse + > { + return this.getPrivate('/api/v3/copy/futures/profit-summary'); + } + + getCopyFuturesProfitDetails( + params?: GetCopyFuturesProfitDetailsRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/copy/futures/profit-details', params); + } + + /** + * + * =====Stock+===== + * + */ + + getStockPlusOptionQuote( + params: GetStockPlusOptionQuoteRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/market/option-quote', params); + } + + getStockPlusOptionChainInfo( + params: GetStockPlusOptionChainInfoRequestV3, + ): Promise> { + return this.getPrivate( + '/api/v3/stockplus/market/option-chain-info', + params, + ); + } + + getStockPlusOptionExpiryDate( + params: GetStockPlusOptionExpiryDateRequestV3, + ): Promise> { + return this.getPrivate( + '/api/v3/stockplus/market/option-expiry-date', + params, + ); + } + + getStockPlusOptionVolume( + params: GetStockPlusOptionVolumeRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/market/option-volume', params); + } + + getStockPlusStaticInfo( + params: GetStockPlusStaticInfoRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/market/static', params); + } + + getStockPlusQuote( + params: GetStockPlusQuoteRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/market/quote', params); + } + + getStockPlusTradeDetail( + params: GetStockPlusTradeDetailRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/market/trade', params); + } + + getStockPlusIntraday( + params: GetStockPlusIntradayRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/market/intraday', params); + } + + getStockPlusHistoryCandlestick( + params: GetStockPlusHistoryCandlestickRequestV3, + ): Promise> { + return this.getPrivate( + '/api/v3/stockplus/market/history-candlestick', + params, + ); + } + + getStockPlusCandlestick( + params: GetStockPlusCandlestickRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/market/candlestick', params); + } + + getStockPlusDepth( + params: GetStockPlusDepthRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/market/depth', params); + } + + placeStockPlusOrder( + params: PlaceStockPlusOrderRequestV3, + ): Promise> { + return this.postPrivate('/api/v3/stockplus/trade/place-order', params); + } + + cancelStockPlusOrder( + params: CancelStockPlusOrderRequestV3, + ): Promise> { + return this.postPrivate('/api/v3/stockplus/trade/cancel-order', params); + } + + modifyStockPlusOrder( + params: ModifyStockPlusOrderRequestV3, + ): Promise> { + return this.postPrivate('/api/v3/stockplus/trade/modify-order', params); + } + + getStockPlusTodayOrders( + params?: GetStockPlusTodayOrdersRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/trade/today-orders', params); + } + + getStockPlusHistoryOrders( + params?: GetStockPlusHistoryOrdersRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/trade/history-orders', params); + } + + getStockPlusOrderDetail( + params: GetStockPlusOrderDetailRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/trade/order-detail', params); + } + + getStockPlusTodayExecutions( + params?: GetStockPlusTodayExecutionsRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/trade/today-executions', params); + } + + getStockPlusHistoryExecutions( + params?: GetStockPlusHistoryExecutionsRequestV3, + ): Promise> { + return this.getPrivate( + '/api/v3/stockplus/trade/history-executions', + params, + ); + } + + getStockPlusAccount( + params?: GetStockPlusAccountRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/asset/account', params); + } + + getStockPlusCashFlow( + params: GetStockPlusCashFlowRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/asset/cash-flow', params); + } + + getStockPlusStockPosition( + params?: GetStockPlusStockPositionRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/asset/stock-position', params); + } + + stockPlusTransfer( + params: StockPlusTransferRequestV3, + ): Promise> { + return this.postPrivate('/api/v3/stockplus/asset/transfer', params); + } + + getStockPlusTransferRecords( + params?: GetStockPlusTransferRecordsRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/asset/transfer-records', params); + } + /** * * =====Account======= endpoints @@ -1049,6 +1302,24 @@ export class RestClientV3 extends BaseRestClient { return this.getPrivate('/api/v3/account/open-interest-limit', params); } + getEligibleSymbols( + params?: GetEligibleSymbolsRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/account/eligible-symbols', params); + } + + getEligibleMarginTier( + params?: GetEligibleMarginTierRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/account/eligible-margin-tier', params); + } + + getEligibleLoanInfo( + params?: GetEligibleLoanInfoRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/account/eligible-loan-info', params); + } + /** * Switch Account - Switch to classic account mode * Only supports parent accounts. @@ -1183,6 +1454,18 @@ export class RestClientV3 extends BaseRestClient { return this.getPrivate('/api/v3/user/sub-api-list', params); } + getRateLimitQuota( + params: GetRateLimitQuotaRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/user/rate-limit-quota', params); + } + + setRateLimitQuota( + params: SetRateLimitQuotaRequestV3, + ): Promise>> { + return this.postPrivate('/api/v3/user/set-rate-limit-quota', params); + } + /** * * =====Transfer======= endpoints diff --git a/src/types/request/v3/account.ts b/src/types/request/v3/account.ts index 924d186..557176f 100644 --- a/src/types/request/v3/account.ts +++ b/src/types/request/v3/account.ts @@ -398,3 +398,28 @@ export interface GetMovePositionHistoryRequestV3 { cursor?: string; limit?: string; } + +export interface GetEligibleSymbolsRequestV3 { + symbol?: string; +} + +export interface GetEligibleMarginTierRequestV3 { + coin?: string; +} + +export interface GetEligibleLoanInfoRequestV3 { + coin?: string; +} + +export interface GetRateLimitQuotaRequestV3 { + category: 'spot' | 'futures'; + uid?: string; + cursor?: string; + limit?: string; +} + +export interface SetRateLimitQuotaRequestV3 { + category: 'spot' | 'futures'; + uids: string[]; + quota: string; +} diff --git a/src/types/request/v3/copytrading.ts b/src/types/request/v3/copytrading.ts index c7f298f..c30414a 100644 --- a/src/types/request/v3/copytrading.ts +++ b/src/types/request/v3/copytrading.ts @@ -6,6 +6,8 @@ export interface CopyFuturesTransferRequestV3 { type: 'in' | 'out'; coin: string; amount: string; + /** Source account type(s) for transfer-in. Comma-separated: funding, uta, otc */ + inAccountType?: string; } export interface GetCopyFuturesTransferRecordRequestV3 { @@ -15,3 +17,15 @@ export interface GetCopyFuturesTransferRecordRequestV3 { /** Pass transferId from the previous page to paginate forward */ cursor?: string; } + +export interface GetCopyFuturesFollowersRequestV3 { + limit?: string; + cursor?: string; +} + +export interface GetCopyFuturesProfitDetailsRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; +} diff --git a/src/types/request/v3/stockplus.ts b/src/types/request/v3/stockplus.ts new file mode 100644 index 0000000..2817d00 --- /dev/null +++ b/src/types/request/v3/stockplus.ts @@ -0,0 +1,165 @@ +/** + * + * + * Stock+ (UTA) + * + * + */ + +export interface GetStockPlusOptionQuoteRequestV3 { + symbol: string; +} + +export interface GetStockPlusOptionChainInfoRequestV3 { + symbol: string; + expiryDate: string; +} + +export interface GetStockPlusOptionExpiryDateRequestV3 { + symbol: string; +} + +export interface GetStockPlusOptionVolumeRequestV3 { + symbol: string; +} + +export interface GetStockPlusStaticInfoRequestV3 { + symbol: string; +} + +export interface GetStockPlusQuoteRequestV3 { + symbol: string; +} + +export interface GetStockPlusTradeDetailRequestV3 { + symbol: string; + count?: string; +} + +export interface GetStockPlusIntradayRequestV3 { + symbol: string; +} + +export interface GetStockPlusHistoryCandlestickRequestV3 { + symbol: string; + period: string; + count?: string; + adjustType?: string; + forward?: boolean; + time?: string; + tradeSessions?: string; +} + +export interface GetStockPlusCandlestickRequestV3 { + symbol: string; + period: string; + count?: string; + adjustType?: string; + tradeSessions?: string; +} + +export interface GetStockPlusDepthRequestV3 { + symbol: string; +} + +export interface PlaceStockPlusOrderRequestV3 { + symbol: string; + orderType: 'LO' | 'MO' | 'LIT' | 'MIT' | 'TSLPAMT' | 'TSLPPCT'; + side: 'Buy' | 'Sell'; + submittedQuantity: string; + timeInForce: 'Day' | 'GoodTilCanceled' | 'GoodTilDate'; + submittedPrice?: string; + triggerPrice?: string; + limitOffset?: string; + trailingAmount?: string; + trailingPercent?: string; + expireDate?: string; + outsideRth?: 'RTHOnly' | 'AnyTime' | 'Overnight'; + limitDepthLevel?: number; + triggerCount?: number; + monitorPrice?: string; + remark?: string; +} + +export interface CancelStockPlusOrderRequestV3 { + symbol: string; + orderId?: string; + clientOid?: string; +} + +export interface ModifyStockPlusOrderRequestV3 { + orderId: string; + quantity: string; + price?: string; + triggerPrice?: string; + limitOffset?: string; + trailingAmount?: string; + trailingPercent?: string; + limitDepthLevel?: number; + triggerCount?: number; + monitorPrice?: string; + remark?: string; +} + +export interface GetStockPlusTodayOrdersRequestV3 { + symbol?: string; + status?: string | string[]; + side?: string; + market?: string; + orderId?: string; +} + +export interface GetStockPlusHistoryOrdersRequestV3 { + symbol?: string; + status?: string | string[]; + side?: string; + market?: string; + startAt?: string; + endAt?: string; +} + +export interface GetStockPlusOrderDetailRequestV3 { + orderId: string; +} + +export interface GetStockPlusTodayExecutionsRequestV3 { + symbol?: string; + orderId?: string; +} + +export interface GetStockPlusHistoryExecutionsRequestV3 { + symbol?: string; + startAt?: string; + endAt?: string; +} + +export interface GetStockPlusAccountRequestV3 { + currency?: string; +} + +export interface GetStockPlusCashFlowRequestV3 { + startTime: string; + endTime: string; + businessType?: string; + symbol?: string; + page?: string; + size?: string; +} + +export interface GetStockPlusStockPositionRequestV3 { + symbol?: string; +} + +export interface StockPlusTransferRequestV3 { + coin?: string; + amount?: string; + direction?: 'in' | 'out'; +} + +export interface GetStockPlusTransferRecordsRequestV3 { + transferId?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; +} diff --git a/src/types/request/v3/trade.ts b/src/types/request/v3/trade.ts index 678633c..f78a34b 100644 --- a/src/types/request/v3/trade.ts +++ b/src/types/request/v3/trade.ts @@ -145,6 +145,7 @@ export interface ModifyOrderRequestV3 { } export interface PlaceRealityOrderRequestV3 { + category?: 'SPOT' | 'MARGIN'; symbol: string; side: 'buy' | 'sell'; orderType: 'limit' | 'market'; @@ -154,6 +155,7 @@ export interface PlaceRealityOrderRequestV3 { } export interface CancelRealityOrderRequestV3 { + category?: 'SPOT' | 'MARGIN'; symbol: string; orderId?: string; clientOid?: string; diff --git a/src/types/response/v2/futures.ts b/src/types/response/v2/futures.ts index f847b68..fbf8d18 100644 --- a/src/types/response/v2/futures.ts +++ b/src/types/response/v2/futures.ts @@ -310,6 +310,8 @@ export interface FuturesPositionV2 { deductedFee: string; marginRatio: string; assetMode: string; + /** Cash dividend, USDT */ + cashDividend?: string; uTime: string; autoMargin: string; cTime: string; @@ -338,6 +340,8 @@ export interface FuturesHistoryPositionV2 { totalFunding: string; openFee: string; closeFee: string; + /** Cash dividend, USDT */ + cashDividend?: string; cTime: string; uTime: string; } diff --git a/src/types/response/v3/account.ts b/src/types/response/v3/account.ts index 2cd0850..66cd86c 100644 --- a/src/types/response/v3/account.ts +++ b/src/types/response/v3/account.ts @@ -71,6 +71,8 @@ export interface AccountAssetV3 { positionValue?: string; /** Account leverage (non-negative) */ leverage?: string; + /** USDT bonus amount */ + bonus?: string; } export interface AccountAssetsV3 { @@ -385,3 +387,60 @@ export interface MovePositionHistoryV3 { createdTime: string; updatedTime: string; } + +export interface EligibleSymbolV3 { + symbol: string; + category: string; + baseCoin: string; + quoteCoin: string; + symbolType?: string; + buyLimitPriceRatio: string; + sellLimitPriceRatio: string; + minOrderQty: string; + maxOrderQty: string; + pricePrecision: string; + quantityPrecision: string; + quotePrecision: string; + minOrderAmount: string; + maxSymbolOrderNum: string; + maxProductOrderNum: string; + status: string; + maintainTime: string; + areaSymbol?: string; + maxPositionNum?: string; + isReality?: string; + launchTime?: string; +} + +export interface EligibleMarginTierItemV3 { + tier: string; + minTierValue: string; + maxTierValue: string; + leverage: string; + mmr: string; +} + +export interface EligibleMarginTierV3 { + coin: string; + tiers: EligibleMarginTierItemV3[]; +} + +export interface EligibleLoanInfoV3 { + limit: string; + masterSubLimit: string; + /** Bitget spelling */ + platformRemaingQuota: string; +} + +export interface RateLimitQuotaItemV3 { + uid: string; + quota: string; +} + +export interface RateLimitQuotaV3 { + category: 'spot' | 'futures' | string; + quotaList: RateLimitQuotaItemV3[]; + masterSubQuota: string; + masterSubCap: string; + cursor: string; +} diff --git a/src/types/response/v3/copytrading.ts b/src/types/response/v3/copytrading.ts index a6532e5..7257291 100644 --- a/src/types/response/v3/copytrading.ts +++ b/src/types/response/v3/copytrading.ts @@ -45,7 +45,13 @@ export interface CopyFuturesTransferResponseV3 { transferId: string; } -export type CopyFuturesTransferAccountTypeV3 = 'spot' | 'uta' | 'lead'; +/** May be a single value or comma-separated values */ +export type CopyFuturesTransferAccountTypeV3 = + | 'spot' + | 'uta' + | 'lead' + | 'otc' + | string; export interface CopyFuturesTransferRecordV3 { transferId: string; @@ -60,3 +66,54 @@ export interface CopyFuturesTransferRecordV3 { export interface CopyFuturesTransferRecordListV3 { list: CopyFuturesTransferRecordV3[]; } + +export interface CopyFuturesCurrentFollowerV3 { + followerName: string; + estimateAssets: string; + totalProfit: string; + totalShareProfit: string; + totalInvestment: string; + canRemove: 'yes' | 'no'; + followDays: string; + totalAssets: string; + startTime: string; +} + +export interface CopyFuturesCurrentFollowersV3 { + list: CopyFuturesCurrentFollowerV3[]; +} + +export interface CopyFuturesHistoryFollowerV3 { + followerName: string; + totalProfit: string; + totalShareProfit: string; + totalInvestment: string; + startTime: string; + endTime: string; +} + +export interface CopyFuturesHistoryFollowersV3 { + list: CopyFuturesHistoryFollowerV3[]; +} + +export interface CopyFuturesProfitSummaryV3 { + totalProfit: string; + totalAllocatedProfit: string; + totalPendingProfit: string; +} + +export interface CopyFuturesProfitDetailV3 { + followerName: string; + profit: string; + allocatedPnl: string; + pendingPnl: string; + shareRatio: string; + shareProfit: string; + reason: 'period' | 'unfollow' | string; + settleTime: string; +} + +export interface CopyFuturesProfitDetailsV3 { + list: CopyFuturesProfitDetailV3[]; + nextCursor: string; +} diff --git a/src/types/response/v3/public.ts b/src/types/response/v3/public.ts index 67d2c2b..bb55579 100644 --- a/src/types/response/v3/public.ts +++ b/src/types/response/v3/public.ts @@ -53,6 +53,9 @@ export interface MarginLoanV3 { dailyInterest: string; annualInterest: string; limit: string; + masterSubLimit?: string; + /** Bitget spelling */ + platformRemaingQuota?: string; } export interface OpenInterestItemV3 { @@ -250,6 +253,8 @@ export interface TickerV3 { price24hPcnt: string; volume24h: string; turnover24h: string; + /** 24h platform turnover; only available for rtoken */ + platformTurnover24h?: string; // Futures specific fields indexPrice?: string; diff --git a/src/types/response/v3/stockplus.ts b/src/types/response/v3/stockplus.ts new file mode 100644 index 0000000..4e94594 --- /dev/null +++ b/src/types/response/v3/stockplus.ts @@ -0,0 +1,346 @@ +/** + * + * + * Stock+ (UTA) + * + * + */ + +export interface StockPlusOptionQuoteItemV3 { + symbol: string; + lastDone: string; + prevClose: string; + open: string; + high: string; + low: string; + timestamp: string; + volume: string; + turnover: string; + tradeStatus: string; + impliedVolatility: string; + openInterest: string; + expiryDate: string; + strikePrice: string; + contractMultipier: string; + contractType: string; + contractSize: string; + direction: string; + historicalVolatility: string; + underlyingSymbol: string; +} + +export interface StockPlusOptionQuoteV3 { + secuQuote: StockPlusOptionQuoteItemV3[]; +} + +export interface StockPlusOptionStrikePriceInfoV3 { + price: string; + callSymbol: string; + putSymbol: string; + standard: boolean; +} + +export interface StockPlusOptionChainInfoV3 { + strikePriceInfo: StockPlusOptionStrikePriceInfoV3[]; +} + +export interface StockPlusOptionExpiryDateV3 { + expiryDate: string[]; +} + +export interface StockPlusOptionVolumeV3 { + c: string; + p: string; +} + +export interface StockPlusStaticInfoItemV3 { + symbol: string; + nameCn: string; + nameEn: string; + exchange: string; + currency: string; + lotSize: number | string; + totalShares: string | number; + circulatingShares: string | number; + eps: string | number; + epsTtm: string | number; + bps: string | number; + dividendYield: string | number; + stockDerivatives: string[]; + board: string; +} + +export interface StockPlusStaticInfoV3 { + list: StockPlusStaticInfoItemV3[]; +} + +export interface StockPlusSessionQuoteV3 { + lastDone: string | number; + timestamp: string; + volume: string | number; + turnover: string | number; + high: string | number; + low: string | number; + prevClose: string | number; +} + +export interface StockPlusQuoteItemV3 { + symbol: string; + lastDone: string | number; + prevClose: string | number; + open: string | number; + high: string | number; + low: string | number; + timestamp: string; + volume: string | number; + turnover: string | number; + tradeStatus: string; + preMarketQuote?: StockPlusSessionQuoteV3 | null; + postMarketQuote?: StockPlusSessionQuoteV3 | null; + overnightQuote?: StockPlusSessionQuoteV3 | null; +} + +export interface StockPlusQuoteV3 { + list: StockPlusQuoteItemV3[]; +} + +export interface StockPlusTradeDetailItemV3 { + price: string | number; + volume: string | number; + timestamp: string; + tradeType: string; + direction: string; + tradeSession: string; +} + +export type StockPlusTradeDetailV3 = StockPlusTradeDetailItemV3[]; + +export interface StockPlusIntradayItemV3 { + price: string | number; + timestamp: string; + volume: string | number; + turnover: string | number; + avgPrice: string | number; +} + +export interface StockPlusIntradayV3 { + list: StockPlusIntradayItemV3[]; +} + +export interface StockPlusCandlestickItemV3 { + close: string; + open: string; + low: string; + high: string; + volume: string; + turnover: string; + timestamp: string; + tradeSession: string; +} + +export interface StockPlusCandlestickV3 { + list: StockPlusCandlestickItemV3[]; +} + +export type StockPlusHistoryCandlestickV3 = StockPlusCandlestickV3; + +export interface StockPlusDepthLevelV3 { + position: number; + price: string; + volume: string; + orderNum: number; +} + +export interface StockPlusDepthV3 { + asks: StockPlusDepthLevelV3[]; + bids: StockPlusDepthLevelV3[]; +} + +export interface StockPlusPlaceOrderResponseV3 { + orderId: string; + clientOid: string; + symbol: string; +} + +export type StockPlusCancelOrderResponseV3 = StockPlusPlaceOrderResponseV3; +export type StockPlusModifyOrderResponseV3 = StockPlusPlaceOrderResponseV3; + +export interface StockPlusOrderV3 { + orderId: string; + status: string; + stockName: string; + quantity: string | number; + executedQuantity: string | number; + price: string | number | null; + executedPrice: string | number | null; + submittedAt: string; + side: string; + symbol: string; + orderType: string; + lastDone: string | number | null; + triggerPrice: string | number | null; + msg: string; + tag: string; + timeInForce: string; + expireDate: string | null; + updatedAt: string | null; + triggerAt: string | null; + trailingAmount: string | number | null; + trailingPercent: string | number | null; + limitOffset: string | number | null; + triggerStatus: string | null; + currency: string; + outsideRth: string; + remark?: string; + limitDepthLevel: number | null; + triggerCount: number | null; + monitorPrice: string | null; +} + +export interface StockPlusOrdersV3 { + orders: StockPlusOrderV3[]; +} + +export interface StockPlusHistoryOrdersV3 { + hasMore: boolean; + orders: StockPlusOrderV3[]; +} + +export interface StockPlusOrderHistoryItemV3 { + price: string | number; + quantity: string | number; + status: string; + msg: string; + time: string; +} + +export interface StockPlusChargeFeeItemV3 { + code: string; + name: string; + amount: number | string; + currency: string; +} + +export interface StockPlusChargeCategoryV3 { + code: string; + name: string; + fees: StockPlusChargeFeeItemV3[]; +} + +export interface StockPlusChargeDetailV3 { + totalAmount: number | string; + currency: string; + items: StockPlusChargeCategoryV3[]; +} + +export interface StockPlusOrderDetailV3 extends StockPlusOrderV3 { + freeStatus?: string; + freeAmount?: string | null; + freeCurrency?: string | null; + deductionsStatus?: string; + deductionsAmount?: string | null; + deductionsCurrency?: string | null; + platformDeductedStatus?: string; + platformDeductedAmount?: string | null; + platformDeductedCurrency?: string | null; + history?: StockPlusOrderHistoryItemV3[]; + chargeDetail?: StockPlusChargeDetailV3; +} + +export interface StockPlusExecutionV3 { + orderId: string; + tradeId: string; + symbol: string; + tradeDoneAt: string; + quantity: number | string; + price: number | string; +} + +export interface StockPlusTodayExecutionsV3 { + trades: StockPlusExecutionV3[]; +} + +export interface StockPlusHistoryExecutionsV3 { + hasMore: boolean; + trades: StockPlusExecutionV3[]; +} + +export interface StockPlusCashInfoV3 { + withdrawCash: number | string; + availableCash: number | string; + frozenCash: number | string; + settlingCash: number | string; + currency: string; +} + +export interface StockPlusFrozenTransactionFeeV3 { + currency?: string; + amount?: number | string; + [key: string]: unknown; +} + +export interface StockPlusAccountItemV3 { + totalCash: number | string; + maxFinanceAmount: number | string; + remainingFinanceAmount: number | string; + riskLevel: number | string; + marginCall: number | string; + netAssets: number | string; + initMargin: number | string; + maintenanceMargin: number | string; + currency: string; + buyPower: number | string; + cashInfos: StockPlusCashInfoV3[]; + frozenTransactionFees: StockPlusFrozenTransactionFeeV3[]; +} + +export interface StockPlusAccountV3 { + list: StockPlusAccountItemV3[]; +} + +export interface StockPlusCashFlowItemV3 { + transactionFlowName: string; + direction: string; + businessType: string; + balance: number | string; + currency: string; + businessTime: string; + symbol: string | null; + description: string; +} + +export interface StockPlusCashFlowV3 { + list: StockPlusCashFlowItemV3[]; +} + +export interface StockPlusPositionItemV3 { + symbol: string; + symbolName: string; + quantity: number | string; + availableQuantity: number | string; + currency: string; + costPrice: number | string; + market: string; + initQuantity: number | string; +} + +export interface StockPlusPositionChannelV3 { + accountChannel: string; + positions: StockPlusPositionItemV3[]; +} + +export interface StockPlusStockPositionV3 { + channels: StockPlusPositionChannelV3[]; +} + +export interface StockPlusTransferResponseV3 { + transferId: string; +} + +export interface StockPlusTransferRecordsV3 { + transferId: string; + coin: string; + amount: string; + direction: string; + cursor: string; +} diff --git a/src/types/response/v3/trade.ts b/src/types/response/v3/trade.ts index d214a6f..af0c070 100644 --- a/src/types/response/v3/trade.ts +++ b/src/types/response/v3/trade.ts @@ -173,6 +173,8 @@ export interface PositionHistoryV3 { totalFunding: string; openFeeTotal: string; closeFeeTotal: string; + /** Cash dividend, USDT */ + cashDividend?: string; createdTime: string; updatedTime: string; } @@ -201,6 +203,8 @@ export interface CurrentPositionV3 { totalFunding: string; openFeeTotal: string; closeFeeTotal: string; + /** Cash dividend, USDT */ + cashDividend?: string; createdTime: string; updatedTime: string; } diff --git a/src/types/websockets/ws-api-request.ts b/src/types/websockets/ws-api-request.ts index 7ddde9d..4fb410a 100644 --- a/src/types/websockets/ws-api-request.ts +++ b/src/types/websockets/ws-api-request.ts @@ -21,4 +21,6 @@ export interface WSAPIPlaceOrderRequestV3 { slOrderType?: 'limit' | 'market'; tpLimitPrice?: string; slLimitPrice?: string; + /** Order TTL in ms [10, 60000]. Only effective when requestTime is also set on the envelope */ + receiveWindow?: string; } diff --git a/src/types/websockets/ws-api.ts b/src/types/websockets/ws-api.ts index e428e26..c631e8b 100644 --- a/src/types/websockets/ws-api.ts +++ b/src/types/websockets/ws-api.ts @@ -34,6 +34,8 @@ export interface WSAPIRequestBitgetV3 { category: BitgetInstTypeV3; topic: WSAPIOperation; args: TWSParams | TWSParams[]; + /** Client-side request timestamp; required for receiveWindow on place-order */ + requestTime?: string; } export interface WSAPIRequestFlags { @@ -72,6 +74,11 @@ export interface WsRequestOperationBitget { op: WSOperation; args?: (TWSRequestArg | string | number)[]; } +export interface WSAPIRateLimitV3 { + limit: string; + remaining: string; +} + export interface WSAPIResponse< TResponseData extends object = object, TOperation extends WSAPIOperation = WSAPIOperation, @@ -88,6 +95,11 @@ export interface WSAPIResponse< ts: string; /** Connection ID (trade operation responses, May 2026+) */ connId?: string; + /** Gateway receive time, Unix microseconds */ + receiveTime?: string; + /** Gateway push time, Unix microseconds */ + pushTime?: string; + rateLimit?: WSAPIRateLimitV3[]; } /** diff --git a/src/types/websockets/ws-events.ts b/src/types/websockets/ws-events.ts index fe09a37..6cf66d0 100644 --- a/src/types/websockets/ws-events.ts +++ b/src/types/websockets/ws-events.ts @@ -85,6 +85,14 @@ export interface WsPositionSnapshotDataUMCBL { cTime: string; uTime: string; markPrice: string; + /** Cash dividend, USDT (Classic V2 positions channel) */ + cashDividend?: string; +} + +/** UTA reality-orderbook push (ts/seq/pseq removed July 2026) */ +export interface WsRealityOrderBookDataV3 { + a: [string, string][]; + b: [string, string][]; } export interface WSPositionSnapshotUMCBL extends WsBaseEvent<'snapshot'> { diff --git a/src/types/websockets/ws-general.ts b/src/types/websockets/ws-general.ts index 0b48d74..e723b64 100644 --- a/src/types/websockets/ws-general.ts +++ b/src/types/websockets/ws-general.ts @@ -117,7 +117,8 @@ export type WsPrivateTopicV3 = | 'position' | 'fill' | 'order' - | 'strategy-order'; + | 'strategy-order' + | 'reality-orderbook'; export type WsTopicV3 = WsPublicTopicV3 | WsPrivateTopicV3; /** This is used to differentiate between each of the available websocket streams */ diff --git a/src/util/websocket-util.ts b/src/util/websocket-util.ts index 069ebd8..fe86f67 100644 --- a/src/util/websocket-util.ts +++ b/src/util/websocket-util.ts @@ -114,6 +114,7 @@ export const PRIVATE_TOPICS_V3: WsPrivateTopicV3[] = [ 'fill', 'order', 'strategy-order', + 'reality-orderbook', ]; export async function getWsUrl( From 5800b0aa30b456eb3b8e718d19e2857e8ae155fc Mon Sep 17 00:00:00 2001 From: JJ-Cro Date: Tue, 11 Aug 2026 12:56:14 +0200 Subject: [PATCH 2/2] refactor: restructure Stock+ API interfaces and update documentation links Removed outdated Stock+ API interfaces from request types and migrated relevant response types to a new WebSocket API response file. Updated documentation links to reflect the new repository structure. --- docs/endpointFunctionList.md | 1042 +-- llms.txt | 11896 ++++++++++++++++----------------- 2 files changed, 6469 insertions(+), 6469 deletions(-) diff --git a/docs/endpointFunctionList.md b/docs/endpointFunctionList.md index 583092e..98ded34 100644 --- a/docs/endpointFunctionList.md +++ b/docs/endpointFunctionList.md @@ -4,8 +4,8 @@

- - SDK Logo + + SDK Logo

@@ -14,7 +14,7 @@ Each REST client is a JavaScript class, which provides functions individually ma The following table shows all methods available in each REST client, whether the method requires authentication (automatically handled if API keys are provided), as well as the exact endpoint each method is connected to. -This can be used to easily find which method to call, once you have [found which endpoint you're looking to use](https://github.com/tiagosiebler/awesome-crypto-examples/wiki/How-to-find-SDK-functions-that-match-API-docs-endpoint). +This can be used to easily find which method to call, once you have [found which endpoint you're looking to use](https://github.com/sieblyio/awesome-crypto-examples/wiki/How-to-find-SDK-functions-that-match-API-docs-endpoint). All REST clients are in the [src](/src) folder. For usage examples, make sure to check the [examples](/examples) folder. @@ -50,310 +50,310 @@ This table includes all endpoints from the official Exchange API docs and corres | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | -| [getAnnouncements()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L506) | | GET | `/api/v2/public/annoucements` | -| [getServerTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L518) | | GET | `/api/v2/public/time` | -| [getTradeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L526) | :closed_lock_with_key: | GET | `/api/v2/common/trade-rate` | -| [getAllTradeRates()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L535) | :closed_lock_with_key: | GET | `/api/v2/common/all-trade-rate` | -| [getSpotTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L553) | :closed_lock_with_key: | GET | `/api/v2/tax/spot-record` | -| [getFuturesTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L559) | :closed_lock_with_key: | GET | `/api/v2/tax/future-record` | -| [getMarginTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L565) | :closed_lock_with_key: | GET | `/api/v2/tax/margin-record` | -| [getP2PTransactionRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L571) | :closed_lock_with_key: | GET | `/api/v2/tax/p2p-record` | -| [getP2PMerchantList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L583) | :closed_lock_with_key: | GET | `/api/v2/p2p/merchantList` | -| [getP2PMerchantInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L592) | :closed_lock_with_key: | GET | `/api/v2/p2p/merchantInfo` | -| [getP2PMerchantOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L596) | :closed_lock_with_key: | GET | `/api/v2/p2p/orderList` | -| [getP2PMerchantAdvertisementList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L605) | :closed_lock_with_key: | GET | `/api/v2/p2p/advList` | -| [getSpotWhaleNetFlowData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L622) | :closed_lock_with_key: | GET | `/api/v2/spot/market/whale-net-flow` | -| [getFuturesActiveTakerBuySellVolumeData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L628) | | GET | `/api/v2/mix/market/taker-buy-sell` | -| [getFuturesActiveLongShortPositionData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L635) | | GET | `/api/v2/mix/market/position-long-short` | -| [getFuturesLongShortRatio()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L642) | | GET | `/api/v2/mix/market/long-short-ratio` | -| [getMarginLoanGrowthRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L650) | | GET | `/api/v2/mix/market/loan-growth` | -| [getIsolatedMarginBorrowingRatio()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L658) | | GET | `/api/v2/mix/market/isolated-borrow-rate` | -| [getFuturesActiveBuySellVolumeData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L665) | | GET | `/api/v2/mix/market/long-short` | -| [getSpotFundFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L672) | | GET | `/api/v2/spot/market/fund-flow` | -| [getTradeDataSupportSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L679) | | GET | `/api/v2/spot/market/support-symbols` | -| [getSpotFundNetFlowData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L688) | | GET | `/api/v2/spot/market/fund-net-flow` | -| [getFuturesActiveLongShortAccountData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L699) | | GET | `/api/v2/mix/market/account-long-short` | -| [createVirtualSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L712) | :closed_lock_with_key: | POST | `/api/v2/user/create-virtual-subaccount` | -| [modifyVirtualSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L718) | :closed_lock_with_key: | POST | `/api/v2/user/modify-virtual-subaccount` | -| [batchCreateVirtualSubaccountAndAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L726) | :closed_lock_with_key: | POST | `/api/v2/user/batch-create-subaccount-and-apikey` | -| [getVirtualSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L735) | :closed_lock_with_key: | GET | `/api/v2/user/virtual-subaccount-list` | -| [createVirtualSubaccountAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L748) | :closed_lock_with_key: | POST | `/api/v2/user/create-virtual-subaccount-apikey` | -| [modifyVirtualSubaccountAPIKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L757) | :closed_lock_with_key: | POST | `/api/v2/user/modify-virtual-subaccount-apikey` | -| [getVirtualSubaccountAPIKeys()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L766) | :closed_lock_with_key: | GET | `/api/v2/user/virtual-subaccount-apikey-list` | -| [createAgentSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L779) | :closed_lock_with_key: | POST | `/api/v2/user/create-agent-subaccount` | -| [getFundingAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L790) | :closed_lock_with_key: | GET | `/api/v2/account/funding-assets` | -| [getBotAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L796) | :closed_lock_with_key: | GET | `/api/v2/account/bot-assets` | -| [getBalances()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L803) | :closed_lock_with_key: | GET | `/api/v2/account/all-account-balance` | -| [getConvertCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L820) | :closed_lock_with_key: | GET | `/api/v2/convert/currencies` | -| [getConvertQuotedPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L824) | :closed_lock_with_key: | GET | `/api/v2/convert/quoted-price` | -| [convert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L830) | :closed_lock_with_key: | POST | `/api/v2/convert/trade` | -| [getConvertHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L836) | :closed_lock_with_key: | GET | `/api/v2/convert/convert-record` | -| [getConvertBGBCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L851) | :closed_lock_with_key: | GET | `/api/v2/convert/bgb-convert-coin-list` | -| [convertBGB()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L859) | :closed_lock_with_key: | POST | `/api/v2/convert/bgb-convert` | -| [getConvertBGBHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L865) | :closed_lock_with_key: | GET | `/api/v2/convert/bgb-convert-records` | -| [getSpotCoinInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L885) | :closed_lock_with_key: | GET | `/api/v2/spot/public/coins` | -| [getSpotSymbolInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L891) | :closed_lock_with_key: | GET | `/api/v2/spot/public/symbols` | -| [getSpotVIPFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L897) | :closed_lock_with_key: | GET | `/api/v2/spot/market/vip-fee-rate` | -| [getSpotTicker()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L901) | :closed_lock_with_key: | GET | `/api/v2/spot/market/tickers` | -| [getSpotMergeDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L907) | :closed_lock_with_key: | GET | `/api/v2/spot/market/merge-depth` | -| [getSpotOrderBookDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L915) | :closed_lock_with_key: | GET | `/api/v2/spot/market/orderbook` | -| [getSpotCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L923) | :closed_lock_with_key: | GET | `/api/v2/spot/market/candles` | -| [getSpotHistoricCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L929) | :closed_lock_with_key: | GET | `/api/v2/spot/market/history-candles` | -| [getSpotRecentTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L935) | :closed_lock_with_key: | GET | `/api/v2/spot/market/fills` | -| [getSpotHistoricTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L942) | :closed_lock_with_key: | GET | `/api/v2/spot/market/fills-history` | -| [getSpotCallAuction()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L948) | | GET | `/api/v2/spot/market/auction` | -| [spotSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L960) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/place-order` | -| [spotCancelandSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L969) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-replace-order` | -| [spotBatchCancelandSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L975) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-replace-order` | -| [spotCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L984) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-order` | -| [spotBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L993) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-orders` | -| [spotBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L999) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-order` | -| [spotCancelSymbolOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1005) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-symbol-order` | -| [getSpotOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1013) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/orderInfo` | -| [getSpotOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1019) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/unfilled-orders` | -| [getSpotHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1025) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/history-orders` | -| [getSpotFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1031) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/fills` | -| [spotSubmitPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1043) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/place-plan-order` | -| [spotModifyPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1052) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/modify-plan-order` | -| [spotCancelPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1061) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-plan-order` | -| [getSpotCurrentPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1072) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/current-plan-order` | -| [getSpotPlanSubOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1082) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/plan-sub-order` | -| [getSpotHistoricPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1088) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/history-plan-order` | -| [spotCancelPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1098) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-plan-order` | -| [getSpotAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1113) | :closed_lock_with_key: | GET | `/api/v2/spot/account/info` | -| [getSpotAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1117) | :closed_lock_with_key: | GET | `/api/v2/spot/account/assets` | -| [getSpotSubAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1124) | :closed_lock_with_key: | GET | `/api/v2/spot/account/subaccount-assets` | -| [spotModifyDepositAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1128) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/modify-deposit-account` | -| [getSpotAccountBills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1138) | :closed_lock_with_key: | GET | `/api/v2/spot/account/bills` | -| [spotTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1144) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/transfer` | -| [getSpotTransferableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1153) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/transfer-coin-info` | -| [spotSubTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1160) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/subaccount-transfer` | -| [spotWithdraw()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1169) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/withdrawal` | -| [getSpotMainSubTransferRecord()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1178) | :closed_lock_with_key: | GET | `/api/v2/spot/account/sub-main-trans-record` | -| [getSpotTransferHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1187) | :closed_lock_with_key: | GET | `/api/v2/spot/account/transferRecords` | -| [spotSwitchBGBDeduct()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1193) | :closed_lock_with_key: | POST | `/api/v2/spot/account/switch-deduct` | -| [getSpotDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1199) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/deposit-address` | -| [getSpotSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1207) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/subaccount-deposit-address` | -| [getSpotBGBDeductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1219) | :closed_lock_with_key: | GET | `/api/v2/spot/account/deduct-info` | -| [spotCancelWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1227) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/cancel-withdrawal` | -| [getSubAccountDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1233) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/subaccount-deposit-records` | -| [getSpotWithdrawalHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1242) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/withdrawal-records` | -| [getSpotDepositHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1248) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/deposit-records` | -| [upgradeToUnifiedAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1263) | :closed_lock_with_key: | POST | `/api/v2/spot/account/upgrade` | -| [getUnifiedAccountSwitchStatus()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1273) | :closed_lock_with_key: | GET | `/api/v2/spot/account/upgrade-status` | -| [getFuturesVIPFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1295) | | GET | `/api/v2/mix/market/vip-fee-rate` | -| [getFuturesInterestRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1299) | | GET | `/api/v2/mix/market/union-interest-rate-history` | -| [getFuturesInterestExchangeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1308) | | GET | `/api/v2/mix/market/exchange-rate` | -| [getFuturesDiscountRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1319) | | GET | `/api/v2/mix/market/discount-rate` | -| [getFuturesMergeDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1323) | | GET | `/api/v2/mix/market/merge-depth` | -| [getFuturesTicker()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1329) | | GET | `/api/v2/mix/market/ticker` | -| [getFuturesAllTickers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1336) | | GET | `/api/v2/mix/market/tickers` | -| [getFuturesRecentTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1342) | | GET | `/api/v2/mix/market/fills` | -| [getFuturesHistoricTrades()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1348) | | GET | `/api/v2/mix/market/fills-history` | -| [getFuturesCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1354) | | GET | `/api/v2/mix/market/candles` | -| [getFuturesHistoricCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1360) | | GET | `/api/v2/mix/market/history-candles` | -| [getFuturesHistoricIndexPriceCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1366) | | GET | `/api/v2/mix/market/history-index-candles` | -| [getFuturesHistoricMarkPriceCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1372) | | GET | `/api/v2/mix/market/history-mark-candles` | -| [getFuturesOpenInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1378) | | GET | `/api/v2/mix/market/open-interest` | -| [getFuturesNextFundingTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1390) | | GET | `/api/v2/mix/market/funding-time` | -| [getFuturesSymbolPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1397) | | GET | `/api/v2/mix/market/symbol-price` | -| [getFuturesHistoricFundingRates()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1404) | | GET | `/api/v2/mix/market/history-fund-rate` | -| [getFuturesCurrentFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1413) | | GET | `/api/v2/mix/market/current-fund-rate` | -| [getFuturesContractConfig()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1431) | | GET | `/api/v2/mix/market/contracts` | -| [getFuturesOiLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1438) | | GET | `/api/v2/mix/market/oi-limit` | -| [getFuturesAccountAsset()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1456) | :closed_lock_with_key: | GET | `/api/v2/mix/account/account` | -| [getFuturesAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1462) | :closed_lock_with_key: | GET | `/api/v2/mix/account/accounts` | -| [getFuturesSubAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1468) | :closed_lock_with_key: | GET | `/api/v2/mix/account/sub-account-assets` | -| [getFuturesInterestHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1481) | :closed_lock_with_key: | GET | `/api/v2/mix/account/interest-history` | -| [getFuturesOpenCount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1487) | :closed_lock_with_key: | GET | `/api/v2/mix/account/open-count` | -| [setFuturesPositionAutoMargin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1495) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-auto-margin` | -| [setFuturesLeverage()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1501) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-leverage` | -| [setFuturesPositionMargin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1507) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-margin` | -| [setFuturesAssetMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1513) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-asset-mode` | -| [setFuturesMarginMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1520) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-margin-mode` | -| [setFuturesPositionMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1526) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-position-mode` | -| [getFuturesAccountBills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1537) | :closed_lock_with_key: | GET | `/api/v2/mix/account/bill` | -| [getUnionTransferLimits()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1552) | :closed_lock_with_key: | GET | `/api/v2/mix/account/transfer-limits` | -| [getUnionConfig()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1564) | :closed_lock_with_key: | GET | `/api/v2/mix/account/union-config` | -| [getSwitchUnionUsdt()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1574) | :closed_lock_with_key: | GET | `/api/v2/mix/account/switch-union-usdt` | -| [unionConvert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1584) | :closed_lock_with_key: | POST | `/api/v2/mix/account/union-convert` | -| [getFuturesMaxOpenableQuantity()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1596) | :closed_lock_with_key: | GET | `/api/v2/mix/account/max-open` | -| [getFuturesLiquidationPrice()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1608) | :closed_lock_with_key: | GET | `/api/v2/mix/account/liq-price` | -| [getFuturesIsolatedSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1620) | :closed_lock_with_key: | GET | `/api/v2/mix/account/isolated-symbols` | -| [getFuturesPositionTier()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1632) | | GET | `/api/v2/mix/market/query-position-lever` | -| [getFuturesPosition()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1639) | :closed_lock_with_key: | GET | `/api/v2/mix/position/single-position` | -| [getFuturesPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1647) | :closed_lock_with_key: | GET | `/api/v2/mix/position/all-position` | -| [getFuturesHistoricPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1654) | :closed_lock_with_key: | GET | `/api/v2/mix/position/history-position` | -| [getFuturesPositionAdlRank()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1665) | :closed_lock_with_key: | GET | `/api/v2/mix/position/adlRank` | -| [futuresSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1677) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-order` | -| [futuresSubmitReversal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1686) | :closed_lock_with_key: | POST | `/api/v2/mix/order/click-backhand` | -| [futuresBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1695) | :closed_lock_with_key: | POST | `/api/v2/mix/order/batch-place-order` | -| [futuresModifyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1701) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-order` | -| [futuresCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1710) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-order` | -| [futuresBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1719) | :closed_lock_with_key: | POST | `/api/v2/mix/order/batch-cancel-orders` | -| [futuresFlashClosePositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1725) | :closed_lock_with_key: | POST | `/api/v2/mix/order/close-positions` | -| [getFuturesOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1731) | :closed_lock_with_key: | GET | `/api/v2/mix/order/detail` | -| [getFuturesFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1737) | :closed_lock_with_key: | GET | `/api/v2/mix/order/fills` | -| [getFuturesHistoricOrderFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1746) | :closed_lock_with_key: | GET | `/api/v2/mix/order/fill-history` | -| [getFuturesOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1757) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-pending` | -| [getFuturesHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1766) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-history` | -| [futuresCancelAllOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1775) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-all-orders` | -| [getFuturesTriggerSubOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1787) | :closed_lock_with_key: | GET | `/api/v2/mix/order/plan-sub-order` | -| [futuresSubmitTPSLOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1795) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-tpsl-order` | -| [futuresSubmitPositionTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1804) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-pos-tpsl` | -| [futuresSubmitPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1816) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-plan-order` | -| [futuresModifyTPSLPOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1825) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-tpsl-order` | -| [futuresModifyPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1834) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-plan-order` | -| [getFuturesPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1843) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-plan-pending` | -| [futuresCancelPlanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1852) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-plan-order` | -| [getFuturesHistoricPlanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1858) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-plan-history` | -| [modifySubaccountEmail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1883) | :closed_lock_with_key: | POST | `/api/v2/broker/account/modify-subaccount-email` | -| [getBrokerInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1893) | :closed_lock_with_key: | GET | `/api/v2/broker/account/info` | -| [createSubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1903) | :closed_lock_with_key: | POST | `/api/v2/broker/account/create-subaccount` | -| [getSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1910) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-list` | -| [modifySubaccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1920) | :closed_lock_with_key: | POST | `/api/v2/broker/account/modify-subaccount` | -| [getSubaccountEmail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1926) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-email` | -| [getSubaccountSpotAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1932) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-spot-assets` | -| [getSubaccountFuturesAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1947) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-future-assets` | -| [createSubaccountDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1961) | :closed_lock_with_key: | POST | `/api/v2/broker/account/subaccount-address` | -| [subaccountWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1972) | :closed_lock_with_key: | POST | `/api/v2/broker/account/subaccount-withdrawal` | -| [subaccountSetAutoTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L1984) | :closed_lock_with_key: | POST | `/api/v2/broker/account/set-subaccount-autotransfer` | -| [subaccountDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2000) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-deposit` | -| [subaccountWithdrawalRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2011) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-withdrawal` | -| [createSubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2026) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/create-subaccount-apikey` | -| [getSubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2035) | :closed_lock_with_key: | GET | `/api/v2/broker/manage/subaccount-apikey-list` | -| [modifySubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2044) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/modify-subaccount-apikey` | -| [deleteSubaccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2053) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/delete-subaccount-apikey` | -| [getAllSubDepositWithdrawalRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2069) | :closed_lock_with_key: | GET | `/api/v2/broker/all-sub-deposit-withdrawal` | -| [getBrokerSubaccounts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2086) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccounts` | -| [getBrokerCommissions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2098) | :closed_lock_with_key: | GET | `/api/v2/broker/commissions` | -| [getBrokerTradeVolume()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2110) | :closed_lock_with_key: | GET | `/api/v2/broker/trade-volume` | -| [getBrokerTotalCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2130) | :closed_lock_with_key: | GET | `/api/v2/broker/total-commission` | -| [getBrokerOrderCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2152) | :closed_lock_with_key: | GET | `/api/v2/broker/order-commission` | -| [getBrokerRebateInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2165) | :closed_lock_with_key: | GET | `/api/v2/broker/rebate-info` | -| [getAgentCustomerCommissions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2177) | :closed_lock_with_key: | GET | `/api/v2/broker/customer-commissions` | -| [getAgentSubCustomerList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2186) | :closed_lock_with_key: | GET | `/api/v2/broker/sub-customer-list` | -| [getAgentCustomerTradeVolume()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2192) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-trade-volume` | -| [getAgentCustomerList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2201) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-list` | -| [getAgentCustomerKycResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2207) | :closed_lock_with_key: | GET | `/api/v2/broker/customer-kyc-result` | -| [getAgentCustomerDeposits()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2213) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-deposit` | -| [getAgentCustomerAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2219) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-asset` | -| [getAgentCommissionDetail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2225) | :closed_lock_with_key: | GET | `/api/v2/broker/agent-commission` | -| [getMarginCurrencies()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2245) | | GET | `/api/v2/margin/currencies` | -| [getMarginBorrowHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2255) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/borrow-history` | -| [getMarginRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2272) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/repay-history` | -| [getMarginInterestHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2289) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/interest-history` | -| [getMarginLiquidationHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2306) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/liquidation-history` | -| [getMarginFinancialHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2323) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/financial-records` | -| [getMarginAccountAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2346) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/assets` | -| [marginBorrow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2357) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/borrow` | -| [marginRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2380) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/repay` | -| [getMarginRiskRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2405) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/risk-rate` | -| [getMarginMaxBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2417) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/max-borrowable-amount` | -| [getMarginMaxTransferable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2430) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/max-transfer-out-amount` | -| [getMarginInterestRateAndMaxBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2445) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/interest-rate-and-limit` | -| [getMarginTierConfiguration()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2461) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/tier-data` | -| [marginFlashRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2473) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/flash-repay` | -| [getMarginFlashRepayResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2491) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/query-flash-repay-status` | -| [marginSubmitOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2515) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/place-order` | -| [marginBatchSubmitOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2528) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/batch-place-order` | -| [marginCancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2539) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/cancel-order` | -| [marginBatchCancelOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2559) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/batch-cancel-order` | -| [getMarginOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2573) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/open-orders` | -| [getMarginHistoricOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2587) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/history-orders` | -| [getMarginHistoricOrderFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2604) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/fills` | -| [getMarginLiquidationOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2618) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/liquidation-order` | -| [getFuturesTraderCurrentOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2650) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-current-track` | -| [getFuturesTraderHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2659) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-history-track` | -| [modifyFuturesTraderOrderTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2668) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/order-modify-tpsl` | -| [getFuturesTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2677) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-total-detail` | -| [getFuturesTraderProfitHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2683) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-history-summarys` | -| [getFuturesTraderProfitShareHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2689) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-history-details` | -| [closeFuturesTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2698) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/order-close-positions` | -| [getFuturesTraderProfitShare()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2717) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-details` | -| [getFuturesTraderProfitShareGroup()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2733) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profits-group-coin-date` | -| [getFuturesTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2751) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/config-query-symbols` | -| [updateFuturesTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2760) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-setting-symbols` | -| [updateFuturesTraderGlobalSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2769) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-settings-base` | -| [getFuturesTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2780) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/config-query-followers` | -| [removeFuturesTraderFollower()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2789) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-remove-follower` | -| [getFuturesFollowerCurrentOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2806) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-current-orders` | -| [getFuturesFollowerHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2815) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-history-orders` | -| [updateFuturesFollowerTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2824) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/setting-tpsl` | -| [updateFuturesFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2830) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/settings` | -| [getFuturesFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2836) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-settings` | -| [closeFuturesFollowerPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2842) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/close-positions` | -| [getFuturesFollowerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2855) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-traders` | -| [getFuturesFollowerFollowLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2861) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-quantity-limit` | -| [unfollowFuturesTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2879) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/cancel-trader` | -| [getBrokerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2893) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-traders` | -| [getBrokerTradersHistoricalOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2897) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-history-traces` | -| [getBrokerTradersPendingOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2904) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-current-traces` | -| [getSpotTraderProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2919) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-summarys` | -| [getSpotTraderHistoryProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2923) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-history-details` | -| [getSpotTraderUnrealizedProfit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2932) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-details` | -| [getSpotTraderOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2940) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-total-detail` | -| [modifySpotTraderOrderTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2944) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/order-modify-tpsl` | -| [getSpotTraderHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2955) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-history-track` | -| [getSpotTraderCurrentOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2964) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-current-track` | -| [sellSpotTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2973) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/order-close-tracking` | -| [getSpotTraderSymbolSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2983) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/config-setting-symbols` | -| [removeSpotTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L2993) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/config-remove-follower` | -| [getSpotTraderConfiguration()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3002) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/config-query-settings` | -| [getSpotTraderFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3006) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/config-query-followers` | -| [cancelSpotFollowerOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3023) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/stop-order` | -| [updateSpotFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3029) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/settings` | -| [updateSpotFollowerTPSL()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3038) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/setting-tpsl` | -| [getSpotFollowerTraders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3046) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-traders` | -| [getSpotFollowerCurrentTraderSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3055) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-trader-symbols` | -| [getSpotFollowerSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3066) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-settings` | -| [getSpotFollowerHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3072) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-history-orders` | -| [getSpotFollowerOpenOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3081) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-current-orders` | -| [sellSpotFollower()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3090) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/order-close-tracking` | -| [unfollowSpotTrader()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3100) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/cancel-trader` | -| [getEarnSavingsProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3114) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/product` | -| [getEarnSavingsAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3121) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/account` | -| [getEarnSavingsAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3125) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/assets` | -| [getEarnSavingsRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3131) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/records` | -| [getEarnSavingsSubscription()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3137) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/subscribe-info` | -| [earnSubscribeSavings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3144) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/subscribe` | -| [getEarnSavingsSubscriptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3157) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/subscribe-result` | -| [earnRedeemSavings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3169) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/redeem` | -| [getEarnSavingsRedemptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3178) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/redeem-result` | -| [getEarnAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3198) | :closed_lock_with_key: | GET | `/api/v2/earn/account/assets` | -| [getEarnEliteProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3217) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/product` | -| [getEarnEliteAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3221) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/assets` | -| [getEarnEliteRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3225) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/records` | -| [getEarnEliteSubscribeInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3231) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/subscribe-info` | -| [subscribeEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3237) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/subscribe` | -| [getEarnEliteSubscribeResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3243) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/subscribe-result` | -| [getEarnEliteRedeemInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3249) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/redeem-info` | -| [redeemEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3255) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/redeem` | -| [getSharkfinProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3269) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/product` | -| [getSharkfinAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3277) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/account` | -| [getSharkfinAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3281) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/assets` | -| [getSharkfinRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3287) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/records` | -| [getSharkfinSubscription()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3293) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/subscribe-info` | -| [subscribeSharkfin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3299) | :closed_lock_with_key: | POST | `/api/v2/earn/sharkfin/subscribe` | -| [getSharkfinSubscriptionResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3308) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/subscribe-result` | -| [getLoanCurrencies()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3325) | | GET | `/api/v2/earn/loan/public/coinInfos` | -| [getLoanEstInterestAndBorrowable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3331) | | GET | `/api/v2/earn/loan/public/hour-interest` | -| [borrowLoan()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3342) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/borrow` | -| [getOngoingLoanOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3350) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/ongoing-orders` | -| [repayLoan()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3358) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/repay` | -| [getRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3364) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/repay-history` | -| [updateLoanPledgeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3370) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/revise-pledge` | -| [getLoanPledgeRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3380) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/revise-history` | -| [getLoanHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3386) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/borrow-history` | -| [getLoanDebts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3392) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/debts` | -| [getLoanLiquidationRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3396) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/reduces` | -| [getLoanProductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3408) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/product-infos` | -| [getLoanSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3414) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/symbols` | -| [getLoanMarginCoinInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3420) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/ensure-coins-convert` | -| [getLoanRiskUnit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3438) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/risk-unit` | -| [getLoanLTVConvert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3446) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/ltv-convert` | -| [getLoanRepaidHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3458) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/repaid-history` | -| [getLoanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v2.ts#L3464) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/loan-order` | +| [getAnnouncements()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L506) | | GET | `/api/v2/public/annoucements` | +| [getServerTime()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L518) | | GET | `/api/v2/public/time` | +| [getTradeRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L526) | :closed_lock_with_key: | GET | `/api/v2/common/trade-rate` | +| [getAllTradeRates()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L535) | :closed_lock_with_key: | GET | `/api/v2/common/all-trade-rate` | +| [getSpotTransactionRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L553) | :closed_lock_with_key: | GET | `/api/v2/tax/spot-record` | +| [getFuturesTransactionRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L559) | :closed_lock_with_key: | GET | `/api/v2/tax/future-record` | +| [getMarginTransactionRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L565) | :closed_lock_with_key: | GET | `/api/v2/tax/margin-record` | +| [getP2PTransactionRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L571) | :closed_lock_with_key: | GET | `/api/v2/tax/p2p-record` | +| [getP2PMerchantList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L583) | :closed_lock_with_key: | GET | `/api/v2/p2p/merchantList` | +| [getP2PMerchantInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L592) | :closed_lock_with_key: | GET | `/api/v2/p2p/merchantInfo` | +| [getP2PMerchantOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L596) | :closed_lock_with_key: | GET | `/api/v2/p2p/orderList` | +| [getP2PMerchantAdvertisementList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L605) | :closed_lock_with_key: | GET | `/api/v2/p2p/advList` | +| [getSpotWhaleNetFlowData()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L622) | :closed_lock_with_key: | GET | `/api/v2/spot/market/whale-net-flow` | +| [getFuturesActiveTakerBuySellVolumeData()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L628) | | GET | `/api/v2/mix/market/taker-buy-sell` | +| [getFuturesActiveLongShortPositionData()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L635) | | GET | `/api/v2/mix/market/position-long-short` | +| [getFuturesLongShortRatio()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L642) | | GET | `/api/v2/mix/market/long-short-ratio` | +| [getMarginLoanGrowthRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L650) | | GET | `/api/v2/mix/market/loan-growth` | +| [getIsolatedMarginBorrowingRatio()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L658) | | GET | `/api/v2/mix/market/isolated-borrow-rate` | +| [getFuturesActiveBuySellVolumeData()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L665) | | GET | `/api/v2/mix/market/long-short` | +| [getSpotFundFlow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L672) | | GET | `/api/v2/spot/market/fund-flow` | +| [getTradeDataSupportSymbols()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L679) | | GET | `/api/v2/spot/market/support-symbols` | +| [getSpotFundNetFlowData()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L688) | | GET | `/api/v2/spot/market/fund-net-flow` | +| [getFuturesActiveLongShortAccountData()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L699) | | GET | `/api/v2/mix/market/account-long-short` | +| [createVirtualSubaccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L712) | :closed_lock_with_key: | POST | `/api/v2/user/create-virtual-subaccount` | +| [modifyVirtualSubaccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L718) | :closed_lock_with_key: | POST | `/api/v2/user/modify-virtual-subaccount` | +| [batchCreateVirtualSubaccountAndAPIKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L726) | :closed_lock_with_key: | POST | `/api/v2/user/batch-create-subaccount-and-apikey` | +| [getVirtualSubaccounts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L735) | :closed_lock_with_key: | GET | `/api/v2/user/virtual-subaccount-list` | +| [createVirtualSubaccountAPIKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L748) | :closed_lock_with_key: | POST | `/api/v2/user/create-virtual-subaccount-apikey` | +| [modifyVirtualSubaccountAPIKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L757) | :closed_lock_with_key: | POST | `/api/v2/user/modify-virtual-subaccount-apikey` | +| [getVirtualSubaccountAPIKeys()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L766) | :closed_lock_with_key: | GET | `/api/v2/user/virtual-subaccount-apikey-list` | +| [createAgentSubaccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L779) | :closed_lock_with_key: | POST | `/api/v2/user/create-agent-subaccount` | +| [getFundingAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L790) | :closed_lock_with_key: | GET | `/api/v2/account/funding-assets` | +| [getBotAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L796) | :closed_lock_with_key: | GET | `/api/v2/account/bot-assets` | +| [getBalances()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L803) | :closed_lock_with_key: | GET | `/api/v2/account/all-account-balance` | +| [getConvertCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L820) | :closed_lock_with_key: | GET | `/api/v2/convert/currencies` | +| [getConvertQuotedPrice()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L824) | :closed_lock_with_key: | GET | `/api/v2/convert/quoted-price` | +| [convert()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L830) | :closed_lock_with_key: | POST | `/api/v2/convert/trade` | +| [getConvertHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L836) | :closed_lock_with_key: | GET | `/api/v2/convert/convert-record` | +| [getConvertBGBCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L851) | :closed_lock_with_key: | GET | `/api/v2/convert/bgb-convert-coin-list` | +| [convertBGB()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L859) | :closed_lock_with_key: | POST | `/api/v2/convert/bgb-convert` | +| [getConvertBGBHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L865) | :closed_lock_with_key: | GET | `/api/v2/convert/bgb-convert-records` | +| [getSpotCoinInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L885) | :closed_lock_with_key: | GET | `/api/v2/spot/public/coins` | +| [getSpotSymbolInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L891) | :closed_lock_with_key: | GET | `/api/v2/spot/public/symbols` | +| [getSpotVIPFeeRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L897) | :closed_lock_with_key: | GET | `/api/v2/spot/market/vip-fee-rate` | +| [getSpotTicker()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L901) | :closed_lock_with_key: | GET | `/api/v2/spot/market/tickers` | +| [getSpotMergeDepth()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L907) | :closed_lock_with_key: | GET | `/api/v2/spot/market/merge-depth` | +| [getSpotOrderBookDepth()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L915) | :closed_lock_with_key: | GET | `/api/v2/spot/market/orderbook` | +| [getSpotCandles()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L923) | :closed_lock_with_key: | GET | `/api/v2/spot/market/candles` | +| [getSpotHistoricCandles()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L929) | :closed_lock_with_key: | GET | `/api/v2/spot/market/history-candles` | +| [getSpotRecentTrades()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L935) | :closed_lock_with_key: | GET | `/api/v2/spot/market/fills` | +| [getSpotHistoricTrades()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L942) | :closed_lock_with_key: | GET | `/api/v2/spot/market/fills-history` | +| [getSpotCallAuction()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L948) | | GET | `/api/v2/spot/market/auction` | +| [spotSubmitOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L960) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/place-order` | +| [spotCancelandSubmitOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L969) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-replace-order` | +| [spotBatchCancelandSubmitOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L975) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-replace-order` | +| [spotCancelOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L984) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-order` | +| [spotBatchSubmitOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L993) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-orders` | +| [spotBatchCancelOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L999) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-order` | +| [spotCancelSymbolOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1005) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-symbol-order` | +| [getSpotOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1013) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/orderInfo` | +| [getSpotOpenOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1019) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/unfilled-orders` | +| [getSpotHistoricOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1025) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/history-orders` | +| [getSpotFills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1031) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/fills` | +| [spotSubmitPlanOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1043) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/place-plan-order` | +| [spotModifyPlanOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1052) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/modify-plan-order` | +| [spotCancelPlanOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1061) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/cancel-plan-order` | +| [getSpotCurrentPlanOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1072) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/current-plan-order` | +| [getSpotPlanSubOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1082) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/plan-sub-order` | +| [getSpotHistoricPlanOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1088) | :closed_lock_with_key: | GET | `/api/v2/spot/trade/history-plan-order` | +| [spotCancelPlanOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1098) | :closed_lock_with_key: | POST | `/api/v2/spot/trade/batch-cancel-plan-order` | +| [getSpotAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1113) | :closed_lock_with_key: | GET | `/api/v2/spot/account/info` | +| [getSpotAccountAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1117) | :closed_lock_with_key: | GET | `/api/v2/spot/account/assets` | +| [getSpotSubAccountAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1124) | :closed_lock_with_key: | GET | `/api/v2/spot/account/subaccount-assets` | +| [spotModifyDepositAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1128) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/modify-deposit-account` | +| [getSpotAccountBills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1138) | :closed_lock_with_key: | GET | `/api/v2/spot/account/bills` | +| [spotTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1144) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/transfer` | +| [getSpotTransferableCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1153) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/transfer-coin-info` | +| [spotSubTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1160) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/subaccount-transfer` | +| [spotWithdraw()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1169) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/withdrawal` | +| [getSpotMainSubTransferRecord()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1178) | :closed_lock_with_key: | GET | `/api/v2/spot/account/sub-main-trans-record` | +| [getSpotTransferHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1187) | :closed_lock_with_key: | GET | `/api/v2/spot/account/transferRecords` | +| [spotSwitchBGBDeduct()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1193) | :closed_lock_with_key: | POST | `/api/v2/spot/account/switch-deduct` | +| [getSpotDepositAddress()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1199) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/deposit-address` | +| [getSpotSubDepositAddress()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1207) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/subaccount-deposit-address` | +| [getSpotBGBDeductInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1219) | :closed_lock_with_key: | GET | `/api/v2/spot/account/deduct-info` | +| [spotCancelWithdrawal()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1227) | :closed_lock_with_key: | POST | `/api/v2/spot/wallet/cancel-withdrawal` | +| [getSubAccountDepositRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1233) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/subaccount-deposit-records` | +| [getSpotWithdrawalHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1242) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/withdrawal-records` | +| [getSpotDepositHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1248) | :closed_lock_with_key: | GET | `/api/v2/spot/wallet/deposit-records` | +| [upgradeToUnifiedAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1263) | :closed_lock_with_key: | POST | `/api/v2/spot/account/upgrade` | +| [getUnifiedAccountSwitchStatus()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1273) | :closed_lock_with_key: | GET | `/api/v2/spot/account/upgrade-status` | +| [getFuturesVIPFeeRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1295) | | GET | `/api/v2/mix/market/vip-fee-rate` | +| [getFuturesInterestRateHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1299) | | GET | `/api/v2/mix/market/union-interest-rate-history` | +| [getFuturesInterestExchangeRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1308) | | GET | `/api/v2/mix/market/exchange-rate` | +| [getFuturesDiscountRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1319) | | GET | `/api/v2/mix/market/discount-rate` | +| [getFuturesMergeDepth()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1323) | | GET | `/api/v2/mix/market/merge-depth` | +| [getFuturesTicker()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1329) | | GET | `/api/v2/mix/market/ticker` | +| [getFuturesAllTickers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1336) | | GET | `/api/v2/mix/market/tickers` | +| [getFuturesRecentTrades()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1342) | | GET | `/api/v2/mix/market/fills` | +| [getFuturesHistoricTrades()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1348) | | GET | `/api/v2/mix/market/fills-history` | +| [getFuturesCandles()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1354) | | GET | `/api/v2/mix/market/candles` | +| [getFuturesHistoricCandles()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1360) | | GET | `/api/v2/mix/market/history-candles` | +| [getFuturesHistoricIndexPriceCandles()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1366) | | GET | `/api/v2/mix/market/history-index-candles` | +| [getFuturesHistoricMarkPriceCandles()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1372) | | GET | `/api/v2/mix/market/history-mark-candles` | +| [getFuturesOpenInterest()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1378) | | GET | `/api/v2/mix/market/open-interest` | +| [getFuturesNextFundingTime()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1390) | | GET | `/api/v2/mix/market/funding-time` | +| [getFuturesSymbolPrice()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1397) | | GET | `/api/v2/mix/market/symbol-price` | +| [getFuturesHistoricFundingRates()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1404) | | GET | `/api/v2/mix/market/history-fund-rate` | +| [getFuturesCurrentFundingRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1413) | | GET | `/api/v2/mix/market/current-fund-rate` | +| [getFuturesContractConfig()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1431) | | GET | `/api/v2/mix/market/contracts` | +| [getFuturesOiLimit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1438) | | GET | `/api/v2/mix/market/oi-limit` | +| [getFuturesAccountAsset()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1456) | :closed_lock_with_key: | GET | `/api/v2/mix/account/account` | +| [getFuturesAccountAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1462) | :closed_lock_with_key: | GET | `/api/v2/mix/account/accounts` | +| [getFuturesSubAccountAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1468) | :closed_lock_with_key: | GET | `/api/v2/mix/account/sub-account-assets` | +| [getFuturesInterestHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1481) | :closed_lock_with_key: | GET | `/api/v2/mix/account/interest-history` | +| [getFuturesOpenCount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1487) | :closed_lock_with_key: | GET | `/api/v2/mix/account/open-count` | +| [setFuturesPositionAutoMargin()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1495) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-auto-margin` | +| [setFuturesLeverage()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1501) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-leverage` | +| [setFuturesPositionMargin()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1507) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-margin` | +| [setFuturesAssetMode()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1513) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-asset-mode` | +| [setFuturesMarginMode()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1520) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-margin-mode` | +| [setFuturesPositionMode()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1526) | :closed_lock_with_key: | POST | `/api/v2/mix/account/set-position-mode` | +| [getFuturesAccountBills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1537) | :closed_lock_with_key: | GET | `/api/v2/mix/account/bill` | +| [getUnionTransferLimits()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1552) | :closed_lock_with_key: | GET | `/api/v2/mix/account/transfer-limits` | +| [getUnionConfig()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1564) | :closed_lock_with_key: | GET | `/api/v2/mix/account/union-config` | +| [getSwitchUnionUsdt()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1574) | :closed_lock_with_key: | GET | `/api/v2/mix/account/switch-union-usdt` | +| [unionConvert()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1584) | :closed_lock_with_key: | POST | `/api/v2/mix/account/union-convert` | +| [getFuturesMaxOpenableQuantity()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1596) | :closed_lock_with_key: | GET | `/api/v2/mix/account/max-open` | +| [getFuturesLiquidationPrice()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1608) | :closed_lock_with_key: | GET | `/api/v2/mix/account/liq-price` | +| [getFuturesIsolatedSymbols()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1620) | :closed_lock_with_key: | GET | `/api/v2/mix/account/isolated-symbols` | +| [getFuturesPositionTier()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1632) | | GET | `/api/v2/mix/market/query-position-lever` | +| [getFuturesPosition()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1639) | :closed_lock_with_key: | GET | `/api/v2/mix/position/single-position` | +| [getFuturesPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1647) | :closed_lock_with_key: | GET | `/api/v2/mix/position/all-position` | +| [getFuturesHistoricPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1654) | :closed_lock_with_key: | GET | `/api/v2/mix/position/history-position` | +| [getFuturesPositionAdlRank()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1665) | :closed_lock_with_key: | GET | `/api/v2/mix/position/adlRank` | +| [futuresSubmitOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1677) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-order` | +| [futuresSubmitReversal()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1686) | :closed_lock_with_key: | POST | `/api/v2/mix/order/click-backhand` | +| [futuresBatchSubmitOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1695) | :closed_lock_with_key: | POST | `/api/v2/mix/order/batch-place-order` | +| [futuresModifyOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1701) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-order` | +| [futuresCancelOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1710) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-order` | +| [futuresBatchCancelOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1719) | :closed_lock_with_key: | POST | `/api/v2/mix/order/batch-cancel-orders` | +| [futuresFlashClosePositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1725) | :closed_lock_with_key: | POST | `/api/v2/mix/order/close-positions` | +| [getFuturesOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1731) | :closed_lock_with_key: | GET | `/api/v2/mix/order/detail` | +| [getFuturesFills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1737) | :closed_lock_with_key: | GET | `/api/v2/mix/order/fills` | +| [getFuturesHistoricOrderFills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1746) | :closed_lock_with_key: | GET | `/api/v2/mix/order/fill-history` | +| [getFuturesOpenOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1757) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-pending` | +| [getFuturesHistoricOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1766) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-history` | +| [futuresCancelAllOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1775) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-all-orders` | +| [getFuturesTriggerSubOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1787) | :closed_lock_with_key: | GET | `/api/v2/mix/order/plan-sub-order` | +| [futuresSubmitTPSLOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1795) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-tpsl-order` | +| [futuresSubmitPositionTPSL()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1804) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-pos-tpsl` | +| [futuresSubmitPlanOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1816) | :closed_lock_with_key: | POST | `/api/v2/mix/order/place-plan-order` | +| [futuresModifyTPSLPOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1825) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-tpsl-order` | +| [futuresModifyPlanOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1834) | :closed_lock_with_key: | POST | `/api/v2/mix/order/modify-plan-order` | +| [getFuturesPlanOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1843) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-plan-pending` | +| [futuresCancelPlanOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1852) | :closed_lock_with_key: | POST | `/api/v2/mix/order/cancel-plan-order` | +| [getFuturesHistoricPlanOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1858) | :closed_lock_with_key: | GET | `/api/v2/mix/order/orders-plan-history` | +| [modifySubaccountEmail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1883) | :closed_lock_with_key: | POST | `/api/v2/broker/account/modify-subaccount-email` | +| [getBrokerInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1893) | :closed_lock_with_key: | GET | `/api/v2/broker/account/info` | +| [createSubaccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1903) | :closed_lock_with_key: | POST | `/api/v2/broker/account/create-subaccount` | +| [getSubaccounts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1910) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-list` | +| [modifySubaccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1920) | :closed_lock_with_key: | POST | `/api/v2/broker/account/modify-subaccount` | +| [getSubaccountEmail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1926) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-email` | +| [getSubaccountSpotAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1932) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-spot-assets` | +| [getSubaccountFuturesAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1947) | :closed_lock_with_key: | GET | `/api/v2/broker/account/subaccount-future-assets` | +| [createSubaccountDepositAddress()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1961) | :closed_lock_with_key: | POST | `/api/v2/broker/account/subaccount-address` | +| [subaccountWithdrawal()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1972) | :closed_lock_with_key: | POST | `/api/v2/broker/account/subaccount-withdrawal` | +| [subaccountSetAutoTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1984) | :closed_lock_with_key: | POST | `/api/v2/broker/account/set-subaccount-autotransfer` | +| [subaccountDepositRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2000) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-deposit` | +| [subaccountWithdrawalRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2011) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-withdrawal` | +| [createSubaccountApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2026) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/create-subaccount-apikey` | +| [getSubaccountApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2035) | :closed_lock_with_key: | GET | `/api/v2/broker/manage/subaccount-apikey-list` | +| [modifySubaccountApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2044) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/modify-subaccount-apikey` | +| [deleteSubaccountApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2053) | :closed_lock_with_key: | POST | `/api/v2/broker/manage/delete-subaccount-apikey` | +| [getAllSubDepositWithdrawalRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2069) | :closed_lock_with_key: | GET | `/api/v2/broker/all-sub-deposit-withdrawal` | +| [getBrokerSubaccounts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2086) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccounts` | +| [getBrokerCommissions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2098) | :closed_lock_with_key: | GET | `/api/v2/broker/commissions` | +| [getBrokerTradeVolume()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2110) | :closed_lock_with_key: | GET | `/api/v2/broker/trade-volume` | +| [getBrokerTotalCommission()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2130) | :closed_lock_with_key: | GET | `/api/v2/broker/total-commission` | +| [getBrokerOrderCommission()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2152) | :closed_lock_with_key: | GET | `/api/v2/broker/order-commission` | +| [getBrokerRebateInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2165) | :closed_lock_with_key: | GET | `/api/v2/broker/rebate-info` | +| [getAgentCustomerCommissions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2177) | :closed_lock_with_key: | GET | `/api/v2/broker/customer-commissions` | +| [getAgentSubCustomerList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2186) | :closed_lock_with_key: | GET | `/api/v2/broker/sub-customer-list` | +| [getAgentCustomerTradeVolume()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2192) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-trade-volume` | +| [getAgentCustomerList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2201) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-list` | +| [getAgentCustomerKycResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2207) | :closed_lock_with_key: | GET | `/api/v2/broker/customer-kyc-result` | +| [getAgentCustomerDeposits()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2213) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-deposit` | +| [getAgentCustomerAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2219) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-asset` | +| [getAgentCommissionDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2225) | :closed_lock_with_key: | GET | `/api/v2/broker/agent-commission` | +| [getMarginCurrencies()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2245) | | GET | `/api/v2/margin/currencies` | +| [getMarginBorrowHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2255) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/borrow-history` | +| [getMarginRepayHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2272) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/repay-history` | +| [getMarginInterestHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2289) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/interest-history` | +| [getMarginLiquidationHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2306) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/liquidation-history` | +| [getMarginFinancialHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2323) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/financial-records` | +| [getMarginAccountAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2346) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/assets` | +| [marginBorrow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2357) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/borrow` | +| [marginRepay()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2380) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/repay` | +| [getMarginRiskRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2405) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/risk-rate` | +| [getMarginMaxBorrowable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2417) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/max-borrowable-amount` | +| [getMarginMaxTransferable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2430) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/max-transfer-out-amount` | +| [getMarginInterestRateAndMaxBorrowable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2445) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/interest-rate-and-limit` | +| [getMarginTierConfiguration()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2461) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/tier-data` | +| [marginFlashRepay()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2473) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/account/flash-repay` | +| [getMarginFlashRepayResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2491) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/account/query-flash-repay-status` | +| [marginSubmitOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2515) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/place-order` | +| [marginBatchSubmitOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2528) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/batch-place-order` | +| [marginCancelOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2539) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/cancel-order` | +| [marginBatchCancelOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2559) | :closed_lock_with_key: | POST | `/api/v2/margin/${marginType}/batch-cancel-order` | +| [getMarginOpenOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2573) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/open-orders` | +| [getMarginHistoricOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2587) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/history-orders` | +| [getMarginHistoricOrderFills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2604) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/fills` | +| [getMarginLiquidationOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2618) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/liquidation-order` | +| [getFuturesTraderCurrentOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2650) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-current-track` | +| [getFuturesTraderHistoryOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2659) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-history-track` | +| [modifyFuturesTraderOrderTPSL()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2668) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/order-modify-tpsl` | +| [getFuturesTraderOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2677) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/order-total-detail` | +| [getFuturesTraderProfitHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2683) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-history-summarys` | +| [getFuturesTraderProfitShareHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2689) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-history-details` | +| [closeFuturesTraderOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2698) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/order-close-positions` | +| [getFuturesTraderProfitShare()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2717) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profit-details` | +| [getFuturesTraderProfitShareGroup()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2733) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/profits-group-coin-date` | +| [getFuturesTraderSymbolSettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2751) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/config-query-symbols` | +| [updateFuturesTraderSymbolSettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2760) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-setting-symbols` | +| [updateFuturesTraderGlobalSettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2769) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-settings-base` | +| [getFuturesTraderFollowers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2780) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-trader/config-query-followers` | +| [removeFuturesTraderFollower()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2789) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-trader/config-remove-follower` | +| [getFuturesFollowerCurrentOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2806) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-current-orders` | +| [getFuturesFollowerHistoryOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2815) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-history-orders` | +| [updateFuturesFollowerTPSL()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2824) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/setting-tpsl` | +| [updateFuturesFollowerSettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2830) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/settings` | +| [getFuturesFollowerSettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2836) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-settings` | +| [closeFuturesFollowerPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2842) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/close-positions` | +| [getFuturesFollowerTraders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2855) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-traders` | +| [getFuturesFollowerFollowLimit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2861) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-follower/query-quantity-limit` | +| [unfollowFuturesTrader()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2879) | :closed_lock_with_key: | POST | `/api/v2/copy/mix-follower/cancel-trader` | +| [getBrokerTraders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2893) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-traders` | +| [getBrokerTradersHistoricalOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2897) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-history-traces` | +| [getBrokerTradersPendingOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2904) | :closed_lock_with_key: | GET | `/api/v2/copy/mix-broker/query-current-traces` | +| [getSpotTraderProfit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2919) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-summarys` | +| [getSpotTraderHistoryProfit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2923) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-history-details` | +| [getSpotTraderUnrealizedProfit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2932) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/profit-details` | +| [getSpotTraderOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2940) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-total-detail` | +| [modifySpotTraderOrderTPSL()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2944) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/order-modify-tpsl` | +| [getSpotTraderHistoryOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2955) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-history-track` | +| [getSpotTraderCurrentOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2964) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/order-current-track` | +| [sellSpotTrader()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2973) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/order-close-tracking` | +| [getSpotTraderSymbolSettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2983) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/config-setting-symbols` | +| [removeSpotTraderFollowers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2993) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-trader/config-remove-follower` | +| [getSpotTraderConfiguration()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3002) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/config-query-settings` | +| [getSpotTraderFollowers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3006) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-trader/config-query-followers` | +| [cancelSpotFollowerOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3023) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/stop-order` | +| [updateSpotFollowerSettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3029) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/settings` | +| [updateSpotFollowerTPSL()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3038) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/setting-tpsl` | +| [getSpotFollowerTraders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3046) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-traders` | +| [getSpotFollowerCurrentTraderSymbols()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3055) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-trader-symbols` | +| [getSpotFollowerSettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3066) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-settings` | +| [getSpotFollowerHistoryOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3072) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-history-orders` | +| [getSpotFollowerOpenOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3081) | :closed_lock_with_key: | GET | `/api/v2/copy/spot-follower/query-current-orders` | +| [sellSpotFollower()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3090) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/order-close-tracking` | +| [unfollowSpotTrader()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3100) | :closed_lock_with_key: | POST | `/api/v2/copy/spot-follower/cancel-trader` | +| [getEarnSavingsProducts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3114) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/product` | +| [getEarnSavingsAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3121) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/account` | +| [getEarnSavingsAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3125) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/assets` | +| [getEarnSavingsRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3131) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/records` | +| [getEarnSavingsSubscription()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3137) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/subscribe-info` | +| [earnSubscribeSavings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3144) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/subscribe` | +| [getEarnSavingsSubscriptionResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3157) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/subscribe-result` | +| [earnRedeemSavings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3169) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/redeem` | +| [getEarnSavingsRedemptionResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3178) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/redeem-result` | +| [getEarnAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3198) | :closed_lock_with_key: | GET | `/api/v2/earn/account/assets` | +| [getEarnEliteProducts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3217) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/product` | +| [getEarnEliteAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3221) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/assets` | +| [getEarnEliteRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3225) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/records` | +| [getEarnEliteSubscribeInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3231) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/subscribe-info` | +| [subscribeEarnElite()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3237) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/subscribe` | +| [getEarnEliteSubscribeResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3243) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/subscribe-result` | +| [getEarnEliteRedeemInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3249) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/redeem-info` | +| [redeemEarnElite()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3255) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/redeem` | +| [getSharkfinProducts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3269) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/product` | +| [getSharkfinAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3277) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/account` | +| [getSharkfinAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3281) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/assets` | +| [getSharkfinRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3287) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/records` | +| [getSharkfinSubscription()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3293) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/subscribe-info` | +| [subscribeSharkfin()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3299) | :closed_lock_with_key: | POST | `/api/v2/earn/sharkfin/subscribe` | +| [getSharkfinSubscriptionResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3308) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/subscribe-result` | +| [getLoanCurrencies()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3325) | | GET | `/api/v2/earn/loan/public/coinInfos` | +| [getLoanEstInterestAndBorrowable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3331) | | GET | `/api/v2/earn/loan/public/hour-interest` | +| [borrowLoan()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3342) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/borrow` | +| [getOngoingLoanOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3350) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/ongoing-orders` | +| [repayLoan()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3358) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/repay` | +| [getRepayHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3364) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/repay-history` | +| [updateLoanPledgeRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3370) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/revise-pledge` | +| [getLoanPledgeRateHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3380) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/revise-history` | +| [getLoanHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3386) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/borrow-history` | +| [getLoanDebts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3392) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/debts` | +| [getLoanLiquidationRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3396) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/reduces` | +| [getLoanProductInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3408) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/product-infos` | +| [getLoanSymbols()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3414) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/symbols` | +| [getLoanMarginCoinInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3420) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/ensure-coins-convert` | +| [getLoanRiskUnit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3438) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/risk-unit` | +| [getLoanLTVConvert()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3446) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/ltv-convert` | +| [getLoanRepaidHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3458) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/repaid-history` | +| [getLoanOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3464) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/loan-order` | # rest-client-v3.ts @@ -361,216 +361,216 @@ This table includes all endpoints from the official Exchange API docs and corres | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | -| [getServerTime()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L480) | | GET | `/api/v3/public/time` | -| [getInstruments()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L497) | | GET | `/api/v3/market/instruments` | -| [getMarketFeeGroup()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L506) | | GET | `/api/v3/market/fee-group` | -| [getLiquidations()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L515) | | GET | `/api/v3/market/liquidations` | -| [getRpiSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L524) | | GET | `/api/v3/market/rpi-symbols` | -| [getRpiOrderBook()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L531) | | GET | `/api/v3/market/rpi-orderbook` | -| [getCashDividendRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L540) | | GET | `/api/v3/market/cash-dividend-records` | -| [getSpotWhaleFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L549) | | GET | `/api/v3/market/spot-whale-flow` | -| [getSpotFundFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L558) | | GET | `/api/v3/market/spot-fund-flow` | -| [getSpotNetFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L567) | | GET | `/api/v3/market/spot-net-flow` | -| [getMarginLongShort()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L576) | | GET | `/api/v3/market/margin-long-short` | -| [getMarginLoanGrowth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L585) | | GET | `/api/v3/market/margin-loan-growth` | -| [getMarginIsolatedBorrow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L594) | | GET | `/api/v3/market/margin-isolated-borrow` | -| [getFuturesActiveBuySell()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L603) | | GET | `/api/v3/market/futures-active-buy-sell` | -| [getFuturesLongShort()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L612) | | GET | `/api/v3/market/futures-long-short` | -| [getFuturesPositionLongShort()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L621) | | GET | `/api/v3/market/futures-position-long-short` | -| [getFuturesAccountLongShort()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L630) | | GET | `/api/v3/market/futures-account-long-short` | -| [getMarketScoreWeights()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L639) | | GET | `/api/v3/market/score-weights` | -| [getTickers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L648) | | GET | `/api/v3/market/tickers` | -| [getOrderBook()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L655) | | GET | `/api/v3/market/orderbook` | -| [getFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L664) | | GET | `/api/v3/market/fills` | -| [getProofOfReserves()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L673) | | GET | `/api/v3/market/proof-of-reserves` | -| [getOpenInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L680) | | GET | `/api/v3/market/open-interest` | -| [getCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L690) | | GET | `/api/v3/market/candles` | -| [getHistoryCandles()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L699) | | GET | `/api/v3/market/history-candles` | -| [getCurrentFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L708) | | GET | `/api/v3/market/current-fund-rate` | -| [getHistoryFundingRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L717) | | GET | `/api/v3/market/history-fund-rate` | -| [getRiskReserve()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L726) | | GET | `/api/v3/market/risk-reserve` | -| [getRiskReserveHour()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L735) | | GET | `/api/v3/market/risk-reserve-hour` | -| [getRiskReserveAll()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L744) | | GET | `/api/v3/market/risk-reserve-all` | -| [getDiscountRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L753) | | GET | `/api/v3/market/discount-rate` | -| [getMarginLoans()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L760) | | GET | `/api/v3/market/margin-loans` | -| [getPositionTier()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L769) | | GET | `/api/v3/market/position-tier` | -| [getContractsOi()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L778) | | GET | `/api/v3/market/oi-limit` | -| [getIndexComponents()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L787) | | GET | `/api/v3/market/index-components` | -| [getRealityOrderBook()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L796) | :closed_lock_with_key: | GET | `/api/v3/account/reality-orderbook` | -| [getRealityFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L805) | :closed_lock_with_key: | GET | `/api/v3/account/reality-fills` | -| [getCopyFuturesTradingPairs()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L822) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/trading-pairs` | -| [getCopyFuturesPositionSummary()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L833) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/position-summary` | -| [getCopyFuturesMaxTransferable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L843) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/max-transferable` | -| [copyFuturesTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L853) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/transfer` | -| [getCopyFuturesTransferRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L863) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/transfer-record` | -| [getCopyFuturesCurrentFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L869) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/current-follower` | -| [getCopyFuturesHistoryFollowers()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L875) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/history-follower` | -| [getCopyFuturesProfitSummary()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L881) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/profit-summary` | -| [getCopyFuturesProfitDetails()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L887) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/profit-details` | -| [getStockPlusOptionQuote()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L899) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/option-quote` | -| [getStockPlusOptionChainInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L905) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/option-chain-info` | -| [getStockPlusOptionExpiryDate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L914) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/option-expiry-date` | -| [getStockPlusOptionVolume()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L923) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/option-volume` | -| [getStockPlusStaticInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L929) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/static` | -| [getStockPlusQuote()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L935) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/quote` | -| [getStockPlusTradeDetail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L941) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/trade` | -| [getStockPlusIntraday()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L947) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/intraday` | -| [getStockPlusHistoryCandlestick()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L953) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/history-candlestick` | -| [getStockPlusCandlestick()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L962) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/candlestick` | -| [getStockPlusDepth()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L968) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/depth` | -| [placeStockPlusOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L974) | :closed_lock_with_key: | POST | `/api/v3/stockplus/trade/place-order` | -| [cancelStockPlusOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L980) | :closed_lock_with_key: | POST | `/api/v3/stockplus/trade/cancel-order` | -| [modifyStockPlusOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L986) | :closed_lock_with_key: | POST | `/api/v3/stockplus/trade/modify-order` | -| [getStockPlusTodayOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L992) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/today-orders` | -| [getStockPlusHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L998) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/history-orders` | -| [getStockPlusOrderDetail()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1004) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/order-detail` | -| [getStockPlusTodayExecutions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1010) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/today-executions` | -| [getStockPlusHistoryExecutions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1016) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/history-executions` | -| [getStockPlusAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1025) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/account` | -| [getStockPlusCashFlow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1031) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/cash-flow` | -| [getStockPlusStockPosition()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1037) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/stock-position` | -| [stockPlusTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1043) | :closed_lock_with_key: | POST | `/api/v3/stockplus/asset/transfer` | -| [getStockPlusTransferRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1049) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/transfer-records` | -| [getBalances()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1064) | :closed_lock_with_key: | GET | `/api/v3/account/assets` | -| [getFundingAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1071) | :closed_lock_with_key: | GET | `/api/v3/account/funding-assets` | -| [getAccountInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1081) | :closed_lock_with_key: | GET | `/api/v3/account/info` | -| [getAccountSettings()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1089) | :closed_lock_with_key: | GET | `/api/v3/account/settings` | -| [adjustAccountMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1096) | :closed_lock_with_key: | POST | `/api/v3/account/adjust-account-mode` | -| [getDeltaInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1106) | :closed_lock_with_key: | GET | `/api/v3/account/delta-info` | -| [setLeverage()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1113) | :closed_lock_with_key: | POST | `/api/v3/account/set-leverage` | -| [setHoldMode()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1120) | :closed_lock_with_key: | POST | `/api/v3/account/set-hold-mode` | -| [getCollateralType()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1129) | :closed_lock_with_key: | GET | `/api/v3/account/collateral-type` | -| [setCollateralType()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1136) | :closed_lock_with_key: | POST | `/api/v3/account/set-collateral-type` | -| [getCustomCollateralCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1145) | | GET | `/api/v3/account/custom-collateral-coins` | -| [preSetLeverage()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1152) | :closed_lock_with_key: | GET | `/api/v3/account/pre-set-leverage` | -| [setMargin()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1161) | :closed_lock_with_key: | POST | `/api/v3/account/set-margin` | -| [getMaxWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1168) | :closed_lock_with_key: | GET | `/api/v3/account/max-withdrawal` | -| [getFinancialRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1177) | :closed_lock_with_key: | GET | `/api/v3/account/financial-records` | -| [getRepayableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1189) | :closed_lock_with_key: | GET | `/api/v3/account/repayable-coins` | -| [getPaymentCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1201) | :closed_lock_with_key: | GET | `/api/v3/account/payment-coins` | -| [submitRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1213) | :closed_lock_with_key: | POST | `/api/v3/account/repay` | -| [getConvertRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1220) | :closed_lock_with_key: | GET | `/api/v3/account/convert-records` | -| [setDepositAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1235) | :closed_lock_with_key: | POST | `/api/v3/account/deposit-account` | -| [switchDeduct()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1244) | :closed_lock_with_key: | POST | `/api/v3/account/switch-deduct` | -| [getDeductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1251) | :closed_lock_with_key: | GET | `/api/v3/account/deduct-info` | -| [getFeeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1262) | :closed_lock_with_key: | GET | `/api/v3/account/fee-rate` | -| [getAllFeeRates()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1274) | :closed_lock_with_key: | GET | `/api/v3/account/all-fee-rate` | -| [getMaxTransferable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1287) | :closed_lock_with_key: | GET | `/api/v3/account/max-transferable` | -| [getOpenInterestLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1299) | :closed_lock_with_key: | GET | `/api/v3/account/open-interest-limit` | -| [getEligibleSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1305) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-symbols` | -| [getEligibleMarginTier()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1311) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-margin-tier` | -| [getEligibleLoanInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1317) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-loan-info` | -| [downgradeAccountToClassic()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1332) | :closed_lock_with_key: | POST | `/api/v3/account/switch` | -| [getUnifiedAccountSwitchStatus()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1340) | :closed_lock_with_key: | GET | `/api/v3/account/switch-status` | -| [getTaxRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1356) | :closed_lock_with_key: | GET | `/api/v3/tax/records` | -| [createSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1371) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub` | -| [createAgentSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1380) | :closed_lock_with_key: | POST | `/api/v3/user/sub-account/agent-create` | -| [freezeSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1389) | :closed_lock_with_key: | POST | `/api/v3/user/freeze-sub` | -| [getSubUnifiedAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1398) | :closed_lock_with_key: | GET | `/api/v3/account/sub-unified-assets` | -| [getSubAccountList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1407) | :closed_lock_with_key: | GET | `/api/v3/user/sub-list` | -| [createSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1420) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub-api` | -| [updateSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1429) | :closed_lock_with_key: | POST | `/api/v3/user/update-sub-api` | -| [deleteSubAccountApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1438) | :closed_lock_with_key: | POST | `/api/v3/user/delete-sub-api` | -| [getSubAccountApiKeys()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1447) | :closed_lock_with_key: | GET | `/api/v3/user/sub-api-list` | -| [getRateLimitQuota()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1457) | :closed_lock_with_key: | GET | `/api/v3/user/rate-limit-quota` | -| [setRateLimitQuota()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1463) | :closed_lock_with_key: | POST | `/api/v3/user/set-rate-limit-quota` | -| [getTransferableCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1478) | :closed_lock_with_key: | GET | `/api/v3/account/transferable-coins` | -| [submitTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1487) | :closed_lock_with_key: | POST | `/api/v3/account/transfer` | -| [subAccountTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1496) | :closed_lock_with_key: | POST | `/api/v3/account/sub-transfer` | -| [getSubTransferRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1508) | :closed_lock_with_key: | GET | `/api/v3/account/sub-transfer-record` | -| [subMasterTransfer()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1520) | :closed_lock_with_key: | POST | `/api/v3/account/sub-master-transfer` | -| [getDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1538) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-address` | -| [getSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1547) | :closed_lock_with_key: | GET | `/api/v3/account/sub-deposit-address` | -| [getDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1556) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-records` | -| [getSubDepositRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1565) | :closed_lock_with_key: | POST | `/api/v3/account/sub-deposit-records` | -| [submitWithdraw()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1580) | :closed_lock_with_key: | POST | `/api/v3/account/withdraw` | -| [getWithdrawRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1589) | :closed_lock_with_key: | GET | `/api/v3/account/withdrawal-records` | -| [getWithdrawAddressBook()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1598) | :closed_lock_with_key: | GET | `/api/v3/account/withdraw-address` | -| [cancelWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1607) | :closed_lock_with_key: | POST | `/api/v3/account/cancel-withdrawal` | -| [submitNewOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1622) | :closed_lock_with_key: | POST | `/api/v3/trade/place-order` | -| [modifyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1631) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-order` | -| [placeRealityOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1640) | :closed_lock_with_key: | POST | `/api/v3/trade/place-reality-order` | -| [cancelRealityOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1649) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-reality-order` | -| [getLoanData()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1658) | :closed_lock_with_key: | GET | `/api/v3/trade/loan-data` | -| [cancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1665) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-order` | -| [placeBatchOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1674) | :closed_lock_with_key: | POST | `/api/v3/trade/place-batch` | -| [batchModifyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1683) | :closed_lock_with_key: | POST | `/api/v3/trade/batch-modify-order` | -| [cancelBatchOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1692) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-batch` | -| [cancelAllOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1701) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-symbol-order` | -| [closeAllPositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1710) | :closed_lock_with_key: | POST | `/api/v3/trade/close-positions` | -| [getOrderInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1719) | :closed_lock_with_key: | GET | `/api/v3/trade/order-info` | -| [getUnfilledOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1728) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-orders` | -| [getHistoryOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1740) | :closed_lock_with_key: | GET | `/api/v3/trade/history-orders` | -| [movePositions()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1752) | :closed_lock_with_key: | POST | `/api/v3/account/move-positions` | -| [getMovePositionHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1761) | :closed_lock_with_key: | GET | `/api/v3/account/move-position-history` | -| [getTradeFills()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1773) | :closed_lock_with_key: | GET | `/api/v3/trade/fills` | -| [getCurrentPosition()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1785) | :closed_lock_with_key: | GET | `/api/v3/position/current-position` | -| [getPositionHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1796) | :closed_lock_with_key: | GET | `/api/v3/position/history-position` | -| [getMaxOpenAvailable()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1808) | :closed_lock_with_key: | POST | `/api/v3/account/max-open-available` | -| [getPositionAdlRank()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1817) | :closed_lock_with_key: | GET | `/api/v3/position/adlRank` | -| [countdownCancelAll()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1824) | :closed_lock_with_key: | POST | `/api/v3/trade/countdown-cancel-all` | -| [getLoanTransfered()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1839) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/transfered` | -| [getLoanSymbols()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1848) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/symbols` | -| [getLoanRiskUnit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1857) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/risk-unit` | -| [getLoanRepaidHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1868) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/repaid-history` | -| [getLoanProductInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1877) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/product-infos` | -| [getLoanOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1886) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/loan-order` | -| [getLoanLTVConvert()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1895) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/ltv-convert` | -| [getLoanMarginCoinInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1904) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/ensure-coins-convert` | -| [bindLoanUid()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1916) | :closed_lock_with_key: | POST | `/api/v3/ins-loan/bind-uid` | -| [getLoanCoins()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1931) | :closed_lock_with_key: | GET | `/api/v3/loan/coins` | -| [getLoanInterest()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1940) | :closed_lock_with_key: | GET | `/api/v3/loan/interest` | -| [loanBorrow()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1949) | :closed_lock_with_key: | POST | `/api/v3/loan/borrow` | -| [getLoanBorrowOngoing()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1958) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-ongoing` | -| [getLoanBorrowHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1967) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-history` | -| [loanRepay()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1976) | :closed_lock_with_key: | POST | `/api/v3/loan/repay` | -| [getLoanRepayHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1985) | :closed_lock_with_key: | GET | `/api/v3/loan/repay-history` | -| [loanRevisePledge()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L1994) | :closed_lock_with_key: | POST | `/api/v3/loan/revise-pledge` | -| [getLoanPledgeRateHistory()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2003) | :closed_lock_with_key: | GET | `/api/v3/loan/pledge-rate-history` | -| [getLoanDebts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2012) | :closed_lock_with_key: | GET | `/api/v3/loan/debts` | -| [getLoanReduces()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2019) | :closed_lock_with_key: | GET | `/api/v3/loan/reduces` | -| [submitStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2034) | :closed_lock_with_key: | POST | `/api/v3/trade/place-strategy-order` | -| [modifyStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2043) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-strategy-order` | -| [cancelStrategyOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2052) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-strategy-order` | -| [getUnfilledStrategyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2061) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-strategy-orders` | -| [getHistoryStrategyOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2070) | :closed_lock_with_key: | GET | `/api/v3/trade/history-strategy-orders` | -| [createBrokerSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2091) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub` | -| [getBrokerSubAccountList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2103) | :closed_lock_with_key: | GET | `/api/v3/broker/sub-list` | -| [modifyBrokerSubAccount()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2115) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub` | -| [brokerSubWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2130) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-withdrawal` | -| [getBrokerSubDepositAddress()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2142) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-deposit-address` | -| [getBrokerAllSubDepositWithdrawal()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2154) | :closed_lock_with_key: | GET | `/api/v3/broker/all-sub-deposit-withdrawal` | -| [getBrokerCommission()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2166) | :closed_lock_with_key: | GET | `/api/v3/broker/commission` | -| [createBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2178) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub-apikey` | -| [modifyBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2190) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub-apikey` | -| [deleteBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2206) | :closed_lock_with_key: | POST | `/api/v3/broker/delete-sub-apikey` | -| [getBrokerSubApiKey()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2218) | :closed_lock_with_key: | GET | `/api/v3/broker/query-sub-apikey` | -| [getP2pAdList()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2230) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-list` | -| [getP2pExchangeRate()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2236) | :closed_lock_with_key: | GET | `/api/v3/p2p/exchange-rate` | -| [simulateP2pFee()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2242) | :closed_lock_with_key: | POST | `/api/v3/p2p/fee-simulate` | -| [getP2pAdLimit()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2248) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-limit` | -| [createP2pAd()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2254) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-create` | -| [updateP2pAd()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2260) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-update` | -| [operateP2pAd()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2264) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-operate` | -| [getP2pAdInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2268) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-info` | -| [getP2pMyAds()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2274) | :closed_lock_with_key: | GET | `/api/v3/p2p/my-ads` | -| [getP2pPendingOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2280) | :closed_lock_with_key: | GET | `/api/v3/p2p/pending-orders` | -| [getP2pAllOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2286) | :closed_lock_with_key: | GET | `/api/v3/p2p/all-orders` | -| [getP2pOrderInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2292) | :closed_lock_with_key: | GET | `/api/v3/p2p/order-info` | -| [confirmP2pOrderPayment()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2298) | :closed_lock_with_key: | POST | `/api/v3/p2p/order-pay` | -| [releaseP2pOrderAsset()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2304) | :closed_lock_with_key: | POST | `/api/v3/p2p/order-release` | -| [getP2pUserInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2310) | :closed_lock_with_key: | GET | `/api/v3/p2p/user-info` | -| [getP2pCurrencies()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2314) | :closed_lock_with_key: | GET | `/api/v3/p2p/currencies` | -| [getP2pPayMethods()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2318) | :closed_lock_with_key: | GET | `/api/v3/p2p/pay-method` | -| [getP2pBalance()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2322) | :closed_lock_with_key: | GET | `/api/v3/p2p/balance` | -| [getEarnEliteProducts()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2334) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-product` | -| [getEarnEliteAssets()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2338) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-assets` | -| [getEarnEliteRecords()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2342) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-records` | -| [getEarnEliteSubscribeInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2348) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-subscribe-info` | -| [subscribeEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2354) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-subscribe` | -| [getEarnEliteSubscribeResult()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2360) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-subscribe-result` | -| [getEarnEliteRedeemInfo()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2366) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-redeem-info` | -| [redeemEarnElite()](https://github.com/tiagosiebler/bitget-api/blob/master/src/rest-client-v3.ts#L2372) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-redeem` | +| [getServerTime()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L480) | | GET | `/api/v3/public/time` | +| [getInstruments()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L497) | | GET | `/api/v3/market/instruments` | +| [getMarketFeeGroup()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L506) | | GET | `/api/v3/market/fee-group` | +| [getLiquidations()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L515) | | GET | `/api/v3/market/liquidations` | +| [getRpiSymbols()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L524) | | GET | `/api/v3/market/rpi-symbols` | +| [getRpiOrderBook()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L531) | | GET | `/api/v3/market/rpi-orderbook` | +| [getCashDividendRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L540) | | GET | `/api/v3/market/cash-dividend-records` | +| [getSpotWhaleFlow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L549) | | GET | `/api/v3/market/spot-whale-flow` | +| [getSpotFundFlow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L558) | | GET | `/api/v3/market/spot-fund-flow` | +| [getSpotNetFlow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L567) | | GET | `/api/v3/market/spot-net-flow` | +| [getMarginLongShort()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L576) | | GET | `/api/v3/market/margin-long-short` | +| [getMarginLoanGrowth()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L585) | | GET | `/api/v3/market/margin-loan-growth` | +| [getMarginIsolatedBorrow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L594) | | GET | `/api/v3/market/margin-isolated-borrow` | +| [getFuturesActiveBuySell()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L603) | | GET | `/api/v3/market/futures-active-buy-sell` | +| [getFuturesLongShort()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L612) | | GET | `/api/v3/market/futures-long-short` | +| [getFuturesPositionLongShort()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L621) | | GET | `/api/v3/market/futures-position-long-short` | +| [getFuturesAccountLongShort()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L630) | | GET | `/api/v3/market/futures-account-long-short` | +| [getMarketScoreWeights()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L639) | | GET | `/api/v3/market/score-weights` | +| [getTickers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L648) | | GET | `/api/v3/market/tickers` | +| [getOrderBook()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L655) | | GET | `/api/v3/market/orderbook` | +| [getFills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L664) | | GET | `/api/v3/market/fills` | +| [getProofOfReserves()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L673) | | GET | `/api/v3/market/proof-of-reserves` | +| [getOpenInterest()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L680) | | GET | `/api/v3/market/open-interest` | +| [getCandles()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L690) | | GET | `/api/v3/market/candles` | +| [getHistoryCandles()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L699) | | GET | `/api/v3/market/history-candles` | +| [getCurrentFundingRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L708) | | GET | `/api/v3/market/current-fund-rate` | +| [getHistoryFundingRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L717) | | GET | `/api/v3/market/history-fund-rate` | +| [getRiskReserve()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L726) | | GET | `/api/v3/market/risk-reserve` | +| [getRiskReserveHour()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L735) | | GET | `/api/v3/market/risk-reserve-hour` | +| [getRiskReserveAll()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L744) | | GET | `/api/v3/market/risk-reserve-all` | +| [getDiscountRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L753) | | GET | `/api/v3/market/discount-rate` | +| [getMarginLoans()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L760) | | GET | `/api/v3/market/margin-loans` | +| [getPositionTier()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L769) | | GET | `/api/v3/market/position-tier` | +| [getContractsOi()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L778) | | GET | `/api/v3/market/oi-limit` | +| [getIndexComponents()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L787) | | GET | `/api/v3/market/index-components` | +| [getRealityOrderBook()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L796) | :closed_lock_with_key: | GET | `/api/v3/account/reality-orderbook` | +| [getRealityFills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L805) | :closed_lock_with_key: | GET | `/api/v3/account/reality-fills` | +| [getCopyFuturesTradingPairs()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L822) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/trading-pairs` | +| [getCopyFuturesPositionSummary()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L833) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/position-summary` | +| [getCopyFuturesMaxTransferable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L843) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/max-transferable` | +| [copyFuturesTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L853) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/transfer` | +| [getCopyFuturesTransferRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L863) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/transfer-record` | +| [getCopyFuturesCurrentFollowers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L869) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/current-follower` | +| [getCopyFuturesHistoryFollowers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L875) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/history-follower` | +| [getCopyFuturesProfitSummary()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L881) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/profit-summary` | +| [getCopyFuturesProfitDetails()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L887) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/profit-details` | +| [getStockPlusOptionQuote()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L899) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/option-quote` | +| [getStockPlusOptionChainInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L905) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/option-chain-info` | +| [getStockPlusOptionExpiryDate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L914) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/option-expiry-date` | +| [getStockPlusOptionVolume()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L923) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/option-volume` | +| [getStockPlusStaticInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L929) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/static` | +| [getStockPlusQuote()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L935) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/quote` | +| [getStockPlusTradeDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L941) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/trade` | +| [getStockPlusIntraday()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L947) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/intraday` | +| [getStockPlusHistoryCandlestick()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L953) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/history-candlestick` | +| [getStockPlusCandlestick()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L962) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/candlestick` | +| [getStockPlusDepth()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L968) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/depth` | +| [placeStockPlusOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L974) | :closed_lock_with_key: | POST | `/api/v3/stockplus/trade/place-order` | +| [cancelStockPlusOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L980) | :closed_lock_with_key: | POST | `/api/v3/stockplus/trade/cancel-order` | +| [modifyStockPlusOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L986) | :closed_lock_with_key: | POST | `/api/v3/stockplus/trade/modify-order` | +| [getStockPlusTodayOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L992) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/today-orders` | +| [getStockPlusHistoryOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L998) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/history-orders` | +| [getStockPlusOrderDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1004) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/order-detail` | +| [getStockPlusTodayExecutions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1010) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/today-executions` | +| [getStockPlusHistoryExecutions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1016) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/history-executions` | +| [getStockPlusAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1025) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/account` | +| [getStockPlusCashFlow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1031) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/cash-flow` | +| [getStockPlusStockPosition()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1037) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/stock-position` | +| [stockPlusTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1043) | :closed_lock_with_key: | POST | `/api/v3/stockplus/asset/transfer` | +| [getStockPlusTransferRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1049) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/transfer-records` | +| [getBalances()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1064) | :closed_lock_with_key: | GET | `/api/v3/account/assets` | +| [getFundingAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1071) | :closed_lock_with_key: | GET | `/api/v3/account/funding-assets` | +| [getAccountInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1081) | :closed_lock_with_key: | GET | `/api/v3/account/info` | +| [getAccountSettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1089) | :closed_lock_with_key: | GET | `/api/v3/account/settings` | +| [adjustAccountMode()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1096) | :closed_lock_with_key: | POST | `/api/v3/account/adjust-account-mode` | +| [getDeltaInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1106) | :closed_lock_with_key: | GET | `/api/v3/account/delta-info` | +| [setLeverage()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1113) | :closed_lock_with_key: | POST | `/api/v3/account/set-leverage` | +| [setHoldMode()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1120) | :closed_lock_with_key: | POST | `/api/v3/account/set-hold-mode` | +| [getCollateralType()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1129) | :closed_lock_with_key: | GET | `/api/v3/account/collateral-type` | +| [setCollateralType()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1136) | :closed_lock_with_key: | POST | `/api/v3/account/set-collateral-type` | +| [getCustomCollateralCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1145) | | GET | `/api/v3/account/custom-collateral-coins` | +| [preSetLeverage()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1152) | :closed_lock_with_key: | GET | `/api/v3/account/pre-set-leverage` | +| [setMargin()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1161) | :closed_lock_with_key: | POST | `/api/v3/account/set-margin` | +| [getMaxWithdrawal()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1168) | :closed_lock_with_key: | GET | `/api/v3/account/max-withdrawal` | +| [getFinancialRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1177) | :closed_lock_with_key: | GET | `/api/v3/account/financial-records` | +| [getRepayableCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1189) | :closed_lock_with_key: | GET | `/api/v3/account/repayable-coins` | +| [getPaymentCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1201) | :closed_lock_with_key: | GET | `/api/v3/account/payment-coins` | +| [submitRepay()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1213) | :closed_lock_with_key: | POST | `/api/v3/account/repay` | +| [getConvertRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1220) | :closed_lock_with_key: | GET | `/api/v3/account/convert-records` | +| [setDepositAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1235) | :closed_lock_with_key: | POST | `/api/v3/account/deposit-account` | +| [switchDeduct()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1244) | :closed_lock_with_key: | POST | `/api/v3/account/switch-deduct` | +| [getDeductInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1251) | :closed_lock_with_key: | GET | `/api/v3/account/deduct-info` | +| [getFeeRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1262) | :closed_lock_with_key: | GET | `/api/v3/account/fee-rate` | +| [getAllFeeRates()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1274) | :closed_lock_with_key: | GET | `/api/v3/account/all-fee-rate` | +| [getMaxTransferable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1287) | :closed_lock_with_key: | GET | `/api/v3/account/max-transferable` | +| [getOpenInterestLimit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1299) | :closed_lock_with_key: | GET | `/api/v3/account/open-interest-limit` | +| [getEligibleSymbols()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1305) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-symbols` | +| [getEligibleMarginTier()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1311) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-margin-tier` | +| [getEligibleLoanInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1317) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-loan-info` | +| [downgradeAccountToClassic()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1332) | :closed_lock_with_key: | POST | `/api/v3/account/switch` | +| [getUnifiedAccountSwitchStatus()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1340) | :closed_lock_with_key: | GET | `/api/v3/account/switch-status` | +| [getTaxRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1356) | :closed_lock_with_key: | GET | `/api/v3/tax/records` | +| [createSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1371) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub` | +| [createAgentSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1380) | :closed_lock_with_key: | POST | `/api/v3/user/sub-account/agent-create` | +| [freezeSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1389) | :closed_lock_with_key: | POST | `/api/v3/user/freeze-sub` | +| [getSubUnifiedAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1398) | :closed_lock_with_key: | GET | `/api/v3/account/sub-unified-assets` | +| [getSubAccountList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1407) | :closed_lock_with_key: | GET | `/api/v3/user/sub-list` | +| [createSubAccountApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1420) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub-api` | +| [updateSubAccountApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1429) | :closed_lock_with_key: | POST | `/api/v3/user/update-sub-api` | +| [deleteSubAccountApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1438) | :closed_lock_with_key: | POST | `/api/v3/user/delete-sub-api` | +| [getSubAccountApiKeys()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1447) | :closed_lock_with_key: | GET | `/api/v3/user/sub-api-list` | +| [getRateLimitQuota()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1457) | :closed_lock_with_key: | GET | `/api/v3/user/rate-limit-quota` | +| [setRateLimitQuota()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1463) | :closed_lock_with_key: | POST | `/api/v3/user/set-rate-limit-quota` | +| [getTransferableCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1478) | :closed_lock_with_key: | GET | `/api/v3/account/transferable-coins` | +| [submitTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1487) | :closed_lock_with_key: | POST | `/api/v3/account/transfer` | +| [subAccountTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1496) | :closed_lock_with_key: | POST | `/api/v3/account/sub-transfer` | +| [getSubTransferRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1508) | :closed_lock_with_key: | GET | `/api/v3/account/sub-transfer-record` | +| [subMasterTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1520) | :closed_lock_with_key: | POST | `/api/v3/account/sub-master-transfer` | +| [getDepositAddress()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1538) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-address` | +| [getSubDepositAddress()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1547) | :closed_lock_with_key: | GET | `/api/v3/account/sub-deposit-address` | +| [getDepositRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1556) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-records` | +| [getSubDepositRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1565) | :closed_lock_with_key: | POST | `/api/v3/account/sub-deposit-records` | +| [submitWithdraw()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1580) | :closed_lock_with_key: | POST | `/api/v3/account/withdraw` | +| [getWithdrawRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1589) | :closed_lock_with_key: | GET | `/api/v3/account/withdrawal-records` | +| [getWithdrawAddressBook()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1598) | :closed_lock_with_key: | GET | `/api/v3/account/withdraw-address` | +| [cancelWithdrawal()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1607) | :closed_lock_with_key: | POST | `/api/v3/account/cancel-withdrawal` | +| [submitNewOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1622) | :closed_lock_with_key: | POST | `/api/v3/trade/place-order` | +| [modifyOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1631) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-order` | +| [placeRealityOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1640) | :closed_lock_with_key: | POST | `/api/v3/trade/place-reality-order` | +| [cancelRealityOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1649) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-reality-order` | +| [getLoanData()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1658) | :closed_lock_with_key: | GET | `/api/v3/trade/loan-data` | +| [cancelOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1665) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-order` | +| [placeBatchOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1674) | :closed_lock_with_key: | POST | `/api/v3/trade/place-batch` | +| [batchModifyOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1683) | :closed_lock_with_key: | POST | `/api/v3/trade/batch-modify-order` | +| [cancelBatchOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1692) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-batch` | +| [cancelAllOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1701) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-symbol-order` | +| [closeAllPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1710) | :closed_lock_with_key: | POST | `/api/v3/trade/close-positions` | +| [getOrderInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1719) | :closed_lock_with_key: | GET | `/api/v3/trade/order-info` | +| [getUnfilledOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1728) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-orders` | +| [getHistoryOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1740) | :closed_lock_with_key: | GET | `/api/v3/trade/history-orders` | +| [movePositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1752) | :closed_lock_with_key: | POST | `/api/v3/account/move-positions` | +| [getMovePositionHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1761) | :closed_lock_with_key: | GET | `/api/v3/account/move-position-history` | +| [getTradeFills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1773) | :closed_lock_with_key: | GET | `/api/v3/trade/fills` | +| [getCurrentPosition()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1785) | :closed_lock_with_key: | GET | `/api/v3/position/current-position` | +| [getPositionHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1796) | :closed_lock_with_key: | GET | `/api/v3/position/history-position` | +| [getMaxOpenAvailable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1808) | :closed_lock_with_key: | POST | `/api/v3/account/max-open-available` | +| [getPositionAdlRank()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1817) | :closed_lock_with_key: | GET | `/api/v3/position/adlRank` | +| [countdownCancelAll()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1824) | :closed_lock_with_key: | POST | `/api/v3/trade/countdown-cancel-all` | +| [getLoanTransfered()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1839) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/transfered` | +| [getLoanSymbols()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1848) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/symbols` | +| [getLoanRiskUnit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1857) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/risk-unit` | +| [getLoanRepaidHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1868) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/repaid-history` | +| [getLoanProductInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1877) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/product-infos` | +| [getLoanOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1886) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/loan-order` | +| [getLoanLTVConvert()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1895) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/ltv-convert` | +| [getLoanMarginCoinInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1904) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/ensure-coins-convert` | +| [bindLoanUid()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1916) | :closed_lock_with_key: | POST | `/api/v3/ins-loan/bind-uid` | +| [getLoanCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1931) | :closed_lock_with_key: | GET | `/api/v3/loan/coins` | +| [getLoanInterest()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1940) | :closed_lock_with_key: | GET | `/api/v3/loan/interest` | +| [loanBorrow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1949) | :closed_lock_with_key: | POST | `/api/v3/loan/borrow` | +| [getLoanBorrowOngoing()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1958) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-ongoing` | +| [getLoanBorrowHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1967) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-history` | +| [loanRepay()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1976) | :closed_lock_with_key: | POST | `/api/v3/loan/repay` | +| [getLoanRepayHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1985) | :closed_lock_with_key: | GET | `/api/v3/loan/repay-history` | +| [loanRevisePledge()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1994) | :closed_lock_with_key: | POST | `/api/v3/loan/revise-pledge` | +| [getLoanPledgeRateHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2003) | :closed_lock_with_key: | GET | `/api/v3/loan/pledge-rate-history` | +| [getLoanDebts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2012) | :closed_lock_with_key: | GET | `/api/v3/loan/debts` | +| [getLoanReduces()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2019) | :closed_lock_with_key: | GET | `/api/v3/loan/reduces` | +| [submitStrategyOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2034) | :closed_lock_with_key: | POST | `/api/v3/trade/place-strategy-order` | +| [modifyStrategyOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2043) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-strategy-order` | +| [cancelStrategyOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2052) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-strategy-order` | +| [getUnfilledStrategyOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2061) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-strategy-orders` | +| [getHistoryStrategyOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2070) | :closed_lock_with_key: | GET | `/api/v3/trade/history-strategy-orders` | +| [createBrokerSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2091) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub` | +| [getBrokerSubAccountList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2103) | :closed_lock_with_key: | GET | `/api/v3/broker/sub-list` | +| [modifyBrokerSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2115) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub` | +| [brokerSubWithdrawal()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2130) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-withdrawal` | +| [getBrokerSubDepositAddress()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2142) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-deposit-address` | +| [getBrokerAllSubDepositWithdrawal()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2154) | :closed_lock_with_key: | GET | `/api/v3/broker/all-sub-deposit-withdrawal` | +| [getBrokerCommission()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2166) | :closed_lock_with_key: | GET | `/api/v3/broker/commission` | +| [createBrokerSubApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2178) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub-apikey` | +| [modifyBrokerSubApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2190) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub-apikey` | +| [deleteBrokerSubApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2206) | :closed_lock_with_key: | POST | `/api/v3/broker/delete-sub-apikey` | +| [getBrokerSubApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2218) | :closed_lock_with_key: | GET | `/api/v3/broker/query-sub-apikey` | +| [getP2pAdList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2230) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-list` | +| [getP2pExchangeRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2236) | :closed_lock_with_key: | GET | `/api/v3/p2p/exchange-rate` | +| [simulateP2pFee()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2242) | :closed_lock_with_key: | POST | `/api/v3/p2p/fee-simulate` | +| [getP2pAdLimit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2248) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-limit` | +| [createP2pAd()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2254) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-create` | +| [updateP2pAd()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2260) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-update` | +| [operateP2pAd()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2264) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-operate` | +| [getP2pAdInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2268) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-info` | +| [getP2pMyAds()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2274) | :closed_lock_with_key: | GET | `/api/v3/p2p/my-ads` | +| [getP2pPendingOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2280) | :closed_lock_with_key: | GET | `/api/v3/p2p/pending-orders` | +| [getP2pAllOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2286) | :closed_lock_with_key: | GET | `/api/v3/p2p/all-orders` | +| [getP2pOrderInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2292) | :closed_lock_with_key: | GET | `/api/v3/p2p/order-info` | +| [confirmP2pOrderPayment()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2298) | :closed_lock_with_key: | POST | `/api/v3/p2p/order-pay` | +| [releaseP2pOrderAsset()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2304) | :closed_lock_with_key: | POST | `/api/v3/p2p/order-release` | +| [getP2pUserInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2310) | :closed_lock_with_key: | GET | `/api/v3/p2p/user-info` | +| [getP2pCurrencies()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2314) | :closed_lock_with_key: | GET | `/api/v3/p2p/currencies` | +| [getP2pPayMethods()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2318) | :closed_lock_with_key: | GET | `/api/v3/p2p/pay-method` | +| [getP2pBalance()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2322) | :closed_lock_with_key: | GET | `/api/v3/p2p/balance` | +| [getEarnEliteProducts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2334) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-product` | +| [getEarnEliteAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2338) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-assets` | +| [getEarnEliteRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2342) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-records` | +| [getEarnEliteSubscribeInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2348) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-subscribe-info` | +| [subscribeEarnElite()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2354) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-subscribe` | +| [getEarnEliteSubscribeResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2360) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-subscribe-result` | +| [getEarnEliteRedeemInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2366) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-redeem-info` | +| [redeemEarnElite()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2372) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-redeem` | # websocket-api-client.ts @@ -580,7 +580,7 @@ This client provides WebSocket API endpoints which allow for faster interactions | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | -| [submitNewOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/websocket-api-client.ts#L79) | | WS | `place-order` | -| [placeBatchOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/websocket-api-client.ts#L98) | | WS | `batch-place` | -| [cancelOrder()](https://github.com/tiagosiebler/bitget-api/blob/master/src/websocket-api-client.ts#L122) | | WS | `cancel-order` | -| [cancelBatchOrders()](https://github.com/tiagosiebler/bitget-api/blob/master/src/websocket-api-client.ts#L141) | | WS | `batch-cancel` | \ No newline at end of file +| [submitNewOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L79) | | WS | `place-order` | +| [placeBatchOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L98) | | WS | `batch-place` | +| [cancelOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L122) | | WS | `cancel-order` | +| [cancelBatchOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L141) | | WS | `batch-cancel` | \ No newline at end of file diff --git a/llms.txt b/llms.txt index 48aa7de..5091c9c 100644 --- a/llms.txt +++ b/llms.txt @@ -750,175 +750,6 @@ export interface GetMarginLiquidationOrdersRequestV2 { idLessThan?: string; } -================ -File: src/types/request/v3/stockplus.ts -================ -/** - * - * - * Stock+ (UTA) - * - * - */ -⋮---- -export interface GetStockPlusOptionQuoteRequestV3 { - symbol: string; -} -⋮---- -export interface GetStockPlusOptionChainInfoRequestV3 { - symbol: string; - expiryDate: string; -} -⋮---- -export interface GetStockPlusOptionExpiryDateRequestV3 { - symbol: string; -} -⋮---- -export interface GetStockPlusOptionVolumeRequestV3 { - symbol: string; -} -⋮---- -export interface GetStockPlusStaticInfoRequestV3 { - symbol: string; -} -⋮---- -export interface GetStockPlusQuoteRequestV3 { - symbol: string; -} -⋮---- -export interface GetStockPlusTradeDetailRequestV3 { - symbol: string; - count?: string; -} -⋮---- -export interface GetStockPlusIntradayRequestV3 { - symbol: string; -} -⋮---- -export interface GetStockPlusHistoryCandlestickRequestV3 { - symbol: string; - period: string; - count?: string; - adjustType?: string; - forward?: boolean; - time?: string; - tradeSessions?: string; -} -⋮---- -export interface GetStockPlusCandlestickRequestV3 { - symbol: string; - period: string; - count?: string; - adjustType?: string; - tradeSessions?: string; -} -⋮---- -export interface GetStockPlusDepthRequestV3 { - symbol: string; -} -⋮---- -export interface PlaceStockPlusOrderRequestV3 { - symbol: string; - orderType: 'LO' | 'MO' | 'LIT' | 'MIT' | 'TSLPAMT' | 'TSLPPCT'; - side: 'Buy' | 'Sell'; - submittedQuantity: string; - timeInForce: 'Day' | 'GoodTilCanceled' | 'GoodTilDate'; - submittedPrice?: string; - triggerPrice?: string; - limitOffset?: string; - trailingAmount?: string; - trailingPercent?: string; - expireDate?: string; - outsideRth?: 'RTHOnly' | 'AnyTime' | 'Overnight'; - limitDepthLevel?: number; - triggerCount?: number; - monitorPrice?: string; - remark?: string; -} -⋮---- -export interface CancelStockPlusOrderRequestV3 { - symbol: string; - orderId?: string; - clientOid?: string; -} -⋮---- -export interface ModifyStockPlusOrderRequestV3 { - orderId: string; - quantity: string; - price?: string; - triggerPrice?: string; - limitOffset?: string; - trailingAmount?: string; - trailingPercent?: string; - limitDepthLevel?: number; - triggerCount?: number; - monitorPrice?: string; - remark?: string; -} -⋮---- -export interface GetStockPlusTodayOrdersRequestV3 { - symbol?: string; - status?: string | string[]; - side?: string; - market?: string; - orderId?: string; -} -⋮---- -export interface GetStockPlusHistoryOrdersRequestV3 { - symbol?: string; - status?: string | string[]; - side?: string; - market?: string; - startAt?: string; - endAt?: string; -} -⋮---- -export interface GetStockPlusOrderDetailRequestV3 { - orderId: string; -} -⋮---- -export interface GetStockPlusTodayExecutionsRequestV3 { - symbol?: string; - orderId?: string; -} -⋮---- -export interface GetStockPlusHistoryExecutionsRequestV3 { - symbol?: string; - startAt?: string; - endAt?: string; -} -⋮---- -export interface GetStockPlusAccountRequestV3 { - currency?: string; -} -⋮---- -export interface GetStockPlusCashFlowRequestV3 { - startTime: string; - endTime: string; - businessType?: string; - symbol?: string; - page?: string; - size?: string; -} -⋮---- -export interface GetStockPlusStockPositionRequestV3 { - symbol?: string; -} -⋮---- -export interface StockPlusTransferRequestV3 { - coin?: string; - amount?: string; - direction?: 'in' | 'out'; -} -⋮---- -export interface GetStockPlusTransferRecordsRequestV3 { - transferId?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; -} - ================ File: src/types/request/shared.ts ================ @@ -1701,944 +1532,594 @@ export interface MarginLiquidationOrderV2 { } ================ -File: src/types/response/v3/stockplus.ts +File: src/types/websockets/ws-api-response.ts ================ -/** - * - * - * Stock+ (UTA) - * - * - */ -⋮---- -export interface StockPlusOptionQuoteItemV3 { +export interface WSAPIPlaceOrderResponseV3 { symbol: string; - lastDone: string; - prevClose: string; - open: string; - high: string; - low: string; - timestamp: string; - volume: string; - turnover: string; - tradeStatus: string; - impliedVolatility: string; - openInterest: string; - expiryDate: string; - strikePrice: string; - contractMultipier: string; - contractType: string; - contractSize: string; - direction: string; - historicalVolatility: string; - underlyingSymbol: string; -} -⋮---- -export interface StockPlusOptionQuoteV3 { - secuQuote: StockPlusOptionQuoteItemV3[]; + orderId: string; + clientOid: string; + cTime: string; } + +================ +File: src/websocket-api-client.ts +================ +import { CancelOrderRequestV3 } from './types/request/v3/trade.js'; +import { CancelOrderResponseV3 } from './types/response/v3/trade.js'; +import { WSAPIResponse } from './types/websockets/ws-api.js'; +import { WSAPIPlaceOrderRequestV3 } from './types/websockets/ws-api-request.js'; +import { WSAPIPlaceOrderResponseV3 } from './types/websockets/ws-api-response.js'; +import { + BitgetInstTypeV3, + WSClientConfigurableOptions, +} from './types/websockets/ws-general.js'; +import { DefaultLogger } from './util/logger.js'; +import { WS_KEY_MAP } from './util/websocket-util.js'; +import { WebsocketClientV3 } from './websocket-client-v3.js'; ⋮---- -export interface StockPlusOptionStrikePriceInfoV3 { - price: string; - callSymbol: string; - putSymbol: string; - standard: boolean; +/** + * Configurable options specific to only the REST-like WebsocketAPIClient + */ +export interface WSAPIClientConfigurableOptions { + /** + * Default: true + * + * Attach default event listeners, which will console log any high level + * events (opened/reconnecting/reconnected/etc). + * + * If you disable this, you should set your own event listeners + * on the embedded WS Client `wsApiClient.getWSClient().on(....)`. + */ + attachEventListeners: boolean; } ⋮---- -export interface StockPlusOptionChainInfoV3 { - strikePriceInfo: StockPlusOptionStrikePriceInfoV3[]; -} +/** + * Default: true + * + * Attach default event listeners, which will console log any high level + * events (opened/reconnecting/reconnected/etc). + * + * If you disable this, you should set your own event listeners + * on the embedded WS Client `wsApiClient.getWSClient().on(....)`. + */ ⋮---- -export interface StockPlusOptionExpiryDateV3 { - expiryDate: string[]; -} +/** + * This is a minimal Websocket API wrapper around the WebsocketClient. + * + * Note: You can also directly use the sendWSAPIRequest() method to make WS API calls, but some + * may find the below methods slightly more intuitive. + * + * Refer to the WS API promises example for a more detailed example on using sendWSAPIRequest() directly: + * https://github.com/tiagosiebler/bitget-api/blob/master/examples/V3/ws-api-trade-raw.ts + */ +export class WebsocketAPIClient ⋮---- -export interface StockPlusOptionVolumeV3 { - c: string; - p: string; -} +constructor( + options?: WSClientConfigurableOptions & + Partial, + logger?: DefaultLogger, +) ⋮---- -export interface StockPlusStaticInfoItemV3 { - symbol: string; - nameCn: string; - nameEn: string; - exchange: string; - currency: string; - lotSize: number | string; - totalShares: string | number; - circulatingShares: string | number; - eps: string | number; - epsTtm: string | number; - bps: string | number; - dividendYield: string | number; - stockDerivatives: string[]; - board: string; -} +public getWSClient(): WebsocketClientV3 ⋮---- -export interface StockPlusStaticInfoV3 { - list: StockPlusStaticInfoItemV3[]; -} +public setTimeOffsetMs(newOffset: number): void ⋮---- -export interface StockPlusSessionQuoteV3 { - lastDone: string | number; - timestamp: string; - volume: string | number; - turnover: string | number; - high: string | number; - low: string | number; - prevClose: string | number; -} +/* + * Bitget WebSocket API Methods + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel + */ ⋮---- -export interface StockPlusQuoteItemV3 { - symbol: string; - lastDone: string | number; - prevClose: string | number; - open: string | number; - high: string | number; - low: string | number; - timestamp: string; - volume: string | number; - turnover: string | number; - tradeStatus: string; - preMarketQuote?: StockPlusSessionQuoteV3 | null; - postMarketQuote?: StockPlusSessionQuoteV3 | null; - overnightQuote?: StockPlusSessionQuoteV3 | null; -} +/** + * Submit a new order + * + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel + * + * @returns + */ +submitNewOrder( + category: BitgetInstTypeV3, + params: WSAPIPlaceOrderRequestV3, +): Promise> ⋮---- -export interface StockPlusQuoteV3 { - list: StockPlusQuoteItemV3[]; -} +/** + * Submit a new order + * + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel + * + * @returns + */ +placeBatchOrders( + category: BitgetInstTypeV3, + params: WSAPIPlaceOrderRequestV3[], +): Promise> ⋮---- -export interface StockPlusTradeDetailItemV3 { - price: string | number; - volume: string | number; - timestamp: string; - tradeType: string; - direction: string; - tradeSession: string; -} +/* + * Bitget WebSocket API Methods + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel + */ ⋮---- -export type StockPlusTradeDetailV3 = StockPlusTradeDetailItemV3[]; +/** + * Cancel Order + * + * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel + * + * @returns + */ +cancelOrder( + category: BitgetInstTypeV3, + params: CancelOrderRequestV3, +): Promise> ⋮---- -export interface StockPlusIntradayItemV3 { - price: string | number; - timestamp: string; - volume: string | number; - turnover: string | number; - avgPrice: string | number; -} +/** + * Batch Cancel Order + * + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel + * + * @returns + */ +cancelBatchOrders( + category: BitgetInstTypeV3, + params: CancelOrderRequestV3[], +): Promise> ⋮---- -export interface StockPlusIntradayV3 { - list: StockPlusIntradayItemV3[]; -} +/** + * + * + * + * + * + * + * + * Private methods for handling some of the convenience/automation provided by the WS API Client + * + * + * + * + * + * + * + */ ⋮---- -export interface StockPlusCandlestickItemV3 { - close: string; - open: string; - low: string; - high: string; - volume: string; - turnover: string; - timestamp: string; - tradeSession: string; -} +private setupDefaultEventListeners() ⋮---- -export interface StockPlusCandlestickV3 { - list: StockPlusCandlestickItemV3[]; -} +/** + * General event handlers for monitoring the WebsocketClient + */ ⋮---- -export type StockPlusHistoryCandlestickV3 = StockPlusCandlestickV3; +// Blind JSON.stringify can fail on circular references ⋮---- -export interface StockPlusDepthLevelV3 { - position: number; - price: string; - volume: string; - orderNum: number; -} +// JSON.stringify({ ...data, target: 'WebSocket' }), + +================ +File: src/websocket-client-v2.ts +================ +import { + WSOperation, + WSOperationLoginParams, + WsRequestOperationBitget, +} from './types/websockets/ws-api.js'; +import { MessageEventLike } from './types/websockets/ws-events.js'; +import { + BitgetInstTypeV2, + WsKey, + WsTopicV2, +} from './types/websockets/ws-general.js'; +import { + BaseWebsocketClient, + EmittableEvent, + MidflightWsRequestEvent, +} from './util/BaseWSClient.js'; +import { isWsPong } from './util/requestUtils.js'; +import { + SignAlgorithm, + SignEncodeMethod, + signMessage, +} from './util/webCryptoAPI.js'; +import { + getMaxTopicsPerSubscribeEvent, + getNormalisedTopicRequests, + getWsUrl, + isPrivateChannel, + WS_AUTH_ON_CONNECT_KEYS, + WS_KEY_MAP, + WsTopicRequest, +} from './util/websocket-util.js'; +import { WSConnectedResult } from './util/WsStore.types.js'; ⋮---- -export interface StockPlusDepthV3 { - asks: StockPlusDepthLevelV3[]; - bids: StockPlusDepthLevelV3[]; -} +export class WebsocketClientV2 extends BaseWebsocketClient< ⋮---- -export interface StockPlusPlaceOrderResponseV3 { - orderId: string; - clientOid: string; - symbol: string; -} +WsRequestOperationBitget // subscribe requests have an "args" parameter with an object within ⋮---- -export type StockPlusCancelOrderResponseV3 = StockPlusPlaceOrderResponseV3; -export type StockPlusModifyOrderResponseV3 = StockPlusPlaceOrderResponseV3; +/** + * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library + */ +public connectAll(): Promise[] ⋮---- -export interface StockPlusOrderV3 { - orderId: string; - status: string; - stockName: string; - quantity: string | number; - executedQuantity: string | number; - price: string | number | null; - executedPrice: string | number | null; - submittedAt: string; - side: string; - symbol: string; - orderType: string; - lastDone: string | number | null; - triggerPrice: string | number | null; - msg: string; - tag: string; - timeInForce: string; - expireDate: string | null; - updatedAt: string | null; - triggerAt: string | null; - trailingAmount: string | number | null; - trailingPercent: string | number | null; - limitOffset: string | number | null; - triggerStatus: string | null; - currency: string; - outsideRth: string; - remark?: string; - limitDepthLevel: number | null; - triggerCount: number | null; - monitorPrice: string | null; -} +/** Some private channels use `coin` instead of `instId`. This method handles building the sub/unsub request */ +private getSubRequest( + instType: BitgetInstTypeV2, + topic: WsTopicV2, + coin: string = 'default', +): WsTopicRequest ⋮---- -export interface StockPlusOrdersV3 { - orders: StockPlusOrderV3[]; -} +/** + * Subscribe to a topic + * @param instType instrument type (refer to API docs). + * @param topic topic name (e.g. "ticker"). + * @param instId instrument ID (e.g. "BTCUSDT"). Use "default" for private topics. + */ +public subscribeTopic( + instType: BitgetInstTypeV2, + topic: WsTopicV2, + coin: string = 'default', +) ⋮---- -export interface StockPlusHistoryOrdersV3 { - hasMore: boolean; - orders: StockPlusOrderV3[]; -} +/** + * Unsubscribe from a topic + * @param instType instrument type (refer to API docs). + * @param topic topic name (e.g. "ticker"). + * @param instId instrument ID (e.g. "BTCUSDT"). Use "default" for private topics to get all symbols. + */ +public unsubscribeTopic( + instType: BitgetInstTypeV2, + topic: WsTopicV2, + coin: string = 'default', +) ⋮---- -export interface StockPlusOrderHistoryItemV3 { - price: string | number; - quantity: string | number; - status: string; - msg: string; - time: string; -} +/** + * 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: CategoryV5}. + * + * - 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 | WsTopicV2) + | (WsTopicRequest | WsTopicV2)[], + wsKey: WsKey, +): Promise ⋮---- -export interface StockPlusChargeFeeItemV3 { - code: string; - name: string; - amount: number | string; - currency: string; -} +/** + * 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 | WsTopicV2) + | (WsTopicRequest | WsTopicV2)[], + wsKey: WsKey, +) ⋮---- -export interface StockPlusChargeCategoryV3 { - code: string; - name: string; - fees: StockPlusChargeFeeItemV3[]; -} +/** + * + * + * Internal methods required to integrate with the BaseWSClient + * + * + */ ⋮---- -export interface StockPlusChargeDetailV3 { - totalAmount: number | string; - currency: string; - items: StockPlusChargeCategoryV3[]; -} +protected sendPingEvent(wsKey: WsKey): void ⋮---- -export interface StockPlusOrderDetailV3 extends StockPlusOrderV3 { - freeStatus?: string; - freeAmount?: string | null; - freeCurrency?: string | null; - deductionsStatus?: string; - deductionsAmount?: string | null; - deductionsCurrency?: string | null; - platformDeductedStatus?: string; - platformDeductedAmount?: string | null; - platformDeductedCurrency?: string | null; - history?: StockPlusOrderHistoryItemV3[]; - chargeDetail?: StockPlusChargeDetailV3; -} +protected sendPongEvent(wsKey: WsKey): void ⋮---- -export interface StockPlusExecutionV3 { - orderId: string; - tradeId: string; - symbol: string; - tradeDoneAt: string; - quantity: number | string; - price: number | string; -} +protected isWsPing(data: any): boolean ⋮---- -export interface StockPlusTodayExecutionsV3 { - trades: StockPlusExecutionV3[]; -} +protected isWsPong(data: any): boolean ⋮---- -export interface StockPlusHistoryExecutionsV3 { - hasMore: boolean; - trades: StockPlusExecutionV3[]; -} +protected isPrivateTopicRequest( + _request: WsTopicRequest, + wsKey: WsKey, +): boolean ⋮---- -export interface StockPlusCashInfoV3 { - withdrawCash: number | string; - availableCash: number | string; - frozenCash: number | string; - settlingCash: number | string; - currency: string; -} +protected getPrivateWSKeys(): WsKey[] ⋮---- -export interface StockPlusFrozenTransactionFeeV3 { - currency?: string; - amount?: number | string; - [key: string]: unknown; -} +protected isAuthOnConnectWsKey(wsKey: WsKey): boolean ⋮---- -export interface StockPlusAccountItemV3 { - totalCash: number | string; - maxFinanceAmount: number | string; - remainingFinanceAmount: number | string; - riskLevel: number | string; - marginCall: number | string; - netAssets: number | string; - initMargin: number | string; - maintenanceMargin: number | string; - currency: string; - buyPower: number | string; - cashInfos: StockPlusCashInfoV3[]; - frozenTransactionFees: StockPlusFrozenTransactionFeeV3[]; -} +protected async getWsUrl(wsKey: WsKey): Promise ⋮---- -export interface StockPlusAccountV3 { - list: StockPlusAccountItemV3[]; -} +protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null ⋮---- -export interface StockPlusCashFlowItemV3 { - transactionFlowName: string; - direction: string; - businessType: string; - balance: number | string; - currency: string; - businessTime: string; - symbol: string | null; - description: string; -} +/** + * @returns one or more correctly structured request events for performing a operations over WS. This can vary per exchange spec. + */ +protected async getWsRequestEvents( + operation: WSOperation, + requests: WsTopicRequest[], +): Promise>[]> ⋮---- -export interface StockPlusCashFlowV3 { - list: StockPlusCashFlowItemV3[]; -} +// Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values ⋮---- -export interface StockPlusPositionItemV3 { - symbol: string; - symbolName: string; - quantity: number | string; - availableQuantity: number | string; - currency: string; - costPrice: number | string; - market: string; - initQuantity: number | string; -} +/** + { + "op":"subscribe", + "args":[ + { + "instType":"SPOT", + "channel":"ticker", + "instId":"BTCUSDT" + }, + { + "instType":"SPOT", + "channel":"candle5m", + "instId":"BTCUSDT" + } + ] + } + */ ⋮---- -export interface StockPlusPositionChannelV3 { - accountChannel: string; - positions: StockPlusPositionItemV3[]; -} +// const request = { +// topic: 'ticker', +// payload: { instType: 'SPOT', instId: 'BTCUSDT' }, +// }; +// becomes: +// const request = { +// channel: 'ticker', +// instType: 'SPOT', +// instId: 'BTCUSDT', +// }; ⋮---- -export interface StockPlusStockPositionV3 { - channels: StockPlusPositionChannelV3[]; -} +private async getWsAuthSignature( + wsKey: WsKey, +): Promise< ⋮---- -export interface StockPlusTransferResponseV3 { - transferId: string; -} +private async signMessage( + paramsStr: string, + secret: string, + method: SignEncodeMethod, + algorithm: SignAlgorithm, +): Promise ⋮---- -export interface StockPlusTransferRecordsV3 { - transferId: string; - coin: string; - amount: string; - direction: string; - cursor: string; +protected async getWsAuthRequestEvent( + wsKey: WsKey, +): Promise> +⋮---- +/** + * Abstraction called to sort ws events into emittable event types (response to a request, data update, etc) + */ +protected resolveEmittableEvents( + wsKey: WsKey, + event: MessageEventLike, +): EmittableEvent[] +⋮---- +// v2 event processing +⋮---- +// v2 authentication event +⋮---- +// messageType: typeof msg, +// messageString: JSON.stringify(msg), +⋮---- +// messageType: typeof msg, +// messageString: JSON.stringify(msg), +⋮---- +// fallback emit anyway +⋮---- +/** + * @deprecrated not supported by Bitget's V2 API offering + */ +async sendWSAPIRequest(): Promise + +================ +File: .eslintrc.cjs +================ +// 'no-unused-vars': ['warn'], + +================ +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 +bundleReport.html +.history/ +tiagoSpot.ts +restClientRegex.ts +localtest.sh +privaterepotracker +testfile.ts +dist +repomix.sh +coverage + +================ +File: .jshintrc +================ +{ + "esversion": 8, + "asi": true, + "laxbreak": true, + "predef": [ "-Promise" ] } ================ -File: src/types/websockets/ws-api-response.ts +File: .prettierrc ================ -export interface WSAPIPlaceOrderResponseV3 { - symbol: string; - orderId: string; - clientOid: string; - cTime: string; +{ + "tabWidth": 2, + "singleQuote": true, + "trailingComma": "all" } ================ -File: src/websocket-api-client.ts +File: jest.config.ts ================ -import { CancelOrderRequestV3 } from './types/request/v3/trade.js'; -import { CancelOrderResponseV3 } from './types/response/v3/trade.js'; -import { WSAPIResponse } from './types/websockets/ws-api.js'; -import { WSAPIPlaceOrderRequestV3 } from './types/websockets/ws-api-request.js'; -import { WSAPIPlaceOrderResponseV3 } from './types/websockets/ws-api-response.js'; -import { - BitgetInstTypeV3, - WSClientConfigurableOptions, -} from './types/websockets/ws-general.js'; -import { DefaultLogger } from './util/logger.js'; -import { WS_KEY_MAP } from './util/websocket-util.js'; -import { WebsocketClientV3 } from './websocket-client-v3.js'; -⋮---- /** - * Configurable options specific to only the REST-like WebsocketAPIClient + * For a detailed explanation regarding each configuration property, visit: + * https://jestjs.io/docs/configuration */ -export interface WSAPIClientConfigurableOptions { - /** - * Default: true - * - * Attach default event listeners, which will console log any high level - * events (opened/reconnecting/reconnected/etc). - * - * If you disable this, you should set your own event listeners - * on the embedded WS Client `wsApiClient.getWSClient().on(....)`. - */ - attachEventListeners: boolean; -} ⋮---- -/** - * Default: true - * - * Attach default event listeners, which will console log any high level - * events (opened/reconnecting/reconnected/etc). - * - * If you disable this, you should set your own event listeners - * on the embedded WS Client `wsApiClient.getWSClient().on(....)`. - */ +import type { Config } from 'jest'; ⋮---- -/** - * This is a minimal Websocket API wrapper around the WebsocketClient. - * - * Note: You can also directly use the sendWSAPIRequest() method to make WS API calls, but some - * may find the below methods slightly more intuitive. - * - * Refer to the WS API promises example for a more detailed example on using sendWSAPIRequest() directly: - * https://github.com/tiagosiebler/bitget-api/blob/master/examples/V3/ws-api-trade-raw.ts - */ -export class WebsocketAPIClient +// All imported modules in your tests should be mocked automatically +// automock: false, ⋮---- -constructor( - options?: WSClientConfigurableOptions & - Partial, - logger?: DefaultLogger, -) +// Stop running tests after `n` failures +// bail: 0, +bail: false, // enable to stop test when an error occur, ⋮---- -public getWSClient(): WebsocketClientV3 +// The directory where Jest should store its cached dependency information +// cacheDirectory: "/private/var/folders/kf/2k3sz4px6c9cbyzj1h_b192h0000gn/T/jest_dx", ⋮---- -public setTimeOffsetMs(newOffset: number): void +// Automatically clear mock calls, instances, contexts and results before every test ⋮---- -/* - * Bitget WebSocket API Methods - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel - */ +// Indicates whether the coverage information should be collected while executing the test ⋮---- -/** - * Submit a new order - * - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel - * - * @returns - */ -submitNewOrder( - category: BitgetInstTypeV3, - params: WSAPIPlaceOrderRequestV3, -): Promise> +// An array of glob patterns indicating a set of files for which coverage information should be collected ⋮---- -/** - * Submit a new order - * - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel - * - * @returns - */ -placeBatchOrders( - category: BitgetInstTypeV3, - params: WSAPIPlaceOrderRequestV3[], -): Promise> +// The directory where Jest should output its coverage files ⋮---- -/* - * Bitget WebSocket API Methods - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel - */ +// An array of regexp pattern strings used to skip coverage collection +// coveragePathIgnorePatterns: [ +// "/node_modules/" +// ], ⋮---- -/** - * Cancel Order - * - * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel - * - * @returns - */ -cancelOrder( - category: BitgetInstTypeV3, - params: CancelOrderRequestV3, -): Promise> +// Indicates which provider should be used to instrument code for coverage ⋮---- -/** - * Batch Cancel Order - * - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel - * - * @returns - */ -cancelBatchOrders( - category: BitgetInstTypeV3, - params: CancelOrderRequestV3[], -): Promise> +// A list of reporter names that Jest uses when writing coverage reports +// coverageReporters: [ +// "json", +// "text", +// "lcov", +// "clover" +// ], ⋮---- -/** - * - * - * - * - * - * - * - * Private methods for handling some of the convenience/automation provided by the WS API Client - * - * - * - * - * - * - * - */ +// An object that configures minimum threshold enforcement for coverage results +// coverageThreshold: undefined, ⋮---- -private setupDefaultEventListeners() +// A path to a custom dependency extractor +// dependencyExtractor: undefined, ⋮---- -/** - * General event handlers for monitoring the WebsocketClient - */ +// Make calling deprecated APIs throw helpful error messages +// errorOnDeprecated: false, ⋮---- -// Blind JSON.stringify can fail on circular references +// The default configuration for fake timers +// fakeTimers: { +// "enableGlobally": false +// }, ⋮---- -// JSON.stringify({ ...data, target: 'WebSocket' }), - -================ -File: src/websocket-client-v2.ts -================ -import { - WSOperation, - WSOperationLoginParams, - WsRequestOperationBitget, -} from './types/websockets/ws-api.js'; -import { MessageEventLike } from './types/websockets/ws-events.js'; -import { - BitgetInstTypeV2, - WsKey, - WsTopicV2, -} from './types/websockets/ws-general.js'; -import { - BaseWebsocketClient, - EmittableEvent, - MidflightWsRequestEvent, -} from './util/BaseWSClient.js'; -import { isWsPong } from './util/requestUtils.js'; -import { - SignAlgorithm, - SignEncodeMethod, - signMessage, -} from './util/webCryptoAPI.js'; -import { - getMaxTopicsPerSubscribeEvent, - getNormalisedTopicRequests, - getWsUrl, - isPrivateChannel, - WS_AUTH_ON_CONNECT_KEYS, - WS_KEY_MAP, - WsTopicRequest, -} from './util/websocket-util.js'; -import { WSConnectedResult } from './util/WsStore.types.js'; +// Force coverage collection from ignored files using an array of glob patterns +// forceCoverageMatch: [], ⋮---- -export class WebsocketClientV2 extends BaseWebsocketClient< +// A path to a module which exports an async function that is triggered once before all test suites +// globalSetup: undefined, ⋮---- -WsRequestOperationBitget // subscribe requests have an "args" parameter with an object within +// A path to a module which exports an async function that is triggered once after all test suites +// globalTeardown: undefined, ⋮---- -/** - * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library - */ -public connectAll(): Promise[] +// A set of global variables that need to be available in all test environments +// globals: {}, ⋮---- -/** Some private channels use `coin` instead of `instId`. This method handles building the sub/unsub request */ -private getSubRequest( - instType: BitgetInstTypeV2, - topic: WsTopicV2, - coin: string = 'default', -): WsTopicRequest +// 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%", ⋮---- -/** - * Subscribe to a topic - * @param instType instrument type (refer to API docs). - * @param topic topic name (e.g. "ticker"). - * @param instId instrument ID (e.g. "BTCUSDT"). Use "default" for private topics. - */ -public subscribeTopic( - instType: BitgetInstTypeV2, - topic: WsTopicV2, - coin: string = 'default', -) +// An array of directory names to be searched recursively up from the requiring module's location +// moduleDirectories: [ +// "node_modules" +// ], ⋮---- -/** - * Unsubscribe from a topic - * @param instType instrument type (refer to API docs). - * @param topic topic name (e.g. "ticker"). - * @param instId instrument ID (e.g. "BTCUSDT"). Use "default" for private topics to get all symbols. - */ -public unsubscribeTopic( - instType: BitgetInstTypeV2, - topic: WsTopicV2, - coin: string = 'default', -) +// An array of file extensions your modules use ⋮---- -/** - * 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: CategoryV5}. - * - * - 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 | WsTopicV2) - | (WsTopicRequest | WsTopicV2)[], - wsKey: WsKey, -): Promise +// modulePaths: ['src'], ⋮---- -/** - * 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 | WsTopicV2) - | (WsTopicRequest | WsTopicV2)[], - wsKey: WsKey, -) +// 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: {}, ⋮---- -/** - * - * - * Internal methods required to integrate with the BaseWSClient - * - * - */ +// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader +// modulePathIgnorePatterns: [], ⋮---- -protected sendPingEvent(wsKey: WsKey): void +// Activates notifications for test results +// notify: false, ⋮---- -protected sendPongEvent(wsKey: WsKey): void +// An enum that specifies notification mode. Requires { notify: true } +// notifyMode: "failure-change", ⋮---- -protected isWsPing(data: any): boolean +// A preset that is used as a base for Jest's configuration +// preset: undefined, ⋮---- -protected isWsPong(data: any): boolean +// Run tests from one or more projects +// projects: undefined, ⋮---- -protected isPrivateTopicRequest( - _request: WsTopicRequest, - wsKey: WsKey, -): boolean +// Use this configuration option to add custom reporters to Jest +// reporters: undefined, ⋮---- -protected getPrivateWSKeys(): WsKey[] +// Automatically reset mock state before every test +// resetMocks: false, ⋮---- -protected isAuthOnConnectWsKey(wsKey: WsKey): boolean +// Reset the module registry before running each individual test +// resetModules: false, ⋮---- -protected async getWsUrl(wsKey: WsKey): Promise +// A path to a custom resolver +// resolver: undefined, ⋮---- -protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null +// Automatically restore mock state and implementation before every test +// restoreMocks: false, ⋮---- -/** - * @returns one or more correctly structured request events for performing a operations over WS. This can vary per exchange spec. - */ -protected async getWsRequestEvents( - operation: WSOperation, - requests: WsTopicRequest[], -): Promise>[]> +// The root directory that Jest should scan for tests and modules within +// rootDir: undefined, ⋮---- -// Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values +// A list of paths to directories that Jest should use to search for files in +// roots: [ +// "" +// ], ⋮---- -/** - { - "op":"subscribe", - "args":[ - { - "instType":"SPOT", - "channel":"ticker", - "instId":"BTCUSDT" - }, - { - "instType":"SPOT", - "channel":"candle5m", - "instId":"BTCUSDT" - } - ] - } - */ +// Allows you to use a custom runner instead of Jest's default test runner +// runner: "jest-runner", ⋮---- -// const request = { -// topic: 'ticker', -// payload: { instType: 'SPOT', instId: 'BTCUSDT' }, -// }; -// becomes: -// const request = { -// channel: 'ticker', -// instType: 'SPOT', -// instId: 'BTCUSDT', -// }; +// The paths to modules that run some code to configure or set up the testing environment before each test +// setupFiles: [], ⋮---- -private async getWsAuthSignature( - wsKey: WsKey, -): Promise< +// A list of paths to modules that run some code to configure or set up the testing framework before each test +// setupFilesAfterEnv: [], ⋮---- -private async signMessage( - paramsStr: string, - secret: string, - method: SignEncodeMethod, - algorithm: SignAlgorithm, -): Promise +// The number of seconds after which a test is considered as slow and reported as such in the results. +// slowTestThreshold: 5, ⋮---- -protected async getWsAuthRequestEvent( - wsKey: WsKey, -): Promise> +// A list of paths to snapshot serializer modules Jest should use for snapshot testing +// snapshotSerializers: [], ⋮---- -/** - * Abstraction called to sort ws events into emittable event types (response to a request, data update, etc) - */ -protected resolveEmittableEvents( - wsKey: WsKey, - event: MessageEventLike, -): EmittableEvent[] +// The test environment that will be used for testing +// testEnvironment: "jest-environment-node", ⋮---- -// v2 event processing +// Options that will be passed to the testEnvironment +// testEnvironmentOptions: {}, ⋮---- -// v2 authentication event +// Adds a location field to test results +// testLocationInResults: false, ⋮---- -// messageType: typeof msg, -// messageString: JSON.stringify(msg), +// The glob patterns Jest uses to detect test files ⋮---- -// messageType: typeof msg, -// messageString: JSON.stringify(msg), +// "**/__tests__/**/*.[jt]s?(x)", ⋮---- -// fallback emit anyway -⋮---- -/** - * @deprecrated not supported by Bitget's V2 API offering - */ -async sendWSAPIRequest(): Promise - -================ -File: .eslintrc.cjs -================ -// 'no-unused-vars': ['warn'], - -================ -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 -bundleReport.html -.history/ -tiagoSpot.ts -restClientRegex.ts -localtest.sh -privaterepotracker -testfile.ts -dist -repomix.sh -coverage - -================ -File: .jshintrc -================ -{ - "esversion": 8, - "asi": true, - "laxbreak": true, - "predef": [ "-Promise" ] -} - -================ -File: .prettierrc -================ -{ - "tabWidth": 2, - "singleQuote": true, - "trailingComma": "all" -} - -================ -File: jest.config.ts -================ -/** - * For a detailed explanation regarding each configuration property, visit: - * https://jestjs.io/docs/configuration - */ -⋮---- -import type { Config } from 'jest'; -⋮---- -// All imported modules in your tests should be mocked automatically -// automock: false, -⋮---- -// Stop running tests after `n` failures -// bail: 0, -bail: false, // enable to stop test when an error occur, -⋮---- -// The directory where Jest should store its cached dependency information -// cacheDirectory: "/private/var/folders/kf/2k3sz4px6c9cbyzj1h_b192h0000gn/T/jest_dx", -⋮---- -// Automatically clear mock calls, instances, contexts and results before every test -⋮---- -// Indicates whether the coverage information should be collected while executing the test -⋮---- -// An array of glob patterns indicating a set of files for which coverage information should be collected -⋮---- -// The directory where Jest should output its coverage files -⋮---- -// An array of regexp pattern strings used to skip coverage collection -// coveragePathIgnorePatterns: [ -// "/node_modules/" -// ], -⋮---- -// Indicates which provider should be used to instrument code for coverage -⋮---- -// 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, -⋮---- -// A path to a custom dependency extractor -// dependencyExtractor: undefined, -⋮---- -// Make calling deprecated APIs throw helpful error messages -// errorOnDeprecated: false, -⋮---- -// The default configuration for fake timers -// fakeTimers: { -// "enableGlobally": false -// }, -⋮---- -// Force coverage collection from ignored files using an array of glob patterns -// forceCoverageMatch: [], -⋮---- -// A path to a module which exports an async function that is triggered once before all test suites -// globalSetup: undefined, -⋮---- -// A path to a module which exports an async function that is triggered once after all test suites -// globalTeardown: undefined, -⋮---- -// A set of global variables that need to be available in all test environments -// globals: {}, -⋮---- -// 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%", -⋮---- -// An array of directory names to be searched recursively up from the requiring module's location -// moduleDirectories: [ -// "node_modules" -// ], -⋮---- -// An array of file extensions your modules use -⋮---- -// modulePaths: ['src'], -⋮---- -// 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: {}, -⋮---- -// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader -// modulePathIgnorePatterns: [], -⋮---- -// Activates notifications for test results -// notify: false, -⋮---- -// An enum that specifies notification mode. Requires { notify: true } -// notifyMode: "failure-change", -⋮---- -// A preset that is used as a base for Jest's configuration -// preset: undefined, -⋮---- -// Run tests from one or more projects -// projects: undefined, -⋮---- -// Use this configuration option to add custom reporters to Jest -// reporters: undefined, -⋮---- -// Automatically reset mock state before every test -// resetMocks: false, -⋮---- -// Reset the module registry before running each individual test -// resetModules: false, -⋮---- -// A path to a custom resolver -// resolver: undefined, -⋮---- -// Automatically restore mock state and implementation before every test -// restoreMocks: false, -⋮---- -// The root directory that Jest should scan for tests and modules within -// rootDir: undefined, -⋮---- -// A list of paths to directories that Jest should use to search for files in -// roots: [ -// "" -// ], -⋮---- -// Allows you to use a custom runner instead of Jest's default test runner -// runner: "jest-runner", -⋮---- -// The paths to modules that run some code to configure or set up the testing environment before each test -// setupFiles: [], -⋮---- -// A list of paths to modules that run some code to configure or set up the testing framework before each test -// setupFilesAfterEnv: [], -⋮---- -// 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/" -// ], +// 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: [], @@ -3495,45 +2976,6 @@ export interface GetSpotDepositRecordRequestV2 { limit?: string; } -================ -File: src/types/request/v3/copytrading.ts -================ -export interface GetCopyFuturesMaxTransferableRequestV3 { - coin: string; -} -⋮---- -export interface CopyFuturesTransferRequestV3 { - type: 'in' | 'out'; - coin: string; - amount: string; - /** Source account type(s) for transfer-in. Comma-separated: funding, uta, otc */ - inAccountType?: string; -} -⋮---- -/** Source account type(s) for transfer-in. Comma-separated: funding, uta, otc */ -⋮---- -export interface GetCopyFuturesTransferRecordRequestV3 { - startTime?: string; - endTime?: string; - limit?: string; - /** Pass transferId from the previous page to paginate forward */ - cursor?: string; -} -⋮---- -/** Pass transferId from the previous page to paginate forward */ -⋮---- -export interface GetCopyFuturesFollowersRequestV3 { - limit?: string; - cursor?: string; -} -⋮---- -export interface GetCopyFuturesProfitDetailsRequestV3 { - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; -} - ================ File: src/types/request/v3/earn.ts ================ @@ -3843,16 +3285,185 @@ export interface GetP2pBalanceRequestV3 { } ================ -File: src/types/response/v2/broker.ts +File: src/types/request/v3/stockplus.ts ================ /** * - * * Broker | Subaccount + * + * Stock+ (UTA) + * * */ ⋮---- -export interface CreateSubaccountResponseV2 { - subUid: string; +export interface GetStockPlusOptionQuoteRequestV3 { + symbol: string; +} +⋮---- +export interface GetStockPlusOptionChainInfoRequestV3 { + symbol: string; + expiryDate: string; +} +⋮---- +export interface GetStockPlusOptionExpiryDateRequestV3 { + symbol: string; +} +⋮---- +export interface GetStockPlusOptionVolumeRequestV3 { + symbol: string; +} +⋮---- +export interface GetStockPlusStaticInfoRequestV3 { + symbol: string; +} +⋮---- +export interface GetStockPlusQuoteRequestV3 { + symbol: string; +} +⋮---- +export interface GetStockPlusTradeDetailRequestV3 { + symbol: string; + count?: string; +} +⋮---- +export interface GetStockPlusIntradayRequestV3 { + symbol: string; +} +⋮---- +export interface GetStockPlusHistoryCandlestickRequestV3 { + symbol: string; + period: string; + count?: string; + adjustType?: string; + forward?: boolean; + time?: string; + tradeSessions?: string; +} +⋮---- +export interface GetStockPlusCandlestickRequestV3 { + symbol: string; + period: string; + count?: string; + adjustType?: string; + tradeSessions?: string; +} +⋮---- +export interface GetStockPlusDepthRequestV3 { + symbol: string; +} +⋮---- +export interface PlaceStockPlusOrderRequestV3 { + symbol: string; + orderType: 'LO' | 'MO' | 'LIT' | 'MIT' | 'TSLPAMT' | 'TSLPPCT'; + side: 'Buy' | 'Sell'; + submittedQuantity: string; + timeInForce: 'Day' | 'GoodTilCanceled' | 'GoodTilDate'; + submittedPrice?: string; + triggerPrice?: string; + limitOffset?: string; + trailingAmount?: string; + trailingPercent?: string; + expireDate?: string; + outsideRth?: 'RTHOnly' | 'AnyTime' | 'Overnight'; + limitDepthLevel?: number; + triggerCount?: number; + monitorPrice?: string; + remark?: string; +} +⋮---- +export interface CancelStockPlusOrderRequestV3 { + symbol: string; + orderId?: string; + clientOid?: string; +} +⋮---- +export interface ModifyStockPlusOrderRequestV3 { + orderId: string; + quantity: string; + price?: string; + triggerPrice?: string; + limitOffset?: string; + trailingAmount?: string; + trailingPercent?: string; + limitDepthLevel?: number; + triggerCount?: number; + monitorPrice?: string; + remark?: string; +} +⋮---- +export interface GetStockPlusTodayOrdersRequestV3 { + symbol?: string; + status?: string | string[]; + side?: string; + market?: string; + orderId?: string; +} +⋮---- +export interface GetStockPlusHistoryOrdersRequestV3 { + symbol?: string; + status?: string | string[]; + side?: string; + market?: string; + startAt?: string; + endAt?: string; +} +⋮---- +export interface GetStockPlusOrderDetailRequestV3 { + orderId: string; +} +⋮---- +export interface GetStockPlusTodayExecutionsRequestV3 { + symbol?: string; + orderId?: string; +} +⋮---- +export interface GetStockPlusHistoryExecutionsRequestV3 { + symbol?: string; + startAt?: string; + endAt?: string; +} +⋮---- +export interface GetStockPlusAccountRequestV3 { + currency?: string; +} +⋮---- +export interface GetStockPlusCashFlowRequestV3 { + startTime: string; + endTime: string; + businessType?: string; + symbol?: string; + page?: string; + size?: string; +} +⋮---- +export interface GetStockPlusStockPositionRequestV3 { + symbol?: string; +} +⋮---- +export interface StockPlusTransferRequestV3 { + coin?: string; + amount?: string; + direction?: 'in' | 'out'; +} +⋮---- +export interface GetStockPlusTransferRecordsRequestV3 { + transferId?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; +} + +================ +File: src/types/response/v2/broker.ts +================ +/** + * + * * Broker | Subaccount + * + */ +⋮---- +export interface CreateSubaccountResponseV2 { + subUid: string; subaccountName: string; status: string; permList: string[]; @@ -5570,404 +5181,438 @@ export interface P2pOrderInfoV3 { } ================ -File: src/types/response/v3/strategy.ts +File: src/types/response/v3/stockplus.ts ================ -import type { - StrategyOrderStatusV3, - StrategyTriggerByV3, - StrategyTriggerOrderTypeV3, -} from '../../request/v3/strategy.js'; +/** + * + * + * Stock+ (UTA) + * + * + */ ⋮---- -export interface PlaceStrategyOrderResponseV3 { - orderId: string; - clientOid: string; +export interface StockPlusOptionQuoteItemV3 { + symbol: string; + lastDone: string; + prevClose: string; + open: string; + high: string; + low: string; + timestamp: string; + volume: string; + turnover: string; + tradeStatus: string; + impliedVolatility: string; + openInterest: string; + expiryDate: string; + strikePrice: string; + contractMultipier: string; + contractType: string; + contractSize: string; + direction: string; + historicalVolatility: string; + underlyingSymbol: string; } ⋮---- -export interface ModifyStrategyOrderResponseV3 { - orderId: string; - clientOid: string; +export interface StockPlusOptionQuoteV3 { + secuQuote: StockPlusOptionQuoteItemV3[]; } ⋮---- -export interface StrategyOrderV3 { - orderId: string; - clientOid: string; - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - qty: string; - posSide: 'long' | 'short'; - status: StrategyOrderStatusV3; - triggerType?: 'takeProfit' | 'stopLoss'; - tpTriggerBy?: StrategyTriggerByV3; - slTriggerBy?: StrategyTriggerByV3; - takeProfit?: string; - stopLoss?: string; - tpOrderType?: StrategyTriggerOrderTypeV3; - slOrderType?: StrategyTriggerOrderTypeV3; - tpLimitPrice?: string; - slLimitPrice?: string; - triggerBy?: StrategyTriggerByV3; - triggerPrice?: string; - triggerOrderType?: StrategyTriggerOrderTypeV3; - triggerOrderPrice?: string; - createdTime: string; - updatedTime: string; +export interface StockPlusOptionStrikePriceInfoV3 { + price: string; + callSymbol: string; + putSymbol: string; + standard: boolean; } - -================ -File: src/types/websockets/ws-api-request.ts -================ -import type { FuturesMarginModeV3 } from '../request/v3/trade.js'; ⋮---- -export interface WSAPIPlaceOrderRequestV3 { - symbol: string; - orderType: 'limit' | 'market'; - qty: string; - price?: string; - side: 'buy' | 'sell'; - posSide?: 'long' | 'short'; - timeInForce?: 'gtc' | 'ioc' | 'fok' | 'post_only'; - reduceOnly?: 'YES' | 'NO'; // Note: reduceOnly is not supported for batch place WS API. Might be supported starting late Q4 2025, but not supported yet. - /** Futures only. Defaults to crossed */ - marginMode?: FuturesMarginModeV3; - clientOid?: string; - stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; - tpTriggerBy?: 'market' | 'mark'; - slTriggerBy?: 'market' | 'mark'; - takeProfit?: string; - stopLoss?: string; - tpOrderType?: 'limit' | 'market'; - slOrderType?: 'limit' | 'market'; - tpLimitPrice?: string; - slLimitPrice?: string; - /** Order TTL in ms [10, 60000]. Only effective when requestTime is also set on the envelope */ - receiveWindow?: string; +export interface StockPlusOptionChainInfoV3 { + strikePriceInfo: StockPlusOptionStrikePriceInfoV3[]; } ⋮---- -reduceOnly?: 'YES' | 'NO'; // Note: reduceOnly is not supported for batch place WS API. Might be supported starting late Q4 2025, but not supported yet. -/** Futures only. Defaults to crossed */ -⋮---- -/** Order TTL in ms [10, 60000]. Only effective when requestTime is also set on the envelope */ - -================ -File: src/types/websockets/ws-api.ts -================ -import { WS_KEY_MAP } from '../../util/websocket-util.js'; -import { CancelOrderRequestV3 } from '../request/v3/trade.js'; -import { CancelOrderResponseV3 } from '../response/v3/trade.js'; -import { WSAPIPlaceOrderRequestV3 } from './ws-api-request.js'; -import { WSAPIPlaceOrderResponseV3 } from './ws-api-response.js'; -import { BitgetInstTypeV3, WsKey } from './ws-general.js'; -⋮---- -export type WSOperation = 'subscribe' | 'unsubscribe' | 'login'; -⋮---- -// When new WS API operations are added, make sure to also update WS_API_Operations[] below -export type WSAPIOperation = - | 'place-order' - | 'batch-place' - | 'cancel-order' - | 'batch-cancel'; -⋮---- -export interface WSOperationLoginParams { - apiKey: string; - passphrase: string; - timestamp: number; - sign: string; +export interface StockPlusOptionExpiryDateV3 { + expiryDate: string[]; } ⋮---- -export interface WSAPIRequestBitgetV3 { - op: 'trade'; - id: string; - category: BitgetInstTypeV3; - topic: WSAPIOperation; - args: TWSParams | TWSParams[]; - /** Client-side request timestamp; required for receiveWindow on place-order */ - requestTime?: string; +export interface StockPlusOptionVolumeV3 { + c: string; + p: string; } ⋮---- -/** Client-side request timestamp; required for receiveWindow on place-order */ -⋮---- -export interface WSAPIRequestFlags { - /** If true, will skip auth requirement for WS API connection */ - authIsOptional?: boolean | undefined; +export interface StockPlusStaticInfoItemV3 { + symbol: string; + nameCn: string; + nameEn: string; + exchange: string; + currency: string; + lotSize: number | string; + totalShares: string | number; + circulatingShares: string | number; + eps: string | number; + epsTtm: string | number; + bps: string | number; + dividendYield: string | number; + stockDerivatives: string[]; + board: string; } ⋮---- -/** If true, will skip auth requirement for WS API connection */ -⋮---- -export type Exact = { - // This part says: if there's any key that's not in T, it's an error - [K: string]: never; -} & { - [K in keyof T]: T[K]; -}; -⋮---- -// This part says: if there's any key that's not in T, it's an error -⋮---- -/** - -/** - * V2 request looks like this: -{ - "op":"subscribe", - "args":[ - { - "instType":"SPOT", - "channel":"ticker", - "instId":"BTCUSDT" - }, - { - "instType":"SPOT", - "channel":"candle5m", - "instId":"BTCUSDT" - } - ] -} - */ -export interface WsRequestOperationBitget { - op: WSOperation; - args?: (TWSRequestArg | string | number)[]; -} -export interface WSAPIRateLimitV3 { - limit: string; - remaining: string; +export interface StockPlusStaticInfoV3 { + list: StockPlusStaticInfoItemV3[]; } ⋮---- -export interface WSAPIResponse< - TResponseData extends object = object, - TOperation extends WSAPIOperation = WSAPIOperation, -> { - wsKey: WsKey; - /** Auto-generated */ - id: string; - event: 'trade'; - category: BitgetInstTypeV3; - topic: TOperation; - args: TResponseData; - code: '0' | string; - msg: 'success' | string; - ts: string; - /** Connection ID (trade operation responses, May 2026+) */ - connId?: string; - /** Gateway receive time, Unix microseconds */ - receiveTime?: string; - /** Gateway push time, Unix microseconds */ - pushTime?: string; - rateLimit?: WSAPIRateLimitV3[]; +export interface StockPlusSessionQuoteV3 { + lastDone: string | number; + timestamp: string; + volume: string | number; + turnover: string | number; + high: string | number; + low: string | number; + prevClose: string | number; } ⋮---- -/** Auto-generated */ +export interface StockPlusQuoteItemV3 { + symbol: string; + lastDone: string | number; + prevClose: string | number; + open: string | number; + high: string | number; + low: string | number; + timestamp: string; + volume: string | number; + turnover: string | number; + tradeStatus: string; + preMarketQuote?: StockPlusSessionQuoteV3 | null; + postMarketQuote?: StockPlusSessionQuoteV3 | null; + overnightQuote?: StockPlusSessionQuoteV3 | null; +} ⋮---- -/** Connection ID (trade operation responses, May 2026+) */ +export interface StockPlusQuoteV3 { + list: StockPlusQuoteItemV3[]; +} ⋮---- -/** Gateway receive time, Unix microseconds */ +export interface StockPlusTradeDetailItemV3 { + price: string | number; + volume: string | number; + timestamp: string; + tradeType: string; + direction: string; + tradeSession: string; +} ⋮---- -/** Gateway push time, Unix microseconds */ +export type StockPlusTradeDetailV3 = StockPlusTradeDetailItemV3[]; ⋮---- -/** - * List of operations supported for this WsKey (connection) - */ -export interface WsAPIWsKeyTopicMap { - [WS_KEY_MAP.v3Private]: WSAPIOperation; +export interface StockPlusIntradayItemV3 { + price: string | number; + timestamp: string; + volume: string | number; + turnover: string | number; + avgPrice: string | number; } ⋮---- -/** - * Request parameters expected per operation - */ -export interface WsAPITopicRequestParamMap { - // https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters - 'place-order': WSAPIPlaceOrderRequestV3; - // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel - 'batch-place': WSAPIPlaceOrderRequestV3[]; - // https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel - 'cancel-order': CancelOrderRequestV3; - // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel - 'batch-cancel': CancelOrderRequestV3[]; +export interface StockPlusIntradayV3 { + list: StockPlusIntradayItemV3[]; } ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters -⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel +export interface StockPlusCandlestickItemV3 { + close: string; + open: string; + low: string; + high: string; + volume: string; + turnover: string; + timestamp: string; + tradeSession: string; +} ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel +export interface StockPlusCandlestickV3 { + list: StockPlusCandlestickItemV3[]; +} ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel +export type StockPlusHistoryCandlestickV3 = StockPlusCandlestickV3; ⋮---- -/** - * Response structure expected for each operation - */ -export interface WsAPIOperationResponseMap { - // https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters - 'place-order': WSAPIResponse<[WSAPIPlaceOrderResponseV3], 'place-order'>; - // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel - 'batch-place': WSAPIResponse; - // https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel - 'cancel-order': WSAPIResponse<[CancelOrderResponseV3], 'cancel-order'>; - // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel - 'batch-cancel': WSAPIResponse; +export interface StockPlusDepthLevelV3 { + position: number; + price: string; + volume: string; + orderNum: number; } ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters +export interface StockPlusDepthV3 { + asks: StockPlusDepthLevelV3[]; + bids: StockPlusDepthLevelV3[]; +} ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel +export interface StockPlusPlaceOrderResponseV3 { + orderId: string; + clientOid: string; + symbol: string; +} ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel +export type StockPlusCancelOrderResponseV3 = StockPlusPlaceOrderResponseV3; +export type StockPlusModifyOrderResponseV3 = StockPlusPlaceOrderResponseV3; ⋮---- -// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel - -================ -File: src/types/websockets/ws-events.ts -================ -export interface MessageEventLike { - target: WebSocket; - type: 'message'; - data: string; +export interface StockPlusOrderV3 { + orderId: string; + status: string; + stockName: string; + quantity: string | number; + executedQuantity: string | number; + price: string | number | null; + executedPrice: string | number | null; + submittedAt: string; + side: string; + symbol: string; + orderType: string; + lastDone: string | number | null; + triggerPrice: string | number | null; + msg: string; + tag: string; + timeInForce: string; + expireDate: string | null; + updatedAt: string | null; + triggerAt: string | null; + trailingAmount: string | number | null; + trailingPercent: string | number | null; + limitOffset: string | number | null; + triggerStatus: string | null; + currency: string; + outsideRth: string; + remark?: string; + limitDepthLevel: number | null; + triggerCount: number | null; + monitorPrice: string | null; } ⋮---- -export function isMessageEvent(msg: unknown): msg is MessageEventLike +export interface StockPlusOrdersV3 { + orders: StockPlusOrderV3[]; +} ⋮---- -export interface WsBaseEvent { - action: TAction; - arg: unknown; - data: TData[]; +export interface StockPlusHistoryOrdersV3 { + hasMore: boolean; + orders: StockPlusOrderV3[]; } ⋮---- -export interface WsSnapshotChannelEvent extends WsBaseEvent<'snapshot'> { - arg: { - instType: string; - channel: string; - instId: string; - }; +export interface StockPlusOrderHistoryItemV3 { + price: string | number; + quantity: string | number; + status: string; + msg: string; + time: string; } ⋮---- -export interface WsSnapshotAccountEvent extends WsBaseEvent<'snapshot'> { - arg: { - instType: string; - channel: 'account'; - instId: string; - }; +export interface StockPlusChargeFeeItemV3 { + code: string; + name: string; + amount: number | string; + currency: string; } ⋮---- -export interface WsSnapshotPositionsEvent extends WsBaseEvent<'snapshot'> { - arg: { - instType: string; - channel: 'positions'; - instId: string; - }; +export interface StockPlusChargeCategoryV3 { + code: string; + name: string; + fees: StockPlusChargeFeeItemV3[]; } ⋮---- -export interface WsAccountSnapshotDataUMCBL { - marginCoin: string; - locked: string; - available: string; - maxOpenPosAvailable: string; - maxTransferOut: string; - equity: string; - usdtEquity: string; +export interface StockPlusChargeDetailV3 { + totalAmount: number | string; + currency: string; + items: StockPlusChargeCategoryV3[]; } ⋮---- -export interface WsAccountSnapshotUMCBL extends WsBaseEvent<'snapshot'> { - arg: { - instType: 'umcbl'; - channel: 'account'; - instId: string; - }; - data: WsAccountSnapshotDataUMCBL[]; +export interface StockPlusOrderDetailV3 extends StockPlusOrderV3 { + freeStatus?: string; + freeAmount?: string | null; + freeCurrency?: string | null; + deductionsStatus?: string; + deductionsAmount?: string | null; + deductionsCurrency?: string | null; + platformDeductedStatus?: string; + platformDeductedAmount?: string | null; + platformDeductedCurrency?: string | null; + history?: StockPlusOrderHistoryItemV3[]; + chargeDetail?: StockPlusChargeDetailV3; } ⋮---- -export interface WsPositionSnapshotDataUMCBL { - posId: string; - instId: string; - instName: string; - marginCoin: string; - margin: string; - marginMode: string; - holdSide: string; - holdMode: string; - total: string; - available: string; - locked: string; - averageOpenPrice: string; - leverage: number; - achievedProfits: string; - upl: string; - uplRate: string; - liqPx: string; - keepMarginRate: string; - marginRate: string; - cTime: string; - uTime: string; - markPrice: string; - /** Cash dividend, USDT (Classic V2 positions channel) */ - cashDividend?: string; +export interface StockPlusExecutionV3 { + orderId: string; + tradeId: string; + symbol: string; + tradeDoneAt: string; + quantity: number | string; + price: number | string; } ⋮---- -/** Cash dividend, USDT (Classic V2 positions channel) */ +export interface StockPlusTodayExecutionsV3 { + trades: StockPlusExecutionV3[]; +} ⋮---- -/** UTA reality-orderbook push (ts/seq/pseq removed July 2026) */ -export interface WsRealityOrderBookDataV3 { - a: [string, string][]; - b: [string, string][]; +export interface StockPlusHistoryExecutionsV3 { + hasMore: boolean; + trades: StockPlusExecutionV3[]; } ⋮---- -export interface WSPositionSnapshotUMCBL extends WsBaseEvent<'snapshot'> { - arg: { - instType: 'umcbl'; - channel: 'positions'; - instId: string; - }; - data: WsPositionSnapshotDataUMCBL[]; +export interface StockPlusCashInfoV3 { + withdrawCash: number | string; + availableCash: number | string; + frozenCash: number | string; + settlingCash: number | string; + currency: string; } ⋮---- -/** Classic V2 depth channel push data. checksum removed May 2026 - use seq instead */ -export interface WsDepthBookDataV2 { - asks: [string, string][]; - bids: [string, string][]; - ts: string; - seq: string; - /** Futures books channel only - previous push serial number */ - pseq?: string; +export interface StockPlusFrozenTransactionFeeV3 { + currency?: string; + amount?: number | string; + [key: string]: unknown; } ⋮---- -/** Futures books channel only - previous push serial number */ - -================ -File: src/types/shared.ts -================ -import { REST_CLIENT_TYPE_ENUM } from '../util/requestUtils.js'; +export interface StockPlusAccountItemV3 { + totalCash: number | string; + maxFinanceAmount: number | string; + remainingFinanceAmount: number | string; + riskLevel: number | string; + marginCall: number | string; + netAssets: number | string; + initMargin: number | string; + maintenanceMargin: number | string; + currency: string; + buyPower: number | string; + cashInfos: StockPlusCashInfoV3[]; + frozenTransactionFees: StockPlusFrozenTransactionFeeV3[]; +} ⋮---- -export type numberInString = string; +export interface StockPlusAccountV3 { + list: StockPlusAccountItemV3[]; +} ⋮---- -export type OrderSide = 'Buy' | 'Sell'; +export interface StockPlusCashFlowItemV3 { + transactionFlowName: string; + direction: string; + businessType: string; + balance: number | string; + currency: string; + businessTime: string; + symbol: string | null; + description: string; +} ⋮---- -/** - * @deprecated use SpotKlineInterval or FuturesKlineInterval, depending on which API group you're using - */ -export type KlineInterval = - | '1min' - | '5min' - | '15min' - | '30min' - | '1h' - | '4h' - | '6h' - | '12h' - | '1M' - | '1W' - | '1week' - | '6Hutc' - | '12Hutc' - | '1Dutc' - | '3Dutc' - | '1Wutc' - | '1Mutc'; +export interface StockPlusCashFlowV3 { + list: StockPlusCashFlowItemV3[]; +} ⋮---- -export type RestClientType = - (typeof REST_CLIENT_TYPE_ENUM)[keyof typeof REST_CLIENT_TYPE_ENUM]; +export interface StockPlusPositionItemV3 { + symbol: string; + symbolName: string; + quantity: number | string; + availableQuantity: number | string; + currency: string; + costPrice: number | string; + market: string; + initQuantity: number | string; +} ⋮---- -export interface APIResponse { - code: string; - requestTime: number; - msg: 'success' | string; - data: T; +export interface StockPlusPositionChannelV3 { + accountChannel: string; + positions: StockPlusPositionItemV3[]; +} +⋮---- +export interface StockPlusStockPositionV3 { + channels: StockPlusPositionChannelV3[]; +} +⋮---- +export interface StockPlusTransferResponseV3 { + transferId: string; +} +⋮---- +export interface StockPlusTransferRecordsV3 { + transferId: string; + coin: string; + amount: string; + direction: string; + cursor: string; +} + +================ +File: src/types/response/v3/strategy.ts +================ +import type { + StrategyOrderStatusV3, + StrategyTriggerByV3, + StrategyTriggerOrderTypeV3, +} from '../../request/v3/strategy.js'; +⋮---- +export interface PlaceStrategyOrderResponseV3 { + orderId: string; + clientOid: string; +} +⋮---- +export interface ModifyStrategyOrderResponseV3 { + orderId: string; + clientOid: string; +} +⋮---- +export interface StrategyOrderV3 { + orderId: string; + clientOid: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + qty: string; + posSide: 'long' | 'short'; + status: StrategyOrderStatusV3; + triggerType?: 'takeProfit' | 'stopLoss'; + tpTriggerBy?: StrategyTriggerByV3; + slTriggerBy?: StrategyTriggerByV3; + takeProfit?: string; + stopLoss?: string; + tpOrderType?: StrategyTriggerOrderTypeV3; + slOrderType?: StrategyTriggerOrderTypeV3; + tpLimitPrice?: string; + slLimitPrice?: string; + triggerBy?: StrategyTriggerByV3; + triggerPrice?: string; + triggerOrderType?: StrategyTriggerOrderTypeV3; + triggerOrderPrice?: string; + createdTime: string; + updatedTime: string; +} + +================ +File: src/types/shared.ts +================ +import { REST_CLIENT_TYPE_ENUM } from '../util/requestUtils.js'; +⋮---- +export type numberInString = string; +⋮---- +export type OrderSide = 'Buy' | 'Sell'; +⋮---- +/** + * @deprecated use SpotKlineInterval or FuturesKlineInterval, depending on which API group you're using + */ +export type KlineInterval = + | '1min' + | '5min' + | '15min' + | '30min' + | '1h' + | '4h' + | '6h' + | '12h' + | '1M' + | '1W' + | '1week' + | '6Hutc' + | '12Hutc' + | '1Dutc' + | '3Dutc' + | '1Wutc' + | '1Mutc'; +⋮---- +export type RestClientType = + (typeof REST_CLIENT_TYPE_ENUM)[keyof typeof REST_CLIENT_TYPE_ENUM]; +⋮---- +export interface APIResponse { + code: string; + requestTime: number; + msg: 'success' | string; + data: T; } ================ @@ -7699,6 +7344,45 @@ export interface GetBrokerSubApiKeyRequestV3 { subUid: string; } +================ +File: src/types/request/v3/copytrading.ts +================ +export interface GetCopyFuturesMaxTransferableRequestV3 { + coin: string; +} +⋮---- +export interface CopyFuturesTransferRequestV3 { + type: 'in' | 'out'; + coin: string; + amount: string; + /** Source account type(s) for transfer-in. Comma-separated: funding, uta, otc */ + inAccountType?: string; +} +⋮---- +/** Source account type(s) for transfer-in. Comma-separated: funding, uta, otc */ +⋮---- +export interface GetCopyFuturesTransferRecordRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + /** Pass transferId from the previous page to paginate forward */ + cursor?: string; +} +⋮---- +/** Pass transferId from the previous page to paginate forward */ +⋮---- +export interface GetCopyFuturesFollowersRequestV3 { + limit?: string; + cursor?: string; +} +⋮---- +export interface GetCopyFuturesProfitDetailsRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; +} + ================ File: src/types/request/v3/strategy.ts ================ @@ -7795,16 +7479,62 @@ export interface GetHistoryStrategyOrdersRequestV3 { } ================ -File: src/types/response/v2/futures.ts +File: src/types/response/v2/spot.ts ================ /** * - * * Futures | Market + * * Spot | Market * */ ⋮---- -export interface FuturesVipFeeRateV2 { - level: string; +export interface SpotCoinChainV2 { + chain: string; + needTag: boolean; + withdrawable: boolean; + rechargeable: boolean; + withdrawFee: string; + extraWithdrawFee: string; + depositConfirm: string; + withdrawConfirm: string; + minDepositAmount: string; + minWithdrawAmount: string; + browserUrl: string; + contractAddress: string; + withdrawStep: string; + withdrawMinScale: string; + congestion: string; +} +⋮---- +export interface SpotCoinInfoV2 { + coinId: string; + coin: string; + transfer: boolean; + chains: SpotCoinChainV2[]; +} +⋮---- +export interface SpotSymbolInfoV2 { + symbol: string; + baseCoin: string; + quoteCoin: string; + minTradeAmount: string; + maxTradeAmount: string; + takerFeeRate: string; + makerFeeRate: string; + pricePrecision: string; + quantityPrecision: string; + quotePrecision: string; + minTradeUSDT: string; + status: string; + buyLimitPriceRatio: string; + sellLimitPriceRatio: string; + orderQuantity: string; + areaSymbol: string; + maxLimitOrderValue?: string; + maxMarketOrderValue?: string; +} +⋮---- +export interface SpotVipFeeRateV2 { + level: number; dealAmount: string; assetAmount: string; takerFeeRate: string; @@ -7813,78 +7543,49 @@ export interface FuturesVipFeeRateV2 { usdtWithdrawAmount: string; } ⋮---- -export interface FuturesHistoryInterestRateV2 { +export interface SpotTickerV2 { + symbol: string; + high24h: string; + open: string; + low24h: string; + lastPr: string; + quoteVolume: string; + baseVolume: string; + usdtVolume: string; + bidPr: string; + askPr: string; + bidSz: string; + askSz: string; + openUtc: string; ts: string; - annualInterestRate: string; - dailyInterestRate: string; -} -⋮---- -export interface FuturesInterestExchangeRateV2 { - tier: string; - minAmount: string; - maxAmount: string; - exchangeRate: string; -} -⋮---- -export interface FuturesDiscountRateV2 { - tier: string; - minAmount: string; - maxAmount: string; - discountRate: string; + changeUtc24h: string; + change24h: string; } ⋮---- -export interface FuturesDiscountRatesV2 { - coin: string; - userLimit: string; - totalLimit: string; - discountRateList: FuturesDiscountRateV2[]; +export interface SpotCallAuctionV2 { + stage: string; + stageEndTime: string; + estOpeningPrice: string | null; + matchedVolume: string | null; + auctionEndTime: string; } ⋮---- -export interface FuturesMergeDepthV2 { - asks: [number, number][]; - bids: [number, number][]; +export interface SpotMergeDepthV2 { + asks: [string, string][]; + bids: [string, string][]; ts: string; scale: string; precision: string; isMaxPrecision: string; } ⋮---- -export interface FuturesTickerV2 { - symbol: string; - lastPr: string; - askPr: string; - bidPr: string; - bidSz: string; - askSz: string; - high24h: string; - low24h: string; +export interface SpotOrderBookDepthV2 { + asks: [string, string][]; + bids: [string, string][]; ts: string; - change24h: string; - baseVolume: string; - quoteVolume: string; - usdtVolume: string; - openUtc: string; - changeUtc24h: string; - indexPrice: string; - fundingRate: string; - holdingAmount: string; - deliveryStartTime: string; - deliveryTime: string; - deliveryStatus: string; - open24h: string; - markPrice: string; -} -⋮---- -export interface FuturesFillV2 { - tradeId: string; - price: string; - size: string; - side: string; - ts: string; - symbol: string; } ⋮---- -export type FuturesCandlestickV2 = [ +export type SpotCandlestickV2 = [ string, // timestamp string, // open string, // high @@ -7904,1480 +7605,983 @@ string, // baseVolume string, // usdtVolume string, // quoteVolume ⋮---- -export interface FuturesOpenInterestV2 { +export interface SpotTradeV2 { symbol: string; + tradeId: string; + side: string; + price: string; size: string; + ts: string; } ⋮---- -export interface FuturesFundingTimeV2 { - symbol: string; - nextFundingTime: string; - ratePeriod: string; +/** + * + * * Spot | Trade + * + */ +⋮---- +export interface CancelAndSubmitSpotOrderResponseV2 { + orderId: string; + clientOid: string | null; + success: string; + msg: string | null; } ⋮---- -export interface FuturesSymbolPriceV2 { +export interface SubmitSpotBatchOrdersResponseV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + errorCode?: string; + }[]; +} +⋮---- +export interface SpotOrderInfoV2 { + userId: string; symbol: string; + orderId: string; + clientOid: string; price: string; - indexPrice: string; - markPrice: string; - ts: string; + size: string; + orderType: string; + side: string; + status: string; + priceAvg: string; + baseVolume: string; + quoteVolume: string; + enterPointSource: string; + feeDetail: { + BGB?: { + deduction: boolean; + feeCoinCode: string; + totalDeductionFee: string; + totalFee: string; + }; + newFees?: { + c: number; + d: number; + deduction: boolean; + r: string; + t: string; + totalDeductionFee: number; + }; + }; + orderSource: string; + cancelReason: string; + cTime: string; + uTime: string; } ⋮---- -export interface FuturesHistoricalFundingRateV2 { +export interface SpotOpenOrderV2 { + userId: string; symbol: string; - fundingRate: string; - fundingTime: string; + orderId: string; + clientOid: string; + priceAvg: string; + size: string; + orderType: string; + side: string; + status: string; + basePrice: string; + baseVolume: string; + quoteVolume: string; + enterPointSource: string; + orderSource?: string; + presetTakeProfitPrice: string; + executeTakeProfitPrice: string; + presetStopLossPrice: string; + executeStopLossPrice: string; + cTime: string; + uTime?: string; + tpslType: string; + triggerPrice: string | null; } ⋮---- -export interface FuturesContractConfigV2 { +export interface SpotFillV2 { + userId: string; symbol: string; - baseCoin: string; - quoteCoin: string; - buyLimitPriceRatio: string; - sellLimitPriceRatio: string; - feeRateUpRatio: string; - makerFeeRate: string; - takerFeeRate: string; - openCostUpRatio: string; - supportMarginCoins: string[]; - minTradeNum: string; - priceEndStep: string; - volumePlace: string; - pricePlace: string; - sizeMultiplier: string; - symbolType: string; - minTradeUSDT: string; - maxSymbolOrderNum: string; - maxProductOrderNum: string; - maxPositionNum: string; - symbolStatus: string; - offTime: string; - limitOpenTime: string; - deliveryTime: string; - deliveryStartTime: string; - launchTime: string; - fundInterval: string; - minLever: string; - maxLever: string; - posLimit: string; - maintainTime: string; - isRwa: string; + orderId: string; + tradeId: string; + orderType: string; + side: string; + priceAvg: string; + size: string; + amount: string; + feeDetail: { + deduction: string; + feeCoin: string; + totalDeductionFee: string; + totalFee: string; + }; + tradeScope: string; + cTime: string; + uTime: string; } ⋮---- /** * - * * Futures | Account + * * Spot | Trigger Orders * */ ⋮---- -export interface FuturesAccountV2 { - marginCoin: string; - locked: string; - available: string; - crossedMaxAvailable: string; - isolatedMaxAvailable: string; - maxTransferOut: string; - accountEquity: string; - usdtEquity: string; - btcEquity: string; - crossedRiskRate: string; - crossedMarginLeverage: string; - isolatedLongLever: string; - isolatedShortLever: string; - marginMode: string; - posMode: string; - unrealizedPL: string; - coupon: string; - crossedUnrealizedPL: string; - isolatedUnrealizedPL: string; - assetMode: string; +export interface SpotCurrentPlanOrderV2 { + orderId: string; + clientOid: string; + symbol: string; + size: string; + executePrice: string; + triggerPrice: string; + status: string; + orderType: string; + side: string; + planType: string; + triggerType: string; + enterPointSource: string; + uTime: string; + cTime: string; } ⋮---- -export interface FuturesAccountsV2 { - marginCoin: string; - locked: string; - available: string; - crossedMaxAvailable: string; - isolatedMaxAvailable: string; - maxTransferOut: string; - accountEquity: string; - usdtEquity: string; - btcEquity: string; - crossedRiskRate: string; - unrealizedPL: string; - coupon: string; - unionTotalMagin: string; - unionAvailable: string; - unionMm: string; - assetList: { - coin: string; - balance: string; - }[]; - isolatedMargin: string; - crossedMargin: string; - crossedUnrealizedPL: string; - isolatedUnrealizedPL: string; - assetMode: string; +export interface SpotHistoryPlanOrderV2 { + orderId: string; + clientOid: string; + symbol: string; + size: string; + executePrice: string; + triggerPrice: string; + status: string; + orderType: string; + side: string; + planType: string; + triggerType: string; + enterPointSource: string; + uTime: string; + cTime: string; } ⋮---- -export interface FuturesSubAccountAssetV2 { - marginCoin: string; - locked: string; - available: string; - crossedMaxAvailable: string; - isolatedMaxAvailable: string; - maxTransferOut: string; - accountEquity: string; - usdtEquity: string; - btcEquity: string; - unrealizedPL: string; - coupon: string; -} -⋮---- -export interface FuturesInterestV2 { - coin: string; - liability: string; - interestFreeLimit: string; - interestLimit: string; - hourInterestRate: string; - interest: string; - cTime: string; -} -export interface FuturesInterestHistoryV2 { - nextSettleTime: string; - borrowAmount: string; - borrowLimit: string; - interestList: FuturesInterestV2[]; - endId: string; -} -⋮---- -export interface SetLeverageResponseV2 { - symbol: string; - marginCoin: string; - longLeverage: string; - shortLeverage: string; - crossMarginLeverage: string; - marginMode: string; -} -⋮---- -export interface SetMarginModeResponseV2 { - symbol: string; - marginCoin: string; - longLeverage: string; - shortLeverage: string; - marginMode: string; +export interface SpotPlanSubOrderV2 { + orderId: string; + price: string; + type: string; + status: string; } ⋮---- -export interface FuturesAccountBillV2 { - billId: string; - symbol: string; - amount: string; - fee: string; - feeByCoupon: string; - businessType: string; - coin: string; - balance: string; - cTime: string; +export interface SpotCancelPlanOrdersV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + }[]; } ⋮---- /** * - * * Futures | Position + * * Spot | Account * */ ⋮---- -export interface FuturesPositionTierV2 { - symbol: string; - level: string; - startUnit: string; - endUnit: string; - leverage: string; - keepMarginRate: string; +export interface SpotAccountInfoV2 { + userId: string; + inviterId: string; + ips: string; + authorities: string[]; + parentId: number; + traderType: string; + channelCode: string; + channel: string; + regisTime: string; } ⋮---- -export interface FuturesPositionV2 { - marginCoin: string; - symbol: string; - holdSide: string; - openDelegateSize: string; - marginSize: string; +export interface SpotAccountAssetV2 { + coin: string; available: string; + frozen: string; locked: string; - total: string; - leverage: string; - achievedProfits: string; - openPriceAvg: string; - marginMode: string; - posMode: string; - unrealizedPL: string; - liquidationPrice: string; - keepMarginRate: string; - markPrice: string; - breakEvenPrice: string; - totalFee: string; - deductedFee: string; - marginRatio: string; - assetMode: string; - /** Cash dividend, USDT */ - cashDividend?: string; + limitAvailable: string; uTime: string; - autoMargin: string; - cTime: string; } ⋮---- -/** Cash dividend, USDT */ -⋮---- -export interface FuturesPositionAdlRankV2 { - symbol: string; - marginCoin: string; - adlRank: string; - rank: string; - holdSide: string; +export interface SpotSubAccountAssetV2 { + coin: string; + available: string; + limitAvailable: string; + frozen: string; + locked: string; + uTime: string; +} +export interface SpotSubAccountAssetsV2 { + userId: number; + assetsList: SpotSubAccountAssetV2[]; } ⋮---- -export interface FuturesHistoryPositionV2 { - positionId: string; - marginCoin: string; - symbol: string; - holdSide: string; - openAvgPrice: string; - closeAvgPrice: string; - marginMode: string; - openTotalPos: string; - closeTotalPos: string; - pnl: string; - netProfit: string; - totalFunding: string; - openFee: string; - closeFee: string; - /** Cash dividend, USDT */ - cashDividend?: string; +export interface SpotAccountBillV2 { cTime: string; - uTime: string; + coin: string; + groupType: string; + businessType: string; + size: string; + balance: string; + fees: string; + billId: string; } ⋮---- -/** Cash dividend, USDT */ -⋮---- -/** - * - * * Futures | Trade - * - */ +export interface SpotMainSubTransferRecordV2 { + coin: string; + status: string; + toType: string; + fromType: string; + size: string; + ts: string; + clientOid: string; + transferId: string; + fromUserId: string; + toUserId: string; +} ⋮---- -export interface FuturesBatchOrderResponseV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - errorCode: string; - }[]; +export interface SpotTransferRecordV2 { + coin: string; + status: string; + toType: string; + toSymbol: string; + fromType: string; + fromSymbol: string; + size: string; + ts: string; + clientOid: string; + transferId: string; } ⋮---- -export interface FuturesClosePositionResponseV2 { - successList: { - orderId: string; - clientOid: string; - symbol: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - symbol: string; - errorMsg: string; - errorCode: string; - }[]; +export interface SpotDepositAddressV2 { + address: string; + chain: string; + coin: string; + tag: string; + url: string; } ⋮---- -export interface FuturesOrderDetailV2 { - symbol: string; - size: string; +export interface SpotSubAccountDepositRecordV2 { orderId: string; - clientOid: string; - baseVolume: string; - priceAvg: string; - fee: string; - price: string; - state: string; - side: string; - force: string; - totalProfits: string; - posSide: string; - marginCoin: string; - presetStopSurplusPrice: string; - presetStopLossPrice: string; - quoteVolume: string; - orderType: string; - leverage: string; - marginMode: string; - reduceOnly: string; - enterPointSource: string; - tradeSide: string; - posMode: string; - orderSource: string; - cancelReason: string; + tradeId: string; + coin: string; + size: string; + status: string; + toAddress: string; + dest: string; + chain: string; + fromAddress: string; + clientOid?: string; + confirm?: string; + tag?: string; cTime: string; uTime: string; } ⋮---- -export interface FuturesOrderFillV2 { - tradeId: string; - symbol: string; - orderId: string; - price: string; - baseVolume: string; - feeDetail: { - deduction: string; - feeCoin: string; - totalDeductionFee: string; - totalFee: string; - }[]; - side: string; - quoteVolume: string; - profit: string; - enterPointSource: string; - tradeSide: string; - posMode: string; - tradeScope: string; - cTime: string; -} -⋮---- -export interface FuturesOpenOrderV2 { - symbol: string; - size: string; +export interface SpotWithdrawalRecordV2 { orderId: string; + tradeId: string; + coin: string; + dest: string; clientOid: string; - baseVolume: string; + type: string; + tag: string; + size: string; fee: string; - price: string; - priceAvg: string; status: string; - side: string; - force: string; - totalProfits: string; - posSide: string; - marginCoin: string; - quoteVolume: string; - leverage: string; - marginMode: string; - enterPointSource: string; - tradeSide: string; - posMode: string; - orderType: string; - orderSource: string; + toAddress: string; + fromAddress: string; + confirm: string; + chain: string; cTime: string; uTime: string; - presetStopSurplusPrice: string; - presetStopSurplusType: string; - presetStopSurplusExecutePrice: string; - presetStopLossPrice: string; - presetStopLossType: string; - presetStopLossExecutePrice: string; } ⋮---- -export interface FuturesHistoryOrderV2 { - symbol: string; - size: string; +export interface SpotDepositRecordV2 { orderId: string; - clientOid: string; - baseVolume: string; - fee: string; - price: string; - priceAvg: string; + tradeId: string; + coin: string; + type: string; + size: string; status: string; - side: string; - force: string; - totalProfits: string; - posSide: string; - marginCoin: string; - quoteVolume: string; - leverage: string; - marginMode: string; - enterPointSource: string; - tradeSide: string; - posMode: string; - orderType: string; - orderSource: string; + toAddress: string; + dest: string; + chain: string; + fromAddress: string; cTime: string; uTime: string; - presetStopSurplusPrice: string; - presetStopLossPrice: string; - liqPrice: string; } -⋮---- -export interface FuturesCancelAllOrdersV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - errorCode: string; - }[]; + +================ +File: src/types/response/v3/broker.ts +================ +export interface CreateBrokerSubAccountResponseV3 { + subUid: string; + subaccountName: string; + subaccountEmail: string; + status: 'normal' | 'freeze'; + permList: string[]; + label: string; + cTime: string; } ⋮---- -/** - * - * * Futures | Trigger Orders - * - */ +export interface BrokerSubAccountV3 { + subUid: string; + subaccountName: string; + subaccountEmail: string | null; + status: 'normal' | 'freeze'; + permList: string[]; + label: string; + language: string; + cTime: string; + uTime: string; +} ⋮---- -export interface FuturesTriggerSubOrderV2 { - orderId: string; - price: string; - type: string; - status: string; +export interface GetBrokerSubAccountListResponseV3 { + subList: BrokerSubAccountV3[]; } ⋮---- -export interface FuturesPendingPlanOrderV2 { - planType: string; - symbol: string; - size: string; - orderId: string; - clientOid: string; - price: string; - executePrice: string; - callbackRatio: string; - triggerPrice: string; - triggerType: string; - planStatus: string; - side: string; - posSide: string; - marginCoin: string; - marginMode: string; - enterPointSource: string; - tradeSide: string; - posMode: string; - orderType: string; - orderSource: string; +export interface ModifyBrokerSubAccountResponseV3 { + subUid: string; + subaccountName: string; + status: 'normal' | 'freeze'; + permList: string[]; + label: string; cTime: string; uTime: string; - stopSurplusExecutePrice: string; - stopSurplusTriggerPrice: string; - stopSurplusTriggerType: string; - stopLossExecutePrice: string; - stopLossTriggerPrice: string; - stopLossTriggerType: string; -} -⋮---- -export interface FuturesCancelPlanOrderV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - }[]; } ⋮---- -export interface FuturesHistoryPlanOrderV2 { - planType: string; - symbol: string; - size: string; +export interface BrokerSubWithdrawalResponseV3 { orderId: string; - executeOrderId: string; clientOid: string; - planStatus: string; - price: string; - executePrice: string; - priceAvg: string; - baseVolume: string; - callbackRatio: string; - triggerPrice: string; - triggerType: string; - side: string; - posSide: string; - marginCoin: string; - marginMode: string; - enterPointSource: string; - tradeSide: string; - posMode: string; - orderType: string; - cTime: string; - uTime: string; - stopSurplusExecutePrice: string; - stopSurplusTriggerPrice: string; - stopSurplusTriggerType: string; - stopLossExecutePrice: string; - stopLossTriggerPrice: string; - stopLossTriggerType: string; } ⋮---- -/** - * - * * Futures | Union Margin - * - */ +export interface BrokerSubDepositAddressV3 { + subUid: string; + coin: string; + address: string; + chain: string; + tag: string | null; + url: string; + cTime: string; +} ⋮---- -export interface UnionTransferLimitsV2 { +export interface BrokerSubDepositWithdrawalRecordV3 { + uid: string; + txId: string; + type: 'deposit' | 'withdrawal'; + subType: 'onchain' | 'internal' | 'fast'; coin: string; - maxTransferIn: string; + amount: string; + status: 'pending' | 'fail' | 'success'; + ts: string; } ⋮---- -export interface UnionConfigV2 { - imr: string; - mmr: string; - individualLimit: string; - individualLimitRatio: string; +export interface GetBrokerAllSubDepositWithdrawalResponseV3 { + list: BrokerSubDepositWithdrawalRecordV3[]; + endId: string; } ⋮---- -export interface UnionSwitchUsdtV2 { - usdtAmount: string; +export interface BrokerCommissionRecordV3 { + uid: string; + coin: string; + symbol: string; + dealtAmount: string; + totalFee: string; + deductedFee: string; + paidFee: string; + markUpFee: string; + totalCommission: string; } ⋮---- -export interface UnionConvertV2 { - usdtAmount: string; -} -⋮---- -/** - * - * * Futures | Account | Max Openable Quantity - * - */ -⋮---- -export interface FuturesMaxOpenV2 { - maxOpen: string; +export interface CreateBrokerSubApiKeyResponseV3 { + subUid: string; + label: string; + apiKey: string; + secretKey: string; + permType: 'read_write' | 'read_only'; + permList: string[]; + ipList: string[] | null; } ⋮---- -/** - * - * * Futures | Account | Liquidation Price - * - */ -⋮---- -export interface FuturesLiquidationPriceV2 { - liqPrice: string; +export interface ModifyBrokerSubApiKeyResponseV3 { + subUid: string; + label: string; + apiKey: string; + permType: 'read_write' | 'read_only'; + permList: string[]; + ipList: string[]; } ⋮---- -/** - * - * * Futures | Account | Isolated Symbols - * - */ -⋮---- -export interface FuturesIsolatedSymbolV2 { - symbol: string; - marginMode: 'isolated'; +export interface GetBrokerSubApiKeyResponseV3 { + subUid: string; + label: string; + apiKey: string; + secretKey: string; + permType: 'read_write' | 'read_only'; + permList: string[]; + ipList: string[] | null; } ================ -File: src/types/response/v2/spot.ts +File: src/types/response/v3/loan.ts ================ -/** - * - * * Spot | Market - * - */ -⋮---- -export interface SpotCoinChainV2 { - chain: string; - needTag: boolean; - withdrawable: boolean; - rechargeable: boolean; - withdrawFee: string; - extraWithdrawFee: string; - depositConfirm: string; - withdrawConfirm: string; - minDepositAmount: string; - minWithdrawAmount: string; - browserUrl: string; - contractAddress: string; - withdrawStep: string; - withdrawMinScale: string; - congestion: string; -} -⋮---- -export interface SpotCoinInfoV2 { - coinId: string; +export interface LoanTransfersV3 { coin: string; - transfer: boolean; - chains: SpotCoinChainV2[]; + transfered: string; + userId: string; } ⋮---- -export interface SpotSymbolInfoV2 { +export interface LoanSymbolSettingV3 { symbol: string; - baseCoin: string; - quoteCoin: string; - minTradeAmount: string; - maxTradeAmount: string; - takerFeeRate: string; - makerFeeRate: string; - pricePrecision: string; - quantityPrecision: string; - quotePrecision: string; - minTradeUSDT: string; - status: string; - buyLimitPriceRatio: string; - sellLimitPriceRatio: string; - orderQuantity: string; - areaSymbol: string; - maxLimitOrderValue?: string; - maxMarketOrderValue?: string; + leverage: string; } ⋮---- -export interface SpotVipFeeRateV2 { - level: number; - dealAmount: string; - assetAmount: string; - takerFeeRate: string; - makerFeeRate: string; - btcWithdrawAmount: string; - usdtWithdrawAmount: string; +export interface LoanSymbolsV3 { + productId: string; + spotSymbols: string[]; + marginLeverage: string; + usdtContractLeverage: string; + coinContractLeverage: string; + usdcContractLeverage: string; + usdtContractSymbols: LoanSymbolSettingV3[]; + coinContractSymbols: LoanSymbolSettingV3[]; + usdcContractSymbols: LoanSymbolSettingV3[]; } ⋮---- -export interface SpotTickerV2 { - symbol: string; - high24h: string; - open: string; - low24h: string; - lastPr: string; - quoteVolume: string; - baseVolume: string; - usdtVolume: string; - bidPr: string; - askPr: string; - bidSz: string; - askSz: string; - openUtc: string; - ts: string; - changeUtc24h: string; - change24h: string; +export interface RepaidHistoryItemV3 { + repayOrderId: string; + businessType: 'normal' | 'liquidation'; + repayType: 'all' | 'part'; + repaidTime: string; + coin: string; + repayAmount: string; + repayInterest: string; } ⋮---- -export interface SpotCallAuctionV2 { - stage: string; - stageEndTime: string; - estOpeningPrice: string | null; - matchedVolume: string | null; - auctionEndTime: string; +export interface LoanProductInfoV3 { + productId: string; + leverage: string; + supportUsdtContract: 'YES' | 'NO'; + supportCoinContract: 'YES' | 'NO'; + supportUsdcContract: 'YES' | 'NO'; + transferLine: string; + spotBuyLine: string; + usdtContractOpenLine: string; + coinContractOpenLine: string; + usdcContractOpenLine: string; + liquidationLine: string; + stopLiquidationLine: string; } ⋮---- -export interface SpotMergeDepthV2 { - asks: [string, string][]; - bids: [string, string][]; - ts: string; - scale: string; - precision: string; - isMaxPrecision: string; +export interface LoanOrderV3 { + orderId: string; + orderProductId: string; + uid: string; + loanTime: string; + loanCoin: string; + loanAmount: string; + unpaidAmount: string; + unpaidInterest: string; + repaidAmount: string; + repaidInterest: string; + reserve: string; + status: 'not_paid_off' | 'paid_off'; } ⋮---- -export interface SpotOrderBookDepthV2 { - asks: [string, string][]; - bids: [string, string][]; - ts: string; +/** Tiered conversion rate item (when Tiered Discount Rate Model is enabled) */ +export interface ConvertRatioListItemV3 { + ladder: string; + convertRatio: string; } ⋮---- -export type SpotCandlestickV2 = [ - string, // timestamp - string, // open - string, // high - string, // low - string, // close - string, // baseVolume - string, // usdtVolume - string, // quoteVolume -]; +export interface CoinInfoV3 { + coin: string; + convertRatio: string; + maxConvertValue: string; + /** Tiered conversion rate (when margin mode is Tiered Discount Rate Model) */ + convertRatioList?: ConvertRatioListItemV3[]; +} ⋮---- -string, // timestamp -string, // open -string, // high -string, // low -string, // close -string, // baseVolume -string, // usdtVolume -string, // quoteVolume +/** Tiered conversion rate (when margin mode is Tiered Discount Rate Model) */ ⋮---- -export interface SpotTradeV2 { - symbol: string; - tradeId: string; - side: string; - price: string; - size: string; - ts: string; +export interface BindUidResponseV3 { + riskUnitId: string; + uid: string; + operate: 'bind' | 'unbind'; } ⋮---- -/** - * - * * Spot | Trade - * - */ +export interface UnpaidInfoV3 { + coin: string; + unpaidQty: string; + unpaidInterest: string; +} ⋮---- -export interface CancelAndSubmitSpotOrderResponseV2 { - orderId: string; - clientOid: string | null; - success: string; - msg: string | null; +export interface BalanceInfoV3 { + coin: string; + price: string; + amount: string; + convertedUsdtAmount: string; } ⋮---- -export interface SubmitSpotBatchOrdersResponseV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - errorCode?: string; - }[]; +export interface LTVConvertResponseV3 { + ltv: string; + subAccountUids: string[]; + unpaidUsdtAmount: string; + usdtBalance: string; + unpaidInfo: UnpaidInfoV3[]; + balanceInfo: BalanceInfoV3[]; } ⋮---- -export interface SpotOrderInfoV2 { - userId: string; - symbol: string; - orderId: string; - clientOid: string; - price: string; - size: string; - orderType: string; - side: string; - status: string; - priceAvg: string; - baseVolume: string; - quoteVolume: string; - enterPointSource: string; - feeDetail: { - BGB?: { - deduction: boolean; - feeCoinCode: string; - totalDeductionFee: string; - totalFee: string; - }; - newFees?: { - c: number; - d: number; - deduction: boolean; - r: string; - t: string; - totalDeductionFee: number; - }; - }; - orderSource: string; - cancelReason: string; - cTime: string; - uTime: string; +/* Unified Account Staking & Lending (Crypto Loans) - /api/v3/loan/* */ +⋮---- +export interface LoanCoinInfoV3 { + coin: string; + hourRateFlexible: string; + rateFlexible: string; + hourRate7D: string; + rate7D: string; + hourRate30D: string; + rate30D: string; + minBorrowAmount: string; + maxBorrowAmount: string; + minBorrowLimit: string; + maxBorrowLimit: string; } ⋮---- -export interface SpotOpenOrderV2 { - userId: string; - symbol: string; - orderId: string; - clientOid: string; - priceAvg: string; - size: string; - orderType: string; - side: string; - status: string; - basePrice: string; - baseVolume: string; - quoteVolume: string; - enterPointSource: string; - orderSource?: string; - presetTakeProfitPrice: string; - executeTakeProfitPrice: string; - presetStopLossPrice: string; - executeStopLossPrice: string; - cTime: string; - uTime?: string; - tpslType: string; - triggerPrice: string | null; +export interface LoanPledgeInfoV3 { + coin: string; + initRate: string; + supRate: string; + forceRate: string; + minPledgeAmount: string; + maxPledgeAmount: string; } ⋮---- -export interface SpotFillV2 { - userId: string; - symbol: string; - orderId: string; - tradeId: string; - orderType: string; - side: string; - priceAvg: string; - size: string; - amount: string; - feeDetail: { - deduction: string; - feeCoin: string; - totalDeductionFee: string; - totalFee: string; - }; - tradeScope: string; - cTime: string; - uTime: string; +export interface GetLoanCoinsResponseV3 { + loanInfos: LoanCoinInfoV3[]; + pledgeInfos: LoanPledgeInfoV3[]; } ⋮---- -/** - * - * * Spot | Trigger Orders - * - */ +export interface GetLoanInterestResponseV3 { + hourInterest: string; + loanAmount: string; +} ⋮---- -export interface SpotCurrentPlanOrderV2 { +export interface LoanBorrowResponseV3 { orderId: string; - clientOid: string; - symbol: string; - size: string; - executePrice: string; - triggerPrice: string; - status: string; - orderType: string; - side: string; - planType: string; - triggerType: string; - enterPointSource: string; - uTime: string; - cTime: string; } ⋮---- -export interface SpotHistoryPlanOrderV2 { +export interface LoanBorrowOngoingItemV3 { orderId: string; - clientOid: string; - symbol: string; - size: string; - executePrice: string; - triggerPrice: string; - status: string; - orderType: string; - side: string; - planType: string; - triggerType: string; - enterPointSource: string; - uTime: string; - cTime: string; + loanCoin: string; + loanAmount: string; + interestAmount: string; + hourInterestRate: string; + pledgeCoin: string; + pledgeAmount: string; + pledgeRate: string; + supRate: string; + forceRate: string; + borrowTime: string; + expireTime: string; } ⋮---- -export interface SpotPlanSubOrderV2 { +export interface LoanBorrowHistoryItemV3 { orderId: string; - price: string; - type: string; + loanCoin: string; + pledgeCoin: string; + initPledgeAmount: string; + initLoanAmount: string; + hourRate: string; + daily: string; + borrowTime: string; status: string; } ⋮---- -export interface SpotCancelPlanOrdersV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - }[]; +export interface LoanRepayResponseV3 { + loanCoin: string; + pledgeCoin: string; + repayAmount: string; + payInterest: string; + repayLoanAmount: string; + repayUnlockAmount: string; } ⋮---- -/** - * - * * Spot | Account - * - */ +export interface LoanRepayHistoryItemV3 { + orderId: string; + loanCoin: string; + pledgeCoin: string; + repayAmount: string; + payInterest: string; + repayLoanAmount: string; + repayUnlockAmount: string; + repayTime: string; +} ⋮---- -export interface SpotAccountInfoV2 { - userId: string; - inviterId: string; - ips: string; - authorities: string[]; - parentId: number; - traderType: string; - channelCode: string; - channel: string; - regisTime: string; +export interface LoanRevisePledgeResponseV3 { + loanCoin: string; + pledgeCoin: string; + afterPledgeRate: string; } ⋮---- -export interface SpotAccountAssetV2 { - coin: string; - available: string; - frozen: string; - locked: string; - limitAvailable: string; - uTime: string; +export interface LoanPledgeRateHistoryItemV3 { + loanCoin: string; + pledgeCoin: string; + orderId: string; + reviseTime: string; + reviseSide: string; + reviseAmount: string; + afterPledgeRate: string; + beforePledgeRate: string; } ⋮---- -export interface SpotSubAccountAssetV2 { +export interface LoanDebtInfoV3 { coin: string; - available: string; - limitAvailable: string; - frozen: string; - locked: string; - uTime: string; + amount: string; + amountUsdt: string; } -export interface SpotSubAccountAssetsV2 { - userId: number; - assetsList: SpotSubAccountAssetV2[]; +⋮---- +export interface GetLoanDebtsResponseV3 { + pledgeInfos: LoanDebtInfoV3[]; + loanInfos: LoanDebtInfoV3[]; } ⋮---- -export interface SpotAccountBillV2 { - cTime: string; - coin: string; - groupType: string; - businessType: string; - size: string; - balance: string; - fees: string; - billId: string; -} -⋮---- -export interface SpotMainSubTransferRecordV2 { - coin: string; - status: string; - toType: string; - fromType: string; - size: string; - ts: string; - clientOid: string; - transferId: string; - fromUserId: string; - toUserId: string; -} -⋮---- -export interface SpotTransferRecordV2 { - coin: string; +export interface LoanReduceItemV3 { + orderId: string; + loanCoin: string; + pledgeCoin: string; + reduceTime: string; + pledgeRate: string; + pledgePrice: string; status: string; - toType: string; - toSymbol: string; - fromType: string; - fromSymbol: string; - size: string; - ts: string; - clientOid: string; - transferId: string; -} -⋮---- -export interface SpotDepositAddressV2 { - address: string; - chain: string; - coin: string; - tag: string; - url: string; + pledgeAmount: string; + reduceFee: string; + residueAmount: string; + runlockAmount: string; + repayLoanAmount: string; } + +================ +File: src/types/websockets/ws-api-request.ts +================ +import type { FuturesMarginModeV3 } from '../request/v3/trade.js'; ⋮---- -export interface SpotSubAccountDepositRecordV2 { - orderId: string; - tradeId: string; - coin: string; - size: string; - status: string; - toAddress: string; - dest: string; - chain: string; - fromAddress: string; +export interface WSAPIPlaceOrderRequestV3 { + symbol: string; + orderType: 'limit' | 'market'; + qty: string; + price?: string; + side: 'buy' | 'sell'; + posSide?: 'long' | 'short'; + timeInForce?: 'gtc' | 'ioc' | 'fok' | 'post_only'; + reduceOnly?: 'YES' | 'NO'; // Note: reduceOnly is not supported for batch place WS API. Might be supported starting late Q4 2025, but not supported yet. + /** Futures only. Defaults to crossed */ + marginMode?: FuturesMarginModeV3; clientOid?: string; - confirm?: string; - tag?: string; - cTime: string; - uTime: string; + stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; + tpTriggerBy?: 'market' | 'mark'; + slTriggerBy?: 'market' | 'mark'; + takeProfit?: string; + stopLoss?: string; + tpOrderType?: 'limit' | 'market'; + slOrderType?: 'limit' | 'market'; + tpLimitPrice?: string; + slLimitPrice?: string; + /** Order TTL in ms [10, 60000]. Only effective when requestTime is also set on the envelope */ + receiveWindow?: string; } ⋮---- -export interface SpotWithdrawalRecordV2 { - orderId: string; - tradeId: string; - coin: string; - dest: string; - clientOid: string; - type: string; - tag: string; - size: string; - fee: string; - status: string; - toAddress: string; - fromAddress: string; - confirm: string; - chain: string; - cTime: string; - uTime: string; -} +reduceOnly?: 'YES' | 'NO'; // Note: reduceOnly is not supported for batch place WS API. Might be supported starting late Q4 2025, but not supported yet. +/** Futures only. Defaults to crossed */ ⋮---- -export interface SpotDepositRecordV2 { - orderId: string; - tradeId: string; - coin: string; - type: string; - size: string; - status: string; - toAddress: string; - dest: string; - chain: string; - fromAddress: string; - cTime: string; - uTime: string; -} +/** Order TTL in ms [10, 60000]. Only effective when requestTime is also set on the envelope */ ================ -File: src/types/response/v3/broker.ts +File: src/types/websockets/ws-api.ts ================ -export interface CreateBrokerSubAccountResponseV3 { - subUid: string; - subaccountName: string; - subaccountEmail: string; - status: 'normal' | 'freeze'; - permList: string[]; - label: string; - cTime: string; -} -⋮---- -export interface BrokerSubAccountV3 { - subUid: string; - subaccountName: string; - subaccountEmail: string | null; - status: 'normal' | 'freeze'; - permList: string[]; - label: string; - language: string; - cTime: string; - uTime: string; -} +import { WS_KEY_MAP } from '../../util/websocket-util.js'; +import { CancelOrderRequestV3 } from '../request/v3/trade.js'; +import { CancelOrderResponseV3 } from '../response/v3/trade.js'; +import { WSAPIPlaceOrderRequestV3 } from './ws-api-request.js'; +import { WSAPIPlaceOrderResponseV3 } from './ws-api-response.js'; +import { BitgetInstTypeV3, WsKey } from './ws-general.js'; ⋮---- -export interface GetBrokerSubAccountListResponseV3 { - subList: BrokerSubAccountV3[]; -} +export type WSOperation = 'subscribe' | 'unsubscribe' | 'login'; ⋮---- -export interface ModifyBrokerSubAccountResponseV3 { - subUid: string; - subaccountName: string; - status: 'normal' | 'freeze'; - permList: string[]; - label: string; - cTime: string; - uTime: string; -} +// When new WS API operations are added, make sure to also update WS_API_Operations[] below +export type WSAPIOperation = + | 'place-order' + | 'batch-place' + | 'cancel-order' + | 'batch-cancel'; ⋮---- -export interface BrokerSubWithdrawalResponseV3 { - orderId: string; - clientOid: string; +export interface WSOperationLoginParams { + apiKey: string; + passphrase: string; + timestamp: number; + sign: string; } ⋮---- -export interface BrokerSubDepositAddressV3 { - subUid: string; - coin: string; - address: string; - chain: string; - tag: string | null; - url: string; - cTime: string; +export interface WSAPIRequestBitgetV3 { + op: 'trade'; + id: string; + category: BitgetInstTypeV3; + topic: WSAPIOperation; + args: TWSParams | TWSParams[]; + /** Client-side request timestamp; required for receiveWindow on place-order */ + requestTime?: string; } ⋮---- -export interface BrokerSubDepositWithdrawalRecordV3 { - uid: string; - txId: string; - type: 'deposit' | 'withdrawal'; - subType: 'onchain' | 'internal' | 'fast'; - coin: string; - amount: string; - status: 'pending' | 'fail' | 'success'; - ts: string; -} +/** Client-side request timestamp; required for receiveWindow on place-order */ ⋮---- -export interface GetBrokerAllSubDepositWithdrawalResponseV3 { - list: BrokerSubDepositWithdrawalRecordV3[]; - endId: string; +export interface WSAPIRequestFlags { + /** If true, will skip auth requirement for WS API connection */ + authIsOptional?: boolean | undefined; } ⋮---- -export interface BrokerCommissionRecordV3 { - uid: string; - coin: string; - symbol: string; - dealtAmount: string; - totalFee: string; - deductedFee: string; - paidFee: string; - markUpFee: string; - totalCommission: string; -} +/** If true, will skip auth requirement for WS API connection */ ⋮---- -export interface CreateBrokerSubApiKeyResponseV3 { - subUid: string; - label: string; - apiKey: string; - secretKey: string; - permType: 'read_write' | 'read_only'; - permList: string[]; - ipList: string[] | null; -} +export type Exact = { + // This part says: if there's any key that's not in T, it's an error + [K: string]: never; +} & { + [K in keyof T]: T[K]; +}; ⋮---- -export interface ModifyBrokerSubApiKeyResponseV3 { - subUid: string; - label: string; - apiKey: string; - permType: 'read_write' | 'read_only'; - permList: string[]; - ipList: string[]; -} +// This part says: if there's any key that's not in T, it's an error ⋮---- -export interface GetBrokerSubApiKeyResponseV3 { - subUid: string; - label: string; - apiKey: string; - secretKey: string; - permType: 'read_write' | 'read_only'; - permList: string[]; - ipList: string[] | null; -} +/** -================ -File: src/types/response/v3/copytrading.ts -================ /** - * - * - * Copy Trading | Futures (UTA) - * - * + * V2 request looks like this: +{ + "op":"subscribe", + "args":[ + { + "instType":"SPOT", + "channel":"ticker", + "instId":"BTCUSDT" + }, + { + "instType":"SPOT", + "channel":"candle5m", + "instId":"BTCUSDT" + } + ] +} */ -⋮---- -export interface CopyFuturesMarginDetailV3 { - marginCoin: string; - maxLongCount: string; - remainingLongCount: string; - maxShortCount: string; - remainingShortCount: string; +export interface WsRequestOperationBitget { + op: WSOperation; + args?: (TWSRequestArg | string | number)[]; } -⋮---- -export interface CopyFuturesTradingPairV3 { - symbol: string; - leverage: string; - marginDetails: CopyFuturesMarginDetailV3[]; +export interface WSAPIRateLimitV3 { + limit: string; + remaining: string; } ⋮---- -export interface CopyFuturesPositionSummaryV3 { - unrealizedPnl: string; - realizedPnl: string; - holdSize: string; - avgPrice: string; - symbol: string; - leverage: string; - marginMode: string; - liqPrice: string; - margin: string; - holdSide: string; - roi: string; - markPrice: string; - positionValue: string; +export interface WSAPIResponse< + TResponseData extends object = object, + TOperation extends WSAPIOperation = WSAPIOperation, +> { + wsKey: WsKey; + /** Auto-generated */ + id: string; + event: 'trade'; + category: BitgetInstTypeV3; + topic: TOperation; + args: TResponseData; + code: '0' | string; + msg: 'success' | string; + ts: string; + /** Connection ID (trade operation responses, May 2026+) */ + connId?: string; + /** Gateway receive time, Unix microseconds */ + receiveTime?: string; + /** Gateway push time, Unix microseconds */ + pushTime?: string; + rateLimit?: WSAPIRateLimitV3[]; } ⋮---- -export interface CopyFuturesMaxTransferableV3 { - maxTransferable: string; - available: string; -} +/** Auto-generated */ ⋮---- -export interface CopyFuturesTransferResponseV3 { - transferId: string; -} +/** Connection ID (trade operation responses, May 2026+) */ ⋮---- -/** May be a single value or comma-separated values */ -export type CopyFuturesTransferAccountTypeV3 = - | 'spot' - | 'uta' - | 'lead' - | 'otc' - | string; +/** Gateway receive time, Unix microseconds */ ⋮---- -export interface CopyFuturesTransferRecordV3 { - transferId: string; - fromType: CopyFuturesTransferAccountTypeV3; - toType: CopyFuturesTransferAccountTypeV3; - amount: string; - coin: string; - status: 'Successful' | 'Failed' | 'Processing'; - createdTime: string; -} +/** Gateway push time, Unix microseconds */ ⋮---- -export interface CopyFuturesTransferRecordListV3 { - list: CopyFuturesTransferRecordV3[]; +/** + * List of operations supported for this WsKey (connection) + */ +export interface WsAPIWsKeyTopicMap { + [WS_KEY_MAP.v3Private]: WSAPIOperation; } ⋮---- -export interface CopyFuturesCurrentFollowerV3 { - followerName: string; - estimateAssets: string; - totalProfit: string; - totalShareProfit: string; - totalInvestment: string; - canRemove: 'yes' | 'no'; - followDays: string; - totalAssets: string; - startTime: string; +/** + * Request parameters expected per operation + */ +export interface WsAPITopicRequestParamMap { + // https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters + 'place-order': WSAPIPlaceOrderRequestV3; + // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel + 'batch-place': WSAPIPlaceOrderRequestV3[]; + // https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel + 'cancel-order': CancelOrderRequestV3; + // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel + 'batch-cancel': CancelOrderRequestV3[]; } ⋮---- -export interface CopyFuturesCurrentFollowersV3 { - list: CopyFuturesCurrentFollowerV3[]; -} +// https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters ⋮---- -export interface CopyFuturesHistoryFollowerV3 { - followerName: string; - totalProfit: string; - totalShareProfit: string; - totalInvestment: string; - startTime: string; - endTime: string; -} +// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel ⋮---- -export interface CopyFuturesHistoryFollowersV3 { - list: CopyFuturesHistoryFollowerV3[]; -} +// https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel ⋮---- -export interface CopyFuturesProfitSummaryV3 { - totalProfit: string; - totalAllocatedProfit: string; - totalPendingProfit: string; -} +// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel ⋮---- -export interface CopyFuturesProfitDetailV3 { - followerName: string; - profit: string; - allocatedPnl: string; - pendingPnl: string; - shareRatio: string; - shareProfit: string; - reason: 'period' | 'unfollow' | string; - settleTime: string; +/** + * Response structure expected for each operation + */ +export interface WsAPIOperationResponseMap { + // https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters + 'place-order': WSAPIResponse<[WSAPIPlaceOrderResponseV3], 'place-order'>; + // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel + 'batch-place': WSAPIResponse; + // https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel + 'cancel-order': WSAPIResponse<[CancelOrderResponseV3], 'cancel-order'>; + // https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel + 'batch-cancel': WSAPIResponse; } ⋮---- -export interface CopyFuturesProfitDetailsV3 { - list: CopyFuturesProfitDetailV3[]; - nextCursor: string; -} +// https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters +⋮---- +// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel +⋮---- +// https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel +⋮---- +// https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel ================ -File: src/types/response/v3/loan.ts +File: src/types/websockets/ws-events.ts ================ -export interface LoanTransfersV3 { - coin: string; - transfered: string; - userId: string; +export interface MessageEventLike { + target: WebSocket; + type: 'message'; + data: string; } ⋮---- -export interface LoanSymbolSettingV3 { - symbol: string; - leverage: string; -} +export function isMessageEvent(msg: unknown): msg is MessageEventLike ⋮---- -export interface LoanSymbolsV3 { - productId: string; - spotSymbols: string[]; - marginLeverage: string; - usdtContractLeverage: string; - coinContractLeverage: string; - usdcContractLeverage: string; - usdtContractSymbols: LoanSymbolSettingV3[]; - coinContractSymbols: LoanSymbolSettingV3[]; - usdcContractSymbols: LoanSymbolSettingV3[]; +export interface WsBaseEvent { + action: TAction; + arg: unknown; + data: TData[]; } ⋮---- -export interface RepaidHistoryItemV3 { - repayOrderId: string; - businessType: 'normal' | 'liquidation'; - repayType: 'all' | 'part'; - repaidTime: string; - coin: string; - repayAmount: string; - repayInterest: string; +export interface WsSnapshotChannelEvent extends WsBaseEvent<'snapshot'> { + arg: { + instType: string; + channel: string; + instId: string; + }; } ⋮---- -export interface LoanProductInfoV3 { - productId: string; - leverage: string; - supportUsdtContract: 'YES' | 'NO'; - supportCoinContract: 'YES' | 'NO'; - supportUsdcContract: 'YES' | 'NO'; - transferLine: string; - spotBuyLine: string; - usdtContractOpenLine: string; - coinContractOpenLine: string; - usdcContractOpenLine: string; - liquidationLine: string; - stopLiquidationLine: string; +export interface WsSnapshotAccountEvent extends WsBaseEvent<'snapshot'> { + arg: { + instType: string; + channel: 'account'; + instId: string; + }; } ⋮---- -export interface LoanOrderV3 { - orderId: string; - orderProductId: string; - uid: string; - loanTime: string; - loanCoin: string; - loanAmount: string; - unpaidAmount: string; - unpaidInterest: string; - repaidAmount: string; - repaidInterest: string; - reserve: string; - status: 'not_paid_off' | 'paid_off'; -} -⋮---- -/** Tiered conversion rate item (when Tiered Discount Rate Model is enabled) */ -export interface ConvertRatioListItemV3 { - ladder: string; - convertRatio: string; -} -⋮---- -export interface CoinInfoV3 { - coin: string; - convertRatio: string; - maxConvertValue: string; - /** Tiered conversion rate (when margin mode is Tiered Discount Rate Model) */ - convertRatioList?: ConvertRatioListItemV3[]; -} -⋮---- -/** Tiered conversion rate (when margin mode is Tiered Discount Rate Model) */ -⋮---- -export interface BindUidResponseV3 { - riskUnitId: string; - uid: string; - operate: 'bind' | 'unbind'; -} -⋮---- -export interface UnpaidInfoV3 { - coin: string; - unpaidQty: string; - unpaidInterest: string; -} -⋮---- -export interface BalanceInfoV3 { - coin: string; - price: string; - amount: string; - convertedUsdtAmount: string; -} -⋮---- -export interface LTVConvertResponseV3 { - ltv: string; - subAccountUids: string[]; - unpaidUsdtAmount: string; - usdtBalance: string; - unpaidInfo: UnpaidInfoV3[]; - balanceInfo: BalanceInfoV3[]; -} -⋮---- -/* Unified Account Staking & Lending (Crypto Loans) - /api/v3/loan/* */ -⋮---- -export interface LoanCoinInfoV3 { - coin: string; - hourRateFlexible: string; - rateFlexible: string; - hourRate7D: string; - rate7D: string; - hourRate30D: string; - rate30D: string; - minBorrowAmount: string; - maxBorrowAmount: string; - minBorrowLimit: string; - maxBorrowLimit: string; -} -⋮---- -export interface LoanPledgeInfoV3 { - coin: string; - initRate: string; - supRate: string; - forceRate: string; - minPledgeAmount: string; - maxPledgeAmount: string; -} -⋮---- -export interface GetLoanCoinsResponseV3 { - loanInfos: LoanCoinInfoV3[]; - pledgeInfos: LoanPledgeInfoV3[]; -} -⋮---- -export interface GetLoanInterestResponseV3 { - hourInterest: string; - loanAmount: string; -} -⋮---- -export interface LoanBorrowResponseV3 { - orderId: string; -} -⋮---- -export interface LoanBorrowOngoingItemV3 { - orderId: string; - loanCoin: string; - loanAmount: string; - interestAmount: string; - hourInterestRate: string; - pledgeCoin: string; - pledgeAmount: string; - pledgeRate: string; - supRate: string; - forceRate: string; - borrowTime: string; - expireTime: string; +export interface WsSnapshotPositionsEvent extends WsBaseEvent<'snapshot'> { + arg: { + instType: string; + channel: 'positions'; + instId: string; + }; } ⋮---- -export interface LoanBorrowHistoryItemV3 { - orderId: string; - loanCoin: string; - pledgeCoin: string; - initPledgeAmount: string; - initLoanAmount: string; - hourRate: string; - daily: string; - borrowTime: string; - status: string; +export interface WsAccountSnapshotDataUMCBL { + marginCoin: string; + locked: string; + available: string; + maxOpenPosAvailable: string; + maxTransferOut: string; + equity: string; + usdtEquity: string; } ⋮---- -export interface LoanRepayResponseV3 { - loanCoin: string; - pledgeCoin: string; - repayAmount: string; - payInterest: string; - repayLoanAmount: string; - repayUnlockAmount: string; +export interface WsAccountSnapshotUMCBL extends WsBaseEvent<'snapshot'> { + arg: { + instType: 'umcbl'; + channel: 'account'; + instId: string; + }; + data: WsAccountSnapshotDataUMCBL[]; } ⋮---- -export interface LoanRepayHistoryItemV3 { - orderId: string; - loanCoin: string; - pledgeCoin: string; - repayAmount: string; - payInterest: string; - repayLoanAmount: string; - repayUnlockAmount: string; - repayTime: string; +export interface WsPositionSnapshotDataUMCBL { + posId: string; + instId: string; + instName: string; + marginCoin: string; + margin: string; + marginMode: string; + holdSide: string; + holdMode: string; + total: string; + available: string; + locked: string; + averageOpenPrice: string; + leverage: number; + achievedProfits: string; + upl: string; + uplRate: string; + liqPx: string; + keepMarginRate: string; + marginRate: string; + cTime: string; + uTime: string; + markPrice: string; + /** Cash dividend, USDT (Classic V2 positions channel) */ + cashDividend?: string; } ⋮---- -export interface LoanRevisePledgeResponseV3 { - loanCoin: string; - pledgeCoin: string; - afterPledgeRate: string; -} +/** Cash dividend, USDT (Classic V2 positions channel) */ ⋮---- -export interface LoanPledgeRateHistoryItemV3 { - loanCoin: string; - pledgeCoin: string; - orderId: string; - reviseTime: string; - reviseSide: string; - reviseAmount: string; - afterPledgeRate: string; - beforePledgeRate: string; +/** UTA reality-orderbook push (ts/seq/pseq removed July 2026) */ +export interface WsRealityOrderBookDataV3 { + a: [string, string][]; + b: [string, string][]; } ⋮---- -export interface LoanDebtInfoV3 { - coin: string; - amount: string; - amountUsdt: string; +export interface WSPositionSnapshotUMCBL extends WsBaseEvent<'snapshot'> { + arg: { + instType: 'umcbl'; + channel: 'positions'; + instId: string; + }; + data: WsPositionSnapshotDataUMCBL[]; } ⋮---- -export interface GetLoanDebtsResponseV3 { - pledgeInfos: LoanDebtInfoV3[]; - loanInfos: LoanDebtInfoV3[]; +/** Classic V2 depth channel push data. checksum removed May 2026 - use seq instead */ +export interface WsDepthBookDataV2 { + asks: [string, string][]; + bids: [string, string][]; + ts: string; + seq: string; + /** Futures books channel only - previous push serial number */ + pseq?: string; } ⋮---- -export interface LoanReduceItemV3 { - orderId: string; - loanCoin: string; - pledgeCoin: string; - reduceTime: string; - pledgeRate: string; - pledgePrice: string; - status: string; - pledgeAmount: string; - reduceFee: string; - residueAmount: string; - runlockAmount: string; - repayLoanAmount: string; -} +/** Futures books channel only - previous push serial number */ ================ File: src/websocket-client-v3.ts @@ -11256,1929 +10460,2280 @@ logger, // Optional: inject a custom logger */ ================ -File: src/types/request/v3/trade.ts +File: src/types/response/v2/futures.ts ================ -export interface BatchModifyOrderRequestV3 { - orderId?: string; - clientOid?: string; - qty?: string; - price?: string; - autoCancel?: 'yes' | 'no'; -} +/** + * + * * Futures | Market + * + */ ⋮---- -export interface CancelAllOrdersRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; -} -⋮---- -export interface CancelBatchOrdersRequestV3 { - orderId?: string; - clientOid?: string; - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol: string; +export interface FuturesVipFeeRateV2 { + level: string; + dealAmount: string; + assetAmount: string; + takerFeeRate: string; + makerFeeRate: string; + btcWithdrawAmount: string; + usdtWithdrawAmount: string; } ⋮---- -export interface CloseAllPositionsRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - posSide?: 'long' | 'short'; +export interface FuturesHistoryInterestRateV2 { + ts: string; + annualInterestRate: string; + dailyInterestRate: string; } ⋮---- -export interface CancelOrderRequestV3 { - orderId?: string; - clientOid?: string; - category?: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; +export interface FuturesInterestExchangeRateV2 { + tier: string; + minAmount: string; + maxAmount: string; + exchangeRate: string; } ⋮---- -export interface GetMaxOpenAvailableRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol: string; - orderType: 'limit' | 'market'; - side: 'buy' | 'sell'; - price?: string; - size?: string; +export interface FuturesDiscountRateV2 { + tier: string; + minAmount: string; + maxAmount: string; + discountRate: string; } ⋮---- -export interface GetOrderInfoRequestV3 { - orderId?: string; - clientOid?: string; +export interface FuturesDiscountRatesV2 { + coin: string; + userLimit: string; + totalLimit: string; + discountRateList: FuturesDiscountRateV2[]; } ⋮---- -export interface GetFillsRequestV3 { - category?: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - orderId?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +export interface FuturesMergeDepthV2 { + asks: [number, number][]; + bids: [number, number][]; + ts: string; + scale: string; + precision: string; + isMaxPrecision: string; } ⋮---- -export interface GetUnfilledOrdersRequestV3 { - category?: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +export interface FuturesTickerV2 { + symbol: string; + lastPr: string; + askPr: string; + bidPr: string; + bidSz: string; + askSz: string; + high24h: string; + low24h: string; + ts: string; + change24h: string; + baseVolume: string; + quoteVolume: string; + usdtVolume: string; + openUtc: string; + changeUtc24h: string; + indexPrice: string; + fundingRate: string; + holdingAmount: string; + deliveryStartTime: string; + deliveryTime: string; + deliveryStatus: string; + open24h: string; + markPrice: string; } ⋮---- -export interface GetHistoryOrdersRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +export interface FuturesFillV2 { + tradeId: string; + price: string; + size: string; + side: string; + ts: string; + symbol: string; } ⋮---- -export interface GetPositionHistoryRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; -} +export type FuturesCandlestickV2 = [ + string, // timestamp + string, // open + string, // high + string, // low + string, // close + string, // baseVolume + string, // usdtVolume + string, // quoteVolume +]; ⋮---- -export interface GetCurrentPositionRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - posSide?: 'long' | 'short'; -} +string, // timestamp +string, // open +string, // high +string, // low +string, // close +string, // baseVolume +string, // usdtVolume +string, // quoteVolume ⋮---- -export interface ModifyOrderRequestV3 { - orderId?: string; - clientOid?: string; - qty?: string; - price?: string; - autoCancel?: 'yes' | 'no'; - symbol?: string; - category?: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - tpTriggerBy?: 'market' | 'mark'; - slTriggerBy?: 'market' | 'mark'; - takeProfit?: string; - stopLoss?: string; - tpOrderType?: 'limit' | 'market'; - slOrderType?: 'limit' | 'market'; - tpLimitPrice?: string; - slLimitPrice?: string; +export interface FuturesOpenInterestV2 { + symbol: string; + size: string; } ⋮---- -export interface PlaceRealityOrderRequestV3 { - category?: 'SPOT' | 'MARGIN'; +export interface FuturesFundingTimeV2 { symbol: string; - side: 'buy' | 'sell'; - orderType: 'limit' | 'market'; - qty: string; - price?: string; - clientOid?: string; + nextFundingTime: string; + ratePeriod: string; } ⋮---- -export interface CancelRealityOrderRequestV3 { - category?: 'SPOT' | 'MARGIN'; +export interface FuturesSymbolPriceV2 { symbol: string; - orderId?: string; - clientOid?: string; + price: string; + indexPrice: string; + markPrice: string; + ts: string; } ⋮---- -export interface PlaceBatchOrdersRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; +export interface FuturesHistoricalFundingRateV2 { symbol: string; - qty: string; - price?: string; - side: 'buy' | 'sell'; - orderType: 'limit' | 'market'; - timeInForce?: 'ioc' | 'fok' | 'gtc' | 'post_only'; - posSide?: 'long' | 'short'; - clientOid?: string; - reduceOnly?: 'yes' | 'no'; + fundingRate: string; + fundingTime: string; } ⋮---- -export type FuturesMarginModeV3 = 'crossed' | 'isolated'; -⋮---- -export interface PlaceOrderRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; +export interface FuturesContractConfigV2 { symbol: string; - qty: string; - price?: string; - side: 'buy' | 'sell'; - orderType: 'limit' | 'market'; - timeInForce?: 'ioc' | 'fok' | 'gtc' | 'post_only'; - posSide?: 'long' | 'short'; - clientOid?: string; - reduceOnly?: 'yes' | 'no'; - /** Futures only. Defaults to crossed */ - marginMode?: FuturesMarginModeV3; - stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; - tpTriggerBy?: 'market' | 'mark'; - slTriggerBy?: 'market' | 'mark'; - takeProfit?: string; - stopLoss?: string; - tpOrderType?: 'limit' | 'market'; - slOrderType?: 'limit' | 'market'; - tpLimitPrice?: string; - slLimitPrice?: string; + baseCoin: string; + quoteCoin: string; + buyLimitPriceRatio: string; + sellLimitPriceRatio: string; + feeRateUpRatio: string; + makerFeeRate: string; + takerFeeRate: string; + openCostUpRatio: string; + supportMarginCoins: string[]; + minTradeNum: string; + priceEndStep: string; + volumePlace: string; + pricePlace: string; + sizeMultiplier: string; + symbolType: string; + minTradeUSDT: string; + maxSymbolOrderNum: string; + maxProductOrderNum: string; + maxPositionNum: string; + symbolStatus: string; + offTime: string; + limitOpenTime: string; + deliveryTime: string; + deliveryStartTime: string; + launchTime: string; + fundInterval: string; + minLever: string; + maxLever: string; + posLimit: string; + maintainTime: string; + isRwa: string; } ⋮---- -/** Futures only. Defaults to crossed */ -⋮---- -export interface CountdownCancelAllRequestV3 { - countdown: string; // seconds until auto-cancel (5-60, or 0 to disable) -} +/** + * + * * Futures | Account + * + */ ⋮---- -countdown: string; // seconds until auto-cancel (5-60, or 0 to disable) - -================ -File: src/types/response/v3/trade.ts -================ -export interface BatchModifyOrderResponseV3 { - orderId: string; - clientOid: string; +export interface FuturesAccountV2 { + marginCoin: string; + locked: string; + available: string; + crossedMaxAvailable: string; + isolatedMaxAvailable: string; + maxTransferOut: string; + accountEquity: string; + usdtEquity: string; + btcEquity: string; + crossedRiskRate: string; + crossedMarginLeverage: string; + isolatedLongLever: string; + isolatedShortLever: string; + marginMode: string; + posMode: string; + unrealizedPL: string; + coupon: string; + crossedUnrealizedPL: string; + isolatedUnrealizedPL: string; + assetMode: string; } ⋮---- -export interface CancelAllOrdersResponseV3 { - list: { - orderId: string; - clientOid: string; - code: string; - msg: string; +export interface FuturesAccountsV2 { + marginCoin: string; + locked: string; + available: string; + crossedMaxAvailable: string; + isolatedMaxAvailable: string; + maxTransferOut: string; + accountEquity: string; + usdtEquity: string; + btcEquity: string; + crossedRiskRate: string; + unrealizedPL: string; + coupon: string; + unionTotalMagin: string; + unionAvailable: string; + unionMm: string; + assetList: { + coin: string; + balance: string; }[]; + isolatedMargin: string; + crossedMargin: string; + crossedUnrealizedPL: string; + isolatedUnrealizedPL: string; + assetMode: string; } ⋮---- -export interface CancelBatchOrdersResponseV3 { - orderId: string; - clientOid: string; - code?: string; - msg?: string; +export interface FuturesSubAccountAssetV2 { + marginCoin: string; + locked: string; + available: string; + crossedMaxAvailable: string; + isolatedMaxAvailable: string; + maxTransferOut: string; + accountEquity: string; + usdtEquity: string; + btcEquity: string; + unrealizedPL: string; + coupon: string; } ⋮---- -export interface CloseAllPositionsResponseV3 { - list: { - orderId: string; - clientOid: string; - code: string; - msg: string; - }[]; +export interface FuturesInterestV2 { + coin: string; + liability: string; + interestFreeLimit: string; + interestLimit: string; + hourInterestRate: string; + interest: string; + cTime: string; } -⋮---- -export interface CancelOrderResponseV3 { - orderId: string; - clientOid: string; +export interface FuturesInterestHistoryV2 { + nextSettleTime: string; + borrowAmount: string; + borrowLimit: string; + interestList: FuturesInterestV2[]; + endId: string; } ⋮---- -export interface GetMaxOpenAvailableResponseV3 { - available: string; - maxOpen: string; - buyOpenCost: string; - sellOpenCost: string; - maxBuyOpen: string; - maxSellOpen: string; +export interface SetLeverageResponseV2 { + symbol: string; + marginCoin: string; + longLeverage: string; + shortLeverage: string; + crossMarginLeverage: string; + marginMode: string; } ⋮---- -export interface FeeDetailV3 { - feeCoin: string; - fee: string; +export interface SetMarginModeResponseV2 { + symbol: string; + marginCoin: string; + longLeverage: string; + shortLeverage: string; + marginMode: string; } ⋮---- -export interface OrderInfoV3 { - orderId: string; - clientOid: string; - category: string; +export interface FuturesAccountBillV2 { + billId: string; symbol: string; - orderType: string; - side: string; - price: string; - qty: string; amount: string; - cumExecQty: string; - cumExecValue: string; - avgPrice: string; - timeInForce: string; - orderStatus: string; - posSide: string; - holdMode: string; - delegateType?: string; - reduceOnly: string; - feeDetail: FeeDetailV3[]; - cancelReason: string; - execType: string; - stpMode?: string; - createdTime: string; - updatedTime: string; + fee: string; + feeByCoupon: string; + businessType: string; + coin: string; + balance: string; + cTime: string; } ⋮---- -export type FillCategoryV3 = - | 'spot' - | 'margin' - | 'usdt-futures' - | 'coin-futures' - | 'usdc-futures' - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; +/** + * + * * Futures | Position + * + */ ⋮---- -export interface FillV3 { - execId: string; - orderId: string; - category: FillCategoryV3; +export interface FuturesPositionTierV2 { symbol: string; - orderType: string; - side: string; - execPrice: string; - execQty: string; - execValue: string; - tradeScope: string; - feeDetail: FeeDetailV3[]; - execPnl?: string; - tradeSide?: string; - createdTime: string; - updatedTime: string; + level: string; + startUnit: string; + endUnit: string; + leverage: string; + keepMarginRate: string; } ⋮---- -export interface UnfilledOrderV3 { - orderId: string; - clientOid: string; - category: string; +export interface FuturesPositionV2 { + marginCoin: string; symbol: string; - orderType: string; - side: string; - price: string; - qty: string; - amount: string; - cumExecQty: string; - cumExecValue: string; - avgPrice: string; - timeInForce: string; - orderStatus: string; - posSide: string; - holdMode: string; - delegateType?: string; - reduceOnly: string; - feeDetail: FeeDetailV3[]; - stpMode?: string; - createdTime: string; - updatedTime: string; + holdSide: string; + openDelegateSize: string; + marginSize: string; + available: string; + locked: string; + total: string; + leverage: string; + achievedProfits: string; + openPriceAvg: string; + marginMode: string; + posMode: string; + unrealizedPL: string; + liquidationPrice: string; + keepMarginRate: string; + markPrice: string; + breakEvenPrice: string; + totalFee: string; + deductedFee: string; + marginRatio: string; + assetMode: string; + /** Cash dividend, USDT */ + cashDividend?: string; + uTime: string; + autoMargin: string; + cTime: string; } ⋮---- -export interface HistoryOrderV3 { - orderId: string; - clientOid: string; - category: string; +/** Cash dividend, USDT */ +⋮---- +export interface FuturesPositionAdlRankV2 { symbol: string; - orderType: string; - side: string; - price: string; - qty: string; - amount: string; - cumExecQty: string; - cumExecValue: string; - avgPrice: string; - timeInForce: string; - orderStatus: string; - posSide: string; - holdMode: string; - delegateType?: string; - reduceOnly: string; - feeDetail: FeeDetailV3[]; - cancelReason: string; - execType: string; - stpMode?: string; - createdTime: string; - updatedTime: string; + marginCoin: string; + adlRank: string; + rank: string; + holdSide: string; } ⋮---- -export interface PositionHistoryV3 { +export interface FuturesHistoryPositionV2 { positionId: string; - category: string; - symbol: string; marginCoin: string; - holdMode: string; - posSide: string; + symbol: string; + holdSide: string; + openAvgPrice: string; + closeAvgPrice: string; marginMode: string; - openPriceAvg: string; - closePriceAvg: string; openTotalPos: string; closeTotalPos: string; - cumRealisedPnl: string; + pnl: string; netProfit: string; totalFunding: string; - openFeeTotal: string; - closeFeeTotal: string; + openFee: string; + closeFee: string; /** Cash dividend, USDT */ cashDividend?: string; - createdTime: string; - updatedTime: string; + cTime: string; + uTime: string; } ⋮---- /** Cash dividend, USDT */ ⋮---- -export interface CurrentPositionV3 { - category: string; - symbol: string; - marginCoin: string; - holdMode: string; - posSide: string; - marginMode: string; - positionBalance: string; - available: string; - frozen: string; - total: string; - leverage: string; - curRealisedPnl: string; - avgPrice: string; - positionStatus: string; - unrealisedPnl: string; - liquidationPrice: string; - mmr: string; - profitRate: string; - markPrice: string; - breakEvenPrice: string; - totalFunding: string; - openFeeTotal: string; - closeFeeTotal: string; - /** Cash dividend, USDT */ - cashDividend?: string; - createdTime: string; - updatedTime: string; -} -⋮---- -/** Cash dividend, USDT */ +/** + * + * * Futures | Trade + * + */ ⋮---- -export interface LoanDataDebtCoinV3 { - coin: string; - debt: string; - interestFreeAmount: string; - interestRateNextHour: string; +export interface FuturesBatchOrderResponseV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + errorCode: string; + }[]; } ⋮---- -export interface LoanDataV3 { - currentLoans: string; - interestPaymentTime: string; - debtCoinList: LoanDataDebtCoinV3[]; +export interface FuturesClosePositionResponseV2 { + successList: { + orderId: string; + clientOid: string; + symbol: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + symbol: string; + errorMsg: string; + errorCode: string; + }[]; } ⋮---- -export interface ModifyOrderResponseV3 { +export interface FuturesOrderDetailV2 { + symbol: string; + size: string; orderId: string; clientOid: string; + baseVolume: string; + priceAvg: string; + fee: string; + price: string; + state: string; + side: string; + force: string; + totalProfits: string; + posSide: string; + marginCoin: string; + presetStopSurplusPrice: string; + presetStopLossPrice: string; + quoteVolume: string; + orderType: string; + leverage: string; + marginMode: string; + reduceOnly: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderSource: string; + cancelReason: string; + cTime: string; + uTime: string; } ⋮---- -export interface PlaceBatchOrdersResponseV3 { +export interface FuturesOrderFillV2 { + tradeId: string; + symbol: string; orderId: string; - clientOid: string; - code?: string; - msg?: string; + price: string; + baseVolume: string; + feeDetail: { + deduction: string; + feeCoin: string; + totalDeductionFee: string; + totalFee: string; + }[]; + side: string; + quoteVolume: string; + profit: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + tradeScope: string; + cTime: string; } ⋮---- -export interface PlaceOrderResponseV3 { +export interface FuturesOpenOrderV2 { + symbol: string; + size: string; orderId: string; clientOid: string; + baseVolume: string; + fee: string; + price: string; + priceAvg: string; + status: string; + side: string; + force: string; + totalProfits: string; + posSide: string; + marginCoin: string; + quoteVolume: string; + leverage: string; + marginMode: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderType: string; + orderSource: string; + cTime: string; + uTime: string; + presetStopSurplusPrice: string; + presetStopSurplusType: string; + presetStopSurplusExecutePrice: string; + presetStopLossPrice: string; + presetStopLossType: string; + presetStopLossExecutePrice: string; } ⋮---- -export interface PositionAdlRankV3 { +export interface FuturesHistoryOrderV2 { symbol: string; + size: string; + orderId: string; + clientOid: string; + baseVolume: string; + fee: string; + price: string; + priceAvg: string; + status: string; + side: string; + force: string; + totalProfits: string; + posSide: string; marginCoin: string; - adlRank: string; - holdSide: 'long' | 'short'; -} - -================ -File: src/types/request/v3/public.ts -================ -export interface GetPublicFillsRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; - limit?: string; + quoteVolume: string; + leverage: string; + marginMode: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderType: string; + orderSource: string; + cTime: string; + uTime: string; + presetStopSurplusPrice: string; + presetStopLossPrice: string; + liqPrice: string; } ⋮---- -export interface GetCandlesRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - interval: - | '1m' - | '3m' - | '5m' - | '15m' - | '30m' - | '1H' - | '4H' - | '6H' - | '12H' - | '1D'; - startTime?: string; - endTime?: string; - type?: 'MARKET' | 'MARK' | 'INDEX'; - limit?: string; +export interface FuturesCancelAllOrdersV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + errorCode: string; + }[]; } ⋮---- -export interface GetHistoryCandlesRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - interval: - | '1m' - | '3m' - | '5m' - | '15m' - | '30m' - | '1H' - | '4H' - | '6H' - | '12H' - | '1D'; - startTime?: string; - endTime?: string; - type?: 'MARKET' | 'MARK' | 'INDEX'; - limit?: string; -} +/** + * + * * Futures | Trigger Orders + * + */ ⋮---- -export interface GetContractsOiRequestV3 { - symbol?: string; - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +export interface FuturesTriggerSubOrderV2 { + orderId: string; + price: string; + type: string; + status: string; } ⋮---- -export interface GetCurrentFundingRateRequestV3 { - category?: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; +export interface FuturesPendingPlanOrderV2 { + planType: string; + symbol: string; + size: string; + orderId: string; + clientOid: string; + price: string; + executePrice: string; + callbackRatio: string; + triggerPrice: string; + triggerType: string; + planStatus: string; + side: string; + posSide: string; + marginCoin: string; + marginMode: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderType: string; + orderSource: string; + cTime: string; + uTime: string; + stopSurplusExecutePrice: string; + stopSurplusTriggerPrice: string; + stopSurplusTriggerType: string; + stopLossExecutePrice: string; + stopLossTriggerPrice: string; + stopLossTriggerType: string; } ⋮---- -export interface GetLiquidationsRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - limit?: string; - cursor?: string; +export interface FuturesCancelPlanOrderV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + }[]; } ⋮---- -export interface GetHistoryFundingRateRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +export interface FuturesHistoryPlanOrderV2 { + planType: string; symbol: string; - cursor?: string; - limit?: string; -} -⋮---- -export interface GetMarginLoansRequestV3 { - coin: string; + size: string; + orderId: string; + executeOrderId: string; + clientOid: string; + planStatus: string; + price: string; + executePrice: string; + priceAvg: string; + baseVolume: string; + callbackRatio: string; + triggerPrice: string; + triggerType: string; + side: string; + posSide: string; + marginCoin: string; + marginMode: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderType: string; + cTime: string; + uTime: string; + stopSurplusExecutePrice: string; + stopSurplusTriggerPrice: string; + stopSurplusTriggerType: string; + stopLossExecutePrice: string; + stopLossTriggerPrice: string; + stopLossTriggerType: string; } ⋮---- -export interface GetOpenInterestRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; -} +/** + * + * * Futures | Union Margin + * + */ ⋮---- -export interface GetPositionTierRequestV3 { - category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - coin?: string; +export interface UnionTransferLimitsV2 { + coin: string; + maxTransferIn: string; } ⋮---- -export interface GetRiskReserveRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - marginCoin?: string; +export interface UnionConfigV2 { + imr: string; + mmr: string; + individualLimit: string; + individualLimitRatio: string; } ⋮---- -export interface GetRiskReserveAllRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +export interface UnionSwitchUsdtV2 { + usdtAmount: string; } ⋮---- -export interface GetInstrumentsRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; +export interface UnionConvertV2 { + usdtAmount: string; } ⋮---- -export interface GetMarketFeeGroupRequestV3 { - category: 'SPOT' | 'FUTURES'; - group?: 'DEFAULT' | 'GROUP_A' | 'GROUP_B' | 'GROUP_C'; -} +/** + * + * * Futures | Account | Max Openable Quantity + * + */ ⋮---- -export interface GetMarketScoreWeightsRequestV3 { - category?: 'SPOT' | 'FUTURES'; +export interface FuturesMaxOpenV2 { + maxOpen: string; } ⋮---- -export interface GetOrderBookRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - limit?: string; -} +/** + * + * * Futures | Account | Liquidation Price + * + */ ⋮---- -export interface GetTickersRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; +export interface FuturesLiquidationPriceV2 { + liqPrice: string; } ⋮---- -export interface GetIndexComponentsRequestV3 { - symbol: string; -} +/** + * + * * Futures | Account | Isolated Symbols + * + */ ⋮---- -export interface GetRpiOrderBookRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +export interface FuturesIsolatedSymbolV2 { symbol: string; - limit?: string; -} -⋮---- -export interface GetCashDividendRecordsRequestV3 { - symbol: string; - type: 'pending' | 'paid'; - cursor?: string; - limit?: string; + marginMode: 'isolated'; } + +================ +File: src/types/response/v3/copytrading.ts +================ +/** + * + * + * Copy Trading | Futures (UTA) + * + * + */ ⋮---- -export interface GetSpotWhaleFlowRequestV3 { - symbol: string; +export interface CopyFuturesMarginDetailV3 { + marginCoin: string; + maxLongCount: string; + remainingLongCount: string; + maxShortCount: string; + remainingShortCount: string; } ⋮---- -export interface GetSpotFundFlowRequestV3 { +export interface CopyFuturesTradingPairV3 { symbol: string; - period?: string; + leverage: string; + marginDetails: CopyFuturesMarginDetailV3[]; } ⋮---- -export interface GetSpotNetFlowRequestV3 { +export interface CopyFuturesPositionSummaryV3 { + unrealizedPnl: string; + realizedPnl: string; + holdSize: string; + avgPrice: string; symbol: string; + leverage: string; + marginMode: string; + liqPrice: string; + margin: string; + holdSide: string; + roi: string; + markPrice: string; + positionValue: string; } ⋮---- -export interface GetMarginLongShortRequestV3 { - symbol: string; - period?: '24h' | '30d'; - coin?: string; +export interface CopyFuturesMaxTransferableV3 { + maxTransferable: string; + available: string; } ⋮---- -export interface GetMarginLoanGrowthRequestV3 { - symbol: string; - period?: string; - coin?: string; +export interface CopyFuturesTransferResponseV3 { + transferId: string; } ⋮---- -export interface GetMarginIsolatedBorrowRequestV3 { - symbol: string; - period?: string; +/** May be a single value or comma-separated values */ +export type CopyFuturesTransferAccountTypeV3 = + | 'spot' + | 'uta' + | 'lead' + | 'otc' + | string; +⋮---- +export interface CopyFuturesTransferRecordV3 { + transferId: string; + fromType: CopyFuturesTransferAccountTypeV3; + toType: CopyFuturesTransferAccountTypeV3; + amount: string; + coin: string; + status: 'Successful' | 'Failed' | 'Processing'; + createdTime: string; } ⋮---- -export interface GetFuturesTradingDataRequestV3 { - symbol: string; - period?: string; +export interface CopyFuturesTransferRecordListV3 { + list: CopyFuturesTransferRecordV3[]; } - -================ -File: src/types/response/v3/account.ts -================ -// Account Management Response Types -import type { CollateralTypeV3 } from '../../request/v3/account.js'; ⋮---- -export interface AccountSymbolConfigV3 { - category: string; - symbol: string; - marginMode: string; - leverage: string; +export interface CopyFuturesCurrentFollowerV3 { + followerName: string; + estimateAssets: string; + totalProfit: string; + totalShareProfit: string; + totalInvestment: string; + canRemove: 'yes' | 'no'; + followDays: string; + totalAssets: string; + startTime: string; } ⋮---- -export interface AccountCoinConfigV3 { - coin: string; - leverage: string; +export interface CopyFuturesCurrentFollowersV3 { + list: CopyFuturesCurrentFollowerV3[]; } ⋮---- -export type AccountPermissionV3 = - | 'uta_mgt' - | 'uta_trade' - | 'withdraw' - | 'copy_futures_position' - | 'copy_futures_order'; +export interface CopyFuturesHistoryFollowerV3 { + followerName: string; + totalProfit: string; + totalShareProfit: string; + totalInvestment: string; + startTime: string; + endTime: string; +} ⋮---- -export interface AccountInfoV3 { - userId: string; - inviterId: string; - /** Only set when the calling account is a sub-account */ - parentId: string; - channelCode: string; - channel: string; - ips: string; - permType: 'read-only' | 'read-and-write'; - permissions: AccountPermissionV3[]; - regisTime: string; +export interface CopyFuturesHistoryFollowersV3 { + list: CopyFuturesHistoryFollowerV3[]; } ⋮---- -/** Only set when the calling account is a sub-account */ +export interface CopyFuturesProfitSummaryV3 { + totalProfit: string; + totalAllocatedProfit: string; + totalPendingProfit: string; +} ⋮---- -export type AccountLevelV3 = 'basic' | 'advanced' | 'isolated' | 'delta'; +export interface CopyFuturesProfitDetailV3 { + followerName: string; + profit: string; + allocatedPnl: string; + pendingPnl: string; + shareRatio: string; + shareProfit: string; + reason: 'period' | 'unfollow' | string; + settleTime: string; +} ⋮---- -export interface AccountSettingsV3 { - uid: string; - accountMode: 'unified' | 'hybrid' | 'upgrading' | 'switching'; - assetMode: string; - accountLevel: AccountLevelV3; - holdMode: string; - stpMode: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; - symbolConfigList: AccountSymbolConfigV3[]; - coinConfigList: AccountCoinConfigV3[]; +export interface CopyFuturesProfitDetailsV3 { + list: CopyFuturesProfitDetailV3[]; + nextCursor: string; +} + +================ +File: src/types/request/v3/public.ts +================ +export interface GetPublicFillsRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; + limit?: string; } ⋮---- -export interface AccountDeltaCoinPositionV3 { - coin: string; - positionRatio: string; +export interface GetCandlesRequestV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + interval: + | '1m' + | '3m' + | '5m' + | '15m' + | '30m' + | '1H' + | '4H' + | '6H' + | '12H' + | '1D'; + startTime?: string; + endTime?: string; + type?: 'MARKET' | 'MARK' | 'INDEX'; + limit?: string; } ⋮---- -/** Delta-neutral mode metrics. Only available when accountLevel is delta. */ -export interface AccountDeltaInfoV3 { - deltaEquityRatio: string; - deltaThreshold: string; - positionThreshold: string; - list: AccountDeltaCoinPositionV3[]; +export interface GetHistoryCandlesRequestV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + interval: + | '1m' + | '3m' + | '5m' + | '15m' + | '30m' + | '1H' + | '4H' + | '6H' + | '12H' + | '1D'; + startTime?: string; + endTime?: string; + type?: 'MARKET' | 'MARK' | 'INDEX'; + limit?: string; } ⋮---- -export interface AccountAssetV3 { - coin: string; - equity: string; - usdValue: string; - balance: string; - available: string; - debt: string; - locked: string; - /** Position value in USD */ - positionValue?: string; - /** Account leverage (non-negative) */ - leverage?: string; - /** USDT bonus amount */ - bonus?: string; +export interface GetContractsOiRequestV3 { + symbol?: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; } ⋮---- -/** Position value in USD */ +export interface GetCurrentFundingRateRequestV3 { + category?: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; +} ⋮---- -/** Account leverage (non-negative) */ +export interface GetLiquidationsRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + limit?: string; + cursor?: string; +} ⋮---- -/** USDT bonus amount */ +export interface GetHistoryFundingRateRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + cursor?: string; + limit?: string; +} ⋮---- -export interface AccountAssetsV3 { - accountEquity: string; - usdtEquity: string; - btcEquity: string; - unrealisedPnl: string; - usdtUnrealisedPnl: string; - btcUnrealizedPnl: string; - effEquity: string; - mmr: string; - imr: string; - mgnRatio: string; - positionMgnRatio: string; - assets: AccountAssetV3[]; +export interface GetMarginLoansRequestV3 { + coin: string; } ⋮---- -export interface ConvertRecordV3 { - fromCoin: string; - fromCoinSize: string; - toCoin: string; - toCoinSize: string; - price: string; - ts: string; +export interface GetOpenInterestRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; } ⋮---- -export interface FinancialRecordV3 { - category: string; - id: string; - symbol: string; - coin: string; - type: string; - amount: string; - fee: string; - balance: string; - ts: string; - /** crossed | isolated */ - positionType?: string; - positionAmount?: string; - positionBalance?: string; +export interface GetPositionTierRequestV3 { + category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + coin?: string; } ⋮---- -/** crossed | isolated */ -⋮---- -export interface PaymentCoinV3 { - coin: string; - size: string; - amount: string; +export interface GetRiskReserveRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + marginCoin?: string; } ⋮---- -export interface RepayableCoinV3 { - coin: string; - size: string; - amount: string; +export interface GetRiskReserveAllRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; } ⋮---- -export interface RepayResponseV3 { - result: string; - repayAmount: string; +export interface GetInstrumentsRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; } ⋮---- -// Sub-account Management Response Types -⋮---- -export interface CreateSubAccountApiKeyResponseV3 { - note: string; - apiKey: string; - secret: string; - type: string; - permissions: string[]; - ips: string[]; -} -export interface SubAccountApiKeyV3 { - apiKey: string; - note: string; - type: string; - permissions: string[]; - ips: string[]; - ts?: string; +export interface GetMarketFeeGroupRequestV3 { + category: 'SPOT' | 'FUTURES'; + group?: 'DEFAULT' | 'GROUP_A' | 'GROUP_B' | 'GROUP_C'; } ⋮---- -export interface UpdateSubAccountApiKeyResponseV3 { - note: string; - apiKey: string; - type: string; - permissions: string[]; - ips: string[]; +export interface GetMarketScoreWeightsRequestV3 { + category?: 'SPOT' | 'FUTURES'; } ⋮---- -export interface CreateSubAccountResponseV3 { - username: string; - subUid: string; - status: string; - note: string; - createdTime: string; - updatedTime: string; +export interface GetOrderBookRequestV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + limit?: string; } ⋮---- -export interface CreateAgentSubAccountResponseV3 { - username: string; - subUid: string; - apiKey: string; - secret: string; - note: string; - createdTime: string; +export interface GetTickersRequestV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; } ⋮---- -export interface SubAccountV3 { - subUid: string; - username: string; - status: string; - accountMode: string; - type: 'normal' | 'virtual' | 'custodian'; - note: string; - createdTime: string; - updatedTime: string; +export interface GetIndexComponentsRequestV3 { + symbol: string; } ⋮---- -export interface WithdrawAddressBookEntryV3 { - coin: string; - chain: string; - address: string; - countryCode: string; - label: string; - memo: string; - type: 'regular' | 'EVM' | 'universal' | 'internal'; - internalType: '' | 'uid' | 'mobile' | 'email'; - createdTime: string; +export interface GetRpiOrderBookRequestV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + limit?: string; } ⋮---- -export interface WithdrawAddressBookV3 { - addressList: WithdrawAddressBookEntryV3[]; +export interface GetCashDividendRecordsRequestV3 { + symbol: string; + type: 'pending' | 'paid'; cursor?: string; + limit?: string; } ⋮---- -// Transfer Response Types +export interface GetSpotWhaleFlowRequestV3 { + symbol: string; +} ⋮---- -export interface AllSymbolFeeRateV3 { +export interface GetSpotFundFlowRequestV3 { symbol: string; - makerFeeRate: string; - takerFeeRate: string; + period?: string; } ⋮---- -export interface TransferResponseV3 { - transferId: string; - clientOid?: string; +export interface GetSpotNetFlowRequestV3 { + symbol: string; } ⋮---- -export interface SubTransferRecordV3 { - transferId: string; - oldTransferId?: string; - fromType: string; - toType: string; - amount: string; - coin: string; - fromUserId: string; - toUserId: string; - status: string; - clientOid: string; - createdTime: string; - updatedTime: string; +export interface GetMarginLongShortRequestV3 { + symbol: string; + period?: '24h' | '30d'; + coin?: string; } ⋮---- -export interface SubUnifiedAssetV3 { - coin: string; - equity: string; - usdValue: string; - balance: string; - available: string; - debt: string; - locked: string; +export interface GetMarginLoanGrowthRequestV3 { + symbol: string; + period?: string; + coin?: string; } ⋮---- -export interface SubUnifiedAssetV3 { - subUid: string; - cursor: string; - assets: SubUnifiedAssetV3[]; +export interface GetMarginIsolatedBorrowRequestV3 { + symbol: string; + period?: string; } ⋮---- -export interface GetFeeRateResponseV3 { - makerFeeRate: string; - takerFeeRate: string; +export interface GetFuturesTradingDataRequestV3 { + symbol: string; + period?: string; +} + +================ +File: src/types/request/v3/trade.ts +================ +export interface BatchModifyOrderRequestV3 { + orderId?: string; + clientOid?: string; + qty?: string; + price?: string; + autoCancel?: 'yes' | 'no'; } ⋮---- -export interface FundingAssetV3 { - coin: string; - available: string; - frozen: string; - balance: string; +export interface CancelAllOrdersRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; } ⋮---- -// Deposit Response Types +export interface CancelBatchOrdersRequestV3 { + orderId?: string; + clientOid?: string; + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol: string; +} ⋮---- -export interface DepositAddressV3 { - address: string; - chain: string; - coin: string; - tag: string; - url: string; +export interface CloseAllPositionsRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + posSide?: 'long' | 'short'; } ⋮---- -export interface DepositRecordV3 { - orderId: string; - recordId: string; - coin: string; - type: 'deposit'; - dest: 'on_chain' | 'internal_transfer'; - size: string; - status: 'pending' | 'success' | 'fail'; - fromAddress: string; - toAddress: string; - chain: string; - createdTime: string; - updatedTime: string; -} -⋮---- -// Withdraw Response Types -⋮---- -export interface WithdrawResponseV3 { - orderId: string; - clientOid: string; -} -⋮---- -export interface WithdrawRecordV3 { - orderId: string; - clientOid: string; - recordId: string; - coin: string; - type: 'withdraw'; - dest: 'on_chain' | 'internal_transfer'; - size: string; - status: 'pending' | 'success' | 'fail'; - fromAddress: string; - toAddress: string; - chain: string; - fee: string; - confirm: string; - tag: string; - createdTime: string; - updatedTime: string; -} -⋮---- -export interface MaxTransferableV3 { - coin: string; - maxTransfer: string; - borrowMaxTransfer: string; +export interface CancelOrderRequestV3 { + orderId?: string; + clientOid?: string; + category?: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; } ⋮---- -export interface OpenInterestLimitV3 { +export interface GetMaxOpenAvailableRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; symbol: string; - singleUserLimit: string; - masterSubLimit: string; - marketMakerLimit: string; + orderType: 'limit' | 'market'; + side: 'buy' | 'sell'; + price?: string; + size?: string; } ⋮---- -export interface TaxRecordV3 { - id: string; - coin: string; - type: string; - amount: string; - fee: string; - balance: string; - ts: string; +export interface GetOrderInfoRequestV3 { + orderId?: string; + clientOid?: string; } ⋮---- -export interface CollateralTypeConfigV3 { - collateralType: CollateralTypeV3; - /** Returned when collateralType=custom */ - collateralCoins?: string; +export interface GetFillsRequestV3 { + category?: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + orderId?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -/** Returned when collateralType=custom */ -⋮---- -export interface CustomCollateralCoinV3 { - collateralCoin: string; +export interface GetUnfilledOrdersRequestV3 { + category?: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface PreSetLeverageV3 { - estMaxOpen?: string; - estMaxBorrowable?: string; - requiredMargin: string; - marginChange: string; +export interface GetHistoryOrdersRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface MaxWithdrawalV3 { - coin: string; - otcMaxWithdrawal: string; - spotMaxWithdrawal: string; - utaMaxWithdrawal: string; - totalMaxWithdrawal: string; +export interface GetPositionHistoryRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface MovePositionOrderResultV3 { - orderId: string; - clientOid: string; - code: string; - msg: string; +export interface GetCurrentPositionRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + posSide?: 'long' | 'short'; } ⋮---- -export interface MovePositionsResponseV3 { - closePosition: MovePositionOrderResultV3[]; - openPosition: MovePositionOrderResultV3[]; +export interface ModifyOrderRequestV3 { + orderId?: string; + clientOid?: string; + qty?: string; + price?: string; + autoCancel?: 'yes' | 'no'; + symbol?: string; + category?: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + tpTriggerBy?: 'market' | 'mark'; + slTriggerBy?: 'market' | 'mark'; + takeProfit?: string; + stopLoss?: string; + tpOrderType?: 'limit' | 'market'; + slOrderType?: 'limit' | 'market'; + tpLimitPrice?: string; + slLimitPrice?: string; } ⋮---- -export interface MovePositionHistoryV3 { - category: string; - fromUid: string; - toUid: string; - orderId: string; - openExecId: string; - closeExecId: string; +export interface PlaceRealityOrderRequestV3 { + category?: 'SPOT' | 'MARGIN'; symbol: string; - posSide: 'long' | 'short'; + side: 'buy' | 'sell'; + orderType: 'limit' | 'market'; qty: string; - price: string; - status: 'processing' | 'completed' | 'failed'; - createdTime: string; - updatedTime: string; + price?: string; + clientOid?: string; } ⋮---- -export interface EligibleSymbolV3 { +export interface CancelRealityOrderRequestV3 { + category?: 'SPOT' | 'MARGIN'; symbol: string; - category: string; - baseCoin: string; - quoteCoin: string; - symbolType?: string; - buyLimitPriceRatio: string; - sellLimitPriceRatio: string; - minOrderQty: string; - maxOrderQty: string; - pricePrecision: string; - quantityPrecision: string; - quotePrecision: string; - minOrderAmount: string; - maxSymbolOrderNum: string; - maxProductOrderNum: string; - status: string; - maintainTime: string; - areaSymbol?: string; - maxPositionNum?: string; - isReality?: string; - launchTime?: string; -} -⋮---- -export interface EligibleMarginTierItemV3 { - tier: string; - minTierValue: string; - maxTierValue: string; - leverage: string; - mmr: string; -} -⋮---- -export interface EligibleMarginTierV3 { - coin: string; - tiers: EligibleMarginTierItemV3[]; + orderId?: string; + clientOid?: string; } ⋮---- -export interface EligibleLoanInfoV3 { - limit: string; - masterSubLimit: string; - /** Bitget spelling */ - platformRemaingQuota: string; +export interface PlaceBatchOrdersRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol: string; + qty: string; + price?: string; + side: 'buy' | 'sell'; + orderType: 'limit' | 'market'; + timeInForce?: 'ioc' | 'fok' | 'gtc' | 'post_only'; + posSide?: 'long' | 'short'; + clientOid?: string; + reduceOnly?: 'yes' | 'no'; } ⋮---- -/** Bitget spelling */ -⋮---- -export interface RateLimitQuotaItemV3 { - uid: string; - quota: string; -} +export type FuturesMarginModeV3 = 'crossed' | 'isolated'; ⋮---- -export interface RateLimitQuotaV3 { - category: 'spot' | 'futures' | string; - quotaList: RateLimitQuotaItemV3[]; - masterSubQuota: string; - masterSubCap: string; - cursor: string; +export interface PlaceOrderRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol: string; + qty: string; + price?: string; + side: 'buy' | 'sell'; + orderType: 'limit' | 'market'; + timeInForce?: 'ioc' | 'fok' | 'gtc' | 'post_only'; + posSide?: 'long' | 'short'; + clientOid?: string; + reduceOnly?: 'yes' | 'no'; + /** Futures only. Defaults to crossed */ + marginMode?: FuturesMarginModeV3; + stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; + tpTriggerBy?: 'market' | 'mark'; + slTriggerBy?: 'market' | 'mark'; + takeProfit?: string; + stopLoss?: string; + tpOrderType?: 'limit' | 'market'; + slOrderType?: 'limit' | 'market'; + tpLimitPrice?: string; + slLimitPrice?: string; } - -================ -File: src/types/websockets/ws-general.ts -================ -import type { ClientRequestArgs } from 'http'; -import WebSocket from 'isomorphic-ws'; -⋮---- -import { RestClientOptions } from '../../util/requestUtils.js'; -import { WS_KEY_MAP } from '../../util/websocket-util.js'; -import { FuturesProductTypeV2 } from '../request/shared.js'; ⋮---- -export type BitgetInstType = 'SP' | 'SPBL' | 'MC' | 'UMCBL' | 'DMCBL'; -export type BitgetInstTypeV2 = 'SPOT' | FuturesProductTypeV2; -export type BitgetInstTypeV3 = - | 'UTA' // for account-level topics - | 'spot' - | 'usdt-futures' - | 'coin-futures' - | 'usdc-futures'; +/** Futures only. Defaults to crossed */ ⋮---- -| 'UTA' // for account-level topics +export interface CountdownCancelAllRequestV3 { + countdown: string; // seconds until auto-cancel (5-60, or 0 to disable) +} ⋮---- -/** - * - * V1 list of topics for WebSocket consumers - * - */ +countdown: string; // seconds until auto-cancel (5-60, or 0 to disable) + +================ +File: src/types/response/v3/trade.ts +================ +export interface BatchModifyOrderResponseV3 { + orderId: string; + clientOid: string; +} ⋮---- -export type WsPublicSpotTopic = - | 'ticker' - | 'candle1W' - | 'candle1D' - | 'candle12H' - | 'candle4H' - | 'candle1H' - | 'candle30m' - | 'candle15m' - | 'candle5m' - | 'candle1m' - | 'books' - | 'books5' - | 'trade'; +export interface CancelAllOrdersResponseV3 { + list: { + orderId: string; + clientOid: string; + code: string; + msg: string; + }[]; +} ⋮---- -// Futures currently has the same public topics as spot -export type WsPublicFuturesTopic = WsPublicSpotTopic; -export type WsPrivateSpotTopic = 'account' | 'orders'; +export interface CancelBatchOrdersResponseV3 { + orderId: string; + clientOid: string; + code?: string; + msg?: string; +} ⋮---- -export type WsPrivateFuturesTopic = - | 'account' - | 'positions' - | 'orders' - | 'ordersAlgo'; +export interface CloseAllPositionsResponseV3 { + list: { + orderId: string; + clientOid: string; + code: string; + msg: string; + }[]; +} ⋮---- -export type WsPublicTopic = WsPublicSpotTopic | WsPublicFuturesTopic; +export interface CancelOrderResponseV3 { + orderId: string; + clientOid: string; +} ⋮---- -export type WsPrivateTopic = WsPrivateSpotTopic | WsPrivateFuturesTopic; -export type WsTopic = WsPublicTopic | WsPrivateTopic; +export interface GetMaxOpenAvailableResponseV3 { + available: string; + maxOpen: string; + buyOpenCost: string; + sellOpenCost: string; + maxBuyOpen: string; + maxSellOpen: string; +} ⋮---- -/** - * - * V2 list of topics for WebSocket consumers - * - */ +export interface FeeDetailV3 { + feeCoin: string; + fee: string; +} ⋮---- -export type WsPublicTopicV2 = - | 'index-price' // margin only - | 'ticker' - | 'candle1m' - | 'candle5m' - | 'candle15m' - | 'candle30m' - | 'candle1H' - | 'candle4H' - | 'candle6H' - | 'candle12H' - | 'candle1D' - | 'candle3D' - | 'candle1W' - | 'candle1M' - | 'candle6Hutc' - | 'candle12Hutc' - | 'candle1Dutc' - | 'candle3Dutc' - | 'candle1Wutc' - | 'candle1Mutc' - | 'trade' - | 'books' - | 'books1' - | 'books5' - | 'books15'; +export interface OrderInfoV3 { + orderId: string; + clientOid: string; + category: string; + symbol: string; + orderType: string; + side: string; + price: string; + qty: string; + amount: string; + cumExecQty: string; + cumExecValue: string; + avgPrice: string; + timeInForce: string; + orderStatus: string; + posSide: string; + holdMode: string; + delegateType?: string; + reduceOnly: string; + feeDetail: FeeDetailV3[]; + cancelReason: string; + execType: string; + stpMode?: string; + createdTime: string; + updatedTime: string; +} ⋮---- -| 'index-price' // margin only +export type FillCategoryV3 = + | 'spot' + | 'margin' + | 'usdt-futures' + | 'coin-futures' + | 'usdc-futures' + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; ⋮---- -// Also update PRIVATE_TOPICS_V2 if this is updated -export type WSPrivateTopicFuturesV2 = - | 'positions' - | 'orders-algo' - | 'positions-history'; +export interface FillV3 { + execId: string; + orderId: string; + category: FillCategoryV3; + symbol: string; + orderType: string; + side: string; + execPrice: string; + execQty: string; + execValue: string; + tradeScope: string; + feeDetail: FeeDetailV3[]; + execPnl?: string; + tradeSide?: string; + createdTime: string; + updatedTime: string; +} ⋮---- -// Also update PRIVATE_TOPICS_V2 if this is updated -export type WSPrivateTopicMarginV2 = - | 'orders-crossed' - | 'account-crossed' - | 'account-isolated' - | 'orders-isolated'; +export interface UnfilledOrderV3 { + orderId: string; + clientOid: string; + category: string; + symbol: string; + orderType: string; + side: string; + price: string; + qty: string; + amount: string; + cumExecQty: string; + cumExecValue: string; + avgPrice: string; + timeInForce: string; + orderStatus: string; + posSide: string; + holdMode: string; + delegateType?: string; + reduceOnly: string; + feeDetail: FeeDetailV3[]; + stpMode?: string; + createdTime: string; + updatedTime: string; +} ⋮---- -// Also update PRIVATE_TOPICS_V2 if this is updated -export type WsPrivateTopicV2 = - | 'account' - | 'orders' - | WSPrivateTopicFuturesV2 - | WSPrivateTopicMarginV2; +export interface HistoryOrderV3 { + orderId: string; + clientOid: string; + category: string; + symbol: string; + orderType: string; + side: string; + price: string; + qty: string; + amount: string; + cumExecQty: string; + cumExecValue: string; + avgPrice: string; + timeInForce: string; + orderStatus: string; + posSide: string; + holdMode: string; + delegateType?: string; + reduceOnly: string; + feeDetail: FeeDetailV3[]; + cancelReason: string; + execType: string; + stpMode?: string; + createdTime: string; + updatedTime: string; +} ⋮---- -export type WsTopicV2 = WsPublicTopicV2 | WsPrivateTopicV2; +export interface PositionHistoryV3 { + positionId: string; + category: string; + symbol: string; + marginCoin: string; + holdMode: string; + posSide: string; + marginMode: string; + openPriceAvg: string; + closePriceAvg: string; + openTotalPos: string; + closeTotalPos: string; + cumRealisedPnl: string; + netProfit: string; + totalFunding: string; + openFeeTotal: string; + closeFeeTotal: string; + /** Cash dividend, USDT */ + cashDividend?: string; + createdTime: string; + updatedTime: string; +} ⋮---- -/** - * - * V3 / UTA list of topics for WebSocket consumers - * - */ -export type WsPublicTopicV3 = 'ticker' | 'kline' | 'books' | 'publicTrade'; -// Also update PRIVATE_TOPICS_V3 if this is updated -export type WsPrivateTopicV3 = - | 'account' - | 'position' - | 'fill' - | 'order' - | 'strategy-order' - | 'reality-orderbook'; -export type WsTopicV3 = WsPublicTopicV3 | WsPrivateTopicV3; +/** Cash dividend, USDT */ ⋮---- -/** This is used to differentiate between each of the available websocket streams */ -export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP]; +export interface CurrentPositionV3 { + category: string; + symbol: string; + marginCoin: string; + holdMode: string; + posSide: string; + marginMode: string; + positionBalance: string; + available: string; + frozen: string; + total: string; + leverage: string; + curRealisedPnl: string; + avgPrice: string; + positionStatus: string; + unrealisedPnl: string; + liquidationPrice: string; + mmr: string; + profitRate: string; + markPrice: string; + breakEvenPrice: string; + totalFunding: string; + openFeeTotal: string; + closeFeeTotal: string; + /** Cash dividend, USDT */ + cashDividend?: string; + createdTime: string; + updatedTime: string; +} ⋮---- -/** - * Event args for subscribing/unsubscribing - */ +/** Cash dividend, USDT */ ⋮---- -export interface WsTopicSubscribeEventArgs { - instType: BitgetInstType; - channel: WsTopic; - instId?: string; +export interface LoanDataDebtCoinV3 { + coin: string; + debt: string; + interestFreeAmount: string; + interestRateNextHour: string; } ⋮---- -export type WsTopicSubscribePublicArgsV2 = { - instType: BitgetInstTypeV2; - channel: WsPublicTopicV2; - /** The symbol, e.g. "BTCUSDT" */ - instId: string; -}; -⋮---- -/** The symbol, e.g. "BTCUSDT" */ +export interface LoanDataV3 { + currentLoans: string; + interestPaymentTime: string; + debtCoinList: LoanDataDebtCoinV3[]; +} ⋮---- -export type WsInstIdChannelsV2 = - | 'orders' - | WSPrivateTopicFuturesV2 - | 'orders-crossed' - | 'orders-isolated'; +export interface ModifyOrderResponseV3 { + orderId: string; + clientOid: string; +} ⋮---- -export type WsTopicSubscribePrivateInstIdArgsV2 = { - instType: BitgetInstTypeV2; - channel: WsInstIdChannelsV2; - /** The symbol, e.g. "BTCUSDT" */ - instId?: string; -}; +export interface PlaceBatchOrdersResponseV3 { + orderId: string; + clientOid: string; + code?: string; + msg?: string; +} ⋮---- -/** The symbol, e.g. "BTCUSDT" */ +export interface PlaceOrderResponseV3 { + orderId: string; + clientOid: string; +} ⋮---- -export type WsCoinChannelsV2 = - | 'account' - | 'account-crossed' - | 'account-isolated'; +export interface PositionAdlRankV3 { + symbol: string; + marginCoin: string; + adlRank: string; + holdSide: 'long' | 'short'; +} + +================ +File: src/types/response/v3/account.ts +================ +// Account Management Response Types +import type { CollateralTypeV3 } from '../../request/v3/account.js'; ⋮---- -export type WsTopicSubscribePrivateCoinArgsV2 = { - instType: BitgetInstTypeV2; - channel: WsCoinChannelsV2; - coin: 'default' | string; -}; +export interface AccountSymbolConfigV3 { + category: string; + symbol: string; + marginMode: string; + leverage: string; +} ⋮---- -export type WsTopicSubscribePrivateArgsV2 = - | WsTopicSubscribePrivateInstIdArgsV2 - | WsTopicSubscribePrivateCoinArgsV2; +export interface AccountCoinConfigV3 { + coin: string; + leverage: string; +} ⋮---- -export type WsTopicSubscribeEventArgsV2 = - | WsTopicSubscribePublicArgsV2 - | WsTopicSubscribePrivateArgsV2; +export type AccountPermissionV3 = + | 'uta_mgt' + | 'uta_trade' + | 'withdraw' + | 'copy_futures_position' + | 'copy_futures_order'; ⋮---- -/** General configuration for the WebsocketClient */ -export interface WSClientConfigurableOptions { - /** Your API key */ - apiKey?: string; - - /** Your API secret */ - apiSecret?: string; - - /** The passphrase you set when creating the API Key (NOT your account password) */ - apiPass?: string; - - /** - * Set to `true` to connect to Bitget's demo trading WebSockets: - * - * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket - * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading - */ - demoTrading?: boolean; - - /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ - recvWindow?: number; - - // Disable ping/pong ws heartbeat mechanism (not recommended) - disableHeartbeat?: boolean; - - /** 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; - - requestOptions?: RestClientOptions; - - wsOptions?: { - protocols?: string[]; - agent?: any; - } & ( - | Omit, 'agent'> - | Omit, 'agent'> - ); - - wsUrl?: 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. - */ - customSignMessageFn?: (message: string, secret: string) => Promise; +export interface AccountInfoV3 { + userId: string; + inviterId: string; + /** Only set when the calling account is a sub-account */ + parentId: string; + channelCode: string; + channel: string; + ips: string; + permType: 'read-only' | 'read-and-write'; + permissions: AccountPermissionV3[]; + regisTime: string; } ⋮---- -/** Your API key */ -⋮---- -/** Your API secret */ +/** Only set when the calling account is a sub-account */ ⋮---- -/** The passphrase you set when creating the API Key (NOT your account password) */ +export type AccountLevelV3 = 'basic' | 'advanced' | 'isolated' | 'delta'; ⋮---- -/** - * Set to `true` to connect to Bitget's demo trading WebSockets: - * - * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket - * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading - */ +export interface AccountSettingsV3 { + uid: string; + accountMode: 'unified' | 'hybrid' | 'upgrading' | 'switching'; + assetMode: string; + accountLevel: AccountLevelV3; + holdMode: string; + stpMode: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both'; + symbolConfigList: AccountSymbolConfigV3[]; + coinConfigList: AccountCoinConfigV3[]; +} ⋮---- -/** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ +export interface AccountDeltaCoinPositionV3 { + coin: string; + positionRatio: string; +} ⋮---- -// Disable ping/pong ws heartbeat mechanism (not recommended) +/** Delta-neutral mode metrics. Only available when accountLevel is delta. */ +export interface AccountDeltaInfoV3 { + deltaEquityRatio: string; + deltaThreshold: string; + positionThreshold: string; + list: AccountDeltaCoinPositionV3[]; +} ⋮---- -/** How often to check if the connection is alive */ +export interface AccountAssetV3 { + coin: string; + equity: string; + usdValue: string; + balance: string; + available: string; + debt: string; + locked: string; + /** Position value in USD */ + positionValue?: string; + /** Account leverage (non-negative) */ + leverage?: string; + /** USDT bonus amount */ + bonus?: string; +} ⋮---- -/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ +/** Position value in USD */ ⋮---- -/** Delay in milliseconds before respawning the connection */ +/** Account leverage (non-negative) */ ⋮---- -/** - * 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. - */ +/** USDT bonus amount */ ⋮---- -export interface WebsocketClientOptions extends WSClientConfigurableOptions { - pingInterval: number; - pongTimeout: number; - reconnectTimeout: number; - recvWindow: number; - authPrivateConnectionsOnConnect: boolean; - authPrivateRequests: boolean; +export interface AccountAssetsV3 { + accountEquity: string; + usdtEquity: string; + btcEquity: string; + unrealisedPnl: string; + usdtUnrealisedPnl: string; + btcUnrealizedPnl: string; + effEquity: string; + mmr: string; + imr: string; + mgnRatio: string; + positionMgnRatio: string; + assets: AccountAssetV3[]; } - -================ -File: src/index.ts -================ - - -================ -File: src/types/request/v3/account.ts -================ -// Account Management Request Types -⋮---- -export type AccountAdjustModeV3 = 'basic' | 'advanced' | 'delta' | 'isolated'; ⋮---- -export interface AdjustAccountModeRequestV3 { - mode: AccountAdjustModeV3; - /** Sub-account UID when the master account switches mode for a sub-account */ - targetUid?: string; +export interface ConvertRecordV3 { + fromCoin: string; + fromCoinSize: string; + toCoin: string; + toCoinSize: string; + price: string; + ts: string; } ⋮---- -/** Sub-account UID when the master account switches mode for a sub-account */ -⋮---- -export interface SetLeverageRequestV3 { - category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - leverage: string; - coin?: string; - posSide?: 'long' | 'short'; - /** Futures only. Defaults to crossed */ - marginMode?: 'crossed' | 'isolated'; - /** Isolated two-way mode: long leverage. Takes priority over leverage when both set */ - longLeverage?: string; - /** Isolated two-way mode: short leverage. Takes priority over leverage when both set */ - shortLeverage?: string; +export interface FinancialRecordV3 { + category: string; + id: string; + symbol: string; + coin: string; + type: string; + amount: string; + fee: string; + balance: string; + ts: string; + /** crossed | isolated */ + positionType?: string; + positionAmount?: string; + positionBalance?: string; } ⋮---- -/** Futures only. Defaults to crossed */ -⋮---- -/** Isolated two-way mode: long leverage. Takes priority over leverage when both set */ -⋮---- -/** Isolated two-way mode: short leverage. Takes priority over leverage when both set */ -⋮---- -export interface GetAllFeeRatesRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; -} +/** crossed | isolated */ ⋮---- -export interface GetConvertRecordsRequestV3 { - fromCoin?: string; - toCoin?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +export interface PaymentCoinV3 { + coin: string; + size: string; + amount: string; } ⋮---- -export interface GetFinancialRecordsRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - coin?: string; - type?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +export interface RepayableCoinV3 { + coin: string; + size: string; + amount: string; } ⋮---- -export interface RepayRequestV3 { - repayableCoinList: string[]; - paymentCoinList: string[]; +export interface RepayResponseV3 { + result: string; + repayAmount: string; } ⋮---- -// Sub-account Management Request Types +// Sub-account Management Response Types ⋮---- -export interface CreateSubAccountApiKeyRequestV3 { - subUid: string; +export interface CreateSubAccountApiKeyResponseV3 { note: string; - type: 'read_write' | 'read_only'; - passphrase: string; + apiKey: string; + secret: string; + type: string; permissions: string[]; ips: string[]; } +export interface SubAccountApiKeyV3 { + apiKey: string; + note: string; + type: string; + permissions: string[]; + ips: string[]; + ts?: string; +} ⋮---- -export interface DeleteSubAccountApiKeyRequestV3 { +export interface UpdateSubAccountApiKeyResponseV3 { + note: string; apiKey: string; + type: string; + permissions: string[]; + ips: string[]; } ⋮---- -export interface GetSubAccountApiKeysRequestV3 { +export interface CreateSubAccountResponseV3 { + username: string; subUid: string; - limit?: string; - cursor?: string; + status: string; + note: string; + createdTime: string; + updatedTime: string; } ⋮---- -export interface UpdateSubAccountApiKeyRequestV3 { +export interface CreateAgentSubAccountResponseV3 { + username: string; + subUid: string; apiKey: string; - passphrase: string; - type?: 'read_write' | 'read_only'; - permissions?: string[]; - ips?: string[]; + secret: string; + note: string; + createdTime: string; } ⋮---- -export interface CreateSubAccountRequestV3 { +export interface SubAccountV3 { + subUid: string; username: string; - accountMode?: 'classic' | 'unified'; - note?: string; + status: string; + accountMode: string; + type: 'normal' | 'virtual' | 'custodian'; + note: string; + createdTime: string; + updatedTime: string; } ⋮---- -export interface FreezeSubAccountRequestV3 { - subUid: string; - operation: 'freeze' | 'unfreeze'; +export interface WithdrawAddressBookEntryV3 { + coin: string; + chain: string; + address: string; + countryCode: string; + label: string; + memo: string; + type: 'regular' | 'EVM' | 'universal' | 'internal'; + internalType: '' | 'uid' | 'mobile' | 'email'; + createdTime: string; } ⋮---- -export interface GetSubAccountListRequestV3 { - limit?: string; +export interface WithdrawAddressBookV3 { + addressList: WithdrawAddressBookEntryV3[]; cursor?: string; } ⋮---- -// Transfer Request Types +// Transfer Response Types ⋮---- -export interface TransferRequestV3 { - clientOid?: string; - fromType: - | 'spot' - | 'p2p' - | 'coin_futures' - | 'usdt_futures' - | 'usdc_futures' - | 'crossed_margin' - | 'isolated_margin' - | 'uta'; - toType: - | 'spot' - | 'p2p' - | 'coin_futures' - | 'usdt_futures' - | 'usdc_futures' - | 'crossed_margin' - | 'isolated_margin' - | 'uta'; - amount: string; - coin: string; - symbol?: string; - /** Enable automatic margin borrowing when balance insufficient. yes | no */ - allowBorrow?: 'yes' | 'no'; -} -⋮---- -/** Enable automatic margin borrowing when balance insufficient. yes | no */ -⋮---- -export interface GetTransferableCoinsRequestV3 { - fromType: - | 'spot' - | 'p2p' - | 'coin_futures' - | 'usdt_futures' - | 'usdc_futures' - | 'crossed_margin' - | 'isolated_margin' - | 'uta'; - toType: - | 'spot' - | 'p2p' - | 'coin_futures' - | 'usdt_futures' - | 'usdc_futures' - | 'crossed_margin' - | 'isolated_margin' - | 'uta'; +export interface AllSymbolFeeRateV3 { + symbol: string; + makerFeeRate: string; + takerFeeRate: string; } ⋮---- -export interface GetSubTransferRecordsRequestV3 { - subUid?: string; - role?: 'initiator' | 'receiver'; - coin?: string; - startTime?: string; - endTime?: string; +export interface TransferResponseV3 { + transferId: string; clientOid?: string; - limit?: string; - cursor?: string; } ⋮---- -export interface SubAccountTransferRequestV3 { - fromType: - | 'spot' - | 'p2p' - | 'usdt_futures' - | 'coin_futures' - | 'usdc_futures' - | 'crossed_margin' - | 'uta'; - toType: - | 'spot' - | 'p2p' - | 'usdt_futures' - | 'coin_futures' - | 'usdc_futures' - | 'crossed_margin' - | 'uta'; +export interface SubTransferRecordV3 { + transferId: string; + oldTransferId?: string; + fromType: string; + toType: string; amount: string; coin: string; fromUserId: string; toUserId: string; + status: string; clientOid: string; - /** Enable automatic margin borrowing when balance insufficient. yes | no */ - allowBorrow?: 'yes' | 'no'; + createdTime: string; + updatedTime: string; } ⋮---- -/** Enable automatic margin borrowing when balance insufficient. yes | no */ -⋮---- -export interface GetSubUnifiedAssetsRequestV3 { - subUid?: string; - cursor?: string; - limit?: string; +export interface SubUnifiedAssetV3 { + coin: string; + equity: string; + usdValue: string; + balance: string; + available: string; + debt: string; + locked: string; } ⋮---- -export interface GetFeeRateRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol: string; +export interface SubUnifiedAssetV3 { + subUid: string; + cursor: string; + assets: SubUnifiedAssetV3[]; } ⋮---- -export interface GetFundingAssetsRequestV3 { - coin?: string; +export interface GetFeeRateResponseV3 { + makerFeeRate: string; + takerFeeRate: string; } ⋮---- -export interface SwitchDeductRequestV3 { - deduct: 'on' | 'off'; +export interface FundingAssetV3 { + coin: string; + available: string; + frozen: string; + balance: string; } ⋮---- -// Deposit Request Types +// Deposit Response Types ⋮---- -export interface GetDepositAddressRequestV3 { +export interface DepositAddressV3 { + address: string; + chain: string; coin: string; - chain?: string; - size?: string; + tag: string; + url: string; } ⋮---- -export interface GetSubDepositAddressRequestV3 { - subUid: string; +export interface DepositRecordV3 { + orderId: string; + recordId: string; coin: string; - chain?: string; - size?: string; + type: 'deposit'; + dest: 'on_chain' | 'internal_transfer'; + size: string; + status: 'pending' | 'success' | 'fail'; + fromAddress: string; + toAddress: string; + chain: string; + createdTime: string; + updatedTime: string; } ⋮---- -export interface GetDepositRecordsRequestV3 { - coin?: string; - orderId?: string; - startTime: string; - endTime: string; - limit?: string; - cursor?: string; -} +// Withdraw Response Types ⋮---- -export interface GetSubDepositRecordsRequestV3 { - coin?: string; - subUid: string; - startTime: string; - endTime: string; - limit?: string; - cursor?: string; +export interface WithdrawResponseV3 { + orderId: string; + clientOid: string; } ⋮---- -// Withdraw Request Types -⋮---- -export interface WithdrawRequestV3 { +export interface WithdrawRecordV3 { + orderId: string; + clientOid: string; + recordId: string; coin: string; - chain?: string; - /** Deduct from funding, uta, and/or otc accounts (comma-separated). Order: funding -> otc -> uta */ - accountType?: string; - transferType: 'on_chain' | 'internal_transfer'; - address: string; - innerToType?: 'uid' | 'email' | 'mobile'; - areaCode?: string; - tag?: string; + type: 'withdraw'; + dest: 'on_chain' | 'internal_transfer'; size: string; - remark?: string; - clientOid?: string; - memberCode?: 'bithumb' | 'korbit' | 'coinone'; - identityType?: 'company' | 'user'; - companyName?: string; - firstName?: string; - lastName?: string; -} -⋮---- -/** Deduct from funding, uta, and/or otc accounts (comma-separated). Order: funding -> otc -> uta */ -⋮---- -export interface GetWithdrawRecordsRequestV3 { - coin?: string; - orderId?: string; - clientOid?: string; - startTime: string; - endTime: string; - limit?: string; - cursor?: string; + status: 'pending' | 'success' | 'fail'; + fromAddress: string; + toAddress: string; + chain: string; + fee: string; + confirm: string; + tag: string; + createdTime: string; + updatedTime: string; } ⋮---- -export interface GetWithdrawAddressBookRequestV3 { - coin?: string; - type?: 'EVM' | 'regular' | 'universal' | 'internal'; - limit?: string; - cursor?: string; +export interface MaxTransferableV3 { + coin: string; + maxTransfer: string; + borrowMaxTransfer: string; } ⋮---- -export interface CancelWithdrawalRequestV3 { - orderId?: string; - clientOid?: string; +export interface OpenInterestLimitV3 { + symbol: string; + singleUserLimit: string; + masterSubLimit: string; + marketMakerLimit: string; } ⋮---- -export interface SetDepositAccountRequestV3 { +export interface TaxRecordV3 { + id: string; coin: string; - accountType: 'funding' | 'unified' | 'otc'; + type: string; + amount: string; + fee: string; + balance: string; + ts: string; } ⋮---- -export interface GetMaxTransferableRequestV3 { - coin: string; +export interface CollateralTypeConfigV3 { + collateralType: CollateralTypeV3; + /** Returned when collateralType=custom */ + collateralCoins?: string; } ⋮---- -export interface GetOpenInterestLimitRequestV3 { - symbol: string; - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +/** Returned when collateralType=custom */ +⋮---- +export interface CustomCollateralCoinV3 { + collateralCoin: string; } ⋮---- -export interface GetTaxRecordsRequestV3 { - bizType: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES' - | 'OTHER'; - marginType?: 'isolated' | 'crossed'; - coin?: string; - startTime: string; - endTime: string; - limit?: string; - cursor?: string; +export interface PreSetLeverageV3 { + estMaxOpen?: string; + estMaxBorrowable?: string; + requiredMargin: string; + marginChange: string; } ⋮---- -export type CollateralTypeV3 = 'mainstream' | 'all' | 'custom'; -⋮---- -export interface SetCollateralTypeRequestV3 { - collateralType: CollateralTypeV3; - /** Required when collateralType=custom. Comma-separated coin names */ - collateralCoins?: string; +export interface MaxWithdrawalV3 { + coin: string; + otcMaxWithdrawal: string; + spotMaxWithdrawal: string; + utaMaxWithdrawal: string; + totalMaxWithdrawal: string; } ⋮---- -/** Required when collateralType=custom. Comma-separated coin names */ +export interface MovePositionOrderResultV3 { + orderId: string; + clientOid: string; + code: string; + msg: string; +} ⋮---- -export interface PreSetLeverageRequestV3 { - category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - coin?: string; - marginMode: 'isolated' | 'cross'; - leverage?: string; - longLeverage?: string; - shortLeverage?: string; +export interface MovePositionsResponseV3 { + closePosition: MovePositionOrderResultV3[]; + openPosition: MovePositionOrderResultV3[]; } ⋮---- -export interface SetMarginRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +export interface MovePositionHistoryV3 { + category: string; + fromUid: string; + toUid: string; + orderId: string; + openExecId: string; + closeExecId: string; symbol: string; posSide: 'long' | 'short'; - operation: 'add' | 'remove'; - amount: string; -} -⋮---- -export interface GetMaxWithdrawalRequestV3 { - coin: string; + qty: string; + price: string; + status: 'processing' | 'completed' | 'failed'; + createdTime: string; + updatedTime: string; } ⋮---- -export interface GetRealityOrderBookRequestV3 { +export interface EligibleSymbolV3 { symbol: string; + category: string; + baseCoin: string; + quoteCoin: string; + symbolType?: string; + buyLimitPriceRatio: string; + sellLimitPriceRatio: string; + minOrderQty: string; + maxOrderQty: string; + pricePrecision: string; + quantityPrecision: string; + quotePrecision: string; + minOrderAmount: string; + maxSymbolOrderNum: string; + maxProductOrderNum: string; + status: string; + maintainTime: string; + areaSymbol?: string; + maxPositionNum?: string; + isReality?: string; + launchTime?: string; } ⋮---- -export interface GetRealityFillsRequestV3 { - symbol: string; - limit?: string; +export interface EligibleMarginTierItemV3 { + tier: string; + minTierValue: string; + maxTierValue: string; + leverage: string; + mmr: string; } ⋮---- -export interface SubMasterTransferRequestV3 { - fromType: 'spot' | 'uta'; - toType: 'spot' | 'p2p' | 'uta'; - amount: string; +export interface EligibleMarginTierV3 { coin: string; - clientOid?: string; + tiers: EligibleMarginTierItemV3[]; } ⋮---- -export interface CreateAgentSubAccountRequestV3 { - username: string; - passphrase: string; - note?: string; +export interface EligibleLoanInfoV3 { + limit: string; + masterSubLimit: string; + /** Bitget spelling */ + platformRemaingQuota: string; } ⋮---- -export interface MovePositionItemRequestV3 { - symbol: string; - side: 'buy' | 'sell'; - qty: string; -} +/** Bitget spelling */ ⋮---- -export interface MovePositionsRequestV3 { - fromUid: string; - toUid: string; - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - positionList: MovePositionItemRequestV3[]; +export interface RateLimitQuotaItemV3 { + uid: string; + quota: string; } ⋮---- -export interface GetMovePositionHistoryRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - startTime?: string; - endTime?: string; - cursor?: string; - limit?: string; +export interface RateLimitQuotaV3 { + category: 'spot' | 'futures' | string; + quotaList: RateLimitQuotaItemV3[]; + masterSubQuota: string; + masterSubCap: string; + cursor: string; } + +================ +File: src/types/websockets/ws-general.ts +================ +import type { ClientRequestArgs } from 'http'; +import WebSocket from 'isomorphic-ws'; ⋮---- -export interface GetEligibleSymbolsRequestV3 { - symbol?: string; -} +import { RestClientOptions } from '../../util/requestUtils.js'; +import { WS_KEY_MAP } from '../../util/websocket-util.js'; +import { FuturesProductTypeV2 } from '../request/shared.js'; ⋮---- -export interface GetEligibleMarginTierRequestV3 { - coin?: string; -} +export type BitgetInstType = 'SP' | 'SPBL' | 'MC' | 'UMCBL' | 'DMCBL'; +export type BitgetInstTypeV2 = 'SPOT' | FuturesProductTypeV2; +export type BitgetInstTypeV3 = + | 'UTA' // for account-level topics + | 'spot' + | 'usdt-futures' + | 'coin-futures' + | 'usdc-futures'; ⋮---- -export interface GetEligibleLoanInfoRequestV3 { - coin?: string; -} +| 'UTA' // for account-level topics ⋮---- -export interface GetRateLimitQuotaRequestV3 { - category: 'spot' | 'futures'; - uid?: string; - cursor?: string; - limit?: string; -} +/** + * + * V1 list of topics for WebSocket consumers + * + */ ⋮---- -export interface SetRateLimitQuotaRequestV3 { - category: 'spot' | 'futures'; - uids: string[]; - quota: string; -} - -================ -File: src/rest-client-v2.ts -================ -import { FuturesProductTypeV2, MarginType } from './types/request/shared.js'; -import { - AgentCustomerAssetRequestV2, - AgentCustomerDepositRequestV2, - AgentCustomerListRequestV2, - AgentCustomerTradeVolumeRequestV2, - CreateSubAccountApiKeyRequestV2, - DeleteSubAccountApiKeyRequestV2, - GetAgentCommissionDetailRequestV2, - GetAgentCustomerCommissionsRequestV2, - GetAgentCustomerKycResultRequestV2, - GetAgentSubCustomerListRequestV2, - GetAllSubDepositWithdrawalRequestV2, - GetBrokerCommissionsRequestV2, - GetBrokerOrderCommissionRequestV2, - GetBrokerRebateInfoRequestV2, - GetBrokerSubaccountsRequestV2, - GetBrokerTotalCommissionRequestV2, - GetBrokerTradeVolumeRequestV2, - GetSubAccountsRequestV2, - ModifySubAccountApiKeyRequestV2, - ModifySubRequestV2, - SubDepositRecordsRequestV2, - SubWithdrawalRecordsRequestV2, - SubWithdrawalRequestV2, -} from './types/request/v2/broker.js'; -import { - ConvertQuoteRequestV2, - ConvertRequestV2, - CreateAgentSubaccountRequestV2, - CreateVirtualSubApiKeyRequestV2, - CreateVirtualSubRequestV2, - GetAllTradeRatesRequestV2, - GetAnnouncementsRequestV2, - GetConvertBGBHistoryRequestV2, - GetConvertHistoryRequestV2, - GetFuturesTransactionsRequestV2, - GetMarginTransactionsRequestV2, - GetMerchantAdvertisementsRequestV2, - GetMerchantP2POrdersRequestV2, - GetP2PMerchantsRequestV2, - GetP2PTransactionsRequestV2, - GetSpotTransactionsRequestV2, - GetTradeRateRequestV2, - ModifyVirtualSubApiKeyRequestV2, - ModifyVirtualSubRequestV2, -} from './types/request/v2/common.js'; -import { - CloseFuturesFollowerPositionsRequestV2, - CopyTradingProductTypeV2, - FuturesTraderSymbolSettingRequestV2, - GetFollowerFuturesCurrentTrackingOrdersRequestV2, - GetFollowerFuturesHistoryTrackingOrdersRequestV2, - GetFuturesFollowerTradersRequestV2, - GetFuturesTraderCurrentOrdersRequestV2, - GetFuturesTraderFollowersRequestV2, - GetFuturesTraderHistoryOrdersRequestV2, - GetFuturesTraderProfitShareDetailRequestV2, - GetSpotFollowerHistoryOrdersRequestV2, - GetSpotFollowerOpenOrdersRequestV2, - GetSpotTraderCurrentOrdersRequestV2, - GetSpotTraderFollowersRequestV2, - GetSpotTraderHistoryOrdersRequestV2, - GetSpotTraderHistoryProfitRequestV2, - ModifyFuturesTraderOrderTPSLRequestV2, - SpotFollowerCopyTradeSettingV2, +export type WsPublicSpotTopic = + | 'ticker' + | 'candle1W' + | 'candle1D' + | 'candle12H' + | 'candle4H' + | 'candle1H' + | 'candle30m' + | 'candle15m' + | 'candle5m' + | 'candle1m' + | 'books' + | 'books5' + | 'trade'; +⋮---- +// Futures currently has the same public topics as spot +export type WsPublicFuturesTopic = WsPublicSpotTopic; +export type WsPrivateSpotTopic = 'account' | 'orders'; +⋮---- +export type WsPrivateFuturesTopic = + | 'account' + | 'positions' + | 'orders' + | 'ordersAlgo'; +⋮---- +export type WsPublicTopic = WsPublicSpotTopic | WsPublicFuturesTopic; +⋮---- +export type WsPrivateTopic = WsPrivateSpotTopic | WsPrivateFuturesTopic; +export type WsTopic = WsPublicTopic | WsPrivateTopic; +⋮---- +/** + * + * V2 list of topics for WebSocket consumers + * + */ +⋮---- +export type WsPublicTopicV2 = + | 'index-price' // margin only + | 'ticker' + | 'candle1m' + | 'candle5m' + | 'candle15m' + | 'candle30m' + | 'candle1H' + | 'candle4H' + | 'candle6H' + | 'candle12H' + | 'candle1D' + | 'candle3D' + | 'candle1W' + | 'candle1M' + | 'candle6Hutc' + | 'candle12Hutc' + | 'candle1Dutc' + | 'candle3Dutc' + | 'candle1Wutc' + | 'candle1Mutc' + | 'trade' + | 'books' + | 'books1' + | 'books5' + | 'books15'; +⋮---- +| 'index-price' // margin only +⋮---- +// Also update PRIVATE_TOPICS_V2 if this is updated +export type WSPrivateTopicFuturesV2 = + | 'positions' + | 'orders-algo' + | 'positions-history'; +⋮---- +// Also update PRIVATE_TOPICS_V2 if this is updated +export type WSPrivateTopicMarginV2 = + | 'orders-crossed' + | 'account-crossed' + | 'account-isolated' + | 'orders-isolated'; +⋮---- +// Also update PRIVATE_TOPICS_V2 if this is updated +export type WsPrivateTopicV2 = + | 'account' + | 'orders' + | WSPrivateTopicFuturesV2 + | WSPrivateTopicMarginV2; +⋮---- +export type WsTopicV2 = WsPublicTopicV2 | WsPrivateTopicV2; +⋮---- +/** + * + * V3 / UTA list of topics for WebSocket consumers + * + */ +export type WsPublicTopicV3 = 'ticker' | 'kline' | 'books' | 'publicTrade'; +// Also update PRIVATE_TOPICS_V3 if this is updated +export type WsPrivateTopicV3 = + | 'account' + | 'position' + | 'fill' + | 'order' + | 'strategy-order' + | 'reality-orderbook'; +export type WsTopicV3 = WsPublicTopicV3 | WsPrivateTopicV3; +⋮---- +/** This is used to differentiate between each of the available websocket streams */ +export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP]; +⋮---- +/** + * Event args for subscribing/unsubscribing + */ +⋮---- +export interface WsTopicSubscribeEventArgs { + instType: BitgetInstType; + channel: WsTopic; + instId?: string; +} +⋮---- +export type WsTopicSubscribePublicArgsV2 = { + instType: BitgetInstTypeV2; + channel: WsPublicTopicV2; + /** The symbol, e.g. "BTCUSDT" */ + instId: string; +}; +⋮---- +/** The symbol, e.g. "BTCUSDT" */ +⋮---- +export type WsInstIdChannelsV2 = + | 'orders' + | WSPrivateTopicFuturesV2 + | 'orders-crossed' + | 'orders-isolated'; +⋮---- +export type WsTopicSubscribePrivateInstIdArgsV2 = { + instType: BitgetInstTypeV2; + channel: WsInstIdChannelsV2; + /** The symbol, e.g. "BTCUSDT" */ + instId?: string; +}; +⋮---- +/** The symbol, e.g. "BTCUSDT" */ +⋮---- +export type WsCoinChannelsV2 = + | 'account' + | 'account-crossed' + | 'account-isolated'; +⋮---- +export type WsTopicSubscribePrivateCoinArgsV2 = { + instType: BitgetInstTypeV2; + channel: WsCoinChannelsV2; + coin: 'default' | string; +}; +⋮---- +export type WsTopicSubscribePrivateArgsV2 = + | WsTopicSubscribePrivateInstIdArgsV2 + | WsTopicSubscribePrivateCoinArgsV2; +⋮---- +export type WsTopicSubscribeEventArgsV2 = + | WsTopicSubscribePublicArgsV2 + | WsTopicSubscribePrivateArgsV2; +⋮---- +/** General configuration for the WebsocketClient */ +export interface WSClientConfigurableOptions { + /** Your API key */ + apiKey?: string; + + /** Your API secret */ + apiSecret?: string; + + /** The passphrase you set when creating the API Key (NOT your account password) */ + apiPass?: string; + + /** + * Set to `true` to connect to Bitget's demo trading WebSockets: + * + * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket + * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading + */ + demoTrading?: boolean; + + /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ + recvWindow?: number; + + // Disable ping/pong ws heartbeat mechanism (not recommended) + disableHeartbeat?: boolean; + + /** 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; + + requestOptions?: RestClientOptions; + + wsOptions?: { + protocols?: string[]; + agent?: any; + } & ( + | Omit, 'agent'> + | Omit, 'agent'> + ); + + wsUrl?: 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. + */ + customSignMessageFn?: (message: string, secret: string) => Promise; +} +⋮---- +/** Your API key */ +⋮---- +/** Your API secret */ +⋮---- +/** The passphrase you set when creating the API Key (NOT your account password) */ +⋮---- +/** + * Set to `true` to connect to Bitget's demo trading WebSockets: + * + * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket + * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading + */ +⋮---- +/** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ +⋮---- +// Disable ping/pong ws heartbeat mechanism (not recommended) +⋮---- +/** How often to check if the connection is alive */ +⋮---- +/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ +⋮---- +/** Delay in milliseconds before respawning the connection */ +⋮---- +/** + * 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 WebsocketClientOptions extends WSClientConfigurableOptions { + pingInterval: number; + pongTimeout: number; + reconnectTimeout: number; + recvWindow: number; + authPrivateConnectionsOnConnect: boolean; + authPrivateRequests: boolean; +} + +================ +File: src/index.ts +================ + + +================ +File: src/rest-client-v2.ts +================ +import { FuturesProductTypeV2, MarginType } from './types/request/shared.js'; +import { + AgentCustomerAssetRequestV2, + AgentCustomerDepositRequestV2, + AgentCustomerListRequestV2, + AgentCustomerTradeVolumeRequestV2, + CreateSubAccountApiKeyRequestV2, + DeleteSubAccountApiKeyRequestV2, + GetAgentCommissionDetailRequestV2, + GetAgentCustomerCommissionsRequestV2, + GetAgentCustomerKycResultRequestV2, + GetAgentSubCustomerListRequestV2, + GetAllSubDepositWithdrawalRequestV2, + GetBrokerCommissionsRequestV2, + GetBrokerOrderCommissionRequestV2, + GetBrokerRebateInfoRequestV2, + GetBrokerSubaccountsRequestV2, + GetBrokerTotalCommissionRequestV2, + GetBrokerTradeVolumeRequestV2, + GetSubAccountsRequestV2, + ModifySubAccountApiKeyRequestV2, + ModifySubRequestV2, + SubDepositRecordsRequestV2, + SubWithdrawalRecordsRequestV2, + SubWithdrawalRequestV2, +} from './types/request/v2/broker.js'; +import { + ConvertQuoteRequestV2, + ConvertRequestV2, + CreateAgentSubaccountRequestV2, + CreateVirtualSubApiKeyRequestV2, + CreateVirtualSubRequestV2, + GetAllTradeRatesRequestV2, + GetAnnouncementsRequestV2, + GetConvertBGBHistoryRequestV2, + GetConvertHistoryRequestV2, + GetFuturesTransactionsRequestV2, + GetMarginTransactionsRequestV2, + GetMerchantAdvertisementsRequestV2, + GetMerchantP2POrdersRequestV2, + GetP2PMerchantsRequestV2, + GetP2PTransactionsRequestV2, + GetSpotTransactionsRequestV2, + GetTradeRateRequestV2, + ModifyVirtualSubApiKeyRequestV2, + ModifyVirtualSubRequestV2, +} from './types/request/v2/common.js'; +import { + CloseFuturesFollowerPositionsRequestV2, + CopyTradingProductTypeV2, + FuturesTraderSymbolSettingRequestV2, + GetFollowerFuturesCurrentTrackingOrdersRequestV2, + GetFollowerFuturesHistoryTrackingOrdersRequestV2, + GetFuturesFollowerTradersRequestV2, + GetFuturesTraderCurrentOrdersRequestV2, + GetFuturesTraderFollowersRequestV2, + GetFuturesTraderHistoryOrdersRequestV2, + GetFuturesTraderProfitShareDetailRequestV2, + GetSpotFollowerHistoryOrdersRequestV2, + GetSpotFollowerOpenOrdersRequestV2, + GetSpotTraderCurrentOrdersRequestV2, + GetSpotTraderFollowersRequestV2, + GetSpotTraderHistoryOrdersRequestV2, + GetSpotTraderHistoryProfitRequestV2, + ModifyFuturesTraderOrderTPSLRequestV2, + SpotFollowerCopyTradeSettingV2, UpdateFuturesFollowerSettingsRequestV2, UpdateFuturesFollowerTPSLRequestV2, } from './types/request/v2/copytrading.js'; @@ -13522,2311 +13077,2756 @@ import BaseRestClient from './util/BaseRestClient.js'; import { REST_CLIENT_TYPE_ENUM } from './util/requestUtils.js'; import { assertMarginType } from './util/type-guards.js'; ⋮---- -/** - * REST API client for all V2 endpoints - */ -export class RestClientV2 extends BaseRestClient +/** + * REST API client for all V2 endpoints + */ +export class RestClientV2 extends BaseRestClient +⋮---- +getClientType() +⋮---- +/** + * + * Custom SDK functions + * + */ +⋮---- +/** + * 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 +⋮---- +// Adjust server time by adding estimated one-way latency +⋮---- +// Calculate time difference between adjusted server time and local time +⋮---- +async fetchServerTime(): Promise +⋮---- +/** + * + * Bitget misc functions + * + */ +⋮---- +/** + * + * + * Common + * + * + */ +⋮---- +/** + * + * * Common | Notice + * + */ +⋮---- +getAnnouncements( + params?: GetAnnouncementsRequestV2, +): Promise> +⋮---- +/** + * + * * Common | Public + * + */ +⋮---- +getServerTime(): Promise< + APIResponse<{ + serverTime: string; + }> + > { + return this.get('/api/v2/public/time'); +⋮---- +getTradeRate(params: GetTradeRateRequestV2): Promise< + APIResponse<{ + makerFeeRate: string; + takerFeeRate: string; + }> + > { + return this.getPrivate('/api/v2/common/trade-rate', params); +⋮---- +getAllTradeRates(params: GetAllTradeRatesRequestV2): Promise< + APIResponse< + { + symbol: string; + makerFeeRate: string; + takerFeeRate: string; + }[] + > + > { + return this.getPrivate('/api/v2/common/all-trade-rate', params); +⋮---- +/** + * + * * Common | Tax + * + */ +⋮---- +getSpotTransactionRecords( + params: GetSpotTransactionsRequestV2, +): Promise> +⋮---- +getFuturesTransactionRecords( + params: GetFuturesTransactionsRequestV2, +): Promise> +⋮---- +getMarginTransactionRecords( + params: GetMarginTransactionsRequestV2, +): Promise> +⋮---- +getP2PTransactionRecords( + params: GetP2PTransactionsRequestV2, +): Promise> +⋮---- +/** + * + * * Common | P2P + * + */ +⋮---- +getP2PMerchantList(params?: GetP2PMerchantsRequestV2): Promise< + APIResponse<{ + merchantList: P2PMerchantV2[]; + minMerchantId: string; + }> + > { + return this.getPrivate('/api/v2/p2p/merchantList', params); +⋮---- +getP2PMerchantInfo(): Promise> +⋮---- +getP2PMerchantOrders(params: GetMerchantP2POrdersRequestV2): Promise< + APIResponse<{ + orderList: P2PMerchantOrderV2[]; + minOrderId: string; + }> + > { + return this.getPrivate('/api/v2/p2p/orderList', params); +⋮---- +getP2PMerchantAdvertisementList( + params: GetMerchantAdvertisementsRequestV2, + ): Promise< + APIResponse<{ + advList: P2PMerchantAdvertismentV2[]; + minAdvId: string; + }> + > { + return this.getPrivate('/api/v2/p2p/advList', params); +⋮---- +/** + * + * * Common | Trading insights + * + */ +⋮---- +getSpotWhaleNetFlowData(params: { + symbol: string; +}): Promise> +⋮---- +getFuturesActiveTakerBuySellVolumeData(params: { + symbol: string; + period?: string; +}): Promise> +⋮---- +getFuturesActiveLongShortPositionData(params: { + symbol: string; + period?: string; +}): Promise> +⋮---- +getFuturesLongShortRatio(params: { + symbol: string; + period?: string; + coin?: string; +}): Promise> +⋮---- +getMarginLoanGrowthRate(params: { + symbol: string; + period?: string; + coin?: string; +}): Promise> +⋮---- +getIsolatedMarginBorrowingRatio(params: { + symbol: string; + period?: string; +}): Promise> +⋮---- +getFuturesActiveBuySellVolumeData(params: { + symbol: string; + period?: string; +}): Promise> +⋮---- +getSpotFundFlow(params: { + symbol: string; + period?: string; +}): Promise> +⋮---- +getTradeDataSupportSymbols(): Promise< + APIResponse<{ + spotList: string[]; + futureList: string[]; + }> + > { + return this.get('/api/v2/spot/market/support-symbols'); +⋮---- +getSpotFundNetFlowData(params: { symbol: string }): Promise< + APIResponse< + { + netFlow: string; + ts: string; + }[] + > + > { + return this.get('/api/v2/spot/market/fund-net-flow', params); +⋮---- +getFuturesActiveLongShortAccountData(params: { + symbol: string; + period?: string; +}): Promise> +⋮---- +/** + * + * * Common | Virtual Subaccount + * + */ +⋮---- +createVirtualSubaccount(params: { + subAccountList: string[]; +}): Promise> +⋮---- +modifyVirtualSubaccount(params: ModifyVirtualSubRequestV2): Promise< + APIResponse<{ + result: string; + }> + > { + return this.postPrivate('/api/v2/user/modify-virtual-subaccount', params); +⋮---- +batchCreateVirtualSubaccountAndAPIKey( + params: CreateVirtualSubRequestV2, +): Promise> +⋮---- +getVirtualSubaccounts(params?: { + limit?: string; + idLessThan?: string; + status?: 'normal' | 'freeze'; + }): Promise< + APIResponse<{ + endId: string; + subAccountList: VirtualSubAccountV2[]; + }> + > { + return this.getPrivate('/api/v2/user/virtual-subaccount-list', params); +⋮---- +createVirtualSubaccountAPIKey( + params: CreateVirtualSubApiKeyRequestV2, +): Promise> +⋮---- +modifyVirtualSubaccountAPIKey( + params: ModifyVirtualSubApiKeyRequestV2, +): Promise> +⋮---- +getVirtualSubaccountAPIKeys(params: { + subAccountUid: string; +}): Promise> +⋮---- +/** + * Create a dedicated sub-account for an AI Agent instance. + * Frequency limit: 1/s per UID. Agent sub-accounts cannot be edited after creation. + */ +createAgentSubaccount( + params: CreateAgentSubaccountRequestV2, +): Promise> +⋮---- +/** + * + * * Common | Assets + * + */ +getFundingAssets(params?: { + coin?: string; +}): Promise> +⋮---- +getBotAccount(params?: { + accountType?: string; +}): Promise> +⋮---- +/** Get assets overview */ +getBalances(): Promise< + APIResponse< + { + accountType: string; + usdtBalance: string; + }[] + > + > { + return this.getPrivate('/api/v2/account/all-account-balance'); +⋮---- +/** + * + * * Common | Convert + * + */ +⋮---- +getConvertCoins(): Promise> +⋮---- +getConvertQuotedPrice( + params: ConvertQuoteRequestV2, +): Promise> +⋮---- +convert( + params: ConvertRequestV2, +): Promise> +⋮---- +getConvertHistory(params: GetConvertHistoryRequestV2): Promise< + APIResponse<{ + dataList: ConvertRecordV2[]; + endId: string; + }> + > { + return this.getPrivate('/api/v2/convert/convert-record', params); +⋮---- +/** + * + * * Common | BGB Convert + * + */ +⋮---- +getConvertBGBCoins(): Promise< + APIResponse<{ + coinList: BGBConvertCoinV2[]; + }> + > { + return this.getPrivate('/api/v2/convert/bgb-convert-coin-list'); +⋮---- +convertBGB(params: { + coinList: string; +}): Promise> +⋮---- +getConvertBGBHistory( + params: GetConvertBGBHistoryRequestV2, +): Promise> +⋮---- +/** + * + * + * Spot + * + * + */ +⋮---- +/** + * + * * Spot | Market + * + */ +⋮---- +getSpotCoinInfo(params?: { + coin?: string; +}): Promise> +⋮---- +getSpotSymbolInfo(params?: { + symbol?: string; +}): Promise> +⋮---- +getSpotVIPFeeRate(): Promise> +⋮---- +getSpotTicker(params?: { + symbol?: string; +}): Promise> +⋮---- +getSpotMergeDepth(params: { + symbol: string; + precision?: string; + limit?: string; +}): Promise> +⋮---- +getSpotOrderBookDepth(params: { + symbol: string; + type?: string; + limit?: string; +}): Promise> +⋮---- +getSpotCandles( + params: SpotCandlesRequestV2, +): Promise> +⋮---- +getSpotHistoricCandles( + params: SpotHistoricCandlesRequestV2, +): Promise> +⋮---- +getSpotRecentTrades(params: { + symbol: string; + limit?: string; +}): Promise> +⋮---- +getSpotHistoricTrades( + params: SpotHistoricTradesRequestV2, +): Promise> +⋮---- +getSpotCallAuction( + params: SpotCallAuctionRequestV2, +): Promise> +⋮---- +/** + * + * * Spot | Trade + * + */ +⋮---- +spotSubmitOrder(params: SpotOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/spot/trade/place-order', params); +⋮---- +spotCancelandSubmitOrder( + params: SpotCancelandSubmitOrderRequestV2, +): Promise> +⋮---- +spotBatchCancelandSubmitOrder(params: { + orderList: SpotCancelandSubmitOrderRequestV2[]; +}): Promise> +⋮---- +spotCancelOrder(params: SpotCancelOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/spot/trade/cancel-order', params); +⋮---- +spotBatchSubmitOrders( + params: SpotBatchOrderRequestV2, +): Promise> +⋮---- +spotBatchCancelOrders( + params: SpotBatchCancelOrderRequestV2, +): Promise> +⋮---- +spotCancelSymbolOrder(params: { symbol: string }): Promise< + APIResponse<{ + symbol: string; + }> + > { + return this.postPrivate('/api/v2/spot/trade/cancel-symbol-order', params); +⋮---- +getSpotOrder( + params?: GetSpotOrderInfoRequestV2, +): Promise> +⋮---- +getSpotOpenOrders( + params?: GetSpotOpenOrdersRequestV2, +): Promise> +⋮---- +getSpotHistoricOrders( + params?: GetSpotHistoryOrdersRequestV2, +): Promise> +⋮---- +getSpotFills( + params: GetSpotFillsRequestV2, +): Promise> +⋮---- +/** + * + * * Spot | Trigger Orders + * + */ +⋮---- +spotSubmitPlanOrder(params: SpotPlanOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/spot/trade/place-plan-order', params); +⋮---- +spotModifyPlanOrder(params: SpotModifyPlanOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/spot/trade/modify-plan-order', params); +⋮---- +spotCancelPlanOrder(params: { + clientOid?: string; + orderId?: string; + }): Promise< + APIResponse<{ + result: string; + }> + > { + return this.postPrivate('/api/v2/spot/trade/cancel-plan-order', params); +⋮---- +getSpotCurrentPlanOrders(params: GetSpotCurrentPlanOrdersRequestV2): Promise< + APIResponse<{ + nextFlag: boolean; + idLessThan: string; + orderList: SpotCurrentPlanOrderV2[]; + }> + > { + return this.getPrivate('/api/v2/spot/trade/current-plan-order', params); +⋮---- +getSpotPlanSubOrder(params: { + planOrderId: string; +}): Promise> +⋮---- +getSpotHistoricPlanOrders(params: GetSpotHistoryPlanOrdersRequestV2): Promise< + APIResponse<{ + nextFlag: boolean; + idLessThan: string; + orderList: SpotHistoryPlanOrderV2[]; + }> + > { + return this.getPrivate('/api/v2/spot/trade/history-plan-order', params); +⋮---- +spotCancelPlanOrders(params?: { + symbolList?: string[]; +}): Promise> +⋮---- +/** + * + * * Spot | Account + * + */ +⋮---- +getSpotAccount(): Promise> +⋮---- +getSpotAccountAssets(params?: { + coin?: string; + assetType?: string; +}): Promise> +⋮---- +getSpotSubAccountAssets(): Promise> +⋮---- +spotModifyDepositAccount(params: { + accountType: string; + coin: string; +}): Promise> +⋮---- +getSpotAccountBills( + params?: GetSpotAccountBillsRequestV2, +): Promise> +⋮---- +spotTransfer(params: SpotTransferRequestV2): Promise< + APIResponse<{ + transferId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/spot/wallet/transfer', params); +⋮---- +getSpotTransferableCoins(params: { + fromType: SpotAccountTypeV2; + toType: SpotAccountTypeV2; +}): Promise> +⋮---- +spotSubTransfer(params: SpotSubAccountTransferRequestV2): Promise< + APIResponse<{ + transferId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/spot/wallet/subaccount-transfer', params); +⋮---- +spotWithdraw(params: SpotWithdrawalRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/spot/wallet/withdrawal', params); +⋮---- +getSpotMainSubTransferRecord( + params: SpotMainSubTransferRecordRequestV2, +): Promise> ⋮---- -getClientType() +getSpotTransferHistory( + params: GetSpotTransferRecordRequestV2, +): Promise> ⋮---- -/** - * - * Custom SDK functions - * - */ +spotSwitchBGBDeduct(params: { + deduct: boolean; +}): Promise> ⋮---- -/** - * 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 +getSpotDepositAddress(params: { + coin: string; + chain?: string; + size: string; +}): Promise> ⋮---- -// Adjust server time by adding estimated one-way latency +getSpotSubDepositAddress(params: { + subUid: string; + coin: string; + chain?: string; + size: string; +}): Promise> ⋮---- -// Calculate time difference between adjusted server time and local time +getSpotBGBDeductInfo(): Promise< + APIResponse<{ + deduct: string; + }> + > { + return this.getPrivate('/api/v2/spot/account/deduct-info'); ⋮---- -async fetchServerTime(): Promise +spotCancelWithdrawal(params: { + orderId: string; +}): Promise> +⋮---- +getSubAccountDepositRecords( + params: GetSpotSubAccountDepositRecordRequestV2, +): Promise> +⋮---- +getSpotWithdrawalHistory( + params: GetSpotWithdrawalRecordRequestV2, +): Promise> +⋮---- +getSpotDepositHistory( + params: GetSpotDepositRecordRequestV2, +): Promise> ⋮---- /** - * - * Bitget misc functions - * + * Upgrade Account - Upgrade to unified account mode + * No account type restrictions; both parent and sub-accounts are supported. + * This interface is only used for upgrading to the unified account mode. + * Please note that as the account upgrade process takes approximately 1 minute, + * the successful response you receive only indicates that the request has been received, + * and does not mean that the account has been successfully upgraded to a unified account. + * Please use the query upgrade status interface to confirm whether the account upgrade is successful. */ +upgradeToUnifiedAccount(params?: { + subUid?: string; +}): Promise> ⋮---- /** - * - * - * Common - * - * + * Get Upgrade Status - Get account upgrade status + * No account type restrictions; both parent and sub-accounts are supported. */ +getUnifiedAccountSwitchStatus(params?: { subUid?: string }): Promise< + APIResponse<{ + status: 'processProcessing' | 'successSuccess' | 'failFailed'; + }> + > { + return this.getPrivate('/api/v2/spot/account/upgrade-status', params); ⋮---- /** * - * * Common | Notice + * + * Futures + * * */ ⋮---- -getAnnouncements( - params?: GetAnnouncementsRequestV2, -): Promise> -⋮---- /** * - * * Common | Public + * * Futures | Market * */ ⋮---- -getServerTime(): Promise< - APIResponse<{ - serverTime: string; - }> - > { - return this.get('/api/v2/public/time'); +getFuturesVIPFeeRate(): Promise> ⋮---- -getTradeRate(params: GetTradeRateRequestV2): Promise< +getFuturesInterestRateHistory(params: { coin: string }): Promise< APIResponse<{ - makerFeeRate: string; - takerFeeRate: string; + coin: string; + historyInterestRateList: FuturesHistoryInterestRateV2[]; }> > { - return this.getPrivate('/api/v2/common/trade-rate', params); + return this.get('/api/v2/mix/market/union-interest-rate-history', params); ⋮---- -getAllTradeRates(params: GetAllTradeRatesRequestV2): Promise< +getFuturesInterestExchangeRate(): Promise< APIResponse< { - symbol: string; - makerFeeRate: string; - takerFeeRate: string; + coin: string; + exchangeRateList: FuturesInterestExchangeRateV2[]; }[] > > { - return this.getPrivate('/api/v2/common/all-trade-rate', params); + return this.get('/api/v2/mix/market/exchange-rate'); ⋮---- -/** - * - * * Common | Tax - * - */ +getFuturesDiscountRate(): Promise> ⋮---- -getSpotTransactionRecords( - params: GetSpotTransactionsRequestV2, -): Promise> +getFuturesMergeDepth( + params: FuturesMergeDepthRequestV2, +): Promise> ⋮---- -getFuturesTransactionRecords( - params: GetFuturesTransactionsRequestV2, -): Promise> +getFuturesTicker(params: { + symbol: string; + productType: FuturesProductTypeV2; +}): Promise> ⋮---- -getMarginTransactionRecords( - params: GetMarginTransactionsRequestV2, -): Promise> +getFuturesAllTickers(params: { + productType: FuturesProductTypeV2; +}): Promise> ⋮---- -getP2PTransactionRecords( - params: GetP2PTransactionsRequestV2, -): Promise> +getFuturesRecentTrades( + params: FuturesRecentTradesRequestV2, +): Promise> ⋮---- -/** - * - * * Common | P2P - * - */ +getFuturesHistoricTrades( + params: FuturesHistoricTradesRequestV2, +): Promise> ⋮---- -getP2PMerchantList(params?: GetP2PMerchantsRequestV2): Promise< - APIResponse<{ - merchantList: P2PMerchantV2[]; - minMerchantId: string; - }> - > { - return this.getPrivate('/api/v2/p2p/merchantList', params); +getFuturesCandles( + params: FuturesCandlesRequestV2, +): Promise> ⋮---- -getP2PMerchantInfo(): Promise> +getFuturesHistoricCandles( + params: FuturesCandlesRequestV2, +): Promise> ⋮---- -getP2PMerchantOrders(params: GetMerchantP2POrdersRequestV2): Promise< - APIResponse<{ - orderList: P2PMerchantOrderV2[]; - minOrderId: string; - }> - > { - return this.getPrivate('/api/v2/p2p/orderList', params); +getFuturesHistoricIndexPriceCandles( + params: FuturesCandlesRequestV2, +): Promise> ⋮---- -getP2PMerchantAdvertisementList( - params: GetMerchantAdvertisementsRequestV2, - ): Promise< +getFuturesHistoricMarkPriceCandles( + params: FuturesCandlesRequestV2, +): Promise> +⋮---- +getFuturesOpenInterest(params: { + symbol: string; + productType: FuturesProductTypeV2; + }): Promise< APIResponse<{ - advList: P2PMerchantAdvertismentV2[]; - minAdvId: string; + openInterestList: FuturesOpenInterestV2[]; + ts: string; }> > { - return this.getPrivate('/api/v2/p2p/advList', params); -⋮---- -/** - * - * * Common | Trading insights - * - */ -⋮---- -getSpotWhaleNetFlowData(params: { - symbol: string; -}): Promise> -⋮---- -getFuturesActiveTakerBuySellVolumeData(params: { - symbol: string; - period?: string; -}): Promise> -⋮---- -getFuturesActiveLongShortPositionData(params: { - symbol: string; - period?: string; -}): Promise> -⋮---- -getFuturesLongShortRatio(params: { - symbol: string; - period?: string; - coin?: string; -}): Promise> -⋮---- -getMarginLoanGrowthRate(params: { - symbol: string; - period?: string; - coin?: string; -}): Promise> + return this.get('/api/v2/mix/market/open-interest', params); ⋮---- -getIsolatedMarginBorrowingRatio(params: { +getFuturesNextFundingTime(params: { symbol: string; - period?: string; -}): Promise> + productType: FuturesProductTypeV2; +}): Promise> ⋮---- -getFuturesActiveBuySellVolumeData(params: { +getFuturesSymbolPrice(params: { symbol: string; - period?: string; -}): Promise> + productType: FuturesProductTypeV2; +}): Promise> ⋮---- -getSpotFundFlow(params: { +getFuturesHistoricFundingRates(params: { symbol: string; - period?: string; -}): Promise> + productType: FuturesProductTypeV2; + pageSize?: string; + pageNo?: string; +}): Promise> ⋮---- -getTradeDataSupportSymbols(): Promise< - APIResponse<{ - spotList: string[]; - futureList: string[]; - }> +getFuturesCurrentFundingRate(params: { + symbol?: string; + productType: FuturesProductTypeV2; + }): Promise< + APIResponse< + { + symbol: string; + fundingRate: string; // '0.0001'; + fundingRateInterval: string; // hours, example: '1' | '2' | '4' | '8'; + nextUpdate: string; // timestamp in milliseconds + minFundingRate: string; + maxFundingRate: string; + }[] + > > { - return this.get('/api/v2/spot/market/support-symbols'); + return this.get('/api/v2/mix/market/current-fund-rate', params); ⋮---- -getSpotFundNetFlowData(params: { symbol: string }): Promise< +fundingRate: string; // '0.0001'; +fundingRateInterval: string; // hours, example: '1' | '2' | '4' | '8'; +nextUpdate: string; // timestamp in milliseconds +⋮---- +getFuturesContractConfig(params: { + symbol?: string; + productType: FuturesProductTypeV2; +}): Promise> +⋮---- +getFuturesOiLimit(params: FuturesOiLimitRequestV2): Promise< APIResponse< { - netFlow: string; - ts: string; + symbol: string; + notionalValue: string; + totalNotionalValue: string; }[] > > { - return this.get('/api/v2/spot/market/fund-net-flow', params); -⋮---- -getFuturesActiveLongShortAccountData(params: { - symbol: string; - period?: string; -}): Promise> + return this.get('/api/v2/mix/market/oi-limit', params); ⋮---- /** * - * * Common | Virtual Subaccount + * * Futures | Account * */ ⋮---- -createVirtualSubaccount(params: { - subAccountList: string[]; -}): Promise> +getFuturesAccountAsset( + params: FuturesSingleAccountRequestV2, +): Promise> ⋮---- -modifyVirtualSubaccount(params: ModifyVirtualSubRequestV2): Promise< - APIResponse<{ - result: string; - }> +getFuturesAccountAssets(params: { + productType: FuturesProductTypeV2; +}): Promise> +⋮---- +getFuturesSubAccountAssets(params: { + productType: FuturesProductTypeV2; + }): Promise< + APIResponse< + { + userId: number; + assetList: FuturesSubAccountAssetV2[]; + }[] + > > { - return this.postPrivate('/api/v2/user/modify-virtual-subaccount', params); + return this.getPrivate('/api/v2/mix/account/sub-account-assets', params); ⋮---- -batchCreateVirtualSubaccountAndAPIKey( - params: CreateVirtualSubRequestV2, -): Promise> +getFuturesInterestHistory( + params: FuturesInterestHistoryRequestV2, +): Promise> ⋮---- -getVirtualSubaccounts(params?: { - limit?: string; - idLessThan?: string; - status?: 'normal' | 'freeze'; - }): Promise< +getFuturesOpenCount(params: FuturesOpenCountRequestV2): Promise< APIResponse<{ - endId: string; - subAccountList: VirtualSubAccountV2[]; + size: string; }> > { - return this.getPrivate('/api/v2/user/virtual-subaccount-list', params); -⋮---- -createVirtualSubaccountAPIKey( - params: CreateVirtualSubApiKeyRequestV2, -): Promise> + return this.getPrivate('/api/v2/mix/account/open-count', params); ⋮---- -modifyVirtualSubaccountAPIKey( - params: ModifyVirtualSubApiKeyRequestV2, -): Promise> +setFuturesPositionAutoMargin( + params: FuturesSetAutoMarginRequestV2, +): Promise> ⋮---- -getVirtualSubaccountAPIKeys(params: { - subAccountUid: string; -}): Promise> +setFuturesLeverage( + params: FuturesSetLeverageRequestV2, +): Promise> ⋮---- -/** - * Create a dedicated sub-account for an AI Agent instance. - * Frequency limit: 1/s per UID. Agent sub-accounts cannot be edited after creation. - */ -createAgentSubaccount( - params: CreateAgentSubaccountRequestV2, -): Promise> +setFuturesPositionMargin( + params: FuturesSetPositionMarginRequestV2, +): Promise> ⋮---- -/** - * - * * Common | Assets - * - */ -getFundingAssets(params?: { - coin?: string; -}): Promise> +setFuturesAssetMode(params: { + productType: 'USDT-FUTURES' | 'SUSDT-FUTURES'; + assetMode: 'single' | 'union'; +}): Promise> ⋮---- -getBotAccount(params?: { - accountType?: string; -}): Promise> +setFuturesMarginMode( + params: FuturesSetMarginModeRequestV2, +): Promise> ⋮---- -/** Get assets overview */ -getBalances(): Promise< - APIResponse< - { - accountType: string; - usdtBalance: string; - }[] - > +setFuturesPositionMode(params: { + productType: FuturesProductTypeV2; + posMode: 'one_way_mode' | 'hedge_mode'; + }): Promise< + APIResponse<{ + posMode: 'one_way_mode' | 'hedge_mode'; + }> > { - return this.getPrivate('/api/v2/account/all-account-balance'); -⋮---- -/** - * - * * Common | Convert - * - */ -⋮---- -getConvertCoins(): Promise> -⋮---- -getConvertQuotedPrice( - params: ConvertQuoteRequestV2, -): Promise> -⋮---- -convert( - params: ConvertRequestV2, -): Promise> + return this.postPrivate('/api/v2/mix/account/set-position-mode', params); ⋮---- -getConvertHistory(params: GetConvertHistoryRequestV2): Promise< +getFuturesAccountBills(params: FuturesAccountBillRequestV2): Promise< APIResponse<{ - dataList: ConvertRecordV2[]; + bills: FuturesAccountBillV2[]; endId: string; }> > { - return this.getPrivate('/api/v2/convert/convert-record', params); + return this.getPrivate('/api/v2/mix/account/bill', params); ⋮---- /** + * Get Union Transfer Limits * - * * Common | BGB Convert - * + * - Rate limit: 1 time/1s (uid) + * - Get union margin currency transfer limits */ +getUnionTransferLimits( + params: GetUnionTransferLimitsRequestV2, +): Promise> ⋮---- -getConvertBGBCoins(): Promise< - APIResponse<{ - coinList: BGBConvertCoinV2[]; - }> - > { - return this.getPrivate('/api/v2/convert/bgb-convert-coin-list'); -⋮---- -convertBGB(params: { - coinList: string; -}): Promise> +/** + * Get Union Config + * + * - Rate limit: 1 time/1s (uid) + * - Get API for union margin configuration parameters (Liability Initial Margin Rate, Liability Maintenance Margin Rate, Personal Liability Limit, Personal Liability Limit Ratio) + */ +getUnionConfig(): Promise> ⋮---- -getConvertBGBHistory( - params: GetConvertBGBHistoryRequestV2, -): Promise> +/** + * Get Switch Union USDT + * + * - Rate limit: 1 time/1s (uid) + * - Get USDT quota for switching from union margin to single margin + */ +getSwitchUnionUsdt(): Promise> ⋮---- /** + * Union Convert * + * - Rate limit: 1 time/1s (uid) + * - Union margin exchange + */ +unionConvert( + params: UnionConvertRequestV2, +): Promise> +⋮---- +/** + * Get Max Openable Quantity * - * Spot + * - Rate limit: 20 req/sec/UID + * - Get Max Openable Quantity + */ +getFuturesMaxOpenableQuantity( + params: FuturesMaxOpenRequestV2, +): Promise> +⋮---- +/** + * Get Liquidation Price * + * - Rate limit: 20 req/sec/UID + * - Get Liquidation Price + */ +getFuturesLiquidationPrice( + params: FuturesLiquidationPriceRequestV2, +): Promise> +⋮---- +/** + * Get Isolated Symbols * + * - Rate limits: 10 time/1s (uid) + * - Retrieve trading pairs with isolated margin mode under the account. */ +getFuturesIsolatedSymbols( + params: FuturesIsolatedSymbolsRequestV2, +): Promise> ⋮---- /** * - * * Spot | Market + * * Futures | Position * */ ⋮---- -getSpotCoinInfo(params?: { - coin?: string; -}): Promise> -⋮---- -getSpotSymbolInfo(params?: { - symbol?: string; -}): Promise> -⋮---- -getSpotVIPFeeRate(): Promise> -⋮---- -getSpotTicker(params?: { - symbol?: string; -}): Promise> -⋮---- -getSpotMergeDepth(params: { +getFuturesPositionTier(params: { + productType: FuturesProductTypeV2; symbol: string; - precision?: string; - limit?: string; -}): Promise> +}): Promise> ⋮---- -getSpotOrderBookDepth(params: { +getFuturesPosition(params: { + productType: FuturesProductTypeV2; symbol: string; - type?: string; - limit?: string; -}): Promise> -⋮---- -getSpotCandles( - params: SpotCandlesRequestV2, -): Promise> -⋮---- -getSpotHistoricCandles( - params: SpotHistoricCandlesRequestV2, -): Promise> + marginCoin: string; +}): Promise> ⋮---- -getSpotRecentTrades(params: { - symbol: string; - limit?: string; -}): Promise> +getFuturesPositions(params: { + productType: FuturesProductTypeV2; + marginCoin?: string; +}): Promise> ⋮---- -getSpotHistoricTrades( - params: SpotHistoricTradesRequestV2, -): Promise> +getFuturesHistoricPositions( + params?: FuturesHistoricalPositionsRequestV2, + ): Promise< + APIResponse<{ + list: FuturesHistoryPositionV2[]; + endId: string; + }> + > { + return this.getPrivate('/api/v2/mix/position/history-position', params); ⋮---- -getSpotCallAuction( - params: SpotCallAuctionRequestV2, -): Promise> +getFuturesPositionAdlRank( + params: FuturesPositionAdlRankRequestV2, +): Promise> ⋮---- /** * - * * Spot | Trade + * * Futures | Trade * */ ⋮---- -spotSubmitOrder(params: SpotOrderRequestV2): Promise< +futuresSubmitOrder(params: FuturesPlaceOrderRequestV2): Promise< APIResponse<{ orderId: string; clientOid: string; }> > { - return this.postPrivate('/api/v2/spot/trade/place-order', params); -⋮---- -spotCancelandSubmitOrder( - params: SpotCancelandSubmitOrderRequestV2, -): Promise> -⋮---- -spotBatchCancelandSubmitOrder(params: { - orderList: SpotCancelandSubmitOrderRequestV2[]; -}): Promise> + return this.postPrivate('/api/v2/mix/order/place-order', params); ⋮---- -spotCancelOrder(params: SpotCancelOrderRequestV2): Promise< +futuresSubmitReversal(params: FuturesReversalOrderRequestV2): Promise< APIResponse<{ orderId: string; clientOid: string; }> > { - return this.postPrivate('/api/v2/spot/trade/cancel-order', params); -⋮---- -spotBatchSubmitOrders( - params: SpotBatchOrderRequestV2, -): Promise> + return this.postPrivate('/api/v2/mix/order/click-backhand', params); ⋮---- -spotBatchCancelOrders( - params: SpotBatchCancelOrderRequestV2, -): Promise> +futuresBatchSubmitOrders( + params: FuturesBatchOrderRequestV2, +): Promise> ⋮---- -spotCancelSymbolOrder(params: { symbol: string }): Promise< +futuresModifyOrder(params: FuturesModifyOrderRequestV2): Promise< APIResponse<{ - symbol: string; + orderId: string; + clientOid: string; }> > { - return this.postPrivate('/api/v2/spot/trade/cancel-symbol-order', params); -⋮---- -getSpotOrder( - params?: GetSpotOrderInfoRequestV2, -): Promise> -⋮---- -getSpotOpenOrders( - params?: GetSpotOpenOrdersRequestV2, -): Promise> -⋮---- -getSpotHistoricOrders( - params?: GetSpotHistoryOrdersRequestV2, -): Promise> -⋮---- -getSpotFills( - params: GetSpotFillsRequestV2, -): Promise> -⋮---- -/** - * - * * Spot | Trigger Orders - * - */ + return this.postPrivate('/api/v2/mix/order/modify-order', params); ⋮---- -spotSubmitPlanOrder(params: SpotPlanOrderRequestV2): Promise< +futuresCancelOrder(params: FuturesCancelOrderRequestV2): Promise< APIResponse<{ orderId: string; clientOid: string; }> > { - return this.postPrivate('/api/v2/spot/trade/place-plan-order', params); + return this.postPrivate('/api/v2/mix/order/cancel-order', params); ⋮---- -spotModifyPlanOrder(params: SpotModifyPlanOrderRequestV2): Promise< +futuresBatchCancelOrders( + params: FuturesBatchCancelOrderRequestV2, +): Promise> +⋮---- +futuresFlashClosePositions( + params: FuturesFlashClosePositionsRequestV2, +): Promise> +⋮---- +getFuturesOrder( + params: FuturesGetOrderRequestV2, +): Promise> +⋮---- +getFuturesFills(params: FuturesGetOrderFillsRequestV2): Promise< APIResponse<{ - orderId: string; - clientOid: string; + fillList: FuturesOrderFillV2[]; + endId: string; }> > { - return this.postPrivate('/api/v2/spot/trade/modify-plan-order', params); + return this.getPrivate('/api/v2/mix/order/fills', params); ⋮---- -spotCancelPlanOrder(params: { - clientOid?: string; - orderId?: string; - }): Promise< +getFuturesHistoricOrderFills( + params: FuturesGetHistoricalFillsRequestV2, + ): Promise< APIResponse<{ - result: string; + fillList: FuturesOrderFillV2[]; + endId: string; }> > { - return this.postPrivate('/api/v2/spot/trade/cancel-plan-order', params); + return this.getPrivate('/api/v2/mix/order/fill-history', params); ⋮---- -getSpotCurrentPlanOrders(params: GetSpotCurrentPlanOrdersRequestV2): Promise< +getFuturesOpenOrders(params: FuturesGetOpenOrdersRequestV2): Promise< APIResponse<{ - nextFlag: boolean; - idLessThan: string; - orderList: SpotCurrentPlanOrderV2[]; + entrustedList: FuturesOpenOrderV2[]; + endId: string; }> > { - return this.getPrivate('/api/v2/spot/trade/current-plan-order', params); -⋮---- -getSpotPlanSubOrder(params: { - planOrderId: string; -}): Promise> + return this.getPrivate('/api/v2/mix/order/orders-pending', params); ⋮---- -getSpotHistoricPlanOrders(params: GetSpotHistoryPlanOrdersRequestV2): Promise< +getFuturesHistoricOrders(params: FuturesGetHistoryOrdersRequestV2): Promise< APIResponse<{ - nextFlag: boolean; - idLessThan: string; - orderList: SpotHistoryPlanOrderV2[]; + entrustedList: FuturesHistoryOrderV2[]; + endId: string; }> > { - return this.getPrivate('/api/v2/spot/trade/history-plan-order', params); + return this.getPrivate('/api/v2/mix/order/orders-history', params); ⋮---- -spotCancelPlanOrders(params?: { - symbolList?: string[]; -}): Promise> +futuresCancelAllOrders( + params: FuturesCancelAllOrdersRequestV2, +): Promise> ⋮---- /** * - * * Spot | Account + * * Futures | Trigger Orders * */ ⋮---- -getSpotAccount(): Promise> -⋮---- -getSpotAccountAssets(params?: { - coin?: string; - assetType?: string; -}): Promise> -⋮---- -getSpotSubAccountAssets(): Promise> -⋮---- -spotModifyDepositAccount(params: { - accountType: string; - coin: string; -}): Promise> -⋮---- -getSpotAccountBills( - params?: GetSpotAccountBillsRequestV2, -): Promise> +getFuturesTriggerSubOrder(params: { + planType: 'normal_plan' | 'track_plan'; + planOrderId: string; + productType: FuturesProductTypeV2; +}): Promise> ⋮---- -spotTransfer(params: SpotTransferRequestV2): Promise< +futuresSubmitTPSLOrder(params: FuturesTPSLOrderRequestV2): Promise< APIResponse<{ - transferId: string; + orderId: string; clientOid: string; }> > { - return this.postPrivate('/api/v2/spot/wallet/transfer', params); + return this.postPrivate('/api/v2/mix/order/place-tpsl-order', params); ⋮---- -getSpotTransferableCoins(params: { - fromType: SpotAccountTypeV2; - toType: SpotAccountTypeV2; -}): Promise> +futuresSubmitPositionTPSL(params: FuturesPositionTPSLOrderRequestV2): Promise< + APIResponse< + { + orderId: string; + stopSurplusClientOid: string; + stopLossClientOid: string; + }[] + > + > { + return this.postPrivate('/api/v2/mix/order/place-pos-tpsl', params); ⋮---- -spotSubTransfer(params: SpotSubAccountTransferRequestV2): Promise< +futuresSubmitPlanOrder(params: FuturesPlanOrderRequestV2): Promise< APIResponse<{ - transferId: string; + orderId: string; clientOid: string; }> > { - return this.postPrivate('/api/v2/spot/wallet/subaccount-transfer', params); + return this.postPrivate('/api/v2/mix/order/place-plan-order', params); ⋮---- -spotWithdraw(params: SpotWithdrawalRequestV2): Promise< +futuresModifyTPSLPOrder(params: FuturesModifyTPSLOrderRequestV2): Promise< APIResponse<{ orderId: string; clientOid: string; }> > { - return this.postPrivate('/api/v2/spot/wallet/withdrawal', params); -⋮---- -getSpotMainSubTransferRecord( - params: SpotMainSubTransferRecordRequestV2, -): Promise> -⋮---- -getSpotTransferHistory( - params: GetSpotTransferRecordRequestV2, -): Promise> -⋮---- -spotSwitchBGBDeduct(params: { - deduct: boolean; -}): Promise> -⋮---- -getSpotDepositAddress(params: { - coin: string; - chain?: string; - size: string; -}): Promise> + return this.postPrivate('/api/v2/mix/order/modify-tpsl-order', params); ⋮---- -getSpotSubDepositAddress(params: { - subUid: string; - coin: string; - chain?: string; - size: string; -}): Promise> +futuresModifyPlanOrder(params: FuturesModifyPlanOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/mix/order/modify-plan-order', params); ⋮---- -getSpotBGBDeductInfo(): Promise< +getFuturesPlanOrders(params: FuturesGetPlanOrdersRequestV2): Promise< APIResponse<{ - deduct: string; + entrustedList: FuturesPendingPlanOrderV2[]; + endId: string; }> > { - return this.getPrivate('/api/v2/spot/account/deduct-info'); -⋮---- -spotCancelWithdrawal(params: { - orderId: string; -}): Promise> -⋮---- -getSubAccountDepositRecords( - params: GetSpotSubAccountDepositRecordRequestV2, -): Promise> -⋮---- -getSpotWithdrawalHistory( - params: GetSpotWithdrawalRecordRequestV2, -): Promise> -⋮---- -getSpotDepositHistory( - params: GetSpotDepositRecordRequestV2, -): Promise> + return this.getPrivate('/api/v2/mix/order/orders-plan-pending', params); ⋮---- -/** - * Upgrade Account - Upgrade to unified account mode - * No account type restrictions; both parent and sub-accounts are supported. - * This interface is only used for upgrading to the unified account mode. - * Please note that as the account upgrade process takes approximately 1 minute, - * the successful response you receive only indicates that the request has been received, - * and does not mean that the account has been successfully upgraded to a unified account. - * Please use the query upgrade status interface to confirm whether the account upgrade is successful. - */ -upgradeToUnifiedAccount(params?: { - subUid?: string; -}): Promise> +futuresCancelPlanOrder( + params: FuturesCancelPlanOrderRequestV2, +): Promise> ⋮---- -/** - * Get Upgrade Status - Get account upgrade status - * No account type restrictions; both parent and sub-accounts are supported. - */ -getUnifiedAccountSwitchStatus(params?: { subUid?: string }): Promise< +getFuturesHistoricPlanOrders( + params: FuturesGetHistoryPlanOrdersRequestV2, + ): Promise< APIResponse<{ - status: 'processProcessing' | 'successSuccess' | 'failFailed'; + entrustedList: FuturesHistoryPlanOrderV2[]; + endId: string; }> > { - return this.getPrivate('/api/v2/spot/account/upgrade-status', params); + return this.getPrivate('/api/v2/mix/order/orders-plan-history', params); ⋮---- /** * * - * Futures + * Broker * * */ ⋮---- /** * - * * Futures | Market + * * Broker | Subaccount * */ ⋮---- -getFuturesVIPFeeRate(): Promise> +modifySubaccountEmail(params: { + subUid: string; + subaccountEmail: string; +}): Promise> ⋮---- -getFuturesInterestRateHistory(params: { coin: string }): Promise< +getBrokerInfo(): Promise< APIResponse<{ - coin: string; - historyInterestRateList: FuturesHistoryInterestRateV2[]; + subAccountSize: string; + maxSubAccountSize: string; + uTime: string; }> > { - return this.get('/api/v2/mix/market/union-interest-rate-history', params); -⋮---- -getFuturesInterestExchangeRate(): Promise< - APIResponse< - { - coin: string; - exchangeRateList: FuturesInterestExchangeRateV2[]; - }[] - > - > { - return this.get('/api/v2/mix/market/exchange-rate'); -⋮---- -getFuturesDiscountRate(): Promise> -⋮---- -getFuturesMergeDepth( - params: FuturesMergeDepthRequestV2, -): Promise> -⋮---- -getFuturesTicker(params: { - symbol: string; - productType: FuturesProductTypeV2; -}): Promise> -⋮---- -getFuturesAllTickers(params: { - productType: FuturesProductTypeV2; -}): Promise> -⋮---- -getFuturesRecentTrades( - params: FuturesRecentTradesRequestV2, -): Promise> -⋮---- -getFuturesHistoricTrades( - params: FuturesHistoricTradesRequestV2, -): Promise> + return this.getPrivate('/api/v2/broker/account/info'); ⋮---- -getFuturesCandles( - params: FuturesCandlesRequestV2, -): Promise> +createSubaccount(params: { + subaccountName: string; + label: string; +}): Promise> ⋮---- -getFuturesHistoricCandles( - params: FuturesCandlesRequestV2, -): Promise> +getSubaccounts(params?: GetSubAccountsRequestV2): Promise< + APIResponse<{ + hasNextPage: boolean; + idLessThan: number; + subList: BrokerSubaccountV2[]; + }> + > { + return this.getPrivate('/api/v2/broker/account/subaccount-list', params); ⋮---- -getFuturesHistoricIndexPriceCandles( - params: FuturesCandlesRequestV2, -): Promise> +modifySubaccount( + params: ModifySubRequestV2, +): Promise> ⋮---- -getFuturesHistoricMarkPriceCandles( - params: FuturesCandlesRequestV2, -): Promise> +getSubaccountEmail(params: { + subUid: string; +}): Promise> ⋮---- -getFuturesOpenInterest(params: { - symbol: string; - productType: FuturesProductTypeV2; +getSubaccountSpotAssets(params: { + subUid: string; + coin?: string; + assetType?: 'hold_only' | 'all'; }): Promise< APIResponse<{ - openInterestList: FuturesOpenInterestV2[]; - ts: string; + assetsList: BrokerSubaccountSpotAssetV2[]; }> > { - return this.get('/api/v2/mix/market/open-interest', params); -⋮---- -getFuturesNextFundingTime(params: { - symbol: string; - productType: FuturesProductTypeV2; -}): Promise> -⋮---- -getFuturesSymbolPrice(params: { - symbol: string; - productType: FuturesProductTypeV2; -}): Promise> -⋮---- -getFuturesHistoricFundingRates(params: { - symbol: string; - productType: FuturesProductTypeV2; - pageSize?: string; - pageNo?: string; -}): Promise> + return this.getPrivate( + '/api/v2/broker/account/subaccount-spot-assets', + params, + ); ⋮---- -getFuturesCurrentFundingRate(params: { - symbol?: string; +getSubaccountFuturesAssets(params: { + subUid: string; productType: FuturesProductTypeV2; }): Promise< - APIResponse< - { - symbol: string; - fundingRate: string; // '0.0001'; - fundingRateInterval: string; // hours, example: '1' | '2' | '4' | '8'; - nextUpdate: string; // timestamp in milliseconds - minFundingRate: string; - maxFundingRate: string; - }[] - > + APIResponse<{ + assetsList: BrokerSubaccountFutureAssetV2[]; + }> > { - return this.get('/api/v2/mix/market/current-fund-rate', params); -⋮---- -fundingRate: string; // '0.0001'; -fundingRateInterval: string; // hours, example: '1' | '2' | '4' | '8'; -nextUpdate: string; // timestamp in milliseconds + return this.getPrivate( + '/api/v2/broker/account/subaccount-future-assets', + params, + ); ⋮---- -getFuturesContractConfig(params: { - symbol?: string; - productType: FuturesProductTypeV2; -}): Promise> +createSubaccountDepositAddress(params: { + subUid: string; + coin: string; + chain?: string; +}): Promise> ⋮---- -getFuturesOiLimit(params: FuturesOiLimitRequestV2): Promise< - APIResponse< - { - symbol: string; - notionalValue: string; - totalNotionalValue: string; - }[] - > +subaccountWithdrawal(params: SubWithdrawalRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> > { - return this.get('/api/v2/mix/market/oi-limit', params); + return this.postPrivate( + '/api/v2/broker/account/subaccount-withdrawal', + params, + ); +⋮---- +subaccountSetAutoTransfer(params: { + subUid: string; + coin: string; + toAccountType: string; +}): Promise> ⋮---- /** + * Sub Deposit Records * - * * Futures | Account - * + * - Only applicable for ND broker main-account to get ND sub-accounts deposit record */ +subaccountDepositRecords( + params: SubDepositRecordsRequestV2, +): Promise> ⋮---- -getFuturesAccountAsset( - params: FuturesSingleAccountRequestV2, -): Promise> -⋮---- -getFuturesAccountAssets(params: { - productType: FuturesProductTypeV2; -}): Promise> -⋮---- -getFuturesSubAccountAssets(params: { - productType: FuturesProductTypeV2; - }): Promise< - APIResponse< - { - userId: number; - assetList: FuturesSubAccountAssetV2[]; - }[] - > - > { - return this.getPrivate('/api/v2/mix/account/sub-account-assets', params); -⋮---- -getFuturesInterestHistory( - params: FuturesInterestHistoryRequestV2, -): Promise> -⋮---- -getFuturesOpenCount(params: FuturesOpenCountRequestV2): Promise< +/** + * Sub Withdrawal Records + * + * - Only applicable for ND broker main-account + */ +subaccountWithdrawalRecords(params: SubWithdrawalRecordsRequestV2): Promise< APIResponse<{ - size: string; + resultList: BrokerSubaccountWithdrawalV2[]; + endId: string; }> > { - return this.getPrivate('/api/v2/mix/account/open-count', params); -⋮---- -setFuturesPositionAutoMargin( - params: FuturesSetAutoMarginRequestV2, -): Promise> + return this.getPrivate('/api/v2/broker/subaccount-withdrawal', params); ⋮---- -setFuturesLeverage( - params: FuturesSetLeverageRequestV2, -): Promise> +/** + * + * Broker | Api Key + * + */ ⋮---- -setFuturesPositionMargin( - params: FuturesSetPositionMarginRequestV2, -): Promise> +createSubaccountApiKey( + params: CreateSubAccountApiKeyRequestV2, +): Promise> ⋮---- -setFuturesAssetMode(params: { - productType: 'USDT-FUTURES' | 'SUSDT-FUTURES'; - assetMode: 'single' | 'union'; -}): Promise> +getSubaccountApiKey(params: { + subUid: string; +}): Promise> ⋮---- -setFuturesMarginMode( - params: FuturesSetMarginModeRequestV2, -): Promise> +modifySubaccountApiKey( + params: ModifySubAccountApiKeyRequestV2, +): Promise> ⋮---- -setFuturesPositionMode(params: { - productType: FuturesProductTypeV2; - posMode: 'one_way_mode' | 'hedge_mode'; - }): Promise< - APIResponse<{ - posMode: 'one_way_mode' | 'hedge_mode'; - }> - > { - return this.postPrivate('/api/v2/mix/account/set-position-mode', params); +deleteSubaccountApiKey( + params: DeleteSubAccountApiKeyRequestV2, +): Promise> ⋮---- -getFuturesAccountBills(params: FuturesAccountBillRequestV2): Promise< +/** + * Get All Sub-accounts Deposit and Withdrawal Records + * + * - Only applicable for ND broker main-account + * - Rate limit: 5 req/sec/UID + * - Able to get ND sub-accounts deposit and withdrawal records within 90 days + */ +getAllSubDepositWithdrawalRecords( + params?: GetAllSubDepositWithdrawalRequestV2, + ): Promise< APIResponse<{ - bills: FuturesAccountBillV2[]; + list: AllSubDepositWithdrawalRecordV2[]; endId: string; }> > { - return this.getPrivate('/api/v2/mix/account/bill', params); + return this.getPrivate('/api/v2/broker/all-sub-deposit-withdrawal', params); ⋮---- /** - * Get Union Transfer Limits + * Get Broker Subaccounts * - * - Rate limit: 1 time/1s (uid) - * - Get union margin currency transfer limits + * - Rate limit: 5 req/sec/UID + * - Please contact your BD or RM to apply for access permissions */ -getUnionTransferLimits( - params: GetUnionTransferLimitsRequestV2, -): Promise> +getBrokerSubaccounts( + params?: GetBrokerSubaccountsRequestV2, +): Promise> ⋮---- /** - * Get Union Config + * Get Broker Subaccounts Commissions * - * - Rate limit: 1 time/1s (uid) - * - Get API for union margin configuration parameters (Liability Initial Margin Rate, Liability Maintenance Margin Rate, Personal Liability Limit, Personal Liability Limit Ratio) + * - Rate limit: 5 req/sec/UID + * - Please contact your BD or RM to apply for access permissions */ -getUnionConfig(): Promise> +getBrokerCommissions( + params?: GetBrokerCommissionsRequestV2, +): Promise> ⋮---- /** - * Get Switch Union USDT + * Get Broker Trade Volume * - * - Rate limit: 1 time/1s (uid) - * - Get USDT quota for switching from union margin to single margin + * - Rate limit: 5 req/sec/UID + * - Please contact your BD or RM to apply for access permissions */ -getSwitchUnionUsdt(): Promise> +getBrokerTradeVolume( + params?: GetBrokerTradeVolumeRequestV2, +): Promise> ⋮---- /** - * Union Convert + * Get Total Commission * - * - Rate limit: 1 time/1s (uid) - * - Union margin exchange + * - Rate limit: 20 req/sec/UID + * - Data retention: 365 days + * - Historical data available from: 2025/6/1 + * - Data granularity: daily + * - Data update granularity: daily, previous day's data is updated on the current day + * - Time zone: UTC+8 + * - startTime and endTime should either both be set or both left unset + * - This API supports retrieving data within the past 365 days (data is available starting from 2025/6/1 at the earliest) + * - If startTime and endTime are not set in the request, the default returned information will be for yesterday (00:00-23:59 UTC+8) + * - Data update frequency: T+1 (UTC+8) */ -unionConvert( - params: UnionConvertRequestV2, -): Promise> +getBrokerTotalCommission( + params?: GetBrokerTotalCommissionRequestV2, +): Promise> ⋮---- /** - * Get Max Openable Quantity + * Get Order Commission * * - Rate limit: 20 req/sec/UID - * - Get Max Openable Quantity + * - Data storage: 30 days + * - Historical data backtracking: 2025/9/1 + * - Data granularity: daily + * - Data update frequency: daily, previous day's data is updated on the current day + * - Time zone: UTC+8 + * - startTime and endTime should either both be set or both not set + * - The maximum time span supported for startTime and endTime is 30 days + * - This API supports retrieving data within the past 30 days + * - If startTime and endTime are not set in the request, the default return will be information for yesterday (00:00-23:59 UTC+8) + * - This API data is updated on a T+1 basis + * - Transaction details only show those marked with broker channel id */ -getFuturesMaxOpenableQuantity( - params: FuturesMaxOpenRequestV2, -): Promise> +getBrokerOrderCommission( + params?: GetBrokerOrderCommissionRequestV2, +): Promise> ⋮---- /** - * Get Liquidation Price + * Get Rebate Info * * - Rate limit: 20 req/sec/UID - * - Get Liquidation Price + * - Data retention: 30 days + * - Real-time data */ -getFuturesLiquidationPrice( - params: FuturesLiquidationPriceRequestV2, -): Promise> +getBrokerRebateInfo( + params: GetBrokerRebateInfoRequestV2, +): Promise> ⋮---- /** - * Get Isolated Symbols * - * - Rate limits: 10 time/1s (uid) - * - Retrieve trading pairs with isolated margin mode under the account. + * * Broker | Agent (affiliate) customer APIs + * */ -getFuturesIsolatedSymbols( - params: FuturesIsolatedSymbolsRequestV2, -): Promise> +⋮---- +getAgentCustomerCommissions( + params?: GetAgentCustomerCommissionsRequestV2, +): Promise> +⋮---- +/** + * Without startTime/endTime, returns all registered sub-customers (no time restriction). + */ +getAgentSubCustomerList( + params?: GetAgentSubCustomerListRequestV2, +): Promise> +⋮---- +getAgentCustomerTradeVolume( + params?: AgentCustomerTradeVolumeRequestV2, +): Promise> +⋮---- +/** + * Without startTime/endTime, returns all registered customers (no time restriction). + */ +getAgentCustomerList( + params?: AgentCustomerListRequestV2, +): Promise> +⋮---- +getAgentCustomerKycResult( + params?: GetAgentCustomerKycResultRequestV2, +): Promise> +⋮---- +getAgentCustomerDeposits( + params?: AgentCustomerDepositRequestV2, +): Promise> +⋮---- +getAgentCustomerAssets( + params?: AgentCustomerAssetRequestV2, +): Promise> +⋮---- +getAgentCommissionDetail( + params?: GetAgentCommissionDetailRequestV2, +): Promise> ⋮---- /** * - * * Futures | Position + * + * Margin + * * */ ⋮---- -getFuturesPositionTier(params: { - productType: FuturesProductTypeV2; - symbol: string; -}): Promise> +/** + * + * * Margin | Common + * + */ ⋮---- -getFuturesPosition(params: { - productType: FuturesProductTypeV2; - symbol: string; - marginCoin: string; -}): Promise> +getMarginCurrencies(): Promise> ⋮---- -getFuturesPositions(params: { - productType: FuturesProductTypeV2; - marginCoin?: string; -}): Promise> +/** + * + * * Margin | Cross/Isolated | Order Record + * + */ +⋮---- +getMarginBorrowHistory( + marginType: MarginType, + params: GetBorrowHistoryRequestV2, + ): Promise< + APIResponse<{ + resultList: MarginBorrowHistoryItemV2[]; + maxId: string; + minId: string; + }> + > { + assertMarginType(marginType); +⋮---- +getMarginRepayHistory( + marginType: MarginType, + params: GetRepayHistoryRequestV2, + ): Promise< + APIResponse<{ + resultList: MarginRepaymentHistoryItemV2[]; + maxId: string; + minId: string; + }> + > { + assertMarginType(marginType); +⋮---- +getMarginInterestHistory( + marginType: MarginType, + params: GetInterestHistoryRequestV2, + ): Promise< + APIResponse<{ + resultList: MarginInterestHistoryItemV2[]; + maxId: string; + minId: string; + }> + > { + assertMarginType(marginType); ⋮---- -getFuturesHistoricPositions( - params?: FuturesHistoricalPositionsRequestV2, +getMarginLiquidationHistory( + marginType: MarginType, + params: GetLiquidationHistoryRequestV2, ): Promise< APIResponse<{ - list: FuturesHistoryPositionV2[]; - endId: string; + resultList: MarginLiquidationHistoryItemV2[]; + maxId: string; + minId: string; }> > { - return this.getPrivate('/api/v2/mix/position/history-position', params); + assertMarginType(marginType); ⋮---- -getFuturesPositionAdlRank( - params: FuturesPositionAdlRankRequestV2, -): Promise> +getMarginFinancialHistory( + marginType: MarginType, + params: GetFinancialHistoryRequestV2, + ): Promise< + APIResponse<{ + resultList: MarginFinancialHistoryItemV2[]; + maxId: string; + minId: string; + }> + > { + assertMarginType(marginType); ⋮---- /** * - * * Futures | Trade + * * Margin | Cross/Isolated | Account * */ ⋮---- -futuresSubmitOrder(params: FuturesPlaceOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - return this.postPrivate('/api/v2/mix/order/place-order', params); +getMarginAccountAssets( + marginType: MarginType, + params?: { coin?: string }, +): Promise> ⋮---- -futuresSubmitReversal(params: FuturesReversalOrderRequestV2): Promise< +marginBorrow( + marginType: MarginType, + params: { + loanId: string; + symbol: string; + coin: string; + borrowAmount: string; + }, + ): Promise< APIResponse<{ - orderId: string; - clientOid: string; + loanId: string; + symbol: string; + coin: string; + borrowAmount: string; }> > { - return this.postPrivate('/api/v2/mix/order/click-backhand', params); -⋮---- -futuresBatchSubmitOrders( - params: FuturesBatchOrderRequestV2, -): Promise> + assertMarginType(marginType); ⋮---- -futuresModifyOrder(params: FuturesModifyOrderRequestV2): Promise< +marginRepay( + marginType: MarginType, + params: { + remainDebtAmount: string; + symbol: string; + repayId: string; + coin: string; + repayAmount: string; + }, + ): Promise< APIResponse<{ - orderId: string; - clientOid: string; + symbol: string; + coin: string; + repayId: string; + remainDebtAmount: string; + repayAmount: string; }> > { - return this.postPrivate('/api/v2/mix/order/modify-order', params); + assertMarginType(marginType); ⋮---- -futuresCancelOrder(params: FuturesCancelOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> +getMarginRiskRate(marginType: MarginType): Promise< + APIResponse< + { + symbol: string; + riskRateRatio: string; + }[] + > > { - return this.postPrivate('/api/v2/mix/order/cancel-order', params); -⋮---- -futuresBatchCancelOrders( - params: FuturesBatchCancelOrderRequestV2, -): Promise> -⋮---- -futuresFlashClosePositions( - params: FuturesFlashClosePositionsRequestV2, -): Promise> + assertMarginType(marginType); ⋮---- -getFuturesOrder( - params: FuturesGetOrderRequestV2, -): Promise> +getMarginMaxBorrowable( + marginType: MarginType, + params: { coin: string }, + ): Promise< + APIResponse + > { + assertMarginType(marginType); ⋮---- -getFuturesFills(params: FuturesGetOrderFillsRequestV2): Promise< - APIResponse<{ - fillList: FuturesOrderFillV2[]; - endId: string; - }> +getMarginMaxTransferable( + marginType: MarginType, + params: { coin: string }, + ): Promise< + APIResponse< + CrossMaxTransferableResponseV2 | IsolatedMaxTransferableResponseV2 + > > { - return this.getPrivate('/api/v2/mix/order/fills', params); + assertMarginType(marginType); ⋮---- -getFuturesHistoricOrderFills( - params: FuturesGetHistoricalFillsRequestV2, +getMarginInterestRateAndMaxBorrowable( + marginType: MarginType, + params: { coin: string }, ): Promise< - APIResponse<{ - fillList: FuturesOrderFillV2[]; - endId: string; - }> + APIResponse< + | IsolatedInterestRateAndLimitResponseV2[] + | CrossInterestRateAndLimitResponseV2[] + > > { - return this.getPrivate('/api/v2/mix/order/fill-history', params); + assertMarginType(marginType); ⋮---- -getFuturesOpenOrders(params: FuturesGetOpenOrdersRequestV2): Promise< - APIResponse<{ - entrustedList: FuturesOpenOrderV2[]; - endId: string; - }> +getMarginTierConfiguration( + marginType: MarginType, + params: { coin: string }, + ): Promise< + APIResponse< + CrossTierConfigurationResponseV2[] | IsolatedTierConfigurationResponseV2[] + > > { - return this.getPrivate('/api/v2/mix/order/orders-pending', params); + assertMarginType(marginType); ⋮---- -getFuturesHistoricOrders(params: FuturesGetHistoryOrdersRequestV2): Promise< +marginFlashRepay( + marginType: MarginType, + params: { coin: string }, + ): Promise< APIResponse<{ - entrustedList: FuturesHistoryOrderV2[]; - endId: string; + repayId: string; + coin?: string; + symbol?: string; + result?: string; }> > { - return this.getPrivate('/api/v2/mix/order/orders-history', params); + assertMarginType(marginType); ⋮---- -futuresCancelAllOrders( - params: FuturesCancelAllOrdersRequestV2, -): Promise> +getMarginFlashRepayResult( + marginType: MarginType, + params: { idList: string }, + ): Promise< + APIResponse< + { + repayId: string; + status: string; + }[] + > + > { + assertMarginType(marginType); ⋮---- /** * - * * Futures | Trigger Orders + * * Margin | Cross/Isolated | Trade * */ ⋮---- -getFuturesTriggerSubOrder(params: { - planType: 'normal_plan' | 'track_plan'; - planOrderId: string; - productType: FuturesProductTypeV2; -}): Promise> -⋮---- -futuresSubmitTPSLOrder(params: FuturesTPSLOrderRequestV2): Promise< +marginSubmitOrder( + marginType: MarginType, + params: MarginPlaceOrderRequestV2, + ): Promise< APIResponse<{ orderId: string; clientOid: string; }> > { - return this.postPrivate('/api/v2/mix/order/place-tpsl-order', params); + assertMarginType(marginType); ⋮---- -futuresSubmitPositionTPSL(params: FuturesPositionTPSLOrderRequestV2): Promise< - APIResponse< - { - orderId: string; - stopSurplusClientOid: string; - stopLossClientOid: string; - }[] - > - > { - return this.postPrivate('/api/v2/mix/order/place-pos-tpsl', params); +marginBatchSubmitOrders( + marginType: MarginType, + params: MarginBatchOrdersRequestV2, +): Promise> ⋮---- -futuresSubmitPlanOrder(params: FuturesPlanOrderRequestV2): Promise< +marginCancelOrder( + marginType: MarginType, + params: { + symbol: string; + orderId?: string; + clientOid?: string; + }, + ): Promise< APIResponse<{ orderId: string; clientOid: string; }> > { - return this.postPrivate('/api/v2/mix/order/place-plan-order', params); + assertMarginType(marginType); ⋮---- -futuresModifyTPSLPOrder(params: FuturesModifyTPSLOrderRequestV2): Promise< +marginBatchCancelOrders( + marginType: MarginType, + params: { + symbol: string; + orderIdList: string[]; + }, +): Promise> +⋮---- +getMarginOpenOrders( + marginType: MarginType, + params: GetMarginCurrentOrdersRequestV2, + ): Promise< APIResponse<{ - orderId: string; - clientOid: string; + orderList: MarginCurrentOrderV2[]; + maxId: string; + minId: string; }> > { - return this.postPrivate('/api/v2/mix/order/modify-tpsl-order', params); + assertMarginType(marginType); ⋮---- -futuresModifyPlanOrder(params: FuturesModifyPlanOrderRequestV2): Promise< +getMarginHistoricOrders( + marginType: MarginType, + params: GetHistoryOrdersRequestV2, + ): Promise< APIResponse<{ - orderId: string; - clientOid: string; + orderList: MarginHistoryOrderV2[]; + maxId: string; + minId: string; }> > { - return this.postPrivate('/api/v2/mix/order/modify-plan-order', params); + assertMarginType(marginType); ⋮---- -getFuturesPlanOrders(params: FuturesGetPlanOrdersRequestV2): Promise< +getMarginHistoricOrderFills( + marginType: MarginType, + params: GetMarginOrderFillsRequestV2, + ): Promise< APIResponse<{ - entrustedList: FuturesPendingPlanOrderV2[]; - endId: string; + fills: MarginOrderFillV2[]; + minId: string; + maxId: string; }> > { - return this.getPrivate('/api/v2/mix/order/orders-plan-pending', params); -⋮---- -futuresCancelPlanOrder( - params: FuturesCancelPlanOrderRequestV2, -): Promise> + assertMarginType(marginType); ⋮---- -getFuturesHistoricPlanOrders( - params: FuturesGetHistoryPlanOrdersRequestV2, +getMarginLiquidationOrders( + marginType: MarginType, + params: GetMarginLiquidationOrdersRequestV2, ): Promise< APIResponse<{ - entrustedList: FuturesHistoryPlanOrderV2[]; - endId: string; + resultList: MarginLiquidationOrderV2[]; + idLessThan: string; }> > { - return this.getPrivate('/api/v2/mix/order/orders-plan-history', params); + assertMarginType(marginType); ⋮---- /** * * - * Broker + * Copy Trading * * */ ⋮---- /** * - * * Broker | Subaccount + * + * Copy Trading | Future copy trading | Trader Api + * * */ ⋮---- -modifySubaccountEmail(params: { - subUid: string; - subaccountEmail: string; -}): Promise> +getFuturesTraderCurrentOrder( + params: GetFuturesTraderCurrentOrdersRequestV2, +): Promise> ⋮---- -getBrokerInfo(): Promise< - APIResponse<{ - subAccountSize: string; - maxSubAccountSize: string; - uTime: string; - }> - > { - return this.getPrivate('/api/v2/broker/account/info'); +getFuturesTraderHistoryOrders( + params: GetFuturesTraderHistoryOrdersRequestV2, +): Promise> ⋮---- -createSubaccount(params: { - subaccountName: string; - label: string; -}): Promise> +modifyFuturesTraderOrderTPSL( + params: ModifyFuturesTraderOrderTPSLRequestV2, +): Promise> ⋮---- -getSubaccounts(params?: GetSubAccountsRequestV2): Promise< - APIResponse<{ - hasNextPage: boolean; - idLessThan: number; - subList: BrokerSubaccountV2[]; - }> +getFuturesTraderOrder(): Promise< + APIResponse > { - return this.getPrivate('/api/v2/broker/account/subaccount-list', params); + return this.getPrivate('/api/v2/copy/mix-trader/order-total-detail'); ⋮---- -modifySubaccount( - params: ModifySubRequestV2, -): Promise> +getFuturesTraderProfitHistory(): Promise< + APIResponse + > { + return this.getPrivate('/api/v2/copy/mix-trader/profit-history-summarys'); ⋮---- -getSubaccountEmail(params: { - subUid: string; -}): Promise> +getFuturesTraderProfitShareHistory( + params: GetFuturesTraderProfitShareDetailRequestV2, +): Promise> ⋮---- -getSubaccountSpotAssets(params: { - subUid: string; - coin?: string; - assetType?: 'hold_only' | 'all'; +closeFuturesTraderOrder(params: { + trackingNo: string; + symbol: string; + productType: CopyTradingProductTypeV2; }): Promise< - APIResponse<{ - assetsList: BrokerSubaccountSpotAssetV2[]; - }> + APIResponse< + { + trackingNo: string; + symbol: string; + productType: string; + }[] + > > { - return this.getPrivate( - '/api/v2/broker/account/subaccount-spot-assets', + return this.postPrivate( + '/api/v2/copy/mix-trader/order-close-positions', params, ); ⋮---- -getSubaccountFuturesAssets(params: { - subUid: string; - productType: FuturesProductTypeV2; +getFuturesTraderProfitShare(params?: { + coin?: string; + pageSize?: string; + pageNo?: string; }): Promise< - APIResponse<{ - assetsList: BrokerSubaccountFutureAssetV2[]; - }> + APIResponse< + { + coin: string; + profit: string; + nickName: string; + }[] + > > { - return this.getPrivate( - '/api/v2/broker/account/subaccount-future-assets', - params, - ); -⋮---- -createSubaccountDepositAddress(params: { - subUid: string; - coin: string; - chain?: string; -}): Promise> + return this.getPrivate('/api/v2/copy/mix-trader/profit-details', params); ⋮---- -subaccountWithdrawal(params: SubWithdrawalRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> +getFuturesTraderProfitShareGroup(params?: { + pageSize?: string; + pageNo?: string; + }): Promise< + APIResponse< + { + coin: string; + profit: string; + profitTime: string; + }[] + > > { - return this.postPrivate( - '/api/v2/broker/account/subaccount-withdrawal', + return this.getPrivate( + '/api/v2/copy/mix-trader/profits-group-coin-date', params, ); ⋮---- -subaccountSetAutoTransfer(params: { - subUid: string; - coin: string; - toAccountType: string; -}): Promise> -⋮---- -/** - * Sub Deposit Records - * - * - Only applicable for ND broker main-account to get ND sub-accounts deposit record - */ -subaccountDepositRecords( - params: SubDepositRecordsRequestV2, -): Promise> -⋮---- -/** - * Sub Withdrawal Records - * - * - Only applicable for ND broker main-account - */ -subaccountWithdrawalRecords(params: SubWithdrawalRecordsRequestV2): Promise< - APIResponse<{ - resultList: BrokerSubaccountWithdrawalV2[]; - endId: string; - }> - > { - return this.getPrivate('/api/v2/broker/subaccount-withdrawal', params); -⋮---- -/** - * - * Broker | Api Key - * - */ -⋮---- -createSubaccountApiKey( - params: CreateSubAccountApiKeyRequestV2, -): Promise> -⋮---- -getSubaccountApiKey(params: { - subUid: string; -}): Promise> -⋮---- -modifySubaccountApiKey( - params: ModifySubAccountApiKeyRequestV2, -): Promise> -⋮---- -deleteSubaccountApiKey( - params: DeleteSubAccountApiKeyRequestV2, -): Promise> -⋮---- -/** - * Get All Sub-accounts Deposit and Withdrawal Records - * - * - Only applicable for ND broker main-account - * - Rate limit: 5 req/sec/UID - * - Able to get ND sub-accounts deposit and withdrawal records within 90 days - */ -getAllSubDepositWithdrawalRecords( - params?: GetAllSubDepositWithdrawalRequestV2, - ): Promise< - APIResponse<{ - list: AllSubDepositWithdrawalRecordV2[]; - endId: string; - }> - > { - return this.getPrivate('/api/v2/broker/all-sub-deposit-withdrawal', params); -⋮---- -/** - * Get Broker Subaccounts - * - * - Rate limit: 5 req/sec/UID - * - Please contact your BD or RM to apply for access permissions - */ -getBrokerSubaccounts( - params?: GetBrokerSubaccountsRequestV2, -): Promise> -⋮---- -/** - * Get Broker Subaccounts Commissions - * - * - Rate limit: 5 req/sec/UID - * - Please contact your BD or RM to apply for access permissions - */ -getBrokerCommissions( - params?: GetBrokerCommissionsRequestV2, -): Promise> +getFuturesTraderSymbolSettings(params: { + productType: CopyTradingProductTypeV2; +}): Promise> ⋮---- -/** - * Get Broker Trade Volume - * - * - Rate limit: 5 req/sec/UID - * - Please contact your BD or RM to apply for access permissions - */ -getBrokerTradeVolume( - params?: GetBrokerTradeVolumeRequestV2, -): Promise> +updateFuturesTraderSymbolSettings(params: { + settingList: FuturesTraderSymbolSettingRequestV2[]; +}): Promise> ⋮---- -/** - * Get Total Commission - * - * - Rate limit: 20 req/sec/UID - * - Data retention: 365 days - * - Historical data available from: 2025/6/1 - * - Data granularity: daily - * - Data update granularity: daily, previous day's data is updated on the current day - * - Time zone: UTC+8 - * - startTime and endTime should either both be set or both left unset - * - This API supports retrieving data within the past 365 days (data is available starting from 2025/6/1 at the earliest) - * - If startTime and endTime are not set in the request, the default returned information will be for yesterday (00:00-23:59 UTC+8) - * - Data update frequency: T+1 (UTC+8) - */ -getBrokerTotalCommission( - params?: GetBrokerTotalCommissionRequestV2, -): Promise> +updateFuturesTraderGlobalSettings(params?: { + enable?: 'YES' | 'NO'; + showTotalEquity?: 'YES' | 'NO'; + showTpsl?: 'YES' | 'NO'; +}): Promise> ⋮---- -/** - * Get Order Commission - * - * - Rate limit: 20 req/sec/UID - * - Data storage: 30 days - * - Historical data backtracking: 2025/9/1 - * - Data granularity: daily - * - Data update frequency: daily, previous day's data is updated on the current day - * - Time zone: UTC+8 - * - startTime and endTime should either both be set or both not set - * - The maximum time span supported for startTime and endTime is 30 days - * - This API supports retrieving data within the past 30 days - * - If startTime and endTime are not set in the request, the default return will be information for yesterday (00:00-23:59 UTC+8) - * - This API data is updated on a T+1 basis - * - Transaction details only show those marked with broker channel id - */ -getBrokerOrderCommission( - params?: GetBrokerOrderCommissionRequestV2, -): Promise> +getFuturesTraderFollowers( + params?: GetFuturesTraderFollowersRequestV2, +): Promise> ⋮---- -/** - * Get Rebate Info - * - * - Rate limit: 20 req/sec/UID - * - Data retention: 30 days - * - Real-time data - */ -getBrokerRebateInfo( - params: GetBrokerRebateInfoRequestV2, -): Promise> +removeFuturesTraderFollower(params: { + followerUid: string; +}): Promise> ⋮---- /** * - * * Broker | Agent (affiliate) customer APIs + * + * Copy Trading | Future copy trading | Follower Api + * * */ ⋮---- -getAgentCustomerCommissions( - params?: GetAgentCustomerCommissionsRequestV2, -): Promise> +getFuturesFollowerCurrentOrders( + params: GetFollowerFuturesCurrentTrackingOrdersRequestV2, +): Promise> ⋮---- -/** - * Without startTime/endTime, returns all registered sub-customers (no time restriction). - */ -getAgentSubCustomerList( - params?: GetAgentSubCustomerListRequestV2, -): Promise> +getFuturesFollowerHistoryOrders( + params: GetFollowerFuturesHistoryTrackingOrdersRequestV2, +): Promise> ⋮---- -getAgentCustomerTradeVolume( - params?: AgentCustomerTradeVolumeRequestV2, -): Promise> +updateFuturesFollowerTPSL( + params: UpdateFuturesFollowerTPSLRequestV2, +): Promise> ⋮---- -/** - * Without startTime/endTime, returns all registered customers (no time restriction). - */ -getAgentCustomerList( - params?: AgentCustomerListRequestV2, -): Promise> +updateFuturesFollowerSettings( + params: UpdateFuturesFollowerSettingsRequestV2, +): Promise> ⋮---- -getAgentCustomerKycResult( - params?: GetAgentCustomerKycResultRequestV2, -): Promise> +getFuturesFollowerSettings(params: { + traderId: string; +}): Promise> ⋮---- -getAgentCustomerDeposits( - params?: AgentCustomerDepositRequestV2, -): Promise> +closeFuturesFollowerPositions( + params: CloseFuturesFollowerPositionsRequestV2, + ): Promise< + APIResponse<{ + orderIdList: string[]; + }> + > { + return this.postPrivate( + '/api/v2/copy/mix-follower/close-positions', + params, + ); ⋮---- -getAgentCustomerAssets( - params?: AgentCustomerAssetRequestV2, -): Promise> +getFuturesFollowerTraders( + params: GetFuturesFollowerTradersRequestV2, +): Promise> ⋮---- -getAgentCommissionDetail( - params?: GetAgentCommissionDetailRequestV2, -): Promise> +getFuturesFollowerFollowLimit(params: { + symbol: string; + productType: CopyTradingProductTypeV2; + }): Promise< + APIResponse< + { + maxFollowSize: string; + minFollowSize: string; + symbol: string; + }[] + > + > { + return this.getPrivate( + '/api/v2/copy/mix-follower/query-quantity-limit', + params, + ); +⋮---- +unfollowFuturesTrader(params: { + traderId: string; +}): Promise> ⋮---- /** * * - * Margin + * Copy Trading | Future copy trading | Broker api * * */ ⋮---- -/** - * - * * Margin | Common - * - */ +getBrokerTraders(params: object): Promise> ⋮---- -getMarginCurrencies(): Promise> +getBrokerTradersHistoricalOrders(params: object): Promise> +⋮---- +getBrokerTradersPendingOrders(params: object): Promise> ⋮---- /** * - * * Margin | Cross/Isolated | Order Record + * + * Copy Trading | Spot copy trading | Trader api + * * */ ⋮---- -getMarginBorrowHistory( - marginType: MarginType, - params: GetBorrowHistoryRequestV2, - ): Promise< - APIResponse<{ - resultList: MarginBorrowHistoryItemV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); +getSpotTraderProfit(): Promise> ⋮---- -getMarginRepayHistory( - marginType: MarginType, - params: GetRepayHistoryRequestV2, - ): Promise< - APIResponse<{ - resultList: MarginRepaymentHistoryItemV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); +getSpotTraderHistoryProfit( + params: GetSpotTraderHistoryProfitRequestV2, +): Promise> ⋮---- -getMarginInterestHistory( - marginType: MarginType, - params: GetInterestHistoryRequestV2, - ): Promise< - APIResponse<{ - resultList: MarginInterestHistoryItemV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); +getSpotTraderUnrealizedProfit(params?: { + coin?: string; + pageNo?: string; + pageSize?: string; +}): Promise> ⋮---- -getMarginLiquidationHistory( - marginType: MarginType, - params: GetLiquidationHistoryRequestV2, - ): Promise< - APIResponse<{ - resultList: MarginLiquidationHistoryItemV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); +getSpotTraderOrder(): Promise> ⋮---- -getMarginFinancialHistory( - marginType: MarginType, - params: GetFinancialHistoryRequestV2, - ): Promise< - APIResponse<{ - resultList: MarginFinancialHistoryItemV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); +modifySpotTraderOrderTPSL(params: { + trackingNo: string; + stopSurplusPrice?: string; + stopLossPrice?: string; +}): Promise> +⋮---- +getSpotTraderHistoryOrders( + params: GetSpotTraderHistoryOrdersRequestV2, +): Promise> +⋮---- +getSpotTraderCurrentOrders( + params: GetSpotTraderCurrentOrdersRequestV2, +): Promise> +⋮---- +sellSpotTrader(params: { + trackingNoList: string[]; + symbol: string; +}): Promise> +⋮---- +getSpotTraderSymbolSettings(params: { + symbolList: string[]; + settingType: 'add' | 'delete'; +}): Promise> +⋮---- +removeSpotTraderFollowers(params: { + followerUid: string; +}): Promise> +⋮---- +getSpotTraderConfiguration(): Promise> +⋮---- +getSpotTraderFollowers( + params: GetSpotTraderFollowersRequestV2, +): Promise> ⋮---- /** * - * * Margin | Cross/Isolated | Account + * + * Copy Trading | Spot copy trading | Follower api + * * */ ⋮---- -getMarginAccountAssets( - marginType: MarginType, - params?: { coin?: string }, -): Promise> +cancelSpotFollowerOrder(params: { + trackingNoList: string[]; +}): Promise> ⋮---- -marginBorrow( - marginType: MarginType, - params: { - loanId: string; - symbol: string; - coin: string; - borrowAmount: string; - }, - ): Promise< - APIResponse<{ - loanId: string; - symbol: string; - coin: string; - borrowAmount: string; - }> - > { - assertMarginType(marginType); +updateSpotFollowerSettings(params: { + traderId: string; + autoCopy?: 'on' | 'off'; + mode?: 'basic' | 'advanced'; + settings: SpotFollowerCopyTradeSettingV2[]; +}): Promise> ⋮---- -marginRepay( - marginType: MarginType, - params: { - remainDebtAmount: string; - symbol: string; - repayId: string; - coin: string; - repayAmount: string; - }, - ): Promise< - APIResponse<{ - symbol: string; - coin: string; - repayId: string; - remainDebtAmount: string; - repayAmount: string; - }> - > { - assertMarginType(marginType); +updateSpotFollowerTPSL(params: { + trackingNo: string; + stopSurplusPrice?: string; + stopLossPrice?: string; +}): Promise> ⋮---- -getMarginRiskRate(marginType: MarginType): Promise< - APIResponse< - { - symbol: string; - riskRateRatio: string; - }[] - > - > { - assertMarginType(marginType); +getSpotFollowerTraders(params?: { + pageNo?: string; + pageSize?: string; + startTime?: string; + endTime?: string; +}): Promise> ⋮---- -getMarginMaxBorrowable( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse +getSpotFollowerCurrentTraderSymbols(params: { traderId: string }): Promise< + APIResponse<{ + currentTradingList: string[]; + }> > { - assertMarginType(marginType); + return this.getPrivate( + '/api/v2/copy/spot-follower/query-trader-symbols', + params, + ); ⋮---- -getMarginMaxTransferable( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse< - CrossMaxTransferableResponseV2 | IsolatedMaxTransferableResponseV2 - > - > { - assertMarginType(marginType); +getSpotFollowerSettings(params: { + traderId: string; +}): Promise> ⋮---- -getMarginInterestRateAndMaxBorrowable( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse< - | IsolatedInterestRateAndLimitResponseV2[] - | CrossInterestRateAndLimitResponseV2[] - > - > { - assertMarginType(marginType); +getSpotFollowerHistoryOrders( + params: GetSpotFollowerHistoryOrdersRequestV2, +): Promise> ⋮---- -getMarginTierConfiguration( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse< - CrossTierConfigurationResponseV2[] | IsolatedTierConfigurationResponseV2[] - > - > { - assertMarginType(marginType); +getSpotFollowerOpenOrders( + params: GetSpotFollowerOpenOrdersRequestV2, +): Promise> ⋮---- -marginFlashRepay( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse<{ - repayId: string; - coin?: string; - symbol?: string; - result?: string; - }> - > { - assertMarginType(marginType); +sellSpotFollower(params: { + trackingNoList: string[]; + symbol: string; +}): Promise> ⋮---- -getMarginFlashRepayResult( - marginType: MarginType, - params: { idList: string }, - ): Promise< - APIResponse< - { - repayId: string; - status: string; - }[] - > - > { - assertMarginType(marginType); +unfollowSpotTrader(params: { + traderId: string; +}): Promise> ⋮---- /** * - * * Margin | Cross/Isolated | Trade + * + * Earn | Savings + * * */ ⋮---- -marginSubmitOrder( - marginType: MarginType, - params: MarginPlaceOrderRequestV2, - ): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - assertMarginType(marginType); +getEarnSavingsProducts(params?: { + coin?: string; + filter?: string; +}): Promise> ⋮---- -marginBatchSubmitOrders( - marginType: MarginType, - params: MarginBatchOrdersRequestV2, -): Promise> +getEarnSavingsAccount(): Promise> ⋮---- -marginCancelOrder( - marginType: MarginType, - params: { - symbol: string; - orderId?: string; - clientOid?: string; - }, - ): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - assertMarginType(marginType); +getEarnSavingsAssets( + params: GetEarnSavingsAssetsRequestV2, +): Promise> ⋮---- -marginBatchCancelOrders( - marginType: MarginType, - params: { - symbol: string; - orderIdList: string[]; - }, -): Promise> +getEarnSavingsRecords( + params: GetEarnSavingsRecordsRequestV2, +): Promise> ⋮---- -getMarginOpenOrders( - marginType: MarginType, - params: GetMarginCurrentOrdersRequestV2, - ): Promise< +getEarnSavingsSubscription(params: { + productId: string; + periodType: string; +}): Promise> +⋮---- +earnSubscribeSavings(params: { + productId: string; + periodType: string; + amount: string; + }): Promise< APIResponse<{ - orderList: MarginCurrentOrderV2[]; - maxId: string; - minId: string; + orderId: string; + status: string; }> > { - assertMarginType(marginType); + return this.postPrivate('/api/v2/earn/savings/subscribe', params); ⋮---- -getMarginHistoricOrders( - marginType: MarginType, - params: GetHistoryOrdersRequestV2, - ): Promise< +getEarnSavingsSubscriptionResult(params: { + productId: string; + periodType: string; + }): Promise< APIResponse<{ - orderList: MarginHistoryOrderV2[]; - maxId: string; - minId: string; + result: 'success' | 'fail'; + msg: string; }> > { - assertMarginType(marginType); + return this.getPrivate('/api/v2/earn/savings/subscribe-result', params); ⋮---- -getMarginHistoricOrderFills( - marginType: MarginType, - params: GetMarginOrderFillsRequestV2, - ): Promise< +earnRedeemSavings(params: RedeemSavingsRequestV2): Promise< APIResponse<{ - fills: MarginOrderFillV2[]; - minId: string; - maxId: string; + orderId: string; + status: string; }> - > { - assertMarginType(marginType); -⋮---- -getMarginLiquidationOrders( - marginType: MarginType, - params: GetMarginLiquidationOrdersRequestV2, - ): Promise< + > { + return this.postPrivate('/api/v2/earn/savings/redeem', params); +⋮---- +getEarnSavingsRedemptionResult(params: { + orderId: string; + periodType: string; + }): Promise< APIResponse<{ - resultList: MarginLiquidationOrderV2[]; - idLessThan: string; + result: 'success' | 'fail'; + msg: string; }> > { - assertMarginType(marginType); + return this.getPrivate('/api/v2/earn/savings/redeem-result', params); ⋮---- /** * * - * Copy Trading + * Earn | Earn Account * * */ ⋮---- +getEarnAccount(params?: { coin?: string }): Promise< + APIResponse< + { + coin: string; + amount: string; + }[] + > + > { + return this.getPrivate('/api/v2/earn/account/assets', params); +⋮---- /** * * - * Copy Trading | Future copy trading | Trader Api + * Earn | On-Chain Elite * * */ ⋮---- -getFuturesTraderCurrentOrder( - params: GetFuturesTraderCurrentOrdersRequestV2, -): Promise> +getEarnEliteProducts(): Promise> ⋮---- -getFuturesTraderHistoryOrders( - params: GetFuturesTraderHistoryOrdersRequestV2, -): Promise> +getEarnEliteAssets(): Promise> ⋮---- -modifyFuturesTraderOrderTPSL( - params: ModifyFuturesTraderOrderTPSLRequestV2, -): Promise> +getEarnEliteRecords( + params: GetEarnEliteRecordsRequestV2, +): Promise> ⋮---- -getFuturesTraderOrder(): Promise< - APIResponse - > { - return this.getPrivate('/api/v2/copy/mix-trader/order-total-detail'); +getEarnEliteSubscribeInfo( + params: GetEarnEliteSubscribeInfoRequestV2, +): Promise> ⋮---- -getFuturesTraderProfitHistory(): Promise< - APIResponse - > { - return this.getPrivate('/api/v2/copy/mix-trader/profit-history-summarys'); +subscribeEarnElite( + params: EarnEliteSubscribeRequestV2, +): Promise> ⋮---- -getFuturesTraderProfitShareHistory( - params: GetFuturesTraderProfitShareDetailRequestV2, -): Promise> +getEarnEliteSubscribeResult( + params: GetEarnEliteSubscribeResultRequestV2, +): Promise> ⋮---- -closeFuturesTraderOrder(params: { - trackingNo: string; - symbol: string; - productType: CopyTradingProductTypeV2; - }): Promise< - APIResponse< - { - trackingNo: string; - symbol: string; - productType: string; - }[] - > - > { - return this.postPrivate( - '/api/v2/copy/mix-trader/order-close-positions', - params, - ); +getEarnEliteRedeemInfo( + params: GetEarnEliteRedeemInfoRequestV2, +): Promise> ⋮---- -getFuturesTraderProfitShare(params?: { - coin?: string; - pageSize?: string; - pageNo?: string; - }): Promise< - APIResponse< - { - coin: string; - profit: string; - nickName: string; - }[] - > - > { - return this.getPrivate('/api/v2/copy/mix-trader/profit-details', params); +redeemEarnElite( + params: RedeemEarnEliteRequestV2, +): Promise> ⋮---- -getFuturesTraderProfitShareGroup(params?: { - pageSize?: string; - pageNo?: string; - }): Promise< - APIResponse< - { - coin: string; - profit: string; - profitTime: string; - }[] - > - > { - return this.getPrivate( - '/api/v2/copy/mix-trader/profits-group-coin-date', - params, - ); +/** + * + * + * Earn | Shark Fin + * + * + */ ⋮---- -getFuturesTraderSymbolSettings(params: { - productType: CopyTradingProductTypeV2; -}): Promise> +getSharkfinProducts(params: { + coin: string; + limit?: string; + idLessThan?: string; +}): Promise> ⋮---- -updateFuturesTraderSymbolSettings(params: { - settingList: FuturesTraderSymbolSettingRequestV2[]; -}): Promise> +getSharkfinAccount(): Promise> ⋮---- -updateFuturesTraderGlobalSettings(params?: { - enable?: 'YES' | 'NO'; - showTotalEquity?: 'YES' | 'NO'; - showTpsl?: 'YES' | 'NO'; -}): Promise> +getSharkfinAssets( + params: GetSharkfinAssetsRequestV2, +): Promise> ⋮---- -getFuturesTraderFollowers( - params?: GetFuturesTraderFollowersRequestV2, -): Promise> +getSharkfinRecords( + params: GetSharkfinRecordsRequestV2, +): Promise> ⋮---- -removeFuturesTraderFollower(params: { - followerUid: string; -}): Promise> +getSharkfinSubscription(params: { + productId: string; +}): Promise> +⋮---- +subscribeSharkfin(params: { productId: string; amount: string }): Promise< + APIResponse<{ + orderId: string; + status: string; + }> + > { + return this.postPrivate('/api/v2/earn/sharkfin/subscribe', params); +⋮---- +getSharkfinSubscriptionResult(params: { orderId: string }): Promise< + APIResponse<{ + result: 'success' | 'fail'; + msg: string; + }> + > { + return this.getPrivate('/api/v2/earn/sharkfin/subscribe-result', params); ⋮---- /** * * - * Copy Trading | Future copy trading | Follower Api + * Earn | Loan * * */ ⋮---- -getFuturesFollowerCurrentOrders( - params: GetFollowerFuturesCurrentTrackingOrdersRequestV2, -): Promise> +getLoanCurrencies(params?: { + coin?: string; +}): Promise> ⋮---- -getFuturesFollowerHistoryOrders( - params: GetFollowerFuturesHistoryTrackingOrdersRequestV2, -): Promise> +getLoanEstInterestAndBorrowable( + params: GetLoanEstInterestAndBorrowableRequestV2, + ): Promise< + APIResponse<{ + hourInterest: string; + loanAmount: string; + }> + > { + return this.get('/api/v2/earn/loan/public/hour-interest', params); ⋮---- -updateFuturesFollowerTPSL( - params: UpdateFuturesFollowerTPSLRequestV2, -): Promise> +borrowLoan(params: BorrowLoanRequestV2): Promise< + APIResponse<{ + orderId: string; + }> + > { + return this.postPrivate('/api/v2/earn/loan/borrow', params); ⋮---- -updateFuturesFollowerSettings( - params: UpdateFuturesFollowerSettingsRequestV2, -): Promise> +getOngoingLoanOrders(params?: { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; +}): Promise> ⋮---- -getFuturesFollowerSettings(params: { - traderId: string; -}): Promise> +repayLoan( + params: RepayLoanRequestV2, +): Promise> ⋮---- -closeFuturesFollowerPositions( - params: CloseFuturesFollowerPositionsRequestV2, - ): Promise< +getRepayHistory( + params: GetLoanRepayHistoryRequestV2, +): Promise> +⋮---- +updateLoanPledgeRate(params: ModifyLoanPledgeRateRequestV2): Promise< APIResponse<{ - orderIdList: string[]; + loanCoin: string; + pledgeCoin: string; + afterPledgeRate: string; }> > { - return this.postPrivate( - '/api/v2/copy/mix-follower/close-positions', - params, - ); + return this.postPrivate('/api/v2/earn/loan/revise-pledge', params); ⋮---- -getFuturesFollowerTraders( - params: GetFuturesFollowerTradersRequestV2, -): Promise> +getLoanPledgeRateHistory( + params: GetLoanPledgeRateHistoryRequestV2, +): Promise> ⋮---- -getFuturesFollowerFollowLimit(params: { - symbol: string; - productType: CopyTradingProductTypeV2; - }): Promise< - APIResponse< - { - maxFollowSize: string; - minFollowSize: string; - symbol: string; - }[] - > - > { - return this.getPrivate( - '/api/v2/copy/mix-follower/query-quantity-limit', - params, - ); +getLoanHistory( + params: GetLoanHistoryRequestV2, +): Promise> +⋮---- +getLoanDebts(): Promise> ⋮---- -unfollowFuturesTrader(params: { - traderId: string; -}): Promise> +getLoanLiquidationRecords( + params: GetLiquidationRecordsRequestV2, +): Promise> ⋮---- /** * - * - * Copy Trading | Future copy trading | Broker api - * + * * Inst Loan | Product Info * */ ⋮---- -getBrokerTraders(params: object): Promise> +getLoanProductInfo( + params: GetInstLoanProductInfoRequestV2, +): Promise> ⋮---- -getBrokerTradersHistoricalOrders(params: object): Promise> +getLoanSymbols( + params: GetInstLoanSymbolsRequestV2, +): Promise> ⋮---- -getBrokerTradersPendingOrders(params: object): Promise> +getLoanMarginCoinInfo(params: GetInstLoanMarginCoinInfoRequestV2): Promise< + APIResponse<{ + productId: string; + coinInfo: InstLoanCoinInfoV2[]; + }> + > { + return this.getPrivate( + '/api/v2/spot/ins-loan/ensure-coins-convert', + params, + ); ⋮---- /** * - * - * Copy Trading | Spot copy trading | Trader api - * + * * Inst Loan | Account * */ ⋮---- -getSpotTraderProfit(): Promise> -⋮---- -getSpotTraderHistoryProfit( - params: GetSpotTraderHistoryProfitRequestV2, -): Promise> -⋮---- -getSpotTraderUnrealizedProfit(params?: { - coin?: string; - pageNo?: string; - pageSize?: string; -}): Promise> -⋮---- -getSpotTraderOrder(): Promise> -⋮---- -modifySpotTraderOrderTPSL(params: { - trackingNo: string; - stopSurplusPrice?: string; - stopLossPrice?: string; -}): Promise> -⋮---- -getSpotTraderHistoryOrders( - params: GetSpotTraderHistoryOrdersRequestV2, -): Promise> -⋮---- -getSpotTraderCurrentOrders( - params: GetSpotTraderCurrentOrdersRequestV2, -): Promise> -⋮---- -sellSpotTrader(params: { - trackingNoList: string[]; - symbol: string; -}): Promise> -⋮---- -getSpotTraderSymbolSettings(params: { - symbolList: string[]; - settingType: 'add' | 'delete'; -}): Promise> -⋮---- -removeSpotTraderFollowers(params: { - followerUid: string; -}): Promise> -⋮---- -getSpotTraderConfiguration(): Promise> +getLoanRiskUnit(): Promise< + APIResponse<{ + riskUnitId: string[]; + }> + > { + return this.getPrivate('/api/v2/spot/ins-loan/risk-unit'); ⋮---- -getSpotTraderFollowers( - params: GetSpotTraderFollowersRequestV2, -): Promise> +getLoanLTVConvert( + params?: GetInstLoanLTVConvertRequestV2, +): Promise> ⋮---- /** * - * - * Copy Trading | Spot copy trading | Follower api - * + * * Inst Loan | Orders * */ ⋮---- -cancelSpotFollowerOrder(params: { - trackingNoList: string[]; -}): Promise> +getLoanRepaidHistory( + params?: GetInstLoanRepaidHistoryRequestV2, +): Promise> ⋮---- -updateSpotFollowerSettings(params: { - traderId: string; - autoCopy?: 'on' | 'off'; - mode?: 'basic' | 'advanced'; - settings: SpotFollowerCopyTradeSettingV2[]; -}): Promise> +getLoanOrder( + params?: GetInstLoanOrderRequestV2, +): Promise> + +================ +File: src/types/request/v3/account.ts +================ +// Account Management Request Types ⋮---- -updateSpotFollowerTPSL(params: { - trackingNo: string; - stopSurplusPrice?: string; - stopLossPrice?: string; -}): Promise> +export type AccountAdjustModeV3 = 'basic' | 'advanced' | 'delta' | 'isolated'; ⋮---- -getSpotFollowerTraders(params?: { - pageNo?: string; - pageSize?: string; - startTime?: string; - endTime?: string; -}): Promise> +export interface AdjustAccountModeRequestV3 { + mode: AccountAdjustModeV3; + /** Sub-account UID when the master account switches mode for a sub-account */ + targetUid?: string; +} ⋮---- -getSpotFollowerCurrentTraderSymbols(params: { traderId: string }): Promise< - APIResponse<{ - currentTradingList: string[]; - }> - > { - return this.getPrivate( - '/api/v2/copy/spot-follower/query-trader-symbols', - params, - ); +/** Sub-account UID when the master account switches mode for a sub-account */ ⋮---- -getSpotFollowerSettings(params: { - traderId: string; -}): Promise> +export interface SetLeverageRequestV3 { + category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + leverage: string; + coin?: string; + posSide?: 'long' | 'short'; + /** Futures only. Defaults to crossed */ + marginMode?: 'crossed' | 'isolated'; + /** Isolated two-way mode: long leverage. Takes priority over leverage when both set */ + longLeverage?: string; + /** Isolated two-way mode: short leverage. Takes priority over leverage when both set */ + shortLeverage?: string; +} ⋮---- -getSpotFollowerHistoryOrders( - params: GetSpotFollowerHistoryOrdersRequestV2, -): Promise> +/** Futures only. Defaults to crossed */ ⋮---- -getSpotFollowerOpenOrders( - params: GetSpotFollowerOpenOrdersRequestV2, -): Promise> +/** Isolated two-way mode: long leverage. Takes priority over leverage when both set */ ⋮---- -sellSpotFollower(params: { - trackingNoList: string[]; - symbol: string; -}): Promise> +/** Isolated two-way mode: short leverage. Takes priority over leverage when both set */ ⋮---- -unfollowSpotTrader(params: { - traderId: string; -}): Promise> +export interface GetAllFeeRatesRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; +} ⋮---- -/** - * - * - * Earn | Savings - * - * - */ +export interface GetConvertRecordsRequestV3 { + fromCoin?: string; + toCoin?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; +} ⋮---- -getEarnSavingsProducts(params?: { - coin?: string; - filter?: string; -}): Promise> +export interface GetFinancialRecordsRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + coin?: string; + type?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; +} ⋮---- -getEarnSavingsAccount(): Promise> +export interface RepayRequestV3 { + repayableCoinList: string[]; + paymentCoinList: string[]; +} ⋮---- -getEarnSavingsAssets( - params: GetEarnSavingsAssetsRequestV2, -): Promise> +// Sub-account Management Request Types ⋮---- -getEarnSavingsRecords( - params: GetEarnSavingsRecordsRequestV2, -): Promise> +export interface CreateSubAccountApiKeyRequestV3 { + subUid: string; + note: string; + type: 'read_write' | 'read_only'; + passphrase: string; + permissions: string[]; + ips: string[]; +} +⋮---- +export interface DeleteSubAccountApiKeyRequestV3 { + apiKey: string; +} +⋮---- +export interface GetSubAccountApiKeysRequestV3 { + subUid: string; + limit?: string; + cursor?: string; +} +⋮---- +export interface UpdateSubAccountApiKeyRequestV3 { + apiKey: string; + passphrase: string; + type?: 'read_write' | 'read_only'; + permissions?: string[]; + ips?: string[]; +} +⋮---- +export interface CreateSubAccountRequestV3 { + username: string; + accountMode?: 'classic' | 'unified'; + note?: string; +} ⋮---- -getEarnSavingsSubscription(params: { - productId: string; - periodType: string; -}): Promise> +export interface FreezeSubAccountRequestV3 { + subUid: string; + operation: 'freeze' | 'unfreeze'; +} ⋮---- -earnSubscribeSavings(params: { - productId: string; - periodType: string; - amount: string; - }): Promise< - APIResponse<{ - orderId: string; - status: string; - }> - > { - return this.postPrivate('/api/v2/earn/savings/subscribe', params); +export interface GetSubAccountListRequestV3 { + limit?: string; + cursor?: string; +} ⋮---- -getEarnSavingsSubscriptionResult(params: { - productId: string; - periodType: string; - }): Promise< - APIResponse<{ - result: 'success' | 'fail'; - msg: string; - }> - > { - return this.getPrivate('/api/v2/earn/savings/subscribe-result', params); +// Transfer Request Types ⋮---- -earnRedeemSavings(params: RedeemSavingsRequestV2): Promise< - APIResponse<{ - orderId: string; - status: string; - }> - > { - return this.postPrivate('/api/v2/earn/savings/redeem', params); +export interface TransferRequestV3 { + clientOid?: string; + fromType: + | 'spot' + | 'p2p' + | 'coin_futures' + | 'usdt_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'isolated_margin' + | 'uta'; + toType: + | 'spot' + | 'p2p' + | 'coin_futures' + | 'usdt_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'isolated_margin' + | 'uta'; + amount: string; + coin: string; + symbol?: string; + /** Enable automatic margin borrowing when balance insufficient. yes | no */ + allowBorrow?: 'yes' | 'no'; +} ⋮---- -getEarnSavingsRedemptionResult(params: { - orderId: string; - periodType: string; - }): Promise< - APIResponse<{ - result: 'success' | 'fail'; - msg: string; - }> - > { - return this.getPrivate('/api/v2/earn/savings/redeem-result', params); +/** Enable automatic margin borrowing when balance insufficient. yes | no */ ⋮---- -/** - * - * - * Earn | Earn Account - * - * - */ +export interface GetTransferableCoinsRequestV3 { + fromType: + | 'spot' + | 'p2p' + | 'coin_futures' + | 'usdt_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'isolated_margin' + | 'uta'; + toType: + | 'spot' + | 'p2p' + | 'coin_futures' + | 'usdt_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'isolated_margin' + | 'uta'; +} ⋮---- -getEarnAccount(params?: { coin?: string }): Promise< - APIResponse< - { - coin: string; - amount: string; - }[] - > - > { - return this.getPrivate('/api/v2/earn/account/assets', params); +export interface GetSubTransferRecordsRequestV3 { + subUid?: string; + role?: 'initiator' | 'receiver'; + coin?: string; + startTime?: string; + endTime?: string; + clientOid?: string; + limit?: string; + cursor?: string; +} ⋮---- -/** - * - * - * Earn | On-Chain Elite - * - * - */ +export interface SubAccountTransferRequestV3 { + fromType: + | 'spot' + | 'p2p' + | 'usdt_futures' + | 'coin_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'uta'; + toType: + | 'spot' + | 'p2p' + | 'usdt_futures' + | 'coin_futures' + | 'usdc_futures' + | 'crossed_margin' + | 'uta'; + amount: string; + coin: string; + fromUserId: string; + toUserId: string; + clientOid: string; + /** Enable automatic margin borrowing when balance insufficient. yes | no */ + allowBorrow?: 'yes' | 'no'; +} ⋮---- -getEarnEliteProducts(): Promise> +/** Enable automatic margin borrowing when balance insufficient. yes | no */ ⋮---- -getEarnEliteAssets(): Promise> +export interface GetSubUnifiedAssetsRequestV3 { + subUid?: string; + cursor?: string; + limit?: string; +} ⋮---- -getEarnEliteRecords( - params: GetEarnEliteRecordsRequestV2, -): Promise> +export interface GetFeeRateRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol: string; +} ⋮---- -getEarnEliteSubscribeInfo( - params: GetEarnEliteSubscribeInfoRequestV2, -): Promise> +export interface GetFundingAssetsRequestV3 { + coin?: string; +} ⋮---- -subscribeEarnElite( - params: EarnEliteSubscribeRequestV2, -): Promise> +export interface SwitchDeductRequestV3 { + deduct: 'on' | 'off'; +} ⋮---- -getEarnEliteSubscribeResult( - params: GetEarnEliteSubscribeResultRequestV2, -): Promise> +// Deposit Request Types ⋮---- -getEarnEliteRedeemInfo( - params: GetEarnEliteRedeemInfoRequestV2, -): Promise> +export interface GetDepositAddressRequestV3 { + coin: string; + chain?: string; + size?: string; +} ⋮---- -redeemEarnElite( - params: RedeemEarnEliteRequestV2, -): Promise> +export interface GetSubDepositAddressRequestV3 { + subUid: string; + coin: string; + chain?: string; + size?: string; +} ⋮---- -/** - * - * - * Earn | Shark Fin - * - * - */ +export interface GetDepositRecordsRequestV3 { + coin?: string; + orderId?: string; + startTime: string; + endTime: string; + limit?: string; + cursor?: string; +} ⋮---- -getSharkfinProducts(params: { - coin: string; - limit?: string; - idLessThan?: string; -}): Promise> +export interface GetSubDepositRecordsRequestV3 { + coin?: string; + subUid: string; + startTime: string; + endTime: string; + limit?: string; + cursor?: string; +} ⋮---- -getSharkfinAccount(): Promise> +// Withdraw Request Types ⋮---- -getSharkfinAssets( - params: GetSharkfinAssetsRequestV2, -): Promise> +export interface WithdrawRequestV3 { + coin: string; + chain?: string; + /** Deduct from funding, uta, and/or otc accounts (comma-separated). Order: funding -> otc -> uta */ + accountType?: string; + transferType: 'on_chain' | 'internal_transfer'; + address: string; + innerToType?: 'uid' | 'email' | 'mobile'; + areaCode?: string; + tag?: string; + size: string; + remark?: string; + clientOid?: string; + memberCode?: 'bithumb' | 'korbit' | 'coinone'; + identityType?: 'company' | 'user'; + companyName?: string; + firstName?: string; + lastName?: string; +} ⋮---- -getSharkfinRecords( - params: GetSharkfinRecordsRequestV2, -): Promise> +/** Deduct from funding, uta, and/or otc accounts (comma-separated). Order: funding -> otc -> uta */ ⋮---- -getSharkfinSubscription(params: { - productId: string; -}): Promise> +export interface GetWithdrawRecordsRequestV3 { + coin?: string; + orderId?: string; + clientOid?: string; + startTime: string; + endTime: string; + limit?: string; + cursor?: string; +} ⋮---- -subscribeSharkfin(params: { productId: string; amount: string }): Promise< - APIResponse<{ - orderId: string; - status: string; - }> - > { - return this.postPrivate('/api/v2/earn/sharkfin/subscribe', params); +export interface GetWithdrawAddressBookRequestV3 { + coin?: string; + type?: 'EVM' | 'regular' | 'universal' | 'internal'; + limit?: string; + cursor?: string; +} ⋮---- -getSharkfinSubscriptionResult(params: { orderId: string }): Promise< - APIResponse<{ - result: 'success' | 'fail'; - msg: string; - }> - > { - return this.getPrivate('/api/v2/earn/sharkfin/subscribe-result', params); +export interface CancelWithdrawalRequestV3 { + orderId?: string; + clientOid?: string; +} ⋮---- -/** - * - * - * Earn | Loan - * - * - */ +export interface SetDepositAccountRequestV3 { + coin: string; + accountType: 'funding' | 'unified' | 'otc'; +} ⋮---- -getLoanCurrencies(params?: { - coin?: string; -}): Promise> +export interface GetMaxTransferableRequestV3 { + coin: string; +} ⋮---- -getLoanEstInterestAndBorrowable( - params: GetLoanEstInterestAndBorrowableRequestV2, - ): Promise< - APIResponse<{ - hourInterest: string; - loanAmount: string; - }> - > { - return this.get('/api/v2/earn/loan/public/hour-interest', params); +export interface GetOpenInterestLimitRequestV3 { + symbol: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +} ⋮---- -borrowLoan(params: BorrowLoanRequestV2): Promise< - APIResponse<{ - orderId: string; - }> - > { - return this.postPrivate('/api/v2/earn/loan/borrow', params); +export interface GetTaxRecordsRequestV3 { + bizType: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES' + | 'OTHER'; + marginType?: 'isolated' | 'crossed'; + coin?: string; + startTime: string; + endTime: string; + limit?: string; + cursor?: string; +} ⋮---- -getOngoingLoanOrders(params?: { - orderId?: string; - loanCoin?: string; - pledgeCoin?: string; -}): Promise> +export type CollateralTypeV3 = 'mainstream' | 'all' | 'custom'; ⋮---- -repayLoan( - params: RepayLoanRequestV2, -): Promise> +export interface SetCollateralTypeRequestV3 { + collateralType: CollateralTypeV3; + /** Required when collateralType=custom. Comma-separated coin names */ + collateralCoins?: string; +} ⋮---- -getRepayHistory( - params: GetLoanRepayHistoryRequestV2, -): Promise> +/** Required when collateralType=custom. Comma-separated coin names */ ⋮---- -updateLoanPledgeRate(params: ModifyLoanPledgeRateRequestV2): Promise< - APIResponse<{ - loanCoin: string; - pledgeCoin: string; - afterPledgeRate: string; - }> - > { - return this.postPrivate('/api/v2/earn/loan/revise-pledge', params); +export interface PreSetLeverageRequestV3 { + category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + coin?: string; + marginMode: 'isolated' | 'cross'; + leverage?: string; + longLeverage?: string; + shortLeverage?: string; +} ⋮---- -getLoanPledgeRateHistory( - params: GetLoanPledgeRateHistoryRequestV2, -): Promise> +export interface SetMarginRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + posSide: 'long' | 'short'; + operation: 'add' | 'remove'; + amount: string; +} ⋮---- -getLoanHistory( - params: GetLoanHistoryRequestV2, -): Promise> +export interface GetMaxWithdrawalRequestV3 { + coin: string; +} ⋮---- -getLoanDebts(): Promise> +export interface GetRealityOrderBookRequestV3 { + symbol: string; +} ⋮---- -getLoanLiquidationRecords( - params: GetLiquidationRecordsRequestV2, -): Promise> +export interface GetRealityFillsRequestV3 { + symbol: string; + limit?: string; +} ⋮---- -/** - * - * * Inst Loan | Product Info - * - */ +export interface SubMasterTransferRequestV3 { + fromType: 'spot' | 'uta'; + toType: 'spot' | 'p2p' | 'uta'; + amount: string; + coin: string; + clientOid?: string; +} ⋮---- -getLoanProductInfo( - params: GetInstLoanProductInfoRequestV2, -): Promise> +export interface CreateAgentSubAccountRequestV3 { + username: string; + passphrase: string; + note?: string; +} ⋮---- -getLoanSymbols( - params: GetInstLoanSymbolsRequestV2, -): Promise> +export interface MovePositionItemRequestV3 { + symbol: string; + side: 'buy' | 'sell'; + qty: string; +} ⋮---- -getLoanMarginCoinInfo(params: GetInstLoanMarginCoinInfoRequestV2): Promise< - APIResponse<{ - productId: string; - coinInfo: InstLoanCoinInfoV2[]; - }> - > { - return this.getPrivate( - '/api/v2/spot/ins-loan/ensure-coins-convert', - params, - ); +export interface MovePositionsRequestV3 { + fromUid: string; + toUid: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + positionList: MovePositionItemRequestV3[]; +} ⋮---- -/** - * - * * Inst Loan | Account - * - */ +export interface GetMovePositionHistoryRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + startTime?: string; + endTime?: string; + cursor?: string; + limit?: string; +} ⋮---- -getLoanRiskUnit(): Promise< - APIResponse<{ - riskUnitId: string[]; - }> - > { - return this.getPrivate('/api/v2/spot/ins-loan/risk-unit'); +export interface GetEligibleSymbolsRequestV3 { + symbol?: string; +} ⋮---- -getLoanLTVConvert( - params?: GetInstLoanLTVConvertRequestV2, -): Promise> +export interface GetEligibleMarginTierRequestV3 { + coin?: string; +} ⋮---- -/** - * - * * Inst Loan | Orders - * - */ +export interface GetEligibleLoanInfoRequestV3 { + coin?: string; +} ⋮---- -getLoanRepaidHistory( - params?: GetInstLoanRepaidHistoryRequestV2, -): Promise> +export interface GetRateLimitQuotaRequestV3 { + category: 'spot' | 'futures'; + uid?: string; + cursor?: string; + limit?: string; +} ⋮---- -getLoanOrder( - params?: GetInstLoanOrderRequestV2, -): Promise> +export interface SetRateLimitQuotaRequestV3 { + category: 'spot' | 'futures'; + uids: string[]; + quota: string; +} ================ File: src/types/response/v3/public.ts