diff --git a/docs/endpointFunctionList.md b/docs/endpointFunctionList.md index 2f3b312..3b958a5 100644 --- a/docs/endpointFunctionList.md +++ b/docs/endpointFunctionList.md @@ -196,165 +196,165 @@ This table includes all endpoints from the official Exchange API docs and corres | [getFuturesFills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1739) | :closed_lock_with_key: | GET | `/api/v2/mix/order/fills` | | [getFuturesHistoricOrderFills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1748) | :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#L1759) | :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#L1768) | :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#L1777) | :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#L1789) | :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#L1797) | :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#L1806) | :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#L1818) | :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#L1827) | :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#L1836) | :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#L1845) | :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#L1854) | :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#L1860) | :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#L1885) | :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#L1895) | :closed_lock_with_key: | GET | `/api/v2/broker/account/info` | -| [createSubaccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1905) | :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#L1912) | :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#L1922) | :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#L1928) | :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#L1934) | :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#L1949) | :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#L1963) | :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#L1974) | :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#L1986) | :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#L2002) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-deposit` | -| [subaccountWithdrawalRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2013) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-withdrawal` | -| [createSubaccountApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2028) | :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#L2037) | :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#L2046) | :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#L2055) | :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#L2071) | :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#L2088) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccounts` | -| [getBrokerCommissions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2100) | :closed_lock_with_key: | GET | `/api/v2/broker/commissions` | -| [getBrokerTradeVolume()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2112) | :closed_lock_with_key: | GET | `/api/v2/broker/trade-volume` | -| [getBrokerTotalCommission()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2132) | :closed_lock_with_key: | GET | `/api/v2/broker/total-commission` | -| [getBrokerOrderCommission()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2154) | :closed_lock_with_key: | GET | `/api/v2/broker/order-commission` | -| [getBrokerRebateInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2167) | :closed_lock_with_key: | GET | `/api/v2/broker/rebate-info` | -| [getAgentCustomerCommissions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2179) | :closed_lock_with_key: | GET | `/api/v2/broker/customer-commissions` | -| [getAgentSubCustomerList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2188) | :closed_lock_with_key: | GET | `/api/v2/broker/sub-customer-list` | -| [getSubAffiliateInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2194) | :closed_lock_with_key: | GET | `/api/v2/broker/sub-affiliate-info` | -| [getAgentCustomerTradeVolume()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2200) | :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#L2209) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-list` | -| [getAgentCustomerKycResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2215) | :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#L2221) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-deposit` | -| [getAgentCustomerAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2227) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-asset` | -| [getAgentCommissionDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2233) | :closed_lock_with_key: | GET | `/api/v2/broker/agent-commission` | -| [getMarginCurrencies()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2253) | | GET | `/api/v2/margin/currencies` | -| [getMarginBorrowHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2263) | :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#L2280) | :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#L2297) | :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#L2314) | :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#L2331) | :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#L2354) | :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#L2365) | :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#L2388) | :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#L2413) | :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#L2425) | :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#L2438) | :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#L2453) | :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#L2469) | :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#L2481) | :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#L2499) | :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#L2523) | :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#L2536) | :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#L2547) | :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#L2567) | :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#L2581) | :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#L2595) | :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#L2612) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/fills` | -| [getMarginLiquidationOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2626) | :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#L2658) | :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#L2667) | :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#L2676) | :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#L2685) | :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#L2691) | :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#L2697) | :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#L2706) | :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#L2725) | :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#L2741) | :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#L2759) | :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#L2768) | :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#L2777) | :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#L2788) | :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#L2797) | :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#L2814) | :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#L2823) | :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#L2832) | :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#L2838) | :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#L2844) | :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#L2850) | :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#L2863) | :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#L2869) | :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#L2887) | :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#L2901) | :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#L2905) | :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#L2912) | :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#L2927) | :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#L2931) | :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#L2940) | :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#L2948) | :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#L2952) | :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#L2963) | :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#L2972) | :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#L2981) | :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#L2991) | :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#L3001) | :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#L3010) | :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#L3014) | :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#L3031) | :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#L3037) | :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#L3046) | :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#L3054) | :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#L3063) | :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#L3074) | :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#L3080) | :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#L3089) | :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#L3098) | :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#L3108) | :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#L3122) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/product` | -| [getEarnSavingsAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3129) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/account` | -| [getEarnSavingsAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3133) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/assets` | -| [getEarnSavingsRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3139) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/records` | -| [getEarnSavingsSubscription()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3145) | :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#L3152) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/subscribe` | -| [getEarnSavingsSubscriptionResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3165) | :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#L3177) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/redeem` | -| [getEarnSavingsRedemptionResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3186) | :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#L3206) | :closed_lock_with_key: | GET | `/api/v2/earn/account/assets` | -| [getEarnEliteProducts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3225) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/product` | -| [getEarnEliteAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3229) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/assets` | -| [getEarnEliteRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3233) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/records` | -| [getEarnEliteSubscribeInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3239) | :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#L3245) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/subscribe` | -| [getEarnEliteSubscribeResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3251) | :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#L3257) | :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#L3263) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/redeem` | -| [getSharkfinProducts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3277) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/product` | -| [getSharkfinAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3285) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/account` | -| [getSharkfinAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3289) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/assets` | -| [getSharkfinRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3295) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/records` | -| [getSharkfinSubscription()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3301) | :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#L3307) | :closed_lock_with_key: | POST | `/api/v2/earn/sharkfin/subscribe` | -| [getSharkfinSubscriptionResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3316) | :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#L3333) | | GET | `/api/v2/earn/loan/public/coinInfos` | -| [getLoanEstInterestAndBorrowable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3339) | | GET | `/api/v2/earn/loan/public/hour-interest` | -| [borrowLoan()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3350) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/borrow` | -| [getOngoingLoanOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3358) | :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#L3366) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/repay` | -| [getRepayHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3372) | :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#L3378) | :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#L3388) | :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#L3394) | :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#L3400) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/debts` | -| [getLoanLiquidationRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3404) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/reduces` | -| [getLoanProductInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3416) | :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#L3422) | :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#L3428) | :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#L3446) | :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#L3454) | :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#L3466) | :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#L3472) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/loan-order` | +| [getFuturesHistoricOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1772) | :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#L1781) | :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#L1793) | :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#L1801) | :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#L1810) | :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#L1822) | :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#L1831) | :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#L1840) | :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#L1849) | :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#L1862) | :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#L1868) | :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#L1893) | :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#L1903) | :closed_lock_with_key: | GET | `/api/v2/broker/account/info` | +| [createSubaccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L1913) | :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#L1920) | :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#L1930) | :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#L1936) | :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#L1942) | :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#L1957) | :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#L1971) | :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#L1982) | :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#L1994) | :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#L2010) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-deposit` | +| [subaccountWithdrawalRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2021) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccount-withdrawal` | +| [createSubaccountApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2036) | :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#L2045) | :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#L2054) | :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#L2063) | :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#L2079) | :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#L2096) | :closed_lock_with_key: | GET | `/api/v2/broker/subaccounts` | +| [getBrokerCommissions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2108) | :closed_lock_with_key: | GET | `/api/v2/broker/commissions` | +| [getBrokerTradeVolume()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2120) | :closed_lock_with_key: | GET | `/api/v2/broker/trade-volume` | +| [getBrokerTotalCommission()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2140) | :closed_lock_with_key: | GET | `/api/v2/broker/total-commission` | +| [getBrokerOrderCommission()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2162) | :closed_lock_with_key: | GET | `/api/v2/broker/order-commission` | +| [getBrokerRebateInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2175) | :closed_lock_with_key: | GET | `/api/v2/broker/rebate-info` | +| [getAgentCustomerCommissions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2187) | :closed_lock_with_key: | GET | `/api/v2/broker/customer-commissions` | +| [getAgentSubCustomerList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2196) | :closed_lock_with_key: | GET | `/api/v2/broker/sub-customer-list` | +| [getSubAffiliateInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2202) | :closed_lock_with_key: | GET | `/api/v2/broker/sub-affiliate-info` | +| [getAgentCustomerTradeVolume()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2208) | :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#L2217) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-list` | +| [getAgentCustomerKycResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2223) | :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#L2229) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-deposit` | +| [getAgentCustomerAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2235) | :closed_lock_with_key: | POST | `/api/v2/broker/customer-asset` | +| [getAgentCommissionDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2241) | :closed_lock_with_key: | GET | `/api/v2/broker/agent-commission` | +| [getMarginCurrencies()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2261) | | GET | `/api/v2/margin/currencies` | +| [getMarginBorrowHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2271) | :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#L2288) | :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#L2305) | :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#L2322) | :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#L2339) | :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#L2362) | :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#L2373) | :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#L2396) | :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#L2421) | :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#L2433) | :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#L2446) | :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#L2461) | :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#L2477) | :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#L2489) | :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#L2507) | :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#L2531) | :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#L2544) | :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#L2555) | :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#L2575) | :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#L2589) | :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#L2603) | :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#L2620) | :closed_lock_with_key: | GET | `/api/v2/margin/${marginType}/fills` | +| [getMarginLiquidationOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L2634) | :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#L2666) | :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#L2675) | :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#L2684) | :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#L2693) | :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#L2699) | :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#L2705) | :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#L2714) | :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#L2733) | :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#L2749) | :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#L2767) | :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#L2776) | :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#L2785) | :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#L2796) | :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#L2805) | :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#L2822) | :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#L2831) | :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#L2840) | :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#L2846) | :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#L2852) | :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#L2858) | :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#L2871) | :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#L2877) | :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#L2895) | :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#L2909) | :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#L2913) | :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#L2920) | :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#L2935) | :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#L2939) | :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#L2948) | :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#L2956) | :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#L2960) | :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#L2971) | :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#L2980) | :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#L2989) | :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#L2999) | :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#L3009) | :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#L3018) | :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#L3022) | :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#L3039) | :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#L3045) | :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#L3054) | :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#L3062) | :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#L3071) | :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#L3082) | :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#L3088) | :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#L3097) | :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#L3106) | :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#L3116) | :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#L3130) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/product` | +| [getEarnSavingsAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3137) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/account` | +| [getEarnSavingsAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3141) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/assets` | +| [getEarnSavingsRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3147) | :closed_lock_with_key: | GET | `/api/v2/earn/savings/records` | +| [getEarnSavingsSubscription()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3153) | :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#L3160) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/subscribe` | +| [getEarnSavingsSubscriptionResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3173) | :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#L3185) | :closed_lock_with_key: | POST | `/api/v2/earn/savings/redeem` | +| [getEarnSavingsRedemptionResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3194) | :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#L3214) | :closed_lock_with_key: | GET | `/api/v2/earn/account/assets` | +| [getEarnEliteProducts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3233) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/product` | +| [getEarnEliteAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3237) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/assets` | +| [getEarnEliteRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3241) | :closed_lock_with_key: | GET | `/api/v2/earn/elite/records` | +| [getEarnEliteSubscribeInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3247) | :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#L3253) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/subscribe` | +| [getEarnEliteSubscribeResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3259) | :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#L3265) | :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#L3271) | :closed_lock_with_key: | POST | `/api/v2/earn/elite/redeem` | +| [getSharkfinProducts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3285) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/product` | +| [getSharkfinAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3293) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/account` | +| [getSharkfinAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3297) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/assets` | +| [getSharkfinRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3303) | :closed_lock_with_key: | GET | `/api/v2/earn/sharkfin/records` | +| [getSharkfinSubscription()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3309) | :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#L3315) | :closed_lock_with_key: | POST | `/api/v2/earn/sharkfin/subscribe` | +| [getSharkfinSubscriptionResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3324) | :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#L3341) | | GET | `/api/v2/earn/loan/public/coinInfos` | +| [getLoanEstInterestAndBorrowable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3347) | | GET | `/api/v2/earn/loan/public/hour-interest` | +| [borrowLoan()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3358) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/borrow` | +| [getOngoingLoanOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3366) | :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#L3374) | :closed_lock_with_key: | POST | `/api/v2/earn/loan/repay` | +| [getRepayHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3380) | :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#L3386) | :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#L3396) | :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#L3402) | :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#L3408) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/debts` | +| [getLoanLiquidationRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3412) | :closed_lock_with_key: | GET | `/api/v2/earn/loan/reduces` | +| [getLoanProductInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v2.ts#L3424) | :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#L3430) | :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#L3436) | :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#L3454) | :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#L3462) | :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#L3474) | :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#L3480) | :closed_lock_with_key: | GET | `/api/v2/spot/ins-loan/loan-order` | # rest-client-v3.ts @@ -362,305 +362,337 @@ This table includes all endpoints from the official Exchange API docs and corres | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | -| [getServerTime()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L645) | | GET | `/api/v3/market/time` | -| [getAnnouncements()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L659) | | GET | `/api/v3/public/annoucements` | -| [getInstruments()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L678) | | GET | `/api/v3/market/instruments` | -| [getMarketFeeGroup()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L687) | | GET | `/api/v3/market/fee-group` | -| [getLiquidations()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L696) | | GET | `/api/v3/market/liquidations` | -| [getRpiSymbols()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L705) | | GET | `/api/v3/market/rpi-symbols` | -| [getRpiOrderBook()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L712) | | GET | `/api/v3/market/rpi-orderbook` | -| [getCashDividendRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L721) | | GET | `/api/v3/market/cash-dividend-records` | -| [getSplitRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L727) | | GET | `/api/v3/market/split-records` | -| [getSpotWhaleFlow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L736) | | GET | `/api/v3/market/spot-whale-flow` | -| [getSpotFundFlow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L745) | | GET | `/api/v3/market/spot-fund-flow` | -| [getSpotNetFlow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L754) | | GET | `/api/v3/market/spot-net-flow` | -| [getMarginLongShort()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L763) | | GET | `/api/v3/market/margin-long-short` | -| [getMarginLoanGrowth()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L772) | | GET | `/api/v3/market/margin-loan-growth` | -| [getMarginIsolatedBorrow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L781) | | GET | `/api/v3/market/margin-isolated-borrow` | -| [getFuturesActiveBuySell()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L790) | | GET | `/api/v3/market/futures-active-buy-sell` | -| [getFuturesLongShort()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L799) | | GET | `/api/v3/market/futures-long-short` | -| [getFuturesPositionLongShort()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L808) | | GET | `/api/v3/market/futures-position-long-short` | -| [getFuturesAccountLongShort()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L817) | | GET | `/api/v3/market/futures-account-long-short` | -| [getMarketScoreWeights()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L826) | | GET | `/api/v3/market/score-weights` | -| [getTickers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L835) | | GET | `/api/v3/market/tickers` | -| [getOrderBook()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L845) | | GET | `/api/v3/market/orderbook` | -| [getFills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L854) | | GET | `/api/v3/market/fills` | -| [getProofOfReserves()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L863) | | GET | `/api/v3/market/proof-of-reserves` | -| [getOpenInterest()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L870) | | GET | `/api/v3/market/open-interest` | -| [getOpenInterestHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L880) | | GET | `/api/v3/market/open-interest-history` | -| [getCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L891) | | GET | `/api/v3/market/coins` | -| [getCandles()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L899) | | GET | `/api/v3/market/candles` | -| [getHistoryCandles()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L908) | | GET | `/api/v3/market/history-candles` | -| [getCurrentFundingRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L917) | | GET | `/api/v3/market/current-fund-rate` | -| [getHistoryFundingRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L926) | | GET | `/api/v3/market/history-fund-rate` | -| [getRiskReserve()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L935) | | GET | `/api/v3/market/risk-reserve` | -| [getRiskReserveHour()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L944) | | GET | `/api/v3/market/risk-reserve-hour` | -| [getRiskReserveAll()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L953) | | GET | `/api/v3/market/risk-reserve-all` | -| [getDiscountRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L962) | | GET | `/api/v3/market/discount-rate` | -| [getInterestRateHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L971) | | GET | `/api/v3/market/interest-rate-history` | -| [getMarginLoans()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L980) | | GET | `/api/v3/market/margin-loans` | -| [getMarginLoansAll()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L990) | | GET | `/api/v3/market/margin-loans-all` | -| [getPositionTier()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L999) | | GET | `/api/v3/market/position-tier` | -| [getContractsOi()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1008) | | GET | `/api/v3/market/oi-limit` | -| [getIndexComponents()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1017) | | GET | `/api/v3/market/index-components` | -| [getRealityOrderBook()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1028) | :closed_lock_with_key: | GET | `/api/v3/account/reality-orderbook` | -| [getRealityOrderBookSegmented()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1041) | :closed_lock_with_key: | GET | `/api/v3/account/reality-orderbook-segmented` | -| [getRealityFills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1053) | :closed_lock_with_key: | GET | `/api/v3/account/reality-fills` | -| [getRealityCompanyOverview()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1059) | | GET | `/api/v3/reality/market/company-overview` | -| [getRealityValuationIndicators()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1065) | | GET | `/api/v3/reality/market/valuation-indicators` | -| [getRealityEarningsForecast()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1071) | | GET | `/api/v3/reality/market/earnings-forecast` | -| [getRealitySuspensionResumptionInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1077) | | GET | `/api/v3/reality/market/suspension-resumption-info` | -| [getRealityDividends()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1086) | | GET | `/api/v3/reality/market/dividends` | -| [getRealityShareCapitalChange()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1092) | | GET | `/api/v3/reality/market/share-capital-change` | -| [getRealityInnerTrades()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1098) | | GET | `/api/v3/reality/market/inner-trades` | -| [getRealityExecutiveShareholdings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1104) | | GET | `/api/v3/reality/market/executive-shareholdings` | -| [getRealityShareholdDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1112) | | GET | `/api/v3/reality/market/sharehold-detail` | -| [getRealityStockInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1118) | | GET | `/api/v3/reality/market/stock-info` | -| [getRealityMarketStates()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1124) | | GET | `/api/v3/reality/market/states` | -| [getRealityMarketCalendar()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1128) | | GET | `/api/v3/reality/market/calendar` | -| [getCopyFuturesTradingPairs()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1143) | :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#L1154) | :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#L1164) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/max-transferable` | -| [getCopyFuturesCopyMaxTransferable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1175) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/copy-max-transferable` | -| [copyFuturesTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1188) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/transfer` | -| [getCopyFuturesTransferRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1198) | :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#L1204) | :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#L1210) | :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#L1216) | :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#L1222) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/profit-details` | -| [getCopyFuturesPortfolioOverview()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1228) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/portfolio-overview` | -| [createCopyFutures()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1234) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/follower-settings` | -| [modifyCopyFuturesFollowerSettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1240) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/modify-follower-settings` | -| [unfollowCopyFutures()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1249) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/unfollow` | -| [getCopyFuturesCopySettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1255) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/copy-settings` | -| [copyFuturesFollowerTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1261) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/copy-transfer` | -| [getCopyFuturesFollowerTransferRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1267) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/copy-transfer-record` | -| [getCopyFuturesCurrentCopy()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1273) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/current-copy` | -| [getCopyFuturesCopyProfitDetails()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1279) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/copy-profit-details` | -| [closeCopyFuturesPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1285) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/close-positions` | -| [closeAllCopyFuturesPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1291) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/close-all` | -| [getCopyFuturesCurrentPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1297) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/current-positions` | -| [placeCopyFuturesTpSl()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1303) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/place-tpsl` | -| [modifyCopyFuturesTpSl()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1309) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/modify-tpsl` | -| [cancelCopyFuturesTpSl()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1315) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/cancel-tpsl` | -| [getCopyFuturesCurrentTpSlOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1321) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/current-tpsl-orders` | -| [getCopyFuturesTpSlOrderHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1327) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/tpsl-order-history` | -| [getStockPlusOptionQuote()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1339) | :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#L1345) | :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#L1354) | :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#L1363) | :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#L1369) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/static` | -| [getStockPlusQuote()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1375) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/quote` | -| [getStockPlusTradeDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1381) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/trade` | -| [getStockPlusIntraday()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1387) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/intraday` | -| [getStockPlusHistoryCandlestick()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1393) | :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#L1402) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/candlestick` | -| [getStockPlusDepth()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1408) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/depth` | -| [placeStockPlusOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1414) | :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#L1420) | :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#L1426) | :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#L1432) | :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#L1438) | :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#L1444) | :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#L1450) | :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#L1456) | :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#L1465) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/account` | -| [getStockPlusCashFlow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1471) | :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#L1477) | :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#L1483) | :closed_lock_with_key: | POST | `/api/v3/stockplus/asset/transfer` | -| [getStockPlusTransferRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1489) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/transfer-records` | -| [getCfdTickers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1501) | :closed_lock_with_key: | GET | `/api/v3/cfd/market/tickers` | -| [getCfdHistoryCandlestick()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1507) | :closed_lock_with_key: | GET | `/api/v3/cfd/market/history-candlestick` | -| [placeCfdOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1513) | :closed_lock_with_key: | POST | `/api/v3/cfd/trade/place-order` | -| [modifyCfdOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1519) | :closed_lock_with_key: | POST | `/api/v3/cfd/trade/modify-order` | -| [cancelCfdOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1525) | :closed_lock_with_key: | POST | `/api/v3/cfd/trade/cancel-order` | -| [cancelAllCfdOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1529) | :closed_lock_with_key: | POST | `/api/v3/cfd/trade/cancel-all` | -| [closeCfdPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1535) | :closed_lock_with_key: | POST | `/api/v3/cfd/trade/close-positions` | -| [closeAllCfdPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1541) | :closed_lock_with_key: | POST | `/api/v3/cfd/trade/close-all-positions` | -| [getCfdUnfilledOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1547) | :closed_lock_with_key: | GET | `/api/v3/cfd/trade/unfilled-order` | -| [getCfdOrderHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1558) | :closed_lock_with_key: | GET | `/api/v3/cfd/trade/history-order` | -| [getCfdCurrentPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1564) | :closed_lock_with_key: | GET | `/api/v3/cfd/trade/current-positions` | -| [getCfdFundDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1570) | :closed_lock_with_key: | GET | `/api/v3/cfd/account/fund-detail` | -| [cfdTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1574) | :closed_lock_with_key: | POST | `/api/v3/cfd/account/transfer` | -| [getCfdTransferRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1580) | :closed_lock_with_key: | GET | `/api/v3/cfd/account/transfer-records` | -| [getCfdFinancialRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1586) | :closed_lock_with_key: | GET | `/api/v3/cfd/account/financial-records` | -| [getCfdInstruments()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1592) | :closed_lock_with_key: | GET | `/api/v3/cfd/account/instruments` | -| [getBalances()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1607) | :closed_lock_with_key: | GET | `/api/v3/account/assets` | -| [getFundingAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1614) | :closed_lock_with_key: | GET | `/api/v3/account/funding-assets` | -| [getAccountInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1624) | :closed_lock_with_key: | GET | `/api/v3/account/info` | -| [getAccountSettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1632) | :closed_lock_with_key: | GET | `/api/v3/account/settings` | -| [adjustAccountMode()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1639) | :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#L1649) | :closed_lock_with_key: | GET | `/api/v3/account/delta-info` | -| [setLeverage()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1658) | :closed_lock_with_key: | POST | `/api/v3/account/set-leverage` | -| [setHoldMode()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1665) | :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#L1674) | :closed_lock_with_key: | GET | `/api/v3/account/collateral-type` | -| [setCollateralType()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1681) | :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#L1690) | | GET | `/api/v3/account/custom-collateral-coins` | -| [preSetLeverage()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1697) | :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#L1706) | :closed_lock_with_key: | POST | `/api/v3/account/set-margin` | -| [getMaxWithdrawal()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1713) | :closed_lock_with_key: | GET | `/api/v3/account/max-withdrawal` | -| [getFinancialRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1722) | :closed_lock_with_key: | GET | `/api/v3/account/financial-records` | -| [getFundingFinancialRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1731) | :closed_lock_with_key: | GET | `/api/v3/account/funding-financial-records` | -| [getRepayableCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1745) | :closed_lock_with_key: | GET | `/api/v3/account/repayable-coins` | -| [getPaymentCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1757) | :closed_lock_with_key: | GET | `/api/v3/account/payment-coins` | -| [submitRepay()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1769) | :closed_lock_with_key: | POST | `/api/v3/account/repay` | -| [borrow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1773) | :closed_lock_with_key: | POST | `/api/v3/account/borrow` | -| [getMaxBorrowable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1777) | :closed_lock_with_key: | GET | `/api/v3/account/max-borrowable` | -| [setRepayMode()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1783) | :closed_lock_with_key: | POST | `/api/v3/account/set-repay-mode` | -| [getConvertRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1792) | :closed_lock_with_key: | GET | `/api/v3/account/convert-records` | -| [getSmallAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1801) | :closed_lock_with_key: | GET | `/api/v3/convert/small-assets` | -| [tradeSmallAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1807) | :closed_lock_with_key: | POST | `/api/v3/convert/small-assets-trade` | -| [getSmallAssetsHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1813) | :closed_lock_with_key: | GET | `/api/v3/convert/small-assets-history` | -| [setDepositAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1828) | :closed_lock_with_key: | POST | `/api/v3/account/deposit-account` | -| [switchDeduct()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1837) | :closed_lock_with_key: | POST | `/api/v3/account/switch-deduct` | -| [getDeductInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1844) | :closed_lock_with_key: | GET | `/api/v3/account/deduct-info` | -| [getFeeRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1855) | :closed_lock_with_key: | GET | `/api/v3/account/fee-rate` | -| [getAllFeeRates()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1867) | :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#L1880) | :closed_lock_with_key: | GET | `/api/v3/account/max-transferable` | -| [getOpenInterestLimit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1892) | :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#L1898) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-symbols` | -| [getEligibleMarginTier()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1904) | :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#L1910) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-loan-info` | -| [getEligibleDiscountRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1916) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-discount-rate` | -| [downgradeAccountToClassic()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1931) | :closed_lock_with_key: | POST | `/api/v3/account/switch` | -| [getUnifiedAccountSwitchStatus()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1939) | :closed_lock_with_key: | GET | `/api/v3/account/switch-status` | -| [getTaxRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1955) | :closed_lock_with_key: | GET | `/api/v3/tax/records` | -| [createSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1970) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub` | -| [createAgentSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1979) | :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#L1988) | :closed_lock_with_key: | POST | `/api/v3/user/freeze-sub` | -| [deleteSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1994) | :closed_lock_with_key: | POST | `/api/v3/user/delete-sub` | -| [getSubUnifiedAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2003) | :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#L2012) | :closed_lock_with_key: | GET | `/api/v3/user/sub-list` | -| [createSubAccountApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2025) | :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#L2034) | :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#L2043) | :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#L2052) | :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#L2066) | :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#L2077) | :closed_lock_with_key: | POST | `/api/v3/user/set-rate-limit-quota` | -| [createStpGroup()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2087) | :closed_lock_with_key: | POST | `/api/v3/account/create-stp-groups` | -| [getStpGroups()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2097) | :closed_lock_with_key: | GET | `/api/v3/account/stp-groups` | -| [addStpGroupMembers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2107) | :closed_lock_with_key: | POST | `/api/v3/account/add-groups-members` | -| [removeStpGroupMembers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2119) | :closed_lock_with_key: | POST | `/api/v3/account/remove-groups-members` | -| [getTransferableCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2134) | :closed_lock_with_key: | GET | `/api/v3/account/transferable-coins` | -| [submitTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2143) | :closed_lock_with_key: | POST | `/api/v3/account/transfer` | -| [subAccountTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2152) | :closed_lock_with_key: | POST | `/api/v3/account/sub-transfer` | -| [getSubTransferRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2164) | :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#L2176) | :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#L2194) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-address` | -| [getSubDepositAddress()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2203) | :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#L2212) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-records` | -| [getSubDepositRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2221) | :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#L2236) | :closed_lock_with_key: | POST | `/api/v3/account/withdraw` | -| [getWithdrawRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2245) | :closed_lock_with_key: | GET | `/api/v3/account/withdrawal-records` | -| [getWithdrawAddressBook()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2254) | :closed_lock_with_key: | GET | `/api/v3/account/withdraw-address` | -| [cancelWithdrawal()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2263) | :closed_lock_with_key: | POST | `/api/v3/account/cancel-withdrawal` | -| [submitNewOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2281) | :closed_lock_with_key: | POST | `/api/v3/trade/place-order` | -| [modifyOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2290) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-order` | -| [placeRealityOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2299) | :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#L2308) | :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#L2317) | :closed_lock_with_key: | GET | `/api/v3/trade/loan-data` | -| [cancelOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2324) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-order` | -| [placeBatchOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2333) | :closed_lock_with_key: | POST | `/api/v3/trade/place-batch` | -| [batchModifyOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2342) | :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#L2351) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-batch` | -| [cancelAllOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2360) | :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#L2369) | :closed_lock_with_key: | POST | `/api/v3/trade/close-positions` | -| [getOrderInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2378) | :closed_lock_with_key: | GET | `/api/v3/trade/order-info` | -| [getUnfilledOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2387) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-orders` | -| [getHistoryOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2399) | :closed_lock_with_key: | GET | `/api/v3/trade/history-orders` | -| [movePositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2411) | :closed_lock_with_key: | POST | `/api/v3/account/move-positions` | -| [getMovePositionHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2420) | :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#L2432) | :closed_lock_with_key: | GET | `/api/v3/trade/fills` | -| [getCurrentPosition()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2444) | :closed_lock_with_key: | GET | `/api/v3/position/current-position` | -| [getPositionHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2455) | :closed_lock_with_key: | GET | `/api/v3/position/history-position` | -| [getMaxOpenAvailable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2469) | :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#L2478) | :closed_lock_with_key: | GET | `/api/v3/position/adlRank` | -| [countdownCancelAll()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2485) | :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#L2500) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/transfered` | -| [getLoanSymbols()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2509) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/symbols` | -| [getLoanRiskUnit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2518) | :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#L2529) | :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#L2538) | :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#L2547) | :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#L2556) | :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#L2565) | :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#L2577) | :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#L2592) | :closed_lock_with_key: | GET | `/api/v3/loan/coins` | -| [getLoanInterest()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2601) | :closed_lock_with_key: | GET | `/api/v3/loan/interest` | -| [loanBorrow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2610) | :closed_lock_with_key: | POST | `/api/v3/loan/borrow` | -| [getLoanBorrowOngoing()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2619) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-ongoing` | -| [getLoanBorrowHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2628) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-history` | -| [loanRepay()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2637) | :closed_lock_with_key: | POST | `/api/v3/loan/repay` | -| [getLoanRepayHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2646) | :closed_lock_with_key: | GET | `/api/v3/loan/repay-history` | -| [loanRevisePledge()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2655) | :closed_lock_with_key: | POST | `/api/v3/loan/revise-pledge` | -| [getLoanPledgeRateHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2664) | :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#L2673) | :closed_lock_with_key: | GET | `/api/v3/loan/debts` | -| [getLoanReduces()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2680) | :closed_lock_with_key: | GET | `/api/v3/loan/reduces` | -| [submitStrategyOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2695) | :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#L2704) | :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#L2713) | :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#L2722) | :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#L2731) | :closed_lock_with_key: | GET | `/api/v3/trade/history-strategy-orders` | -| [getStrategySubOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2741) | :closed_lock_with_key: | GET | `/api/v3/trade/strategy-sub-orders` | -| [validateGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2756) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/validate` | -| [createGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2762) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/create-bot` | -| [modifyGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2768) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/modify-bot` | -| [modifyGridInterval()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2774) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/modify-grid-interval` | -| [addGridInvestment()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2780) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/add-investment` | -| [closeGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2786) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/close-bot` | -| [getGridBotDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2792) | :closed_lock_with_key: | GET | `/api/v3/trade/grid/bot-detail` | -| [getGridBotOrderDetails()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2798) | :closed_lock_with_key: | GET | `/api/v3/trade/grid/list-details` | -| [validateNeutralGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2804) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/validate-neutral` | -| [createNeutralGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2810) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/create-neutral-bot` | -| [modifyNeutralGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2816) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/modify-neutral-bot` | -| [modifyNeutralGridInterval()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2822) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/modify-neutral-grid-interval` | -| [getNeutralGridBotDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2831) | :closed_lock_with_key: | GET | `/api/v3/trade/grid/neutral-bot-detail` | -| [getNeutralGridBotOrderDetails()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2837) | :closed_lock_with_key: | GET | `/api/v3/trade/grid/neutral-list-details` | -| [createBrokerSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2855) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub` | -| [getBrokerSubAccountList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2867) | :closed_lock_with_key: | GET | `/api/v3/broker/sub-list` | -| [modifyBrokerSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2879) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub` | -| [brokerSubWithdrawal()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2894) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-withdrawal` | -| [getBrokerSubDepositAddress()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2906) | :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#L2918) | :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#L2930) | :closed_lock_with_key: | GET | `/api/v3/broker/commission` | -| [createBrokerSubApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2942) | :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#L2954) | :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#L2970) | :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#L2982) | :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#L2994) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-list` | -| [getP2pExchangeRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3000) | :closed_lock_with_key: | GET | `/api/v3/p2p/exchange-rate` | -| [simulateP2pFee()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3006) | :closed_lock_with_key: | POST | `/api/v3/p2p/fee-simulate` | -| [getP2pAdLimit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3012) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-limit` | -| [createP2pAd()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3018) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-create` | -| [updateP2pAd()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3024) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-update` | -| [operateP2pAd()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3028) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-operate` | -| [getP2pAdInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3032) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-info` | -| [getP2pMyAds()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3038) | :closed_lock_with_key: | GET | `/api/v3/p2p/my-ads` | -| [getP2pPendingOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3044) | :closed_lock_with_key: | GET | `/api/v3/p2p/pending-orders` | -| [getP2pAllOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3050) | :closed_lock_with_key: | GET | `/api/v3/p2p/all-orders` | -| [getP2pOrderInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3056) | :closed_lock_with_key: | GET | `/api/v3/p2p/order-info` | -| [confirmP2pOrderPayment()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3062) | :closed_lock_with_key: | POST | `/api/v3/p2p/order-pay` | -| [releaseP2pOrderAsset()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3068) | :closed_lock_with_key: | POST | `/api/v3/p2p/order-release` | -| [getP2pUserInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3074) | :closed_lock_with_key: | GET | `/api/v3/p2p/user-info` | -| [getP2pCurrencies()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3078) | :closed_lock_with_key: | GET | `/api/v3/p2p/currencies` | -| [getP2pPayMethods()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3082) | :closed_lock_with_key: | GET | `/api/v3/p2p/pay-method` | -| [getP2pBalance()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3086) | :closed_lock_with_key: | GET | `/api/v3/p2p/balance` | -| [getEarnEliteProducts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3098) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-product` | -| [getEarnEliteAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3102) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-assets` | -| [getEarnEliteRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3106) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-records` | -| [getEarnEliteSubscribeInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3112) | :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#L3118) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-subscribe` | -| [getEarnEliteSubscribeResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3124) | :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#L3130) | :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#L3136) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-redeem` | -| [getEarnCashPlusSubscribeInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3153) | :closed_lock_with_key: | GET | `/api/v3/earn/cashplus/subscribe-info` | -| [subscribeEarnCashPlus()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3162) | :closed_lock_with_key: | POST | `/api/v3/earn/cashplus/subscribe` | -| [getEarnCashPlusSubscribeResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3171) | :closed_lock_with_key: | GET | `/api/v3/earn/cashplus/subscribe-result` | -| [getEarnCashPlusRedeemInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3181) | :closed_lock_with_key: | GET | `/api/v3/earn/cashplus/redeem-info` | -| [redeemEarnCashPlus()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3188) | :closed_lock_with_key: | POST | `/api/v3/earn/cashplus/redeem` | -| [getEarnCashPlusRedeemResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3197) | :closed_lock_with_key: | GET | `/api/v3/earn/cashplus/redeem-result` | -| [getEarnCashPlusPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3206) | :closed_lock_with_key: | GET | `/api/v3/earn/cashplus/positions` | -| [getEarnCashPlusHistoryOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3213) | :closed_lock_with_key: | GET | `/api/v3/earn/cashplus/history-orders` | +| [getServerTime()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L711) | | GET | `/api/v3/market/time` | +| [getAnnouncements()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L725) | | GET | `/api/v3/public/annoucements` | +| [getInstruments()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L744) | | GET | `/api/v3/market/instruments` | +| [getMarketFeeGroup()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L753) | | GET | `/api/v3/market/fee-group` | +| [getLiquidations()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L762) | | GET | `/api/v3/market/liquidations` | +| [getRpiSymbols()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L771) | | GET | `/api/v3/market/rpi-symbols` | +| [getRpiOrderBook()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L778) | | GET | `/api/v3/market/rpi-orderbook` | +| [getCashDividendRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L787) | | GET | `/api/v3/market/cash-dividend-records` | +| [getSplitRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L793) | | GET | `/api/v3/market/split-records` | +| [getSpotWhaleFlow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L802) | | GET | `/api/v3/market/spot-whale-flow` | +| [getSpotFundFlow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L811) | | GET | `/api/v3/market/spot-fund-flow` | +| [getSpotNetFlow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L820) | | GET | `/api/v3/market/spot-net-flow` | +| [getMarginLongShort()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L829) | | GET | `/api/v3/market/margin-long-short` | +| [getMarginLoanGrowth()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L838) | | GET | `/api/v3/market/margin-loan-growth` | +| [getMarginIsolatedBorrow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L847) | | GET | `/api/v3/market/margin-isolated-borrow` | +| [getFuturesActiveBuySell()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L856) | | GET | `/api/v3/market/futures-active-buy-sell` | +| [getFuturesLongShort()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L865) | | GET | `/api/v3/market/futures-long-short` | +| [getFuturesPositionLongShort()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L874) | | GET | `/api/v3/market/futures-position-long-short` | +| [getFuturesAccountLongShort()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L883) | | GET | `/api/v3/market/futures-account-long-short` | +| [getMarketScoreWeights()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L892) | | GET | `/api/v3/market/score-weights` | +| [getTickers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L901) | | GET | `/api/v3/market/tickers` | +| [getOrderBook()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L911) | | GET | `/api/v3/market/orderbook` | +| [getFills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L920) | | GET | `/api/v3/market/fills` | +| [getProofOfReserves()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L929) | | GET | `/api/v3/market/proof-of-reserves` | +| [getOpenInterest()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L936) | | GET | `/api/v3/market/open-interest` | +| [getOpenInterestHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L946) | | GET | `/api/v3/market/open-interest-history` | +| [getCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L957) | | GET | `/api/v3/market/coins` | +| [getCandles()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L965) | | GET | `/api/v3/market/candles` | +| [getHistoryCandles()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L974) | | GET | `/api/v3/market/history-candles` | +| [getCurrentFundingRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L983) | | GET | `/api/v3/market/current-fund-rate` | +| [getHistoryFundingRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L992) | | GET | `/api/v3/market/history-fund-rate` | +| [getRiskReserve()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1001) | | GET | `/api/v3/market/risk-reserve` | +| [getRiskReserveHour()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1010) | | GET | `/api/v3/market/risk-reserve-hour` | +| [getRiskReserveAll()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1019) | | GET | `/api/v3/market/risk-reserve-all` | +| [getDiscountRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1028) | | GET | `/api/v3/market/discount-rate` | +| [getInterestRateHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1037) | | GET | `/api/v3/market/interest-rate-history` | +| [getMarginLoans()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1046) | | GET | `/api/v3/market/margin-loans` | +| [getMarginLoansAll()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1056) | | GET | `/api/v3/market/margin-loans-all` | +| [getPositionTier()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1065) | | GET | `/api/v3/market/position-tier` | +| [getContractsOi()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1074) | | GET | `/api/v3/market/oi-limit` | +| [getIndexComponents()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1083) | | GET | `/api/v3/market/index-components` | +| [getRealityOrderBook()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1094) | :closed_lock_with_key: | GET | `/api/v3/account/reality-orderbook` | +| [getRealityOrderBookSegmented()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1107) | :closed_lock_with_key: | GET | `/api/v3/account/reality-orderbook-segmented` | +| [getRealityFills()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1119) | :closed_lock_with_key: | GET | `/api/v3/account/reality-fills` | +| [getRealityCompanyOverview()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1125) | | GET | `/api/v3/reality/market/company-overview` | +| [getRealityValuationIndicators()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1131) | | GET | `/api/v3/reality/market/valuation-indicators` | +| [getRealityEarningsForecast()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1137) | | GET | `/api/v3/reality/market/earnings-forecast` | +| [getRealitySuspensionResumptionInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1143) | | GET | `/api/v3/reality/market/suspension-resumption-info` | +| [getRealityDividends()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1152) | | GET | `/api/v3/reality/market/dividends` | +| [getRealityShareCapitalChange()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1158) | | GET | `/api/v3/reality/market/share-capital-change` | +| [getRealityInnerTrades()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1164) | | GET | `/api/v3/reality/market/inner-trades` | +| [getRealityExecutiveShareholdings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1170) | | GET | `/api/v3/reality/market/executive-shareholdings` | +| [getRealityShareholdDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1178) | | GET | `/api/v3/reality/market/sharehold-detail` | +| [getRealityStockInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1184) | | GET | `/api/v3/reality/market/stock-info` | +| [getRealityMarketStates()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1190) | | GET | `/api/v3/reality/market/states` | +| [getRealityMarketCalendar()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1194) | | GET | `/api/v3/reality/market/calendar` | +| [getCopyFuturesTradingPairs()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1209) | :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#L1220) | :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#L1230) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/max-transferable` | +| [getCopyFuturesCopyMaxTransferable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1241) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/copy-max-transferable` | +| [copyFuturesTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1254) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/transfer` | +| [getCopyFuturesTransferRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1264) | :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#L1270) | :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#L1276) | :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#L1282) | :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#L1288) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/profit-details` | +| [getCopyFuturesPortfolioOverview()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1294) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/portfolio-overview` | +| [createCopyFutures()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1300) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/follower-settings` | +| [modifyCopyFuturesFollowerSettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1306) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/modify-follower-settings` | +| [unfollowCopyFutures()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1315) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/unfollow` | +| [getCopyFuturesCopySettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1321) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/copy-settings` | +| [copyFuturesFollowerTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1327) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/copy-transfer` | +| [getCopyFuturesFollowerTransferRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1333) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/copy-transfer-record` | +| [getCopyFuturesCurrentCopy()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1339) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/current-copy` | +| [getCopyFuturesCopyProfitDetails()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1345) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/copy-profit-details` | +| [closeCopyFuturesPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1351) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/close-positions` | +| [closeAllCopyFuturesPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1357) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/close-all` | +| [getCopyFuturesCurrentPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1363) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/current-positions` | +| [placeCopyFuturesTpSl()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1369) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/place-tpsl` | +| [modifyCopyFuturesTpSl()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1375) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/modify-tpsl` | +| [cancelCopyFuturesTpSl()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1381) | :closed_lock_with_key: | POST | `/api/v3/copy/futures/cancel-tpsl` | +| [getCopyFuturesCurrentTpSlOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1387) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/current-tpsl-orders` | +| [getCopyFuturesTpSlOrderHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1393) | :closed_lock_with_key: | GET | `/api/v3/copy/futures/tpsl-order-history` | +| [getStockPlusOptionQuote()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1405) | :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#L1411) | :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#L1420) | :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#L1429) | :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#L1435) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/static` | +| [getStockPlusQuote()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1441) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/quote` | +| [getStockPlusTradeDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1447) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/trade` | +| [getStockPlusIntraday()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1453) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/intraday` | +| [getStockPlusHistoryCandlestick()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1459) | :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#L1468) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/candlestick` | +| [getStockPlusDepth()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1474) | :closed_lock_with_key: | GET | `/api/v3/stockplus/market/depth` | +| [placeStockPlusOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1480) | :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#L1486) | :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#L1492) | :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#L1498) | :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#L1504) | :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#L1510) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/order-detail` | +| [getStockPlusMaxPurchase()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1516) | :closed_lock_with_key: | GET | `/api/v3/stockplus/trade/max-purchase` | +| [getStockPlusTodayExecutions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1522) | :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#L1528) | :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#L1537) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/account` | +| [getStockPlusCashFlow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1543) | :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#L1549) | :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#L1555) | :closed_lock_with_key: | POST | `/api/v3/stockplus/asset/transfer` | +| [getStockPlusTransferRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1561) | :closed_lock_with_key: | GET | `/api/v3/stockplus/asset/transfer-records` | +| [getCfdTickers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1573) | :closed_lock_with_key: | GET | `/api/v3/cfd/market/tickers` | +| [getCfdHistoryCandlestick()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1579) | :closed_lock_with_key: | GET | `/api/v3/cfd/market/history-candlestick` | +| [placeCfdOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1585) | :closed_lock_with_key: | POST | `/api/v3/cfd/trade/place-order` | +| [modifyCfdOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1591) | :closed_lock_with_key: | POST | `/api/v3/cfd/trade/modify-order` | +| [cancelCfdOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1597) | :closed_lock_with_key: | POST | `/api/v3/cfd/trade/cancel-order` | +| [cancelAllCfdOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1601) | :closed_lock_with_key: | POST | `/api/v3/cfd/trade/cancel-all` | +| [closeCfdPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1607) | :closed_lock_with_key: | POST | `/api/v3/cfd/trade/close-positions` | +| [closeAllCfdPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1613) | :closed_lock_with_key: | POST | `/api/v3/cfd/trade/close-all-positions` | +| [getCfdUnfilledOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1619) | :closed_lock_with_key: | GET | `/api/v3/cfd/trade/unfilled-order` | +| [getCfdOrderHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1630) | :closed_lock_with_key: | GET | `/api/v3/cfd/trade/history-order` | +| [getCfdCurrentPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1636) | :closed_lock_with_key: | GET | `/api/v3/cfd/trade/current-positions` | +| [getCfdFundDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1642) | :closed_lock_with_key: | GET | `/api/v3/cfd/account/fund-detail` | +| [cfdTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1646) | :closed_lock_with_key: | POST | `/api/v3/cfd/account/transfer` | +| [getCfdTransferRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1652) | :closed_lock_with_key: | GET | `/api/v3/cfd/account/transfer-records` | +| [getCfdFinancialRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1658) | :closed_lock_with_key: | GET | `/api/v3/cfd/account/financial-records` | +| [getCfdInstruments()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1664) | :closed_lock_with_key: | GET | `/api/v3/cfd/account/instruments` | +| [getBalances()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1679) | :closed_lock_with_key: | GET | `/api/v3/account/assets` | +| [getFundingAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1686) | :closed_lock_with_key: | GET | `/api/v3/account/funding-assets` | +| [getAccountInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1696) | :closed_lock_with_key: | GET | `/api/v3/account/info` | +| [getAccountSettings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1704) | :closed_lock_with_key: | GET | `/api/v3/account/settings` | +| [adjustAccountMode()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1711) | :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#L1721) | :closed_lock_with_key: | GET | `/api/v3/account/delta-info` | +| [setLeverage()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1730) | :closed_lock_with_key: | POST | `/api/v3/account/set-leverage` | +| [setHoldMode()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1737) | :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#L1746) | :closed_lock_with_key: | GET | `/api/v3/account/collateral-type` | +| [setCollateralType()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1753) | :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#L1762) | | GET | `/api/v3/account/custom-collateral-coins` | +| [preSetLeverage()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1769) | :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#L1778) | :closed_lock_with_key: | POST | `/api/v3/account/set-margin` | +| [getMaxWithdrawal()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1785) | :closed_lock_with_key: | GET | `/api/v3/account/max-withdrawal` | +| [getFinancialRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1794) | :closed_lock_with_key: | GET | `/api/v3/account/financial-records` | +| [getFundingFinancialRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1808) | :closed_lock_with_key: | GET | `/api/v3/account/funding-financial-records` | +| [getRepayableCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1822) | :closed_lock_with_key: | GET | `/api/v3/account/repayable-coins` | +| [getPaymentCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1834) | :closed_lock_with_key: | GET | `/api/v3/account/payment-coins` | +| [submitRepay()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1846) | :closed_lock_with_key: | POST | `/api/v3/account/repay` | +| [borrow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1850) | :closed_lock_with_key: | POST | `/api/v3/account/borrow` | +| [getMaxBorrowable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1854) | :closed_lock_with_key: | GET | `/api/v3/account/max-borrowable` | +| [setRepayMode()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1860) | :closed_lock_with_key: | POST | `/api/v3/account/set-repay-mode` | +| [getConvertRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1869) | :closed_lock_with_key: | GET | `/api/v3/account/convert-records` | +| [getSmallAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1878) | :closed_lock_with_key: | GET | `/api/v3/convert/small-assets` | +| [tradeSmallAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1884) | :closed_lock_with_key: | POST | `/api/v3/convert/small-assets-trade` | +| [getSmallAssetsHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1890) | :closed_lock_with_key: | GET | `/api/v3/convert/small-assets-history` | +| [setDepositAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1905) | :closed_lock_with_key: | POST | `/api/v3/account/deposit-account` | +| [switchDeduct()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1914) | :closed_lock_with_key: | POST | `/api/v3/account/switch-deduct` | +| [getDeductInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1921) | :closed_lock_with_key: | GET | `/api/v3/account/deduct-info` | +| [getFeeRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1932) | :closed_lock_with_key: | GET | `/api/v3/account/fee-rate` | +| [getAllFeeRates()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1944) | :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#L1957) | :closed_lock_with_key: | GET | `/api/v3/account/max-transferable` | +| [getOpenInterestLimit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1969) | :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#L1975) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-symbols` | +| [getEligibleMarginTier()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1981) | :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#L1987) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-loan-info` | +| [getEligibleDiscountRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L1993) | :closed_lock_with_key: | GET | `/api/v3/account/eligible-discount-rate` | +| [downgradeAccountToClassic()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2008) | :closed_lock_with_key: | POST | `/api/v3/account/switch` | +| [getUnifiedAccountSwitchStatus()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2016) | :closed_lock_with_key: | GET | `/api/v3/account/switch-status` | +| [getTaxRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2032) | :closed_lock_with_key: | GET | `/api/v3/tax/records` | +| [createSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2047) | :closed_lock_with_key: | POST | `/api/v3/user/create-sub` | +| [createAgentSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2056) | :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#L2065) | :closed_lock_with_key: | POST | `/api/v3/user/freeze-sub` | +| [deleteSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2071) | :closed_lock_with_key: | POST | `/api/v3/user/delete-sub` | +| [getSubUnifiedAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2080) | :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#L2089) | :closed_lock_with_key: | GET | `/api/v3/user/sub-list` | +| [createSubAccountApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2102) | :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#L2111) | :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#L2120) | :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#L2129) | :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#L2143) | :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#L2154) | :closed_lock_with_key: | POST | `/api/v3/user/set-rate-limit-quota` | +| [createStpGroup()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2164) | :closed_lock_with_key: | POST | `/api/v3/account/create-stp-groups` | +| [getStpGroups()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2174) | :closed_lock_with_key: | GET | `/api/v3/account/stp-groups` | +| [addStpGroupMembers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2184) | :closed_lock_with_key: | POST | `/api/v3/account/add-groups-members` | +| [removeStpGroupMembers()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2196) | :closed_lock_with_key: | POST | `/api/v3/account/remove-groups-members` | +| [getTransferableCoins()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2211) | :closed_lock_with_key: | GET | `/api/v3/account/transferable-coins` | +| [submitTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2220) | :closed_lock_with_key: | POST | `/api/v3/account/transfer` | +| [subAccountTransfer()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2229) | :closed_lock_with_key: | POST | `/api/v3/account/sub-transfer` | +| [getSubTransferRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2241) | :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#L2253) | :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#L2271) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-address` | +| [getSubDepositAddress()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2280) | :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#L2289) | :closed_lock_with_key: | GET | `/api/v3/account/deposit-records` | +| [getSubDepositRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2298) | :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#L2313) | :closed_lock_with_key: | POST | `/api/v3/account/withdraw` | +| [getWithdrawRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2322) | :closed_lock_with_key: | GET | `/api/v3/account/withdrawal-records` | +| [getWithdrawAddressBook()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2331) | :closed_lock_with_key: | GET | `/api/v3/account/withdraw-address` | +| [cancelWithdrawal()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2340) | :closed_lock_with_key: | POST | `/api/v3/account/cancel-withdrawal` | +| [submitNewOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2358) | :closed_lock_with_key: | POST | `/api/v3/trade/place-order` | +| [modifyOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2367) | :closed_lock_with_key: | POST | `/api/v3/trade/modify-order` | +| [placeRealityOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2376) | :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#L2385) | :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#L2394) | :closed_lock_with_key: | GET | `/api/v3/trade/loan-data` | +| [cancelOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2401) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-order` | +| [placeBatchOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2410) | :closed_lock_with_key: | POST | `/api/v3/trade/place-batch` | +| [batchModifyOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2419) | :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#L2428) | :closed_lock_with_key: | POST | `/api/v3/trade/cancel-batch` | +| [cancelAllOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2437) | :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#L2446) | :closed_lock_with_key: | POST | `/api/v3/trade/close-positions` | +| [getOrderInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2455) | :closed_lock_with_key: | GET | `/api/v3/trade/order-info` | +| [getUnfilledOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2464) | :closed_lock_with_key: | GET | `/api/v3/trade/unfilled-orders` | +| [getHistoryOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2476) | :closed_lock_with_key: | GET | `/api/v3/trade/history-orders` | +| [movePositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2488) | :closed_lock_with_key: | POST | `/api/v3/account/move-positions` | +| [getMovePositionHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2497) | :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#L2509) | :closed_lock_with_key: | GET | `/api/v3/trade/fills` | +| [getCurrentPosition()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2521) | :closed_lock_with_key: | GET | `/api/v3/position/current-position` | +| [getPositionHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2536) | :closed_lock_with_key: | GET | `/api/v3/position/history-position` | +| [getMaxOpenAvailable()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2550) | :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#L2559) | :closed_lock_with_key: | GET | `/api/v3/position/adlRank` | +| [countdownCancelAll()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2566) | :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#L2581) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/transfered` | +| [getLoanSymbols()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2590) | :closed_lock_with_key: | GET | `/api/v3/ins-loan/symbols` | +| [getLoanRiskUnit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2599) | :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#L2610) | :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#L2619) | :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#L2628) | :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#L2637) | :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#L2646) | :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#L2658) | :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#L2673) | :closed_lock_with_key: | GET | `/api/v3/loan/coins` | +| [getLoanInterest()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2682) | :closed_lock_with_key: | GET | `/api/v3/loan/interest` | +| [loanBorrow()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2691) | :closed_lock_with_key: | POST | `/api/v3/loan/borrow` | +| [getLoanBorrowOngoing()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2700) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-ongoing` | +| [getLoanBorrowHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2709) | :closed_lock_with_key: | GET | `/api/v3/loan/borrow-history` | +| [loanRepay()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2718) | :closed_lock_with_key: | POST | `/api/v3/loan/repay` | +| [getLoanRepayHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2727) | :closed_lock_with_key: | GET | `/api/v3/loan/repay-history` | +| [loanRevisePledge()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2736) | :closed_lock_with_key: | POST | `/api/v3/loan/revise-pledge` | +| [getLoanPledgeRateHistory()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2745) | :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#L2754) | :closed_lock_with_key: | GET | `/api/v3/loan/debts` | +| [getLoanReduces()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2761) | :closed_lock_with_key: | GET | `/api/v3/loan/reduces` | +| [submitStrategyOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2776) | :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#L2785) | :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#L2794) | :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#L2803) | :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#L2812) | :closed_lock_with_key: | GET | `/api/v3/trade/history-strategy-orders` | +| [getStrategySubOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2822) | :closed_lock_with_key: | GET | `/api/v3/trade/strategy-sub-orders` | +| [validateGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2837) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/validate` | +| [createGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2843) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/create-bot` | +| [modifyGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2849) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/modify-bot` | +| [modifyGridInterval()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2855) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/modify-grid-interval` | +| [addGridInvestment()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2861) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/add-investment` | +| [closeGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2867) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/close-bot` | +| [getGridBotDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2873) | :closed_lock_with_key: | GET | `/api/v3/trade/grid/bot-detail` | +| [getGridBotOrderDetails()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2879) | :closed_lock_with_key: | GET | `/api/v3/trade/grid/list-details` | +| [validateNeutralGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2885) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/validate-neutral` | +| [createNeutralGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2891) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/create-neutral-bot` | +| [modifyNeutralGridBot()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2897) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/modify-neutral-bot` | +| [modifyNeutralGridInterval()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2903) | :closed_lock_with_key: | POST | `/api/v3/trade/grid/modify-neutral-grid-interval` | +| [getNeutralGridBotDetail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2912) | :closed_lock_with_key: | GET | `/api/v3/trade/grid/neutral-bot-detail` | +| [getNeutralGridBotOrderDetails()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2918) | :closed_lock_with_key: | GET | `/api/v3/trade/grid/neutral-list-details` | +| [createBrokerSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2936) | :closed_lock_with_key: | POST | `/api/v3/broker/create-sub` | +| [getBrokerSubAccountList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2948) | :closed_lock_with_key: | GET | `/api/v3/broker/sub-list` | +| [modifyBrokerSubAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2960) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-sub` | +| [brokerSubWithdrawal()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2975) | :closed_lock_with_key: | POST | `/api/v3/broker/sub-withdrawal` | +| [getBrokerSubDepositAddress()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L2987) | :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#L2999) | :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#L3011) | :closed_lock_with_key: | GET | `/api/v3/broker/commission` | +| [createBrokerSubApiKey()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3023) | :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#L3035) | :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#L3051) | :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#L3063) | :closed_lock_with_key: | GET | `/api/v3/broker/query-sub-apikey` | +| [getAgentCustomerList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3079) | :closed_lock_with_key: | GET | `/api/v3/affiliate/customer-list` | +| [getAgentCustomerAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3088) | :closed_lock_with_key: | GET | `/api/v3/affiliate/customer-asset` | +| [getAgentCustomerTradeVolume()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3097) | :closed_lock_with_key: | GET | `/api/v3/affiliate/customer-trade-volume` | +| [getAgentCustomerDeposits()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3106) | :closed_lock_with_key: | GET | `/api/v3/affiliate/customer-deposit` | +| [getAgentCustomerKycResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3115) | :closed_lock_with_key: | GET | `/api/v3/affiliate/customer-kyc-result` | +| [getAgentCustomerCommissions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3124) | :closed_lock_with_key: | GET | `/api/v3/affiliate/customer-commission` | +| [getAgentSubCustomerList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3134) | :closed_lock_with_key: | GET | `/api/v3/affiliate/sub-customer-list` | +| [getSubAffiliateInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3143) | :closed_lock_with_key: | GET | `/api/v3/affiliate/sub-affiliate-info` | +| [getSubAffiliateCommission()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3152) | :closed_lock_with_key: | GET | `/api/v3/affiliate/sub-affiliate-commission` | +| [modifySubaccountEmail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3170) | :closed_lock_with_key: | POST | `/api/v3/broker/modify-subaccount-email` | +| [getSubaccountEmail()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3179) | :closed_lock_with_key: | GET | `/api/v3/broker/subaccount-email` | +| [getBrokerTradeVolume()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3189) | :closed_lock_with_key: | GET | `/api/v3/broker/trade-volume` | +| [getBrokerTotalCommission()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3198) | :closed_lock_with_key: | GET | `/api/v3/broker/total-commission` | +| [getBrokerOrderCommission()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3207) | :closed_lock_with_key: | GET | `/api/v3/broker/order-commission` | +| [getBrokerRebateInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3216) | :closed_lock_with_key: | GET | `/api/v3/broker/rebate-info` | +| [getP2pAdList()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3228) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-list` | +| [getP2pExchangeRate()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3234) | :closed_lock_with_key: | GET | `/api/v3/p2p/exchange-rate` | +| [simulateP2pFee()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3240) | :closed_lock_with_key: | POST | `/api/v3/p2p/fee-simulate` | +| [getP2pAdLimit()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3246) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-limit` | +| [createP2pAd()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3252) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-create` | +| [updateP2pAd()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3258) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-update` | +| [operateP2pAd()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3262) | :closed_lock_with_key: | POST | `/api/v3/p2p/ad-operate` | +| [getP2pAdInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3266) | :closed_lock_with_key: | GET | `/api/v3/p2p/ad-info` | +| [getP2pMyAds()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3272) | :closed_lock_with_key: | GET | `/api/v3/p2p/my-ads` | +| [getP2pPendingOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3278) | :closed_lock_with_key: | GET | `/api/v3/p2p/pending-orders` | +| [getP2pAllOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3284) | :closed_lock_with_key: | GET | `/api/v3/p2p/all-orders` | +| [getP2pOrderInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3290) | :closed_lock_with_key: | GET | `/api/v3/p2p/order-info` | +| [confirmP2pOrderPayment()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3296) | :closed_lock_with_key: | POST | `/api/v3/p2p/order-pay` | +| [releaseP2pOrderAsset()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3302) | :closed_lock_with_key: | POST | `/api/v3/p2p/order-release` | +| [getP2pUserInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3308) | :closed_lock_with_key: | GET | `/api/v3/p2p/user-info` | +| [getP2pCurrencies()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3312) | :closed_lock_with_key: | GET | `/api/v3/p2p/currencies` | +| [getP2pPayMethods()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3316) | :closed_lock_with_key: | GET | `/api/v3/p2p/pay-method` | +| [getP2pBalance()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3320) | :closed_lock_with_key: | GET | `/api/v3/p2p/balance` | +| [getEarnSavingsProducts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3335) | :closed_lock_with_key: | GET | `/api/v3/earn/savings/product` | +| [getEarnSavingsAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3344) | :closed_lock_with_key: | GET | `/api/v3/earn/savings/account` | +| [getEarnSavingsAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3351) | :closed_lock_with_key: | GET | `/api/v3/earn/savings/assets` | +| [getEarnSavingsRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3360) | :closed_lock_with_key: | GET | `/api/v3/earn/savings/records` | +| [getEarnSavingsSubscription()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3369) | :closed_lock_with_key: | GET | `/api/v3/earn/savings/subscribe-info` | +| [earnSubscribeSavings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3378) | :closed_lock_with_key: | POST | `/api/v3/earn/savings/subscribe` | +| [getEarnSavingsSubscriptionResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3387) | :closed_lock_with_key: | GET | `/api/v3/earn/savings/subscribe-result` | +| [earnRedeemSavings()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3396) | :closed_lock_with_key: | POST | `/api/v3/earn/savings/redeem` | +| [getEarnSavingsRedemptionResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3405) | :closed_lock_with_key: | GET | `/api/v3/earn/savings/redeem-result` | +| [getSharkfinProducts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3420) | :closed_lock_with_key: | GET | `/api/v3/earn/sharkfin/product` | +| [getSharkfinAccount()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3429) | :closed_lock_with_key: | GET | `/api/v3/earn/sharkfin/account` | +| [getSharkfinAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3436) | :closed_lock_with_key: | GET | `/api/v3/earn/sharkfin/assets` | +| [getSharkfinRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3445) | :closed_lock_with_key: | GET | `/api/v3/earn/sharkfin/records` | +| [getSharkfinSubscription()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3454) | :closed_lock_with_key: | GET | `/api/v3/earn/sharkfin/subscribe-info` | +| [subscribeSharkfin()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3463) | :closed_lock_with_key: | POST | `/api/v3/earn/sharkfin/subscribe` | +| [getSharkfinSubscriptionResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3472) | :closed_lock_with_key: | GET | `/api/v3/earn/sharkfin/subscribe-result` | +| [getEarnEliteProducts()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3484) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-product` | +| [getEarnEliteAssets()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3488) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-assets` | +| [getEarnEliteRecords()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3492) | :closed_lock_with_key: | GET | `/api/v3/earn/elite-records` | +| [getEarnEliteSubscribeInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3498) | :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#L3504) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-subscribe` | +| [getEarnEliteSubscribeResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3510) | :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#L3516) | :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#L3522) | :closed_lock_with_key: | POST | `/api/v3/earn/elite-redeem` | +| [getEarnCashPlusSubscribeInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3539) | :closed_lock_with_key: | GET | `/api/v3/earn/cashplus/subscribe-info` | +| [subscribeEarnCashPlus()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3548) | :closed_lock_with_key: | POST | `/api/v3/earn/cashplus/subscribe` | +| [getEarnCashPlusSubscribeResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3557) | :closed_lock_with_key: | GET | `/api/v3/earn/cashplus/subscribe-result` | +| [getEarnCashPlusRedeemInfo()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3567) | :closed_lock_with_key: | GET | `/api/v3/earn/cashplus/redeem-info` | +| [redeemEarnCashPlus()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3574) | :closed_lock_with_key: | POST | `/api/v3/earn/cashplus/redeem` | +| [getEarnCashPlusRedeemResult()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3583) | :closed_lock_with_key: | GET | `/api/v3/earn/cashplus/redeem-result` | +| [getEarnCashPlusPositions()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3592) | :closed_lock_with_key: | GET | `/api/v3/earn/cashplus/positions` | +| [getEarnCashPlusHistoryOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/rest-client-v3.ts#L3599) | :closed_lock_with_key: | GET | `/api/v3/earn/cashplus/history-orders` | # websocket-api-client.ts @@ -671,8 +703,8 @@ This client provides WebSocket API endpoints which allow for faster interactions | Function | AUTH | HTTP Method | Endpoint | | -------- | :------: | :------: | -------- | | [submitNewOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L85) | | WS | `place-order` | -| [placeBatchOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L106) | | WS | `batch-place` | -| [cancelOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L130) | | WS | `cancel-order` | -| [cancelBatchOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L149) | | WS | `batch-cancel` | -| [updateOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L161) | | WS | `modify-order` | -| [batchUpdateOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L173) | | WS | `batch-modify` | \ No newline at end of file +| [placeBatchOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L104) | | WS | `batch-place` | +| [cancelOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L128) | | WS | `cancel-order` | +| [cancelBatchOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L147) | | WS | `batch-cancel` | +| [updateOrder()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L159) | | WS | `modify-order` | +| [batchUpdateOrders()](https://github.com/sieblyio/bitget-api/blob/master/src/websocket-api-client.ts#L171) | | WS | `batch-modify` | \ No newline at end of file diff --git a/llms.txt b/llms.txt index 8afe787..e024904 100644 --- a/llms.txt +++ b/llms.txt @@ -97,6 +97,7 @@ src/ spot.ts v3/ account.ts + affiliate.ts broker.ts cfd.ts copytrading.ts @@ -122,6 +123,7 @@ src/ spot.ts v3/ account.ts + affiliate.ts broker.ts cfd.ts copytrading.ts @@ -169,6 +171,75 @@ tsconfig.linting.json Files ================================================================ +================ +File: examples/auth/fasterHmacSign.ts +================ +import { createHmac } from 'crypto'; +⋮---- +import { + 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/auth/rest-private-rsa.md ================ @@ -282,6 +353,131 @@ const clientV3 = new RestClientV3({ For a complete example, refer to the [rest-private-rsa.ts](./rest-private-rsa.ts) file on GitHub. +================ +File: examples/auth/rest-private-rsa.ts +================ +import { RestClientV2, RestClientV3 } from '../../src/index.js'; +⋮---- +// Import frmo NPM: +// import { RestClientV2, RestClientV3 } from 'bitget-api'; +// or if you prefer require: +// const { RestClientV2, RestClientV3 } = require('bitget-api'); +⋮---- +// Received after creating a new API key with a self-generated RSA public key on Bitget +⋮---- +// The self-generated RSA private key, this is never directly given to Bitget, but used to generate a signature +// Note: this MUST include the "BEGIN PRIVATE KEY" header so that the SDK understands this is RSA auth +⋮---- +// This is set by you when registering your RSA API key in Bitget's website. +⋮---- +// const wsClient = new WebsocketClientV2({ +// apiKey: API_KEY, +// apiSecret: rsaPrivateKey, +// apiPass: API_PASS, +// }); + +================ +File: examples/V2 - Classic/Rest/rest-private-futures.ts +================ +import { RestClientV2 } from '../../../src/index.js'; +⋮---- +// or +// import { RestClientV2 } from 'bitget-api'; +⋮---- +// 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/rest-private-futures.ts +⋮---- +// note the single quotes, preventing special characters such as $ from being incorrectly passed +⋮---- +// apiKey: 'apiKeyHere', +// apiSecret: 'apiSecretHere', +// apiPass: 'apiPassHere', +⋮---- +/** 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 */ +⋮---- +startTime: fromTime.getTime() + '', // should be sent as a string +endTime: now.getTime() + '', // should be sent as a string + +================ +File: examples/V2 - Classic/Rest/rest-private-spot.ts +================ +import { RestClientV2 } from '../../../src/index.js'; +⋮---- +// or +// import { RestClientV2 } from 'bitget-api'; +⋮---- +// 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/rest-private-spot.ts +⋮---- +// note the single quotes, preventing special characters such as $ from being incorrectly passed +⋮---- +// apiKey: 'apiKeyHere', +// apiSecret: 'apiSecretHere', +// apiPass: 'apiPassHere', +⋮---- +/** 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 */ + +================ +File: examples/V2 - Classic/Rest/rest-public-futures.ts +================ +import { RestClientV2 } from '../../../src/index.js'; +⋮---- +// or +// import { RestClientV2 } from 'bitget-api'; +⋮---- +// Fetch the last 1000 1min candles for a symbol +⋮---- +const msPerCandle = 60 * 1000; // 60 seconds x 1000 + +================ +File: examples/V2 - Classic/Rest/rest-public-spot.ts +================ +import { RestClientV2 } from '../../../src/index.js'; +⋮---- +// or +// import { RestClientV2 } from 'bitget-api'; + +================ +File: examples/V3 - UTA/Rest/rest-private.ts +================ +import { RestClientV3 } from '../../../src/index.js'; +⋮---- +// or +// import { RestClientV3 } from 'bitget-api'; +⋮---- +// 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-private-futures.ts +⋮---- +// note the single quotes, preventing special characters such as $ from being incorrectly passed +⋮---- +// apiKey: 'apiKeyHere', +// apiSecret: 'apiSecretHere', +// apiPass: 'apiPassHere', +⋮---- +/** This is a simple script wrapped in a immediately invoked function expression, designed to check account assets for futures trading */ + +================ +File: examples/V3 - UTA/Rest/rest-public-UTA-futures.ts +================ +import { RestClientV3 } from '../../../src/index.js'; +⋮---- +// or +// import { RestClientV3 } from 'bitget-api'; + +================ +File: examples/V3 - UTA/Rest/rest-public-UTA-spot.ts +================ +import { RestClientV3 } from '../../../src/index.js'; +⋮---- +// or +// import { RestClientV3 } from 'bitget-api'; + ================ File: examples/README.md ================ @@ -1639,7 +1835,7 @@ private getSubRequest( instType: BitgetInstTypeV2, topic: WsTopicV2, coin: string = 'default', -): WsTopicRequest + ): WsTopicRequest ⋮---- /** * Subscribe to a topic @@ -1651,7 +1847,7 @@ public subscribeTopic( instType: BitgetInstTypeV2, topic: WsTopicV2, coin: string = 'default', -) + ) ⋮---- /** * Unsubscribe from a topic @@ -1663,7 +1859,7 @@ public unsubscribeTopic( instType: BitgetInstTypeV2, topic: WsTopicV2, coin: string = 'default', -) + ) ⋮---- /** * Request subscription to one or more topics. Pass topics as either an array of strings, @@ -1682,7 +1878,7 @@ public subscribe( | (WsTopicRequest | WsTopicV2) | (WsTopicRequest | WsTopicV2)[], wsKey: WsKey, -): Promise + ): Promise ⋮---- /** * Unsubscribe from one or more topics. Similar to subscribe() but in reverse. @@ -1695,7 +1891,7 @@ public unsubscribe( | (WsTopicRequest | WsTopicV2) | (WsTopicRequest | WsTopicV2)[], wsKey: WsKey, -) + ) ⋮---- /** * @@ -1716,7 +1912,7 @@ protected isWsPong(data: any): boolean protected isPrivateTopicRequest( _request: WsTopicRequest, wsKey: WsKey, -): boolean + ): boolean ⋮---- protected getPrivateWSKeys(): WsKey[] ⋮---- @@ -1732,7 +1928,7 @@ protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null protected async getWsRequestEvents( operation: WSOperation, requests: WsTopicRequest[], -): Promise>[]> + ): Promise>[]> ⋮---- // Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values ⋮---- @@ -1767,18 +1963,18 @@ protected async getWsRequestEvents( ⋮---- private async getWsAuthSignature( wsKey: WsKey, -): Promise< + ): Promise<{ expiresAt: number; signature: string }> ⋮---- private async signMessage( paramsStr: string, secret: string, method: SignEncodeMethod, algorithm: SignAlgorithm, -): Promise + ): Promise ⋮---- protected async getWsAuthRequestEvent( wsKey: WsKey, -): Promise> + ): Promise> ⋮---- /** * Abstraction called to sort ws events into emittable event types (response to a request, data update, etc) @@ -1786,7 +1982,7 @@ protected async getWsAuthRequestEvent( protected resolveEmittableEvents( wsKey: WsKey, event: MessageEventLike, -): EmittableEvent[] + ): EmittableEvent[] ⋮---- // v2 event processing ⋮---- @@ -2171,40 +2367,21 @@ File: tsconfig.linting.json } ================ -File: examples/auth/rest-private-rsa.ts -================ -import { RestClientV2, RestClientV3 } from '../../src/index.js'; -⋮---- -// Import frmo NPM: -// import { RestClientV2, RestClientV3 } from 'bitget-api'; -// or if you prefer require: -// const { RestClientV2, RestClientV3 } = require('bitget-api'); -⋮---- -// Received after creating a new API key with a self-generated RSA public key on Bitget -⋮---- -// The self-generated RSA private key, this is never directly given to Bitget, but used to generate a signature -// Note: this MUST include the "BEGIN PRIVATE KEY" header so that the SDK understands this is RSA auth -⋮---- -// This is set by you when registering your RSA API key in Bitget's website. -⋮---- -// const wsClient = new WebsocketClientV2({ -// apiKey: API_KEY, -// apiSecret: rsaPrivateKey, -// apiPass: API_PASS, -// }); - -================ -File: examples/V2 - Classic/Rest/rest-private-futures.ts +File: examples/V2 - Classic/Rest/rest-trade-futures.ts ================ -import { RestClientV2 } from '../../../src/index.js'; +import { + FuturesPlaceOrderRequestV2, + RestClientV2, + WebsocketClientV2, +} from '../../../src/index.js'; ⋮---- // or -// import { RestClientV2 } from 'bitget-api'; +// 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/rest-private-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 ⋮---- @@ -2212,64 +2389,54 @@ import { RestClientV2 } from '../../../src/index.js'; // apiSecret: 'apiSecretHere', // apiPass: 'apiPassHere', ⋮---- -/** 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 */ +function logWSEvent(type: string, data: any) ⋮---- -startTime: fromTime.getTime() + '', // should be sent as a string -endTime: now.getTime() + '', // should be sent as a string - -================ -File: examples/V2 - Classic/Rest/rest-private-spot.ts -================ -import { RestClientV2 } from '../../../src/index.js'; +// simple sleep function +function promiseSleep(milliseconds: number) ⋮---- -// or -// import { RestClientV2 } from 'bitget-api'; +/** + * 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 + * + */ ⋮---- -// read from environmental variables +// Add event listeners to log websocket events on account ⋮---- -// 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-private-spot.ts -⋮---- -// note the single quotes, preventing special characters such as $ from being incorrectly passed -⋮---- -// apiKey: 'apiKeyHere', -// apiSecret: 'apiSecretHere', -// apiPass: 'apiPassHere', +// futures private +// : account updates ⋮---- -/** 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 */ - -================ -File: examples/V2 - Classic/Rest/rest-public-futures.ts -================ -import { RestClientV2 } from '../../../src/index.js'; +// : position updates ⋮---- -// or -// import { RestClientV2 } from 'bitget-api'; +// : order updates ⋮---- -// Fetch the last 1000 1min candles for a symbol +// 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 msPerCandle = 60 * 1000; // 60 seconds x 1000 - -================ -File: examples/V2 - Classic/Rest/rest-public-spot.ts -================ -import { RestClientV2 } from '../../../src/index.js'; +// const balances = allBalances.filter((bal) => Number(bal.available) != 0); ⋮---- -// or -// import { RestClientV2 } from 'bitget-api'; +// Loop through any active positions and send a closing market order on each position ================ -File: examples/V3 - UTA/Rest/rest-private.ts +File: examples/V2 - Classic/Rest/rest-trade-spot.ts ================ -import { RestClientV3 } from '../../../src/index.js'; +import { + RestClientV2, + SpotOrderRequestV2, + WebsocketClientV2, +} from '../../../src/index.js'; ⋮---- -// or -// import { RestClientV3 } from 'bitget-api'; +// 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-private-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-spot.ts ⋮---- // note the single quotes, preventing special characters such as $ from being incorrectly passed ⋮---- @@ -2277,970 +2444,687 @@ import { RestClientV3 } from '../../../src/index.js'; // apiSecret: 'apiSecretHere', // apiPass: 'apiPassHere', ⋮---- -/** This is a simple script wrapped in a immediately invoked function expression, designed to check account assets for futures trading */ +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 +// 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/V3 - UTA/Rest/rest-public-UTA-futures.ts +File: examples/V2 - Classic/Websocket/ws-demo-trading.ts ================ -import { RestClientV3 } from '../../../src/index.js'; +import { DefaultLogger, WebsocketClientV2 } from '../../../src/index.js'; ⋮---- // or -// import { RestClientV3 } from 'bitget-api'; +// 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 +// }, +⋮---- +// Set demoTrading to true, to route all connections to the demo trading wss URLs: +⋮---- +// If using private topics, make sure to include API keys +⋮---- +// console.log('WS raw message received ', JSON.stringify(data, null, 2)); +⋮---- +/** + * Public events + */ ================ -File: examples/V3 - UTA/Rest/rest-public-UTA-spot.ts +File: examples/V2 - Classic/Websocket/ws-private.ts ================ -import { RestClientV3 } from '../../../src/index.js'; +import { DefaultLogger, WebsocketClientV2 } from '../../../src/index.js'; ⋮---- // or -// import { RestClientV3 } from 'bitget-api'; - -================ -File: src/constants/enum.ts -================ -/** Parameter verification exception margin mode == FIXED */ - -================ -File: src/types/request/v2/earn.ts -================ -/** - * - * - * Earn | Savings - * - * - */ +// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; ⋮---- -export interface GetEarnSavingsAssetsRequestV2 { - periodType: string; - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: 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 GetEarnSavingsRecordsRequestV2 { - coin?: string; - periodType: string; - orderType?: string; - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: string; -} +// note the single quotes, preventing special characters such as $ from being incorrectly passed ⋮---- -export interface RedeemSavingsRequestV2 { - productId: string; - orderId?: string; - periodType: string; - amount: string; -} +// restOptions: { +// optionally provide rest options, e.g. to pass through a proxy +// }, ⋮---- -/** - * - * - * Earn | Shark Fin - * - * - */ +// console.log('WS raw message received ', JSON.stringify(data, null, 2)); ⋮---- -export interface GetSharkfinAssetsRequestV2 { - status: string; - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: string; -} +// auth happens async after the ws connection opens ⋮---- -export interface GetSharkfinRecordsRequestV2 { - coin?: string; - type: string; - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: string; -} +// wsClient.subscribePublicSpotTickers(['BTCUSDT', 'LTCUSDT']); ⋮---- /** - * - * - * Earn | Loan - * - * - */ + * Private account updates + */ ⋮---- -export interface GetLoanEstInterestAndBorrowableRequestV2 { - loanCoin: string; - pledgeCoin: string; - daily: 'SEVEN' | 'THIRTY'; - pledgeAmount?: string; -} +// spot private +// : account updates ⋮---- -export interface BorrowLoanRequestV2 { - loanCoin: string; - pledgeCoin: string; - daily: 'SEVEN' | 'THIRTY'; - pledgeAmount?: string; - loanAmount?: string; -} +// : order updates (note: symbol is required) +// wsClient.subscribeTopic('SPOT', 'orders', 'BTCUSDT'); ⋮---- -export interface RepayLoanRequestV2 { - orderId: string; - amount?: string; - repayUnlock?: string; - repayAll: string; -} +// futures private +// : account updates ⋮---- -export interface GetLoanRepayHistoryRequestV2 { - orderId?: string; - loanCoin?: string; - pledgeCoin?: string; - startTime: string; - endTime: string; - pageNo?: string; - pageSize?: string; -} +// : position updates +// wsClient.subscribeTopic('USDT-FUTURES', 'positions'); ⋮---- -export interface ModifyLoanPledgeRateRequestV2 { - orderId: string; - amount: string; - pledgeCoin: string; - reviseType: string; -} +// : order updates +// wsClient.subscribeTopic('USDT-FUTURES', 'orders'); ⋮---- -export interface GetLoanPledgeRateHistoryRequestV2 { - orderId?: string; - reviseSide?: string; - pledgeCoin?: string; - startTime: string; - endTime: string; - pageNo?: string; - pageSize?: string; -} +// : plan order updates +// wsClient.subscribeTopic('USDT-FUTURES', 'orders-algo'); ⋮---- -export interface GetLoanHistoryRequestV2 { - orderId?: string; - loanCoin?: string; - pledgeCoin?: string; - status?: string; - startTime: string; - endTime: string; - pageNo?: string; - pageSize?: string; -} +// wsClient +// .getWsStore() +// .getKeys() +// .forEach((wsKey) => { +// const state = wsClient.getWsStore().get(wsKey); +// console.log(`${wsKey} state: `, state.subscribedTopics.values()); +// }); ⋮---- -export interface GetLiquidationRecordsRequestV2 { - orderId?: string; - loanCoin?: string; - pledgeCoin?: string; - status?: string; - startTime: string; - endTime: string; - pageNo?: string; - pageSize?: string; -} +// setTimeout(() => { +// wsClient.unsubscribeTopic('USDT-FUTURES', 'account'); +// }, 1000 * 2); ⋮---- -/** - * - * - * Earn | On-Chain Elite - * - * - */ -⋮---- -export interface GetEarnEliteRecordsRequestV2 { - type: 'subscribe' | 'redeem' | 'interest'; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; -} -⋮---- -export interface GetEarnEliteSubscribeInfoRequestV2 { - productId: string; -} -⋮---- -export interface EarnEliteSubscribeRequestV2 { - productSubId: string; - amount: string; - coin?: string; - paymentAccount?: 'spot' | 'unified'; -} -⋮---- -export interface GetEarnEliteSubscribeResultRequestV2 { - orderId: string; -} -⋮---- -export interface GetEarnEliteRedeemInfoRequestV2 { - productId: string; -} -⋮---- -export interface RedeemEarnEliteRequestV2 { - productId: string; - productSubId: string; - redeemType: 'fast' | 'standard'; - amount: string; - receiveAccount: 'spot' | 'unified'; - advancedSettle?: 'yes' | 'no'; - coin?: string; -} +// setTimeout(() => { +// wsClient +// .getWsStore() +// .getKeys() +// .forEach((wsKey) => { +// const state = wsClient.getWsStore().get(wsKey); +// console.log(`${wsKey} state: `, state.subscribedTopics.values()); +// }); +// }, 1000 * 5); ================ -File: src/types/request/v2/futures.ts +File: examples/V2 - Classic/Websocket/ws-public.ts ================ -import { FuturesPlanTypeV2, FuturesProductTypeV2 } from '../shared.js'; +import { + DefaultLogger, + WebsocketClientV2, + WS_KEY_MAP, +} from '../../../src/index.js'; ⋮---- -export type FuturesKlineInterval = - | '1m' - | '3m' - | '5m' - | '15m' - | '30m' - | '1H' - | '2H' - | '4H' - | '6H' - | '12H' - | '1D' - | '3D' - | '1W' - | '1M' - | '6Hutc' - | '12Hutc' - | '1Dutc' - | '3Dutc' - | '1Wutc' - | '1Mutc'; +// or +// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; ⋮---- -export type FuturesKlineTypeV2 = 'MARKET' | 'MARK' | 'INDEX'; +// restOptions: { +// optionally provide rest options, e.g. to pass through a proxy +// }, ⋮---- -export interface FuturesAccountBillRequestV2 { - productType: FuturesProductTypeV2; - symbol?: string; - coin?: string; - businessType?: string; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; -} +// console.log('WS raw message received ', JSON.stringify(data, null, 2)); ⋮---- /** - * - * * Futures | Market - * - */ + * Public events + */ ⋮---- -export interface FuturesMergeDepthRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - precision?: 'scale0' | 'scale1' | 'scale2' | 'scale3'; - limit?: '1' | '5' | '15' | '50' | 'max'; -} +// Spot public ⋮---- -export interface FuturesOiLimitRequestV2 { - productType: FuturesProductTypeV2; - symbol?: string; -} +// tickers ⋮---- -export interface FuturesPositionAdlRankRequestV2 { - productType: FuturesProductTypeV2; -} +// candles +// wsClient.subscribeTopic('SPOT', 'candle1m', symbol); ⋮---- -export interface FuturesRecentTradesRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - limit?: string; -} +// orderbook updates +// wsClient.subscribeTopic('SPOT', 'books', symbol); ⋮---- -export interface FuturesHistoricTradesRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - limit?: string; - idLessThan?: string; - startTime?: string; - endTime?: string; -} +// trades +// wsClient.subscribeTopic('SPOT', 'trade', symbol); ⋮---- -export interface FuturesCandlesRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - granularity: FuturesKlineInterval; - startTime?: string; - endTime?: string; - kLineType?: FuturesKlineTypeV2; - limit?: string; -} +// Futures public ⋮---- -/** - * - * * Futures | Account - * - */ +// tickers +// wsClient.subscribeTopic('USDT-FUTURES', 'ticker', symbol); ⋮---- -export interface FuturesSingleAccountRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; -} +// candles +// wsClient.subscribeTopic('USDT-FUTURES', 'candle1m', symbol); ⋮---- -export interface FuturesInterestHistoryRequestV2 { - productType: 'USDT-FUTURES' | 'SUSDT-FUTURES'; - coin?: string; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; -} +// orderbook updates +// wsClient.subscribeTopic('USDT-FUTURES', 'books', symbol); ⋮---- -export interface FuturesOpenCountRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - openAmount: string; - openPrice: string; - leverage?: string; -} +// trades +// wsClient.subscribeTopic('USDT-FUTURES', 'trade', symbol); ⋮---- -export interface FuturesSetAutoMarginRequestV2 { - symbol: string; - autoMargin: 'on' | 'off'; - marginCoin: string; - amount: string; - holdSide?: 'long' | 'short'; -} +// 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'; ⋮---- -export interface FuturesSetLeverageRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - leverage: string; - holdSide?: 'long' | 'short'; -} +// or +// import { PlaceOrderRequestV3, RestClientV3, WebsocketClientV3 } from '../src'; ⋮---- -export interface FuturesSetPositionMarginRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - holdSide: 'long' | 'short'; - amount: string; -} +// read from environmental variables ⋮---- -export interface FuturesSetMarginModeRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - marginMode: 'isolated' | 'crossed'; -} +// 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). * - * * Futures | Position + * 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 * */ ⋮---- -export interface FuturesHistoricalPositionsRequestV2 { - symbol?: string; - productType?: FuturesProductTypeV2; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; -} +// Add event listeners to log websocket events on account ⋮---- -/** - * - * * Futures | Trade - * - */ +// Subscribe to private topics for UTA account ⋮---- -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'; -} +// Subscribe to position updates ⋮---- -export interface FuturesReversalOrderRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - size: string; - side?: 'buy' | 'sell'; - tradeSide?: 'open' | 'close'; - clientOid?: string; -} +// Subscribe to order updates ⋮---- -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'; -} +// 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 FuturesBatchOrderRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - marginMode: 'isolated' | 'crossed'; - orderList: FuturesBatchOrderItem[]; -} +// 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'; ⋮---- -export interface FuturesModifyOrderRequestV2 { - orderId?: string; - clientOid?: string; - symbol: string; - productType: FuturesProductTypeV2; - newClientOid: string; - newSize?: string; - newPrice?: string; - newPresetStopSurplusPrice?: string; - newPresetStopLossPrice?: string; -} +// import { RestClientV3, WebsocketClientV3 } from '../src/index'; ⋮---- -export interface FuturesCancelOrderRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin?: string; - orderId?: string; - clientOid?: string; -} +// read from environmental variables ⋮---- -interface FuturesBatchCancelOrderItem { - orderId?: string; - clientOid?: 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/V3/rest-trade-spot.ts ⋮---- -export interface FuturesBatchCancelOrderRequestV2 { - orderIdList?: FuturesBatchCancelOrderItem[]; - symbol?: string; - productType: FuturesProductTypeV2; - marginCoin?: string; -} +// note the single quotes, preventing special characters such as $ from being incorrectly passed ⋮---- -export interface FuturesFlashClosePositionsRequestV2 { - symbol?: string; - productType: FuturesProductTypeV2; - holdSide?: 'long' | 'short'; -} +// apiKey: 'apiKeyHere', +// apiSecret: 'apiSecretHere', +// apiPass: 'apiPassHere', ⋮---- -export interface FuturesGetOrderRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - orderId?: string; - clientOid?: string; -} +function logWSEvent(type: string, data: any) ⋮---- -export interface FuturesGetOrderFillsRequestV2 { - orderId?: string; - symbol?: string; - productType: FuturesProductTypeV2; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; -} +// simple sleep function +function promiseSleep(milliseconds: number) ⋮---- -export interface FuturesGetHistoricalFillsRequestV2 { - orderId?: string; - symbol?: string; - productType: FuturesProductTypeV2; - startTime?: string; - endTime?: string; - idLessThan?: string; - limit?: string; -} +/** 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 */ ⋮---- -export interface FuturesGetOpenOrdersRequestV2 { - orderId?: string; - clientOid?: string; - symbol?: string; - productType: FuturesProductTypeV2; - status?: 'live' | 'partially_filled'; - idLessThan?: string; - startTime?: string; - endTime?: string; - limit?: string; -} +// Add event listeners to log websocket events on account ⋮---- -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'; +// Subscribe to private account topics +// Account updates for UTA (unified trading account) ⋮---- -export interface FuturesGetHistoryOrdersRequestV2 { - orderId?: string; - clientOid?: string; - symbol?: string; - productType: FuturesProductTypeV2; - idLessThan?: string; - orderSource?: FuturesOrderSourceV2; - startTime?: string; - endTime?: string; - limit?: string; -} +// Order updates for spot ⋮---- -export interface FuturesCancelAllOrdersRequestV2 { - symbol?: string; - productType: FuturesProductTypeV2; - marginCoin?: string; - requestTime?: string; - receiveWindow?: string; -} +// 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'; ⋮---- -/** - * - * * Futures | Trigger Orders - * - */ +// or +// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; ⋮---- -export type FuturesTriggerTypeV2 = 'fill_price' | 'mark_price'; +// 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 type FuturesStpModeV2 = - | 'none' - | 'cancel_taker' - | 'cancel_maker' - | 'cancel_both'; +// console.log('WS raw message received ', JSON.stringify(data, null, 2)); ⋮---- -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; -} +// You can subscribe to one topic at a time ⋮---- -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; -} +instType: 'UTA', // Note: all account events go on the UTA instType ⋮---- -export type FuturesTriggerPriceTypeV2 = - | 'fill_price' - | 'mark_price' - | 'index_price'; +WS_KEY_MAP.v3Private, // This parameter points to private or public ⋮---- -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; -} -⋮---- -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; -} +// Note: all account events go on the UTA instType ⋮---- -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; -} +// Or multiple at once: ⋮---- -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; -} +// 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'; ⋮---- -interface FuturesCancelPlanOrderItemV2 { - orderId?: string; - clientOid?: string; -} +// or +// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; ⋮---- -export type FuturesPlanOrderTypeV2 = - | 'normal_plan' - | 'profit_plan' - | 'loss_plan' - | 'pos_profit' - | 'pos_loss' - | 'moving_plan'; +// console.log('WS raw message received ', JSON.stringify(data, null, 2)); ⋮---- -export interface FuturesCancelPlanOrderRequestV2 { - orderIdList?: FuturesCancelPlanOrderItemV2[]; - symbol?: string; - productType: FuturesProductTypeV2; - marginCoin?: string; - planType?: FuturesPlanOrderTypeV2; -} +/** + * Public events + */ ⋮---- -export type FuturesPlanStatusV2 = 'executed' | 'fail_trigger' | 'cancelled'; +// You can subscribe to one topic at a time ⋮---- -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; -} +WS_KEY_MAP.v3Public, // This parameter points to private or public ⋮---- -/** - * - * * Futures | Union Margin - * - */ +// Or multiple at once: ⋮---- -export interface GetUnionTransferLimitsRequestV2 { - coin: string; -} +// Topics are tracked per websocket type +// The below example will pull a list of subscribed topics on that connection (e.g. all public topics), after a 5 second delay: + +================ +File: examples/V3 - UTA/WS-API/ws-api-client-trade.ts +================ +import { DefaultLogger, WebsocketAPIClient } from '../../../src/index.js'; ⋮---- -export interface UnionConvertRequestV2 { - coin: string; - amount: string; -} +// or +// import { DefaultLogger, WS_KEY_MAP, WebsocketAPIClient } from 'bitget-api'; ⋮---- -/** - * - * * Futures | Account | Max Openable Quantity - * - */ +// 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 FuturesMaxOpenRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - posSide: 'long' | 'short'; - orderType: 'limit' | 'market'; - openPrice?: 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 | Account | Liquidation Price - * - */ +// Whether to use the demo trading wss connection +// demoTrading: true, ⋮---- -export interface FuturesLiquidationPriceRequestV2 { - symbol: string; - productType: FuturesProductTypeV2; - marginCoin: string; - posSide: 'long' | 'short'; - orderType: 'limit' | 'market'; - openAmount: string; - openPrice?: 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 ⋮---- -/** - * - * * Futures | Account | Isolated Symbols - * - */ +logger, // Optional: inject a custom logger ⋮---- -export interface FuturesIsolatedSymbolsRequestV2 { - productType: FuturesProductTypeV2; -} - -================ -File: src/types/request/v2/instloan.ts -================ -export interface GetInstLoanProductInfoRequestV2 { - productId: string; -} +// Optional, see above "attachEventListeners". Attach basic event handlers, so nothing is left unhandled +// attachEventHandlers(wsClient.getWSClient()); ⋮---- -export interface GetInstLoanSymbolsRequestV2 { - productId: 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 GetInstLoanRepaidHistoryRequestV2 { - startTime?: string; - endTime?: string; - limit?: 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 GetInstLoanOrderRequestV2 { - orderId?: string; - startTime?: string; - endTime?: string; -} +/** + * Place Order + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters + */ ⋮---- -export interface GetInstLoanLTVConvertRequestV2 { - riskUnitId?: 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 GetInstLoanMarginCoinInfoRequestV2 { - productId: string; -} - -================ -File: src/types/request/v2/spot.ts -================ -type SpotKlineIntervalV2 = - | '1min' - | '5min' - | '15min' - | '30min' - | '1h' - | '4h' - | '6h' - | '12h' - | '1day' - | '3day' - | '1week' - | '1M' - | '6Hutc' - | '12Hutc' - | '1Dutc' - | '3Dutc' - | '1Wutc' - | '1Mutc'; -⋮---- -export interface SpotCandlesRequestV2 { - symbol: string; - granularity: SpotKlineIntervalV2; - startTime?: string; - endTime?: string; - limit?: string; -} +/** + * Batch Place Order Channel + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel + */ ⋮---- -export interface SpotHistoricCandlesRequestV2 { - symbol: string; - granularity: SpotKlineIntervalV2; - endTime?: string; - limit?: string; -} +/** + * 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 SpotHistoricTradesRequestV2 { - symbol: string; - limit?: string; - idLessThan?: string; - startTime?: string; - endTime?: 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 SpotCallAuctionRequestV2 { - symbol: string; -} +/** + * Cancel Order + * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel + */ ⋮---- /** - * - * * Spot | Trade - * - */ + const res = { + "event": "trade", + "id": "1750034870205", + "topic": "cancel-order", + "args": [ + { + "orderId": "xxxxxxxx", + "clientOid": "xxxxxxxx" + } + ], + "code": "0", + "msg": "Success", + "ts": "1750034870597" + } + */ ⋮---- -export type SpotOrderSideV2 = 'buy' | 'sell'; +/** + * Batch Cancel Order + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel + */ ⋮---- -export type SpotOrderTypeV2 = 'limit' | 'market'; +/** + 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: examples/V3 - UTA/WS-API/ws-api-trade-raw.ts +================ +import { + DefaultLogger, + WebsocketClientV3, + WS_KEY_MAP, +} from '../../../src/index.js'; ⋮---- -export type SpotOrderForceV2 = 'gtc' | 'post_only' | 'fok' | 'ioc'; +// or +// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV3 } from 'bitget-api'; ⋮---- -export type SpotTPSLTypeV2 = 'normal' | 'tpsl'; +// 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 type SpotSTPModeV2 = - | 'none' - | 'cancel_taker' - | 'cancel_maker' - | 'cancel_both'; +// console.log('WS raw message received ', JSON.stringify(data, null, 2)); ⋮---- -export type SpotBatchModeV2 = 'single' | 'multiple'; +/** + * Bitget's WebSocket API can be used via the sendWSAPIRequest() method. + * + * Use the `WS_KEY_MAP.v3Private` connection key for any requests. + * + * Note: this requires V3/UTA API keys! + * Note: for a better user experience, it is recommended to use the WebsocketAPIClient. + */ ⋮---- -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; -} +// Use the V3 private wss connection URL ⋮---- -export interface SpotCancelandSubmitOrderRequestV2 { - symbol: string; - price: string; - size: string; - orderId?: string; - clientOid?: string; - newClientOid?: string; - presetTakeProfitPrice?: string; - executeTakeProfitPrice?: string; - presetStopLossPrice?: string; - executeStopLossPrice?: string; -} +/** + * Place Order + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters + */ ⋮---- -export interface SpotCancelOrderRequestV2 { - symbol: string; - tpslType?: SpotTPSLTypeV2; - orderId?: string; - clientOid?: 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 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; -} +/** + * Batch Place Order Channel + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel + */ ⋮---- -export interface SpotBatchOrderRequestV2 { - symbol?: string; - batchMode?: SpotBatchModeV2; - orderList: SpotBatchOrderRequestItemV2[]; -} +/** + * 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 SpotBatchCancelOrderRequestV2 { - symbol?: string; - batchMode?: SpotBatchModeV2; - orderList: { - symbol?: string; - orderId?: string; - clientOid?: 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 GetSpotOrderInfoRequestV2 { - orderId?: string; - clientOid?: string; - requestTime?: string; - receiveWindow?: string; -} +/** + * Cancel Order + * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel + */ ⋮---- -export interface GetSpotOpenOrdersRequestV2 { - symbol?: string; +/** + 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 + */ +⋮---- +/** + 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/constants/enum.ts +================ +/** Parameter verification exception margin mode == FIXED */ + +================ +File: src/types/request/v2/earn.ts +================ +/** + * + * + * Earn | Savings + * + * + */ +⋮---- +export interface GetEarnSavingsAssetsRequestV2 { + periodType: string; startTime?: string; endTime?: string; + limit?: string; idLessThan?: string; +} +⋮---- +export interface GetEarnSavingsRecordsRequestV2 { + coin?: string; + periodType: string; + orderType?: string; + startTime?: string; + endTime?: string; limit?: string; + idLessThan?: string; +} +⋮---- +export interface RedeemSavingsRequestV2 { + productId: string; orderId?: string; - tpslType?: SpotTPSLTypeV2; - requestTime?: string; - receiveWindow?: string; + periodType: string; + amount: string; } ⋮---- -export interface GetSpotHistoryOrdersRequestV2 { - symbol?: string; +/** + * + * + * Earn | Shark Fin + * + * + */ +⋮---- +export interface GetSharkfinAssetsRequestV2 { + status: string; startTime?: string; endTime?: string; - idLessThan?: string; limit?: string; - orderId?: string; - tpslType?: SpotTPSLTypeV2; - requestTime?: string; - receiveWindow?: string; + idLessThan?: string; } ⋮---- -export interface GetSpotFillsRequestV2 { - symbol: string; - orderId?: string; +export interface GetSharkfinRecordsRequestV2 { + coin?: string; + type: string; startTime?: string; endTime?: string; limit?: string; @@ -3249,917 +3133,1190 @@ export interface GetSpotFillsRequestV2 { ⋮---- /** * - * * Spot | Trigger Orders + * + * Earn | Loan + * * */ ⋮---- -export type SpotPlanTypeV2 = 'amount' | 'total'; +export interface GetLoanEstInterestAndBorrowableRequestV2 { + loanCoin: string; + pledgeCoin: string; + daily: 'SEVEN' | 'THIRTY'; + pledgeAmount?: string; +} ⋮---- -export type SpotTriggerTypeV2 = 'fill_price' | 'mark_price'; +export interface BorrowLoanRequestV2 { + loanCoin: string; + pledgeCoin: string; + daily: 'SEVEN' | 'THIRTY'; + pledgeAmount?: string; + loanAmount?: 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 RepayLoanRequestV2 { + orderId: string; + amount?: string; + repayUnlock?: string; + repayAll: string; } ⋮---- -export interface SpotModifyPlanOrderRequestV2 { +export interface GetLoanRepayHistoryRequestV2 { orderId?: string; - clientOid?: string; - triggerPrice: string; - orderType: SpotOrderTypeV2; - executePrice?: string; - size: string; + loanCoin?: string; + pledgeCoin?: string; + startTime: string; + endTime: string; + pageNo?: string; + pageSize?: string; } ⋮---- -export interface GetSpotCurrentPlanOrdersRequestV2 { - symbol: string; - limit?: string; - idLessThan?: string; - startTime?: string; - endTime?: string; +export interface ModifyLoanPledgeRateRequestV2 { + orderId: string; + amount: string; + pledgeCoin: string; + reviseType: string; } ⋮---- -export interface GetSpotHistoryPlanOrdersRequestV2 { - symbol: string; +export interface GetLoanPledgeRateHistoryRequestV2 { + orderId?: string; + reviseSide?: string; + pledgeCoin?: string; startTime: string; endTime: string; - limit?: string; + pageNo?: string; + pageSize?: string; +} +⋮---- +export interface GetLoanHistoryRequestV2 { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; + status?: string; + startTime: string; + endTime: string; + pageNo?: string; + pageSize?: string; +} +⋮---- +export interface GetLiquidationRecordsRequestV2 { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; + status?: string; + startTime: string; + endTime: string; + pageNo?: string; + pageSize?: string; } ⋮---- /** * - * * Spot | Account + * + * Earn | On-Chain Elite + * * */ ⋮---- -export type SpotBillGroupTypeV2 = - | 'deposit' - | 'withdraw' - | 'transaction' - | 'transfer' - | 'other'; +export interface GetEarnEliteRecordsRequestV2 { + type: 'subscribe' | 'redeem' | 'interest'; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; +} ⋮---- -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 GetEarnEliteSubscribeInfoRequestV2 { + productId: string; +} ⋮---- -export interface GetSpotAccountBillsRequestV2 { +export interface EarnEliteSubscribeRequestV2 { + productSubId: string; + amount: string; coin?: string; - groupType?: SpotBillGroupTypeV2; - businessType?: SpotBusinessTypeV2; - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: string; + paymentAccount?: 'spot' | 'unified'; } ⋮---- -export interface SpotTransferRequestV2 { - fromType: SpotAccountTypeV2; - toType: SpotAccountTypeV2; - amount: string; - coin: string; - symbol: string; - clientOid?: string; +export interface GetEarnEliteSubscribeResultRequestV2 { + orderId: string; } ⋮---- -export interface SpotSubAccountTransferRequestV2 { - fromType: SpotAccountTypeV2; - toType: SpotAccountTypeV2; +export interface GetEarnEliteRedeemInfoRequestV2 { + productId: string; +} +⋮---- +export interface RedeemEarnEliteRequestV2 { + productId: string; + productSubId: string; + redeemType: 'fast' | 'standard'; amount: string; - coin: string; - symbol?: string; - clientOid?: string; - fromUserId: string; - toUserId: string; + receiveAccount: 'spot' | 'unified'; + advancedSettle?: 'yes' | 'no'; + coin?: string; +} + +================ +File: src/types/request/v2/instloan.ts +================ +export interface GetInstLoanProductInfoRequestV2 { + productId: 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 GetInstLoanSymbolsRequestV2 { + productId: string; } ⋮---- -export interface SpotMainSubTransferRecordRequestV2 { - coin?: string; - role?: 'initiator' | 'receiver'; - subUid?: string; +export interface GetInstLoanRepaidHistoryRequestV2 { startTime?: string; endTime?: string; - clientOid?: string; limit?: string; - idLessThan?: string; } ⋮---- -export interface GetSpotTransferRecordRequestV2 { - coin: string; - fromType: SpotAccountTypeV2; +export interface GetInstLoanOrderRequestV2 { + orderId?: string; startTime?: string; endTime?: string; - clientOid?: string; - limit?: string; - idLessThan?: string; } ⋮---- -export interface GetSpotSubAccountDepositRecordRequestV2 { - subUid: string; - coin?: string; +export interface GetInstLoanLTVConvertRequestV2 { + riskUnitId?: string; +} +⋮---- +export interface GetInstLoanMarginCoinInfoRequestV2 { + productId: string; +} + +================ +File: src/types/request/v2/spot.ts +================ +type SpotKlineIntervalV2 = + | '1min' + | '5min' + | '15min' + | '30min' + | '1h' + | '4h' + | '6h' + | '12h' + | '1day' + | '3day' + | '1week' + | '1M' + | '6Hutc' + | '12Hutc' + | '1Dutc' + | '3Dutc' + | '1Wutc' + | '1Mutc'; +⋮---- +export interface SpotCandlesRequestV2 { + symbol: string; + granularity: SpotKlineIntervalV2; startTime?: string; endTime?: string; - idLessThan?: string; limit?: string; } ⋮---- -export interface GetSpotWithdrawalRecordRequestV2 { - coin?: string; - clientOid?: string; - startTime: string; - endTime: string; - idLessThan?: string; - orderId?: string; +export interface SpotHistoricCandlesRequestV2 { + symbol: string; + granularity: SpotKlineIntervalV2; + endTime?: string; limit?: string; } ⋮---- -export interface GetSpotDepositRecordRequestV2 { - coin?: string; - orderId?: string; - startTime: string; - endTime: string; - idLessThan?: string; +export interface SpotHistoricTradesRequestV2 { + symbol: string; limit?: string; + idLessThan?: string; + startTime?: string; + endTime?: string; } - -================ -File: src/types/request/v3/grid.ts -================ -export type GridCategoryV3 = 'SPOT' | 'USDT-FUTURES' | 'USDC-FUTURES'; ⋮---- -export type NeutralGridCategoryV3 = 'USDT-FUTURES' | 'USDC-FUTURES'; +export interface SpotCallAuctionRequestV2 { + symbol: string; +} ⋮---- -export type GridFundsSourceV3 = 'funding' | 'uta' | 'otc'; +/** + * + * * Spot | Trade + * + */ ⋮---- -export type GridYesNoV3 = 'yes' | 'no'; +export type SpotOrderSideV2 = 'buy' | 'sell'; ⋮---- -export type GridOrderModeV3 = 'arithmetic' | 'geometric'; +export type SpotOrderTypeV2 = 'limit' | 'market'; ⋮---- -export type GridTypeV3 = 'long' | 'short' | 'neutral' | 'netural'; +export type SpotOrderForceV2 = 'gtc' | 'post_only' | 'fok' | 'ioc'; ⋮---- -export type GridTriggerConditionV3 = 'instant' | 'price' | 'rsi' | 'boll'; +export type SpotTPSLTypeV2 = 'normal' | 'tpsl'; ⋮---- -export type GridTerminationConditionV3 = 'rsi' | 'boll'; +export type SpotSTPModeV2 = + | 'none' + | 'cancel_taker' + | 'cancel_maker' + | 'cancel_both'; ⋮---- -export type GridAdjustTypeV3 = 'increase' | 'decrease'; +export type SpotBatchModeV2 = 'single' | 'multiple'; ⋮---- -export interface GridInvestmentAmountV3 { - coin: string; - amount: string; +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 GridIndicatorParamsV3 { - indicatorLength?: string; - threshold?: string; - multiplier?: string; - interval?: string; +export interface SpotCancelandSubmitOrderRequestV2 { + symbol: string; + price: string; + size: string; + orderId?: string; + clientOid?: string; + newClientOid?: string; + presetTakeProfitPrice?: string; + executeTakeProfitPrice?: string; + presetStopLossPrice?: string; + executeStopLossPrice?: string; } ⋮---- -export interface GridBotIdRequestV3 { - botId: string; +export interface SpotCancelOrderRequestV2 { + symbol: string; + tpslType?: SpotTPSLTypeV2; + orderId?: string; + clientOid?: string; } ⋮---- -export interface GetGridBotDetailRequestV3 { - botId: string; +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 GetGridBotOrderDetailsRequestV3 { - category: GridCategoryV3; - botId: string; +export interface SpotBatchOrderRequestV2 { + symbol?: string; + batchMode?: SpotBatchModeV2; + orderList: SpotBatchOrderRequestItemV2[]; } ⋮---- -export interface CloseGridBotRequestV3 { - botId: string; -} -⋮---- -export interface AddGridInvestmentRequestV3 { - category: GridCategoryV3; - botId: string; - coin?: string; - size?: string; - fundsSource: GridFundsSourceV3[]; - adjustType?: GridAdjustTypeV3; - reinvestProfit?: GridYesNoV3; +export interface SpotBatchCancelOrderRequestV2 { + symbol?: string; + batchMode?: SpotBatchModeV2; + orderList: { + symbol?: string; + orderId?: string; + clientOid?: string; + }[]; } ⋮---- -export interface CreateGridBotRequestV3 { - category: GridCategoryV3; - symbol: string; - maxPrice: string; - minPrice: string; - gridNum: string; - gridOrderMode: GridOrderModeV3; - investmentAmount: GridInvestmentAmountV3[]; - fundsSource?: GridFundsSourceV3[]; - slippage?: string; - autoTransferProfits?: GridYesNoV3; - gridType?: GridTypeV3; - leverage?: string; - autoReserveMargin?: GridYesNoV3; - reservedMargin?: string; - triggerCondition?: GridTriggerConditionV3; - triggerParams?: GridIndicatorParamsV3[]; - triggerPrice?: string; - terminationCondition?: GridTerminationConditionV3; - terminationParams?: GridIndicatorParamsV3[]; - terminationSell?: GridYesNoV3; - stopLoss?: string; - takeProfit?: string; - trailingGrid?: GridYesNoV3; - movingAverageGains?: string; - stopUpwardPrice?: string; - hodlMode?: GridYesNoV3; - marketOpen?: GridYesNoV3; - lossReserve?: GridYesNoV3; +export interface GetSpotOrderInfoRequestV2 { + orderId?: string; + clientOid?: string; + requestTime?: string; + receiveWindow?: string; } ⋮---- -export type ValidateGridBotRequestV3 = CreateGridBotRequestV3; -⋮---- -export interface ModifyGridBotRequestV3 { - botId: string; - category: GridCategoryV3; - takeProfit?: string; - stopLoss?: string; - terminationCondition?: GridTerminationConditionV3; - terminationParams?: GridIndicatorParamsV3[]; - hodlMode?: GridYesNoV3; - autoTransferProfits?: GridYesNoV3; +export interface GetSpotOpenOrdersRequestV2 { + symbol?: string; + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + orderId?: string; + tpslType?: SpotTPSLTypeV2; + requestTime?: string; + receiveWindow?: string; } ⋮---- -export interface ModifyGridIntervalRequestV3 { - category: GridCategoryV3; - botId: string; - maxPrice: string; - minPrice: string; - gridNum: string; +export interface GetSpotHistoryOrdersRequestV2 { + symbol?: string; + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + orderId?: string; + tpslType?: SpotTPSLTypeV2; + requestTime?: string; + receiveWindow?: string; } ⋮---- -export interface CreateNeutralGridBotRequestV3 { - category: NeutralGridCategoryV3; +export interface GetSpotFillsRequestV2 { symbol: string; - maxPrice: string; - minPrice: string; - gridNum: string; - gridOrderMode: GridOrderModeV3; - fundsSource?: GridFundsSourceV3[]; - leverage?: string; - investmentAmount: GridInvestmentAmountV3[]; - triggerPrice?: string; - stopLoss?: string; - takeProfit?: string; - autoTransferProfits?: GridYesNoV3; + orderId?: string; + startTime?: string; + endTime?: string; + limit?: string; + idLessThan?: string; } ⋮---- -export type ValidateNeutralGridBotRequestV3 = CreateNeutralGridBotRequestV3; -⋮---- -export interface ModifyNeutralGridBotRequestV3 { - botId: string; - category: NeutralGridCategoryV3; - takeProfit?: string; - stopLoss?: string; - autoTransferProfits?: GridYesNoV3; -} +/** + * + * * Spot | Trigger Orders + * + */ ⋮---- -export interface ModifyNeutralGridIntervalRequestV3 { - category: NeutralGridCategoryV3; - botId: string; - maxPrice: string; - minPrice: string; - gridNum: string; -} +export type SpotPlanTypeV2 = 'amount' | 'total'; ⋮---- -export interface GetNeutralGridBotDetailRequestV3 { - botId: string; -} +export type SpotTriggerTypeV2 = 'fill_price' | 'mark_price'; ⋮---- -export interface GetNeutralGridBotOrderDetailsRequestV3 { - category: NeutralGridCategoryV3 | GridCategoryV3; - botId: string; -} - -================ -File: src/types/request/v3/loan.ts -================ -export interface GetTransferedRequestV3 { - userId?: string; - coin: 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 GetSymbolsRequestV3 { - productId: string; +export interface SpotModifyPlanOrderRequestV2 { + orderId?: string; + clientOid?: string; + triggerPrice: string; + orderType: SpotOrderTypeV2; + executePrice?: string; + size: string; } ⋮---- -export interface GetRepaidHistoryRequestV3 { - startTime?: string; - endTime?: string; +export interface GetSpotCurrentPlanOrdersRequestV2 { + symbol: string; limit?: string; -} -⋮---- -export interface GetProductInfosRequestV3 { - productId: string; -} -⋮---- -export interface GetLoanOrderRequestV3 { - orderId?: string; + idLessThan?: string; startTime?: string; endTime?: string; } ⋮---- -export interface GetEnsureCoinsRequestV3 { - productId: string; +export interface GetSpotHistoryPlanOrdersRequestV2 { + symbol: string; + startTime: string; + endTime: string; + limit?: string; } ⋮---- -export interface BindUidRequestV3 { - riskUnitId?: string; - uid: string; - operate: 'bind' | 'unbind'; -} +/** + * + * * Spot | Account + * + */ ⋮---- -export interface GetLTVConvertRequestV3 { - riskUnitId?: string; -} +export type SpotBillGroupTypeV2 = + | 'deposit' + | 'withdraw' + | 'transaction' + | 'transfer' + | 'other'; ⋮---- -/* Unified Account Staking & Lending (Crypto Loans) - /api/v3/loan/* */ +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 interface GetLoanCoinsRequestV3 { +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 GetLoanInterestRequestV3 { - loanCoin: string; - pledgeCoin: string; - daily: 'SEVEN' | 'THIRTY' | 'FLEXIBLE'; - pledgeAmount: string; +export interface SpotTransferRequestV2 { + fromType: SpotAccountTypeV2; + toType: SpotAccountTypeV2; + amount: string; + coin: string; + symbol: string; + clientOid?: string; } ⋮---- -export interface LoanBorrowRequestV3 { - loanCoin: string; - pledgeCoin: string; - daily: 'SEVEN' | 'THIRTY' | 'FLEXIBLE'; - pledgeAmount?: string; - loanAmount?: string; -} -⋮---- -export interface GetLoanBorrowOngoingRequestV3 { - orderId?: string; - loanCoin?: string; - pledgeCoin?: string; +export interface SpotSubAccountTransferRequestV2 { + fromType: SpotAccountTypeV2; + toType: SpotAccountTypeV2; + amount: string; + coin: string; + symbol?: string; + clientOid?: string; + fromUserId: string; + toUserId: string; } ⋮---- -export interface GetLoanBorrowHistoryRequestV3 { - orderId?: string; - loanCoin?: string; - pledgeCoin?: string; - status?: 'ROLLBACK' | 'FORCE' | 'REPAY'; - startTime: string; - endTime: string; - pageNum?: string; - pageSize?: 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 LoanRepayRequestV3 { - orderId: string; - method: 'borrowed_coin' | 'collateral'; - repayAll: 'yes' | 'no'; - amount?: string; - repayUnlock?: 'yes' | 'no'; +export interface SpotMainSubTransferRecordRequestV2 { + coin?: string; + role?: 'initiator' | 'receiver'; + subUid?: string; + startTime?: string; + endTime?: string; + clientOid?: string; + limit?: string; + idLessThan?: string; } ⋮---- -export interface GetLoanRepayHistoryRequestV3 { - orderId?: string; - loanCoin?: string; - pledgeCoin?: string; - startTime: string; - endTime: string; - pageNum?: string; - pageSize?: string; +export interface GetSpotTransferRecordRequestV2 { + coin: string; + fromType: SpotAccountTypeV2; + startTime?: string; + endTime?: string; + clientOid?: string; + limit?: string; + idLessThan?: string; } ⋮---- -export interface LoanRevisePledgeRequestV3 { - orderId: string; - amount: string; - pledgeCoin: string; - reviseType?: 'OUT' | 'IN'; +export interface GetSpotSubAccountDepositRecordRequestV2 { + subUid: string; + coin?: string; + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; } ⋮---- -export interface GetLoanPledgeRateHistoryRequestV3 { - orderId?: string; - reviseSide?: 'down' | 'up'; - pledgeCoin?: string; +export interface GetSpotWithdrawalRecordRequestV2 { + coin?: string; + clientOid?: string; startTime: string; endTime: string; - pageNum?: string; - pageSize?: string; + idLessThan?: string; + orderId?: string; + limit?: string; } ⋮---- -export interface GetLoanReducesRequestV3 { +export interface GetSpotDepositRecordRequestV2 { + coin?: string; orderId?: string; - loanCoin?: string; - pledgeCoin?: string; - status?: 'COMPLETE' | 'WAIT'; startTime: string; endTime: string; - pageNum?: string; - pageSize?: string; + idLessThan?: string; + limit?: string; } ================ -File: src/types/request/v3/p2p.ts +File: src/types/request/v3/affiliate.ts ================ -export type P2pSideV3 = 'buy' | 'sell'; -⋮---- -export type P2pPriceTypeV3 = 'fixed' | 'floating'; -⋮---- -export type P2pMarketTypeV3 = 'public' | 'private'; -⋮---- -export type P2pAdStatusV3 = 'publish' | 'delist' | 'remove'; -⋮---- -export type P2pAdOperationV3 = 'publish' | 'delist' | 'remove'; -⋮---- -export type P2pOrderStatusV3 = - | 'pending_payment' - | 'pending_release' - | 'completed' - | 'cancelled' - | 'in_appeal'; -⋮---- -export interface P2pPayMethodIdRefV3 { - payMethodId: string; - userPayMethodId?: string; -} -⋮---- -export interface GetP2pAdListRequestV3 { - token: string; - fiat: string; - side: P2pSideV3; - amount?: string; - pageNum: string; - limit: string; -} -⋮---- -export interface GetP2pExchangeRateRequestV3 { - token: string; - fiat: string; -} +/** + * + * + * Affiliate + * + * + */ ⋮---- -export interface P2pFeeSimulateRequestV3 { - token: string; - fiat: string; - side: P2pSideV3; - marketType: P2pMarketTypeV3; - amount: string; +export interface AgentCustomerListRequestV3 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + referralCode?: string; } ⋮---- -export interface GetP2pAdLimitRequestV3 { - token: string; - fiat: string; - side: P2pSideV3; +export interface AgentCustomerAssetRequestV3 { + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -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; +export interface AgentCustomerTradeVolumeRequestV3 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -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 AgentCustomerDepositRequestV3 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface OperateP2pAdRequestV3 { - advId: string; - operation: P2pAdOperationV3; +export interface GetAgentCustomerKycResultRequestV3 { + startTime?: string; + endTime?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; + limit?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface GetP2pAdInfoRequestV3 { - advId: string; -} +/** Pass endId from the previous response. Omit on the first page. */ ⋮---- -export interface GetP2pMyAdsRequestV3 { +export interface GetAgentCustomerCommissionsRequestV3 { startTime?: string; endTime?: string; - limit?: string; + /** Pass endId from the previous response. Omit on the first page. */ cursor?: string; - advId?: string; - token?: string; - fiat?: string; - status?: P2pAdStatusV3; + limit?: string; + uid?: string; + coin?: string; + symbol?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface GetP2pPendingOrdersRequestV3 { - orderId?: string; - side?: P2pSideV3; +/** Pass endId from the previous response. Omit on the first page. */ +⋮---- +export interface GetAgentSubCustomerListRequestV3 { startTime?: string; endTime?: string; + /** Pass minId from the previous response. Omit on the first page. */ cursor?: string; limit?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface GetP2pAllOrdersRequestV3 { +/** Pass minId from the previous response. Omit on the first page. */ +⋮---- +export interface GetSubAffiliateInfoRequestV3 { + uid?: string; startTime?: string; endTime?: string; + /** Pass endId from the previous response. Omit on the first page. */ + idLessThan?: string; limit?: string; - cursor?: string; - orderId?: string; - side?: P2pSideV3; - status?: P2pOrderStatusV3; + includeDownLine?: 'yes' | 'no'; } ⋮---- -export interface GetP2pOrderInfoRequestV3 { - orderId: string; -} +/** Pass endId from the previous response. Omit on the first page. */ ⋮---- -export interface P2pOrderActionRequestV3 { - orderId: string; +export interface GetSubAffiliateCommissionRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; } ⋮---- -export interface GetP2pBalanceRequestV3 { - token: string; -} +/** Pass endId from the previous response. Omit on the first page. */ ================ -File: src/types/request/v3/reality.ts +File: src/types/request/v3/grid.ts ================ -export interface GetRealityCompanyOverviewRequestV3 { - code: string; -} +export type GridCategoryV3 = 'SPOT' | 'USDT-FUTURES' | 'USDC-FUTURES'; ⋮---- -export interface GetRealityValuationIndicatorsRequestV3 { - code: string; -} +export type NeutralGridCategoryV3 = 'USDT-FUTURES' | 'USDC-FUTURES'; ⋮---- -export interface GetRealityEarningsForecastRequestV3 { - code: string; -} +export type GridFundsSourceV3 = 'funding' | 'uta' | 'otc'; ⋮---- -export interface GetRealitySuspensionResumptionInfoRequestV3 { - code: string; -} +export type GridYesNoV3 = 'yes' | 'no'; ⋮---- -export interface GetRealityDividendsRequestV3 { - code: string; - limit?: string; - cursor?: string; -} +export type GridOrderModeV3 = 'arithmetic' | 'geometric'; ⋮---- -export interface GetRealityShareCapitalChangeRequestV3 { - code: string; -} +export type GridTypeV3 = 'long' | 'short' | 'neutral' | 'netural'; ⋮---- -export interface GetRealityInnerTradesRequestV3 { - code: string; - limit?: string; - cursor?: string; +export type GridTriggerConditionV3 = 'instant' | 'price' | 'rsi' | 'boll'; +⋮---- +export type GridTerminationConditionV3 = 'rsi' | 'boll'; +⋮---- +export type GridAdjustTypeV3 = 'increase' | 'decrease'; +⋮---- +export interface GridInvestmentAmountV3 { + coin: string; + amount: string; } ⋮---- -export interface GetRealityExecutiveShareholdingsRequestV3 { - code: string; - limit?: string; - cursor?: string; +export interface GridIndicatorParamsV3 { + indicatorLength?: string; + threshold?: string; + multiplier?: string; + interval?: string; } ⋮---- -export interface GetRealityShareholdDetailRequestV3 { - code: string; - limit?: string; - cursor?: string; +export interface GridBotIdRequestV3 { + botId: string; } ⋮---- -export interface GetRealityStockInfoRequestV3 { - symbol?: string; +export interface GetGridBotDetailRequestV3 { + botId: string; } - -================ -File: src/types/request/v3/stockplus.ts -================ -/** - * - * - * Stock+ (UTA) - * - * - */ ⋮---- -export interface GetStockPlusOptionQuoteRequestV3 { - symbol: string; +export interface GetGridBotOrderDetailsRequestV3 { + category: GridCategoryV3; + botId: string; } ⋮---- -export interface GetStockPlusOptionChainInfoRequestV3 { - symbol: string; - expiryDate: string; +export interface CloseGridBotRequestV3 { + botId: string; } ⋮---- -export interface GetStockPlusOptionExpiryDateRequestV3 { - symbol: string; +export interface AddGridInvestmentRequestV3 { + category: GridCategoryV3; + botId: string; + coin?: string; + size?: string; + fundsSource: GridFundsSourceV3[]; + adjustType?: GridAdjustTypeV3; + reinvestProfit?: GridYesNoV3; } ⋮---- -export interface GetStockPlusOptionVolumeRequestV3 { +export interface CreateGridBotRequestV3 { + category: GridCategoryV3; symbol: string; + maxPrice: string; + minPrice: string; + gridNum: string; + gridOrderMode: GridOrderModeV3; + investmentAmount: GridInvestmentAmountV3[]; + fundsSource?: GridFundsSourceV3[]; + slippage?: string; + autoTransferProfits?: GridYesNoV3; + gridType?: GridTypeV3; + leverage?: string; + autoReserveMargin?: GridYesNoV3; + reservedMargin?: string; + triggerCondition?: GridTriggerConditionV3; + triggerParams?: GridIndicatorParamsV3[]; + triggerPrice?: string; + terminationCondition?: GridTerminationConditionV3; + terminationParams?: GridIndicatorParamsV3[]; + terminationSell?: GridYesNoV3; + stopLoss?: string; + takeProfit?: string; + trailingGrid?: GridYesNoV3; + movingAverageGains?: string; + stopUpwardPrice?: string; + hodlMode?: GridYesNoV3; + marketOpen?: GridYesNoV3; + lossReserve?: GridYesNoV3; } ⋮---- -export interface GetStockPlusStaticInfoRequestV3 { - symbol: string; +export type ValidateGridBotRequestV3 = CreateGridBotRequestV3; +⋮---- +export interface ModifyGridBotRequestV3 { + botId: string; + category: GridCategoryV3; + takeProfit?: string; + stopLoss?: string; + terminationCondition?: GridTerminationConditionV3; + terminationParams?: GridIndicatorParamsV3[]; + hodlMode?: GridYesNoV3; + autoTransferProfits?: GridYesNoV3; } ⋮---- -export interface GetStockPlusQuoteRequestV3 { - symbol: string; +export interface ModifyGridIntervalRequestV3 { + category: GridCategoryV3; + botId: string; + maxPrice: string; + minPrice: string; + gridNum: string; } ⋮---- -export interface GetStockPlusTradeDetailRequestV3 { +export interface CreateNeutralGridBotRequestV3 { + category: NeutralGridCategoryV3; symbol: string; - count?: string; + maxPrice: string; + minPrice: string; + gridNum: string; + gridOrderMode: GridOrderModeV3; + fundsSource?: GridFundsSourceV3[]; + leverage?: string; + investmentAmount: GridInvestmentAmountV3[]; + triggerPrice?: string; + stopLoss?: string; + takeProfit?: string; + autoTransferProfits?: GridYesNoV3; } ⋮---- -export interface GetStockPlusIntradayRequestV3 { - symbol: string; +export type ValidateNeutralGridBotRequestV3 = CreateNeutralGridBotRequestV3; +⋮---- +export interface ModifyNeutralGridBotRequestV3 { + botId: string; + category: NeutralGridCategoryV3; + takeProfit?: string; + stopLoss?: string; + autoTransferProfits?: GridYesNoV3; } ⋮---- -export interface GetStockPlusHistoryCandlestickRequestV3 { - symbol: string; - period: string; - count?: string; - adjustType?: string; - forward?: boolean; - time?: string; - tradeSessions?: string; +export interface ModifyNeutralGridIntervalRequestV3 { + category: NeutralGridCategoryV3; + botId: string; + maxPrice: string; + minPrice: string; + gridNum: string; } ⋮---- -export interface GetStockPlusCandlestickRequestV3 { - symbol: string; - period: string; - count?: string; - adjustType?: string; - tradeSessions?: string; +export interface GetNeutralGridBotDetailRequestV3 { + botId: string; } ⋮---- -export interface GetStockPlusDepthRequestV3 { - symbol: string; +export interface GetNeutralGridBotOrderDetailsRequestV3 { + category: NeutralGridCategoryV3 | GridCategoryV3; + botId: string; +} + +================ +File: src/types/request/v3/loan.ts +================ +export interface GetTransferedRequestV3 { + userId?: string; + coin: 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 GetSymbolsRequestV3 { + productId: string; } ⋮---- -export interface CancelStockPlusOrderRequestV3 { - symbol: string; - orderId?: string; - clientOid?: string; +export interface GetRepaidHistoryRequestV3 { + startTime?: string; + endTime?: string; + limit?: 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 GetProductInfosRequestV3 { + productId: string; } ⋮---- -export interface GetStockPlusTodayOrdersRequestV3 { - symbol?: string; - status?: string | string[]; - side?: string; - market?: string; +export interface GetLoanOrderRequestV3 { orderId?: string; + startTime?: string; + endTime?: string; } ⋮---- -export interface GetStockPlusHistoryOrdersRequestV3 { - symbol?: string; - status?: string | string[]; - side?: string; - market?: string; - startAt?: string; - endAt?: string; +export interface GetEnsureCoinsRequestV3 { + productId: string; } ⋮---- -export interface GetStockPlusOrderDetailRequestV3 { - orderId: string; +export interface BindUidRequestV3 { + riskUnitId?: string; + uid: string; + operate: 'bind' | 'unbind'; } ⋮---- -export interface GetStockPlusTodayExecutionsRequestV3 { - symbol?: string; +export interface GetLTVConvertRequestV3 { + riskUnitId?: string; +} +⋮---- +/* Unified Account Staking & Lending (Crypto Loans) - /api/v3/loan/* */ +⋮---- +export interface GetLoanCoinsRequestV3 { + coin?: string; +} +⋮---- +export interface GetLoanInterestRequestV3 { + loanCoin: string; + pledgeCoin: string; + daily: 'SEVEN' | 'THIRTY' | 'FLEXIBLE'; + pledgeAmount: string; +} +⋮---- +export interface LoanBorrowRequestV3 { + loanCoin: string; + pledgeCoin: string; + daily: 'SEVEN' | 'THIRTY' | 'FLEXIBLE'; + pledgeAmount?: string; + loanAmount?: string; +} +⋮---- +export interface GetLoanBorrowOngoingRequestV3 { orderId?: string; + loanCoin?: string; + pledgeCoin?: string; } ⋮---- -export interface GetStockPlusHistoryExecutionsRequestV3 { - symbol?: string; - startAt?: string; - endAt?: string; +export interface GetLoanBorrowHistoryRequestV3 { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; + status?: 'ROLLBACK' | 'FORCE' | 'REPAY'; + startTime: string; + endTime: string; + pageNum?: string; + pageSize?: string; } ⋮---- -export interface GetStockPlusAccountRequestV3 { - currency?: string; +export interface LoanRepayRequestV3 { + orderId: string; + method: 'borrowed_coin' | 'collateral'; + repayAll: 'yes' | 'no'; + amount?: string; + repayUnlock?: 'yes' | 'no'; } ⋮---- -export interface GetStockPlusCashFlowRequestV3 { +export interface GetLoanRepayHistoryRequestV3 { + orderId?: string; + loanCoin?: string; + pledgeCoin?: string; startTime: string; endTime: string; - businessType?: string; - symbol?: string; - page?: string; - size?: string; + pageNum?: string; + pageSize?: string; } ⋮---- -export interface GetStockPlusStockPositionRequestV3 { - symbol?: string; +export interface LoanRevisePledgeRequestV3 { + orderId: string; + amount: string; + pledgeCoin: string; + reviseType?: 'OUT' | 'IN'; } ⋮---- -export interface StockPlusTransferRequestV3 { - coin?: string; - amount?: string; - direction?: 'in' | 'out'; +export interface GetLoanPledgeRateHistoryRequestV3 { + orderId?: string; + reviseSide?: 'down' | 'up'; + pledgeCoin?: string; + startTime: string; + endTime: string; + pageNum?: string; + pageSize?: string; } ⋮---- -export interface GetStockPlusTransferRecordsRequestV3 { - transferId?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: 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'; +⋮---- +export type P2pMarketTypeV3 = 'public' | 'private'; +⋮---- +export type P2pAdStatusV3 = 'publish' | 'delist' | 'remove'; +⋮---- +export type P2pAdOperationV3 = 'publish' | 'delist' | 'remove'; +⋮---- +export type P2pOrderStatusV3 = + | 'pending_payment' + | 'pending_release' + | 'completed' + | 'cancelled' + | 'in_appeal'; +⋮---- +export interface P2pPayMethodIdRefV3 { + payMethodId: string; + userPayMethodId?: string; } ⋮---- -/** - * - * * Common | Public - * - */ +export interface GetP2pAdListRequestV3 { + token: string; + fiat: string; + side: P2pSideV3; + amount?: string; + pageNum: string; + limit: string; +} ⋮---- -/** - * - * * Common | Tax - * - */ +export interface GetP2pExchangeRateRequestV3 { + token: string; + fiat: string; +} ⋮---- -export interface SpotTransactionRecordV2 { - id: string; - coin: string; - spotTaxType: string; +export interface P2pFeeSimulateRequestV3 { + token: string; + fiat: string; + side: P2pSideV3; + marketType: P2pMarketTypeV3; amount: string; - fee: string; - balance: string; - ts: string; } ⋮---- -export interface FuturesTransactionRecordV2 { - id: string; - symbol: string; - marginCoin: string; - futureTaxType: string; - amount: string; - fee: string; - ts: string; +export interface GetP2pAdLimitRequestV3 { + token: string; + fiat: string; + side: P2pSideV3; } ⋮---- -export interface MarginTransactionRecordV2 { - id: string; - coin: string; - marginTaxType: string; - amount: string; - fee: string; - total: string; - symbol: string; - ts: 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; } ⋮---- -export interface P2PMerchantOrdersV2 { - id: string; - coin: string; - p2pTaxType: string; - total: string; - ts: 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; } ⋮---- -/** - * - * * Common | P2P - * - */ +export interface OperateP2pAdRequestV3 { + advId: string; + operation: P2pAdOperationV3; +} ⋮---- -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 GetP2pAdInfoRequestV3 { + advId: string; } ⋮---- -export interface P2PMerchantInfoV2 { - registerTime: string; - nickName: string; - merchantId: string; - avgPaymentTime: string; - avgReleaseTime: string; - totalTrades: string; - totalBuy: string; - totalSell: string; - totalCompletionRate: string; +export interface GetP2pMyAdsRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; + advId?: string; + token?: string; + fiat?: string; + status?: P2pAdStatusV3; +} +⋮---- +export interface GetP2pPendingOrdersRequestV3 { + orderId?: string; + side?: P2pSideV3; + startTime?: string; + endTime?: string; + cursor?: string; + limit?: string; +} +⋮---- +export interface GetP2pAllOrdersRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; + orderId?: string; + side?: P2pSideV3; + status?: P2pOrderStatusV3; +} +⋮---- +export interface GetP2pOrderInfoRequestV3 { + orderId: string; +} +⋮---- +export interface P2pOrderActionRequestV3 { + orderId: string; +} +⋮---- +export interface GetP2pBalanceRequestV3 { + token: string; +} + +================ +File: src/types/request/v3/reality.ts +================ +export interface GetRealityCompanyOverviewRequestV3 { + code: string; +} +⋮---- +export interface GetRealityValuationIndicatorsRequestV3 { + code: string; +} +⋮---- +export interface GetRealityEarningsForecastRequestV3 { + code: string; +} +⋮---- +export interface GetRealitySuspensionResumptionInfoRequestV3 { + code: string; +} +⋮---- +export interface GetRealityDividendsRequestV3 { + code: string; + limit?: string; + cursor?: string; +} +⋮---- +export interface GetRealityShareCapitalChangeRequestV3 { + code: string; +} +⋮---- +export interface GetRealityInnerTradesRequestV3 { + code: string; + limit?: string; + cursor?: string; +} +⋮---- +export interface GetRealityExecutiveShareholdingsRequestV3 { + code: string; + limit?: string; + cursor?: string; +} +⋮---- +export interface GetRealityShareholdDetailRequestV3 { + code: string; + limit?: string; + cursor?: string; +} +⋮---- +export interface GetRealityStockInfoRequestV3 { + symbol?: string; +} + +================ +File: src/types/response/v2/common.ts +================ +/** + * + * * Common | Notice + * + */ +⋮---- +export interface AnnouncementV2 { + annId: string; + annTitle: string; + annDesc: string; + cTime: string; + language: string; + annUrl: string; +} +⋮---- +/** + * + * * Common | Public + * + */ +⋮---- +/** + * + * * Common | Tax + * + */ +⋮---- +export interface SpotTransactionRecordV2 { + id: string; + coin: string; + spotTaxType: string; + amount: string; + fee: string; + balance: string; + ts: string; +} +⋮---- +export interface FuturesTransactionRecordV2 { + id: string; + symbol: string; + marginCoin: string; + futureTaxType: string; + amount: string; + fee: string; + ts: string; +} +⋮---- +export interface MarginTransactionRecordV2 { + id: string; + coin: string; + marginTaxType: string; + amount: string; + fee: string; + total: string; + symbol: string; + ts: string; +} +⋮---- +export interface P2PMerchantOrdersV2 { + id: string; + coin: string; + p2pTaxType: string; + total: string; + ts: string; +} +⋮---- +/** + * + * * Common | P2P + * + */ +⋮---- +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 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; @@ -5021,47 +5178,187 @@ export interface InstLoanLTVConvertV2 { } ================ -File: src/types/response/v3/grid.ts +File: src/types/response/v3/affiliate.ts ================ -import type { GridIndicatorParamsV3 } from '../../request/v3/grid.js'; +/** + * + * + * Affiliate + * https://www.bitget.com/docs/catalog/affiliate/affiliate + * + * + */ ⋮---- -export interface GridBotIdResponseV3 { - botId: string; +export interface AgentCustomerListItemV3 { + uid: string; + registerTime: string; } ⋮---- -export interface GridValidateResponseV3 { - valid: string; - reason?: string; - minInvestment?: string; +export interface AgentCustomerAssetItemV3 { + uid: string; + balance: string; + uTime: string; + remark: string; } ⋮---- -export interface GridBotOrderItemV3 { +export interface AgentCustomerTradeVolumeItemV3 { + uid: string; + /** API field name (Bitget spelling). */ + volumn: string; + spotVolume: string; + futuresVolume: string; + time: string; +} +⋮---- +/** API field name (Bitget spelling). */ +⋮---- +export interface AgentCustomerDepositItemV3 { + uid: string; orderId: string; - delegateCount: string; - delegatePrice: string; - changeRequired: number | string; + depositTime: string; + depositCoin: string; + depositAmount: string; } ⋮---- -export interface GridBotOrderDetailsV3 { - botId: string; - symbol: string; - buyOrderList: GridBotOrderItemV3[]; - sellOrderList: GridBotOrderItemV3[]; +export interface AgentCustomerKycResultItemV3 { + uid: string; + kycResult: 'passed' | 'not_passed'; } ⋮---- -export interface GridBotDetailV3 { - botId: string; +/** Pagination wrapper follows the documented response example. */ +export interface AgentCustomerKycResultV3 { + userList: AgentCustomerKycResultItemV3[]; + endId: string; +} +⋮---- +export interface AgentCustomerCommissionV3 { + uid: string; + date: string; + coin: string; symbol: string; - status: string; - totalProfit: string; - roi: string; - gridProfit: string; - gridProfitRate: string; - unpairedProfit: string; - unpairedProfitRate: string; - margin?: string; - arbitrageAPR: string; - totalAPR: string; + productType: 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 AgentCustomerCommissionsV3 { + commissionList: AgentCustomerCommissionV3[]; + endId: string; +} +⋮---- +/** Pagination wrapper follows the documented response example. */ +export interface AgentSubCustomerListV3 { + list: AgentCustomerListItemV3[]; + minId: string; +} +⋮---- +export interface SubAffiliateRebateRateV3 { + rebateType: string; + rebateRate: string; +} +⋮---- +export interface SubAffiliateInfoItemV3 { + uid: string; + uplineName: string; + rebateRateList: SubAffiliateRebateRateV3[]; + verificationStatus: string; + directReferrals: string; + subAffiliates: string; + subAffiliateDirectReferrals: string; + volume: string; + deposit: string; + transactionFee: string; + rebate: string; +} +⋮---- +export interface SubAffiliateInfoV3 { + list: SubAffiliateInfoItemV3[]; + endId: string; +} +⋮---- +export interface SubAffiliateCommissionItemV3 { + uid: string; + bizType: 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: string; + startCalculationTime: string; + endCalculationTime: string; +} +⋮---- +export interface SubAffiliateCommissionV3 { + commissionList: SubAffiliateCommissionItemV3[]; + endId: string; +} + +================ +File: src/types/response/v3/grid.ts +================ +import type { GridIndicatorParamsV3 } from '../../request/v3/grid.js'; +⋮---- +export interface GridBotIdResponseV3 { + botId: string; +} +⋮---- +export interface GridValidateResponseV3 { + valid: string; + reason?: string; + minInvestment?: string; +} +⋮---- +export interface GridBotOrderItemV3 { + orderId: string; + delegateCount: string; + delegatePrice: string; + changeRequired: number | string; +} +⋮---- +export interface GridBotOrderDetailsV3 { + botId: string; + symbol: string; + buyOrderList: GridBotOrderItemV3[]; + sellOrderList: GridBotOrderItemV3[]; +} +⋮---- +export interface GridBotDetailV3 { + botId: string; + symbol: string; + status: string; + totalProfit: string; + roi: string; + gridProfit: string; + gridProfitRate: string; + unpairedProfit: string; + unpairedProfitRate: string; + margin?: string; + arbitrageAPR: string; + totalAPR: string; createdTime: string; runningTime: string; currentBaseBalance?: string; @@ -5767,3791 +6064,4005 @@ export interface RealityMarketCalendarV3 { } ================ -File: src/types/response/v3/stockplus.ts +File: webpack/webpack.config.cjs +================ +function generateConfig(name) +⋮---- +// Add '.ts' and '.tsx' as resolvable extensions. +⋮---- +// 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 +⋮---- +// Code is already transpiled from TypeScript, no additional loaders needed + +================ +File: .npmrc +================ +min-release-age=30 +save-exact=true + +================ +File: .nvmrc +================ +v24.18.0 + ================ +File: src/types/request/v2/common.ts +================ +import { FuturesProductTypeV2, MarginType } from '../shared.js'; +⋮---- /** * + * * Common | Notice * - * Stock+ (UTA) + */ +⋮---- +export interface GetAnnouncementsRequestV2 { + annType?: string; + startTime?: string; + endTime?: string; + language: string; +} +⋮---- +/** * + * * Common | Public * */ ⋮---- -export interface StockPlusOptionQuoteItemV3 { +export interface GetTradeRateRequestV2 { 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; + businessType: string; } ⋮---- -export interface StockPlusOptionQuoteV3 { - secuQuote: StockPlusOptionQuoteItemV3[]; +export interface GetAllTradeRatesRequestV2 { + businessType: string; } ⋮---- -export interface StockPlusOptionStrikePriceInfoV3 { - price: string; - callSymbol: string; - putSymbol: string; - standard: boolean; -} +/** + * + * * Common | Tax + * + */ ⋮---- -export interface StockPlusOptionChainInfoV3 { - strikePriceInfo: StockPlusOptionStrikePriceInfoV3[]; +export interface GetSpotTransactionsRequestV2 { + coin?: string; + startTime: string; + endTime: string; + limit?: string; + idLessThan?: string; } ⋮---- -export interface StockPlusOptionExpiryDateV3 { - expiryDate: string[]; +export interface GetFuturesTransactionsRequestV2 { + productType?: FuturesProductTypeV2; + marginCoin?: string; + startTime: string; + endTime: string; + limit?: string; + idLessThan?: string; } ⋮---- -export interface StockPlusOptionVolumeV3 { - c: string; - p: string; +export interface GetMarginTransactionsRequestV2 { + marginType?: MarginType; + coin?: string; + startTime: string; + endTime: string; + limit?: string; + idLessThan?: 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 GetP2PTransactionsRequestV2 { + coin?: string; + startTime: string; + endTime: string; + limit?: string; + idLessThan?: string; } ⋮---- -export interface StockPlusStaticInfoV3 { - list: StockPlusStaticInfoItemV3[]; -} +/** + * + * * Common | P2P + * + */ ⋮---- -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 GetP2PMerchantsRequestV2 { + online?: 'yes' | 'no'; + idLessThan?: string; + limit?: 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 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 StockPlusQuoteV3 { - list: StockPlusQuoteItemV3[]; +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; } ⋮---- -export interface StockPlusTradeDetailItemV3 { - price: string | number; - volume: string | number; - timestamp: string; - tradeType: string; - direction: string; - tradeSession: string; -} +/** + * + * * Common | Virtual Subaccount + * + */ ⋮---- -export type StockPlusTradeDetailV3 = StockPlusTradeDetailItemV3[]; +export interface ModifyVirtualSubRequestV2 { + subAccountUid: string; + permList: string[]; + status: string; +} ⋮---- -export interface StockPlusIntradayItemV3 { - price: string | number; - timestamp: string; - volume: string | number; - turnover: string | number; - avgPrice: string | number; +export interface CreateVirtualSubRequestV2 { + subAccountName: string; + passphrase: string; + label: string; + ipList?: string[]; + permList?: string[]; } ⋮---- -export interface StockPlusIntradayV3 { - list: StockPlusIntradayItemV3[]; +export interface CreateVirtualSubApiKeyRequestV2 { + subAccountUid: string; + passphrase: string; + label: string; + ipList?: string[]; + permList?: string[]; } ⋮---- -export interface StockPlusCandlestickItemV3 { - close: string; - open: string; - low: string; - high: string; - volume: string; - turnover: string; - timestamp: string; - tradeSession: string; +export interface ModifyVirtualSubApiKeyRequestV2 { + subAccountUid: string; + subAccountApiKey: string; + passphrase: string; + label: string; + ipList?: string[]; + permList?: string[]; } ⋮---- -export interface StockPlusCandlestickV3 { - list: StockPlusCandlestickItemV3[]; +export interface CreateAgentSubaccountRequestV2 { + /** Lowercase letters only; max 20 characters */ + username: string; + /** 8–32 characters, letters and numbers */ + passphrase: string; + note?: string; } ⋮---- -export type StockPlusHistoryCandlestickV3 = StockPlusCandlestickV3; +/** Lowercase letters only; max 20 characters */ ⋮---- -export interface StockPlusDepthLevelV3 { - position: number; - price: string; - volume: string; - orderNum: number; +/** 8–32 characters, letters and numbers */ +⋮---- +/** + * + * * Common | Convert + * + */ +⋮---- +export interface ConvertQuoteRequestV2 { + fromCoin: string; + fromCoinSize?: string; + toCoin: string; + toCoinSize?: string; } ⋮---- -export interface StockPlusDepthV3 { - asks: StockPlusDepthLevelV3[]; - bids: StockPlusDepthLevelV3[]; +export interface ConvertRequestV2 { + fromCoin: string; + fromCoinSize: string; + cnvtPrice: string; + toCoin: string; + toCoinSize: string; + traceId: string; } ⋮---- -export interface StockPlusPlaceOrderResponseV3 { - orderId: string; - clientOid: string; - symbol: string; +export interface GetConvertHistoryRequestV2 { + startTime: string; + endTime: string; + limit?: string; + idLessThan?: string; } ⋮---- -export type StockPlusCancelOrderResponseV3 = StockPlusPlaceOrderResponseV3; -export type StockPlusModifyOrderResponseV3 = StockPlusPlaceOrderResponseV3; +/** + * + * * Common | BGB Convert + * + */ ⋮---- -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 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 StockPlusOrdersV3 { - orders: StockPlusOrderV3[]; +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 StockPlusHistoryOrdersV3 { - hasMore: boolean; - orders: StockPlusOrderV3[]; +/** + * + * * Futures | Market + * + */ +⋮---- +export interface FuturesMergeDepthRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + precision?: 'scale0' | 'scale1' | 'scale2' | 'scale3'; + limit?: '1' | '5' | '15' | '50' | 'max'; } ⋮---- -export interface StockPlusOrderHistoryItemV3 { - price: string | number; - quantity: string | number; - status: string; - msg: string; - time: string; +export interface FuturesOiLimitRequestV2 { + productType: FuturesProductTypeV2; + symbol?: string; } ⋮---- -export interface StockPlusChargeFeeItemV3 { - code: string; - name: string; - amount: number | string; - currency: string; +export interface FuturesPositionAdlRankRequestV2 { + productType: FuturesProductTypeV2; } ⋮---- -export interface StockPlusChargeCategoryV3 { - code: string; - name: string; - fees: StockPlusChargeFeeItemV3[]; +export interface FuturesRecentTradesRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + limit?: string; } ⋮---- -export interface StockPlusChargeDetailV3 { - totalAmount: number | string; - currency: string; - items: StockPlusChargeCategoryV3[]; +export interface FuturesHistoricTradesRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + limit?: string; + idLessThan?: string; + startTime?: string; + endTime?: string; } ⋮---- -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 FuturesCandlesRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + granularity: FuturesKlineInterval; + startTime?: string; + endTime?: string; + kLineType?: FuturesKlineTypeV2; + limit?: string; } ⋮---- -export interface StockPlusExecutionV3 { - orderId: string; - tradeId: string; +/** + * + * * Futures | Account + * + */ +⋮---- +export interface FuturesSingleAccountRequestV2 { symbol: string; - tradeDoneAt: string; - quantity: number | string; - price: number | string; + productType: FuturesProductTypeV2; + marginCoin: string; } ⋮---- -export interface StockPlusTodayExecutionsV3 { - trades: StockPlusExecutionV3[]; +export interface FuturesInterestHistoryRequestV2 { + productType: 'USDT-FUTURES' | 'SUSDT-FUTURES'; + coin?: string; + idLessThan?: string; + startTime?: string; + endTime?: string; + limit?: string; } ⋮---- -export interface StockPlusHistoryExecutionsV3 { - hasMore: boolean; - trades: StockPlusExecutionV3[]; +export interface FuturesOpenCountRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + openAmount: string; + openPrice: string; + leverage?: string; } ⋮---- -export interface StockPlusCashInfoV3 { - withdrawCash: number | string; - availableCash: number | string; - frozenCash: number | string; - settlingCash: number | string; - currency: string; +export interface FuturesSetAutoMarginRequestV2 { + symbol: string; + autoMargin: 'on' | 'off'; + marginCoin: string; + amount: string; + holdSide?: 'long' | 'short'; } ⋮---- -export interface StockPlusFrozenTransactionFeeV3 { - currency?: string; - amount?: number | string; - [key: string]: unknown; +export interface FuturesSetLeverageRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + leverage: string; + holdSide?: 'long' | 'short'; } ⋮---- -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 FuturesSetPositionMarginRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + holdSide: 'long' | 'short'; + amount: string; } ⋮---- -export interface StockPlusAccountV3 { - list: StockPlusAccountItemV3[]; +export interface FuturesSetMarginModeRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + marginMode: 'isolated' | 'crossed'; } ⋮---- -export interface StockPlusCashFlowItemV3 { - transactionFlowName: string; - direction: string; - businessType: string; - balance: number | string; - currency: string; - businessTime: string; - symbol: string | null; - description: string; +/** + * + * * Futures | Position + * + */ +⋮---- +export interface FuturesHistoricalPositionsRequestV2 { + symbol?: string; + productType?: FuturesProductTypeV2; + idLessThan?: string; + startTime?: string; + endTime?: string; + limit?: string; } ⋮---- -export interface StockPlusCashFlowV3 { - list: StockPlusCashFlowItemV3[]; +/** + * + * * Futures | Trade + * + */ +⋮---- +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 StockPlusPositionItemV3 { +export interface FuturesReversalOrderRequestV2 { symbol: string; - symbolName: string; - quantity: number | string; - availableQuantity: number | string; - currency: string; - costPrice: number | string; - market: string; - initQuantity: number | string; + productType: FuturesProductTypeV2; + marginCoin: string; + size: string; + side?: 'buy' | 'sell'; + tradeSide?: 'open' | 'close'; + clientOid?: string; } ⋮---- -export interface StockPlusPositionChannelV3 { - accountChannel: string; - positions: StockPlusPositionItemV3[]; +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 StockPlusStockPositionV3 { - channels: StockPlusPositionChannelV3[]; +export interface FuturesBatchOrderRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + marginMode: 'isolated' | 'crossed'; + orderList: FuturesBatchOrderItem[]; } ⋮---- -export interface StockPlusTransferResponseV3 { - 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 StockPlusTransferRecordsV3 { - transferId: string; - coin: string; - amount: string; - direction: string; - cursor: string; +export interface FuturesCancelOrderRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin?: string; + orderId?: string; + clientOid?: string; } - -================ -File: webpack/webpack.config.cjs -================ -function generateConfig(name) ⋮---- -// Add '.ts' and '.tsx' as resolvable extensions. +interface FuturesBatchCancelOrderItem { + orderId?: string; + clientOid?: 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 FuturesBatchCancelOrderRequestV2 { + orderIdList?: FuturesBatchCancelOrderItem[]; + symbol?: string; + productType: FuturesProductTypeV2; + marginCoin?: string; +} ⋮---- -// Code is already transpiled from TypeScript, no additional loaders needed - -================ -File: .npmrc -================ -min-release-age=30 -save-exact=true - -================ -File: .nvmrc -================ -v24.18.0 - -================ -File: examples/auth/fasterHmacSign.ts -================ -import { createHmac } from 'crypto'; -⋮---- -import { - 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 +export interface FuturesFlashClosePositionsRequestV2 { + symbol?: string; + productType: FuturesProductTypeV2; + holdSide?: 'long' | 'short'; +} ⋮---- -// Start trading - -================ -File: examples/V2 - Classic/Rest/rest-trade-futures.ts -================ -import { - FuturesPlaceOrderRequestV2, - RestClientV2, - WebsocketClientV2, -} from '../../../src/index.js'; +export interface FuturesGetOrderRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + orderId?: string; + clientOid?: string; +} ⋮---- -// or -// import { FuturesPlaceOrderRequestV2, RestClientV2, WebsocketClientV2 } from '../src'; +export interface FuturesGetOrderFillsRequestV2 { + orderId?: string; + symbol?: string; + productType: FuturesProductTypeV2; + idLessThan?: string; + startTime?: string; + endTime?: string; + limit?: string; +} ⋮---- -// read from environmental variables +export interface FuturesGetHistoricalFillsRequestV2 { + orderId?: string; + symbol?: string; + productType: FuturesProductTypeV2; + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: 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 FuturesGetOpenOrdersRequestV2 { + orderId?: string; + clientOid?: string; + symbol?: string; + productType: FuturesProductTypeV2; + /** Defaults to live; query partially_filled separately to include partially filled orders. */ + status?: 'live' | 'partially_filled'; + idLessThan?: string; + startTime?: string; + endTime?: string; + limit?: string; +} ⋮---- -// note the single quotes, preventing special characters such as $ from being incorrectly passed +/** Defaults to live; query partially_filled separately to include partially filled orders. */ ⋮---- -// apiKey: 'apiKeyHere', -// apiSecret: 'apiSecretHere', -// apiPass: 'apiPassHere', +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'; ⋮---- -function logWSEvent(type: string, data: any) +export interface FuturesGetHistoryOrdersRequestV2 { + orderId?: string; + clientOid?: string; + symbol?: string; + productType: FuturesProductTypeV2; + idLessThan?: string; + orderSource?: FuturesOrderSourceV2; + startTime?: string; + endTime?: string; + limit?: string; +} ⋮---- -// simple sleep function -function promiseSleep(milliseconds: number) +export interface FuturesCancelAllOrdersRequestV2 { + symbol?: string; + productType: FuturesProductTypeV2; + marginCoin?: string; + requestTime?: string; + receiveWindow?: string; +} ⋮---- /** - * 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 + * * Futures | Trigger Orders * */ ⋮---- -// Add event listeners to log websocket events on account +export type FuturesTriggerTypeV2 = 'fill_price' | 'mark_price'; ⋮---- -// futures private -// : account updates +export type FuturesStpModeV2 = + | 'none' + | 'cancel_taker' + | 'cancel_maker' + | 'cancel_both'; ⋮---- -// : position updates +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; +} ⋮---- -// : order updates +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; +} ⋮---- -// 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 type FuturesTriggerPriceTypeV2 = + | 'fill_price' + | 'mark_price' + | 'index_price'; ⋮---- -// const balances = allBalances.filter((bal) => Number(bal.available) != 0); +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; +} ⋮---- -// Loop through any active positions and send a closing market order on each position - -================ -File: examples/V2 - Classic/Rest/rest-trade-spot.ts -================ -import { - RestClientV2, - SpotOrderRequestV2, - WebsocketClientV2, -} from '../../../src/index.js'; -⋮---- -// 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/rest-trade-spot.ts -⋮---- -// note the single quotes, preventing special characters such as $ from being incorrectly passed +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; +} ⋮---- -// apiKey: 'apiKeyHere', -// apiSecret: 'apiSecretHere', -// apiPass: 'apiPassHere', +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; +} ⋮---- -function logWSEvent(type: string, data: any) +export interface FuturesGetPlanOrdersRequestV2 { + orderId?: string; + clientOid?: string; + symbol?: string; + /** A single plan type per request; comma-separated values are not supported. */ + planType: 'normal_plan' | 'track_plan' | 'profit_loss'; + productType: FuturesProductTypeV2; + idLessThan?: string; + startTime?: string; + endTime?: string; + limit?: string; +} ⋮---- -// simple sleep function -function promiseSleep(milliseconds: number) +/** A single plan type per request; comma-separated values are not supported. */ ⋮---- -/** 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 */ +interface FuturesCancelPlanOrderItemV2 { + orderId?: string; + clientOid?: string; +} ⋮---- -// Add event listeners to log websocket events on account +export type FuturesPlanOrderTypeV2 = + | 'normal_plan' + | 'profit_plan' + | 'loss_plan' + | 'pos_profit' + | 'pos_loss' + | 'moving_plan'; ⋮---- -// Subscribe to private account topics -// spot private -// : account updates +export interface FuturesCancelPlanOrderRequestV2 { + orderIdList?: FuturesCancelPlanOrderItemV2[]; + symbol?: string; + productType: FuturesProductTypeV2; + marginCoin?: string; + planType?: FuturesPlanOrderTypeV2; +} ⋮---- -// : order updates (note: symbol is required) +export type FuturesPlanStatusV2 = 'executed' | 'fail_trigger' | 'cancelled'; ⋮---- -// 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 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; +} ⋮---- -// console.log('balance: ', JSON.stringify(balances, null, 2)); - -================ -File: examples/V2 - Classic/Websocket/ws-demo-trading.ts -================ -import { DefaultLogger, WebsocketClientV2 } from '../../../src/index.js'; +/** + * + * * Futures | Union Margin + * + */ ⋮---- -// or -// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; +export interface GetUnionTransferLimitsRequestV2 { + coin: 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 UnionConvertRequestV2 { + coin: string; + amount: string; +} ⋮---- -// restOptions: { -// optionally provide rest options, e.g. to pass through a proxy -// }, +/** + * + * * Futures | Account | Max Openable Quantity + * + */ ⋮---- -// Set demoTrading to true, to route all connections to the demo trading wss URLs: +export interface FuturesMaxOpenRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + posSide: 'long' | 'short'; + orderType: 'limit' | 'market'; + openPrice?: string; +} ⋮---- -// If using private topics, make sure to include API keys +/** + * + * * Futures | Account | Liquidation Price + * + */ ⋮---- -// console.log('WS raw message received ', JSON.stringify(data, null, 2)); +export interface FuturesLiquidationPriceRequestV2 { + symbol: string; + productType: FuturesProductTypeV2; + marginCoin: string; + posSide: 'long' | 'short'; + orderType: 'limit' | 'market'; + openAmount: string; + openPrice?: string; +} ⋮---- /** - * Public events - */ + * + * * Futures | Account | Isolated Symbols + * + */ +⋮---- +export interface FuturesIsolatedSymbolsRequestV2 { + productType: FuturesProductTypeV2; +} ================ -File: examples/V2 - Classic/Websocket/ws-private.ts +File: src/types/request/v3/broker.ts ================ -import { DefaultLogger, WebsocketClientV2 } from '../../../src/index.js'; +export interface CreateBrokerSubAccountRequestV3 { + subaccountName: string; + label: string; +} ⋮---- -// or -// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; +export interface GetBrokerSubAccountListRequestV3 { + limit?: string; + cursor?: string; + status?: 'normal' | 'freeze'; +} ⋮---- -// 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 ModifyBrokerSubAccountRequestV3 { + subUid: string; + status?: 'normal' | 'freeze'; + permList?: string[]; +} ⋮---- -// note the single quotes, preventing special characters such as $ from being incorrectly passed +export interface BrokerSubWithdrawalRequestV3 { + subUid: string; + coin: string; + dest: 'on_chain' | 'internal_transfer'; + address: string; + amount: string; + chain?: string; + tag?: string; + clientOid?: string; +} ⋮---- -// restOptions: { -// optionally provide rest options, e.g. to pass through a proxy -// }, +export interface GetBrokerSubDepositAddressRequestV3 { + subUid: string; + coin: string; + chain?: string; +} ⋮---- -// console.log('WS raw message received ', JSON.stringify(data, null, 2)); +export interface GetBrokerAllSubDepositWithdrawalRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; + status?: 'pending' | 'fail' | 'success'; +} ⋮---- -// auth happens async after the ws connection opens +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'; +} ⋮---- -// wsClient.subscribePublicSpotTickers(['BTCUSDT', 'LTCUSDT']); +export interface CreateBrokerSubApiKeyRequestV3 { + subUid: string; + passphrase: string; + label: string; + ipList?: string[]; + permType: 'read_write' | 'read_only'; + permList: string[]; +} ⋮---- -/** - * Private account updates - */ +export interface ModifyBrokerSubApiKeyRequestV3 { + subUid: string; + passphrase: string; + apiKey: string; + label?: string; + ipList?: string[]; + permType?: 'read_write' | 'read_only'; + permList?: string[]; +} ⋮---- -// spot private -// : account updates +export interface DeleteBrokerSubApiKeyRequestV3 { + subUid: string; + apiKey: string; +} ⋮---- -// : order updates (note: symbol is required) -// wsClient.subscribeTopic('SPOT', 'orders', 'BTCUSDT'); +export interface GetBrokerSubApiKeyRequestV3 { + subUid: string; +} ⋮---- -// futures private -// : account updates +/** + * + * + * Broker | Email and Commissions + * + * + */ ⋮---- -// : position updates -// wsClient.subscribeTopic('USDT-FUTURES', 'positions'); +export interface ModifySubaccountEmailRequestV3 { + subUid: string; + subaccountEmail: string; +} ⋮---- -// : order updates -// wsClient.subscribeTopic('USDT-FUTURES', 'orders'); +export interface GetSubaccountEmailRequestV3 { + subUid: string; +} ⋮---- -// : plan order updates -// wsClient.subscribeTopic('USDT-FUTURES', 'orders-algo'); +export interface GetBrokerTradeVolumeRequestV3 { + startTime?: string; + endTime?: string; + pageSize?: string; + pageNo?: string; +} ⋮---- -// wsClient -// .getWsStore() -// .getKeys() -// .forEach((wsKey) => { -// const state = wsClient.getWsStore().get(wsKey); -// console.log(`${wsKey} state: `, state.subscribedTopics.values()); -// }); +export interface GetBrokerTotalCommissionRequestV3 { + startTime?: string; + endTime?: string; +} ⋮---- -// setTimeout(() => { -// wsClient.unsubscribeTopic('USDT-FUTURES', 'account'); -// }, 1000 * 2); +export interface GetBrokerOrderCommissionRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + uid?: string; + orderid?: string; + /** Pass endId from the previous response. Omit on the first page. */ + idLessThan?: string; +} ⋮---- -// setTimeout(() => { -// wsClient -// .getWsStore() -// .getKeys() -// .forEach((wsKey) => { -// const state = wsClient.getWsStore().get(wsKey); -// console.log(`${wsKey} state: `, state.subscribedTopics.values()); -// }); -// }, 1000 * 5); +/** Pass endId from the previous response. Omit on the first page. */ +⋮---- +export interface GetBrokerRebateInfoRequestV3 { + uid: string; +} ================ -File: examples/V2 - Classic/Websocket/ws-public.ts +File: src/types/request/v3/cfd.ts ================ -import { - DefaultLogger, - WebsocketClientV2, - WS_KEY_MAP, -} from '../../../src/index.js'; -⋮---- -// or -// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; +export type CfdYesNoV3 = 'yes' | 'no'; ⋮---- -// restOptions: { -// optionally provide rest options, e.g. to pass through a proxy -// }, +export type CfdOrderTypeV3 = 'limit' | 'market'; ⋮---- -// console.log('WS raw message received ', JSON.stringify(data, null, 2)); +export type CfdSideV3 = 'buy' | 'sell'; ⋮---- -/** - * Public events - */ +export type CfdKlineIntervalV3 = '1m' | '15m' | '1h' | '4h' | '1d'; ⋮---- -// Spot public +export type CfdTransferAccountTypeV3 = 'funding' | 'uta'; ⋮---- -// tickers +export type CfdTransferDirectionV3 = 'in' | 'out'; ⋮---- -// candles -// wsClient.subscribeTopic('SPOT', 'candle1m', symbol); +export interface GetCfdTickersRequestV3 { + symbol?: string; +} ⋮---- -// orderbook updates -// wsClient.subscribeTopic('SPOT', 'books', symbol); +export interface GetCfdHistoryCandlestickRequestV3 { + symbol: string; + interval: CfdKlineIntervalV3; + side?: CfdSideV3; + startTime?: string; + endTime?: string; + limit?: string; +} ⋮---- -// trades -// wsClient.subscribeTopic('SPOT', 'trade', symbol); +export interface PlaceCfdOrderRequestV3 { + symbol: string; + orderType: CfdOrderTypeV3; + side: CfdSideV3; + qty: string; + price?: string; + takeProfit?: string; + stopLoss?: string; +} ⋮---- -// Futures public +export interface ModifyCfdOrderRequestV3 { + orderId: string; + price?: string; + takeProfit?: string; + stopLoss?: string; +} ⋮---- -// tickers -// wsClient.subscribeTopic('USDT-FUTURES', 'ticker', symbol); +export interface CancelCfdOrderRequestV3 { + orderId: string; +} ⋮---- -// candles -// wsClient.subscribeTopic('USDT-FUTURES', 'candle1m', symbol); +export interface CancelAllCfdOrdersRequestV3 { + symbol?: string; +} ⋮---- -// orderbook updates -// wsClient.subscribeTopic('USDT-FUTURES', 'books', symbol); +export interface CloseCfdPositionsRequestV3 { + positionId: string; + qty: string; +} ⋮---- -// trades -// wsClient.subscribeTopic('USDT-FUTURES', 'trade', symbol); +export interface CloseAllCfdPositionsRequestV3 { + symbol?: string; +} ⋮---- -// 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'; +export interface GetCfdUnfilledOrdersRequestV3 { + symbol?: string; + subUid?: string; +} ⋮---- -// or -// import { PlaceOrderRequestV3, RestClientV3, WebsocketClientV3 } from '../src'; +export interface GetCfdOrderHistoryRequestV3 { + symbol: string; + subUid?: string; + startTime?: string; + endTime?: string; + /** Default 10, range [1, 50]. The first page may return more rows than limit. */ + limit?: string; + pageNo?: string; + /** + * Not required for the first page. + * From the second page, pass the orderId of the last record from the previous page. + */ + cursor?: string; +} ⋮---- -// read from environmental variables +/** Default 10, range [1, 50]. The first page may return more rows than limit. */ ⋮---- -// 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 +/** + * Not required for the first page. + * From the second page, pass the orderId of the last record from the previous page. + */ ⋮---- -// note the single quotes, preventing special characters such as $ from being incorrectly passed +export interface GetCfdCurrentPositionsRequestV3 { + symbol?: string; + subUid?: string; +} ⋮---- -// apiKey: 'apiKeyHere', -// apiSecret: 'apiSecretHere', -// apiPass: 'apiPassHere', +export interface CfdTransferRequestV3 { + coin: string; + amount: string; + accountType: CfdTransferAccountTypeV3; + direction: CfdTransferDirectionV3; +} ⋮---- -function logWSEvent(type: string, data: any) +export interface GetCfdTransferRecordsRequestV3 { + transferId?: string; + subUid?: string; + startTime?: string; + endTime?: string; + direction?: CfdTransferDirectionV3; + limit?: string; +} ⋮---- -// simple sleep function -function promiseSleep(milliseconds: number) +export interface GetCfdFinancialRecordsRequestV3 { + type?: string; + startTime?: string; + endTime?: string; + limit?: string; +} ⋮---- +export interface GetCfdInstrumentsRequestV3 { + symbol?: string; +} + +================ +File: src/types/request/v3/stockplus.ts +================ /** - * 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 + * + * Stock+ (UTA) + * * */ ⋮---- -// Add event listeners to log websocket events on account -⋮---- -// Subscribe to private topics for UTA account +export interface GetStockPlusOptionQuoteRequestV3 { + symbol: string; +} ⋮---- -// Subscribe to position updates +export interface GetStockPlusOptionChainInfoRequestV3 { + symbol: string; + expiryDate: string; +} ⋮---- -// Subscribe to order updates +export interface GetStockPlusOptionExpiryDateRequestV3 { + symbol: string; +} ⋮---- -// 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 GetStockPlusOptionVolumeRequestV3 { + symbol: string; +} ⋮---- -// 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'; +export interface GetStockPlusStaticInfoRequestV3 { + symbol: string; +} ⋮---- -// import { RestClientV3, WebsocketClientV3 } from '../src/index'; -⋮---- -// read from environmental variables +export interface GetStockPlusQuoteRequestV3 { + symbol: 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/V3/rest-trade-spot.ts +export interface GetStockPlusTradeDetailRequestV3 { + symbol: string; + count?: string; +} ⋮---- -// note the single quotes, preventing special characters such as $ from being incorrectly passed +export interface GetStockPlusIntradayRequestV3 { + symbol: string; +} ⋮---- -// apiKey: 'apiKeyHere', -// apiSecret: 'apiSecretHere', -// apiPass: 'apiPassHere', +export interface GetStockPlusHistoryCandlestickRequestV3 { + symbol: string; + period: string; + count?: string; + adjustType?: string; + forward?: boolean; + time?: string; + tradeSessions?: string; +} ⋮---- -function logWSEvent(type: string, data: any) +export interface GetStockPlusCandlestickRequestV3 { + symbol: string; + period: string; + count?: string; + adjustType?: string; + tradeSessions?: string; +} ⋮---- -// simple sleep function -function promiseSleep(milliseconds: number) +export interface GetStockPlusDepthRequestV3 { + symbol: string; +} ⋮---- -/** 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 */ +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; +} ⋮---- -// Add event listeners to log websocket events on account +export interface CancelStockPlusOrderRequestV3 { + symbol: string; + orderId?: string; + clientOid?: string; +} ⋮---- -// Subscribe to private account topics -// Account updates for UTA (unified trading account) +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; +} ⋮---- -// Order updates for spot +export interface GetStockPlusTodayOrdersRequestV3 { + symbol?: string; + status?: string | string[]; + side?: string; + market?: string; + orderId?: string; +} ⋮---- -// 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'; +export interface GetStockPlusHistoryOrdersRequestV3 { + symbol?: string; + status?: string | string[]; + side?: string; + market?: string; + startAt?: string; + endAt?: string; +} ⋮---- -// or -// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV2 } from 'bitget-api'; +export interface GetStockPlusOrderDetailRequestV3 { + orderId: 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 GetStockPlusMaxPurchaseRequestV3 { + symbol: string; + orderType: 'LO' | 'MO' | 'LIT' | 'MIT' | 'TSLPAMT' | 'TSLPPCT'; + side: 'Buy' | 'Sell'; + price?: string; + currency?: string; + orderId?: string; +} ⋮---- -// console.log('WS raw message received ', JSON.stringify(data, null, 2)); +export interface GetStockPlusTodayExecutionsRequestV3 { + symbol?: string; + orderId?: string; +} ⋮---- -// You can subscribe to one topic at a time +export interface GetStockPlusHistoryExecutionsRequestV3 { + symbol?: string; + startAt?: string; + endAt?: string; +} ⋮---- -instType: 'UTA', // Note: all account events go on the UTA instType +export interface GetStockPlusAccountRequestV3 { + currency?: string; +} ⋮---- -WS_KEY_MAP.v3Private, // This parameter points to private or public +export interface GetStockPlusCashFlowRequestV3 { + startTime: string; + endTime: string; + businessType?: string; + symbol?: string; + page?: string; + size?: string; +} ⋮---- -// Note: all account events go on the UTA instType +export interface GetStockPlusStockPositionRequestV3 { + symbol?: string; +} ⋮---- -// Or multiple at once: +export interface StockPlusTransferRequestV3 { + coin?: string; + amount?: string; + direction?: 'in' | 'out'; +} ⋮---- -// 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: +export interface GetStockPlusTransferRecordsRequestV3 { + transferId?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; +} ================ -File: examples/V3 - UTA/Websocket/ws-public.ts +File: src/types/response/v2/broker.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 - */ + * + * * Broker | Subaccount + * + */ ⋮---- -// You can subscribe to one topic at a time +export interface CreateSubaccountResponseV2 { + subUid: string; + subaccountName: string; + status: string; + permList: string[]; + label: string; + cTime: string; +} ⋮---- -WS_KEY_MAP.v3Public, // This parameter points to private or public +export interface BrokerSubaccountV2 { + subUid: string; + subaccountName: string; + status: string; + permList: string[]; + label: string; + language: string; + cTime: string; + uTime: string; +} ⋮---- -// Or multiple at once: +export interface ModifySubaccountResponseV2 { + subUid: string; + subaccountName: string; + status: string; + permList: string[]; + label: string; + language: string; + cTime: string; + uTime: string; +} ⋮---- -// Topics are tracked per websocket type -// The below example will pull a list of subscribed topics on that connection (e.g. all public topics), after a 5 second delay: - -================ -File: examples/V3 - UTA/WS-API/ws-api-trade-raw.ts -================ -import { - DefaultLogger, - WebsocketClientV3, - WS_KEY_MAP, -} from '../../../src/index.js'; +export interface SubaccountEmailV2 { + subUid: string; + subaccountName: string; + subaccountEmail: string; + cTime: string; + uTime: string; +} ⋮---- -// or -// import { DefaultLogger, WS_KEY_MAP, WebsocketClientV3 } from 'bitget-api'; +export interface BrokerSubaccountSpotAssetV2 { + coin: string; + available: string; + frozen: string; + locked: string; + uTime: 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 BrokerSubaccountFutureAssetV2 { + marginCoin: string; + available: string; + frozen: string; + locked: string; + crossedMaxAvailable: string; + isolatedMaxAvailable: string; + maxTransferOut: string; + accountEquity: string; + usdtEquity: string; + btcEquity: string; + uTime: string; +} ⋮---- -// console.log('WS raw message received ', JSON.stringify(data, null, 2)); -⋮---- -/** - * Bitget's WebSocket API can be used via the sendWSAPIRequest() method. - * - * Use the `WS_KEY_MAP.v3Private` connection key for any requests. - * - * Note: this requires V3/UTA API keys! - * Note: for a better user experience, it is recommended to use the WebsocketAPIClient. - */ -⋮---- -// Use the V3 private wss connection URL -⋮---- -/** - * Place Order - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters - */ +export interface CreateSubaccountDepositAddressV2 { + subUid: string; + coin: string; + address: string; + chain: string; + tag: string; + url: string; + cTime: 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 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; +} ⋮---- -/** - * Batch Place Order Channel - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel - */ +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; +} ⋮---- /** - * 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. - */ + * + * Broker | Api Key + * + */ ⋮---- -/** - 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 CreateSubaccountApiKeyResponseV2 { + subUid: string; + apiKey: string; + secretKey: string; + label: string; + ipList: string[]; + permType: string; + permList: string[]; +} ⋮---- -/** - * Cancel Order - * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel - */ +export interface SubaccountApiKeyV2 { + subUid: string; + label: string; + apiKey: string; + secretKey: string; + permType: string; + permList: string[]; + ipList: string[]; +} ⋮---- -/** - const res = { - "event": "trade", - "id": "1750034870205", - "topic": "cancel-order", - "args": [ - { - "orderId": "xxxxxxxx", - "clientOid": "xxxxxxxx" - } - ], - "code": "0", - "msg": "Success", - "ts": "1750034870597" - } - */ +export interface ModifySubaccountApiKeyResponseV2 { + subUid: string; + apiKey: string; + label: string; + ipList: string[]; + permType: string; + permList: string[]; +} ⋮---- /** - * Batch Cancel Order - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel - */ + * + * * Broker | All Sub-accounts Deposit and Withdrawal Records + * + */ ⋮---- -/** - 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/common.ts -================ -import { FuturesProductTypeV2, MarginType } from '../shared.js'; +export interface AllSubDepositWithdrawalRecordV2 { + uid: string; + txId: string; + type: 'deposit' | 'withdrawal'; + subType: 'onchain' | 'internal' | 'fast'; + coin: string; + amount: string; + status: 'pending' | 'fail' | 'success'; + ts: string; +} ⋮---- /** * - * * Common | Notice + * * Broker | Subaccounts * */ ⋮---- -export interface GetAnnouncementsRequestV2 { - annType?: string; - startTime?: string; - endTime?: string; - language: string; +export interface BrokerSubaccountInfoV2 { + uid: string; + asset: string; + firstTimeDeposit: string; + firstTimeTrade: string; + registerTime: string; } ⋮---- /** * - * * Common | Public + * * Broker | Commissions * */ ⋮---- -export interface GetTradeRateRequestV2 { +export interface BrokerCommissionV2 { + uid: string; + coin: string; symbol: string; - businessType: string; -} -⋮---- -export interface GetAllTradeRatesRequestV2 { - businessType: string; + dealtAmount: string; + totalFee: string; + deductedFee: string; + paidFee: string; + markUpFee: string; + totalCommission: string; } ⋮---- /** * - * * Common | Tax + * * Broker | Trade Volume * */ ⋮---- -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; +export interface BrokerTradeVolumeV2 { + uid: string; + volume: string; + spotVolume: string; + futureVolume: string; } ⋮---- /** * - * * Common | P2P + * * Broker | Total Commission * */ ⋮---- -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; +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; + }; } ⋮---- /** * - * * Common | Virtual Subaccount + * * Broker | Order Commission * */ ⋮---- -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 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; } ⋮---- -export interface CreateAgentSubaccountRequestV2 { - /** Lowercase letters only; max 20 characters */ - username: string; - /** 8–32 characters, letters and numbers */ - passphrase: string; - note?: string; +export interface BrokerOrderCommissionV2 { + commissionlist: BrokerOrderCommissionItemV2[]; + endId: string; } ⋮---- -/** Lowercase letters only; max 20 characters */ -⋮---- -/** 8–32 characters, letters and numbers */ -⋮---- /** * - * * Common | Convert + * * Broker | Rebate Info * */ ⋮---- -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; +export interface BrokerRebateInfoV2 { + affiliationType: 'affiliate' | 'official'; + userLevel: string; + clientSpotRebateRatio: string; + clientFuturesRebateRatio: string; } ⋮---- /** * - * * Common | BGB Convert + * * Broker | Agent (affiliate) customer APIs * */ ⋮---- -export interface GetConvertBGBHistoryRequestV2 { - orderId?: string; - startTime: string; - endTime: string; - limit?: string; - idLessThan?: string; +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; } - -================ -File: src/types/request/v3/broker.ts -================ -export interface CreateBrokerSubAccountRequestV3 { - subaccountName: string; - label: string; +⋮---- +export interface AgentCustomerCommissionsV2 { + endId: string; + commissionList: AgentCustomerCommissionItemV2[]; } ⋮---- -export interface GetBrokerSubAccountListRequestV3 { - limit?: string; - cursor?: string; - status?: 'normal' | 'freeze'; +export interface AgentSubCustomerItemV2 { + uid: string; + registerTime: string; } ⋮---- -export interface ModifyBrokerSubAccountRequestV3 { - subUid: string; - status?: 'normal' | 'freeze'; - permList?: string[]; +export interface AgentSubCustomerListV2 { + list: AgentSubCustomerItemV2[]; + minId: string; } ⋮---- -export interface BrokerSubWithdrawalRequestV3 { - subUid: string; - coin: string; - dest: 'on_chain' | 'internal_transfer'; - address: string; - amount: string; - chain?: string; - tag?: string; - clientOid?: string; +export interface AgentCustomerTradeVolumeItemV2 { + uid: string; + /** API field name (Bitget spelling). */ + volumn: string; + spotVolume: string; + futuresVolume: string; + time: string; } ⋮---- -export interface GetBrokerSubDepositAddressRequestV3 { - subUid: string; - coin: string; - chain?: string; +/** API field name (Bitget spelling). */ +⋮---- +export interface AgentCustomerListItemV2 { + uid: string; + registerTime: string; } ⋮---- -export interface GetBrokerAllSubDepositWithdrawalRequestV3 { - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; - status?: 'pending' | 'fail' | 'success'; +export interface AgentCustomerKycItemV2 { + uid: string; + kycResult: 'passed' | 'not_passed' | string; } ⋮---- -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'; +export interface AgentCustomerKycResultV2 { + userList: AgentCustomerKycItemV2[]; + endId: string; } ⋮---- -export interface CreateBrokerSubApiKeyRequestV3 { - subUid: string; - passphrase: string; - label: string; - ipList?: string[]; - permType: 'read_write' | 'read_only'; - permList: string[]; +export interface AgentCustomerDepositItemV2 { + orderId: string; + uid: string; + depositTime: string; + depositCoin: string; + depositAmount: string; } ⋮---- -export interface ModifyBrokerSubApiKeyRequestV3 { - subUid: string; - passphrase: string; - apiKey: string; - label?: string; - ipList?: string[]; - permType?: 'read_write' | 'read_only'; - permList?: string[]; +export interface AgentCustomerAssetItemV2 { + balance: string; + uid: string; + uTime: string; + remark: string; } ⋮---- -export interface DeleteBrokerSubApiKeyRequestV3 { - subUid: string; - apiKey: 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 GetBrokerSubApiKeyRequestV3 { - subUid: string; +export interface AgentCommissionDetailV2 { + endId: string; + commissionList: AgentCommissionDetailItemV2[]; +} +⋮---- +export interface SubAffiliateRebateRateV2 { + rebateType: string; + rebateRate: string; +} +⋮---- +export interface SubAffiliateInfoItemV2 { + uid: string; + uplineName: string; + rebateRateList: SubAffiliateRebateRateV2[]; + verificationStatus: string; + directReferrals: string; + subAffiliates: string; + subAffiliateDirectReferrals: string; + volume: string; + deposit: string; + transactionFee: string; + rebate: string; +} +⋮---- +export interface SubAffiliateInfoV2 { + list: SubAffiliateInfoItemV2[]; + endId: string; } ================ -File: src/types/request/v3/cfd.ts +File: src/types/response/v2/futures.ts ================ -export type CfdYesNoV3 = 'yes' | 'no'; +/** + * + * * Futures | Market + * + */ ⋮---- -export type CfdOrderTypeV3 = 'limit' | 'market'; +export interface FuturesVipFeeRateV2 { + level: string; + dealAmount: string; + assetAmount: string; + takerFeeRate: string; + makerFeeRate: string; + btcWithdrawAmount: string; + usdtWithdrawAmount: string; +} ⋮---- -export type CfdSideV3 = 'buy' | 'sell'; +export interface FuturesHistoryInterestRateV2 { + ts: string; + annualInterestRate: string; + dailyInterestRate: string; +} ⋮---- -export type CfdKlineIntervalV3 = '1m' | '15m' | '1h' | '4h' | '1d'; +export interface FuturesInterestExchangeRateV2 { + tier: string; + minAmount: string; + maxAmount: string; + exchangeRate: string; +} ⋮---- -export type CfdTransferAccountTypeV3 = 'funding' | 'uta'; +export interface FuturesDiscountRateV2 { + tier: string; + minAmount: string; + maxAmount: string; + discountRate: string; +} ⋮---- -export type CfdTransferDirectionV3 = 'in' | 'out'; +export interface FuturesDiscountRatesV2 { + coin: string; + userLimit: string; + totalLimit: string; + discountRateList: FuturesDiscountRateV2[]; +} ⋮---- -export interface GetCfdTickersRequestV3 { - symbol?: string; +export interface FuturesMergeDepthV2 { + asks: [number, number][]; + bids: [number, number][]; + ts: string; + scale: string; + precision: string; + isMaxPrecision: string; } ⋮---- -export interface GetCfdHistoryCandlestickRequestV3 { +export interface FuturesTickerV2 { symbol: string; - interval: CfdKlineIntervalV3; - side?: CfdSideV3; - startTime?: string; - endTime?: string; - limit?: 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 PlaceCfdOrderRequestV3 { +export interface FuturesFillV2 { + tradeId: string; + price: string; + size: string; + side: string; + ts: string; symbol: string; - orderType: CfdOrderTypeV3; - side: CfdSideV3; - qty: string; - price?: string; - takeProfit?: string; - stopLoss?: string; } ⋮---- -export interface ModifyCfdOrderRequestV3 { - orderId: string; - price?: string; - takeProfit?: string; - stopLoss?: string; -} +export type FuturesCandlestickV2 = [ + string, // timestamp + string, // open + string, // high + string, // low + string, // close + string, // baseVolume + string, // usdtVolume + string, // quoteVolume +]; ⋮---- -export interface CancelCfdOrderRequestV3 { - orderId: string; -} +string, // timestamp +string, // open +string, // high +string, // low +string, // close +string, // baseVolume +string, // usdtVolume +string, // quoteVolume ⋮---- -export interface CancelAllCfdOrdersRequestV3 { - symbol?: string; +export interface FuturesOpenInterestV2 { + symbol: string; + size: string; } ⋮---- -export interface CloseCfdPositionsRequestV3 { - positionId: string; - qty: string; +export interface FuturesFundingTimeV2 { + symbol: string; + nextFundingTime: string; + ratePeriod: string; } ⋮---- -export interface CloseAllCfdPositionsRequestV3 { - symbol?: string; +export interface FuturesSymbolPriceV2 { + symbol: string; + price: string; + indexPrice: string; + markPrice: string; + ts: string; } ⋮---- -export interface GetCfdUnfilledOrdersRequestV3 { - symbol?: string; - subUid?: string; +export interface FuturesHistoricalFundingRateV2 { + symbol: string; + fundingRate: string; + fundingTime: string; } ⋮---- -export interface GetCfdOrderHistoryRequestV3 { +export interface FuturesContractConfigV2 { symbol: string; - subUid?: string; - startTime?: string; - endTime?: string; - /** Default 10, range [1, 50]. The first page may return more rows than limit. */ - limit?: string; - pageNo?: string; - /** - * Not required for the first page. - * From the second page, pass the orderId of the last record from the previous page. - */ - cursor?: 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; } ⋮---- -/** Default 10, range [1, 50]. The first page may return more rows than limit. */ -⋮---- /** - * Not required for the first page. - * From the second page, pass the orderId of the last record from the previous page. - */ + * + * * Futures | Account + * + */ ⋮---- -export interface GetCfdCurrentPositionsRequestV3 { - symbol?: string; - subUid?: 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 CfdTransferRequestV3 { +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 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; - amount: string; - accountType: CfdTransferAccountTypeV3; - direction: CfdTransferDirectionV3; + 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 GetCfdTransferRecordsRequestV3 { - transferId?: string; - subUid?: string; - startTime?: string; - endTime?: string; - direction?: CfdTransferDirectionV3; - limit?: string; +export interface SetLeverageResponseV2 { + symbol: string; + marginCoin: string; + longLeverage: string; + shortLeverage: string; + crossMarginLeverage: string; + marginMode: string; } ⋮---- -export interface GetCfdFinancialRecordsRequestV3 { - type?: string; - startTime?: string; - endTime?: string; - limit?: string; +export interface SetMarginModeResponseV2 { + symbol: string; + marginCoin: string; + longLeverage: string; + shortLeverage: string; + marginMode: string; } ⋮---- -export interface GetCfdInstrumentsRequestV3 { - symbol?: string; +export interface FuturesAccountBillV2 { + billId: string; + symbol: string; + amount: string; + fee: string; + feeByCoupon: string; + businessType: string; + coin: string; + balance: string; + cTime: string; } - -================ -File: src/types/request/v3/earn.ts -================ +⋮---- /** * - * - * Earn | On-Chain Elite (UTA) - * + * * Futures | Position * */ ⋮---- -export interface GetEarnEliteRecordsRequestV3 { - type: 'subscribe' | 'redeem' | 'interest'; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +export interface FuturesPositionTierV2 { + symbol: string; + level: string; + startUnit: string; + endUnit: string; + leverage: string; + keepMarginRate: string; } ⋮---- -export interface GetEarnEliteSubscribeInfoRequestV3 { - productId: string; +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; } ⋮---- -export interface EarnEliteSubscribeRequestV3 { - productSubId: string; - amount: string; - coin?: string; - paymentAccount?: 'spot' | 'unified'; -} +/** Cash dividend, USDT */ ⋮---- -export interface GetEarnEliteSubscribeResultRequestV3 { - orderId: string; +export interface FuturesPositionAdlRankV2 { + symbol: string; + marginCoin: string; + adlRank: string; + rank: string; + holdSide: string; } ⋮---- -export interface GetEarnEliteRedeemInfoRequestV3 { - productId: string; +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; } ⋮---- -export interface RedeemEarnEliteRequestV3 { - productId: string; - productSubId: string; - redeemType: 'fast' | 'standard'; - amount: string; - receiveAccount: 'spot' | 'unified'; - advancedSettle?: 'yes' | 'no'; - coin?: string; -} +/** Cash dividend, USDT */ ⋮---- /** * - * - * Earn | Cash+ (UTA) - * Master and sub-accounts can call these. - * + * * Futures | Trade * */ ⋮---- -export type EarnCashPlusRecordTypeV3 = - | 'subscribe' - | 'redeem' - | 'compound_interest' - | 'liquidation_redeem'; -⋮---- -export interface EarnCashPlusSubscribeRequestV3 { - /** From subscribe-info */ - productSubId: string; - /** Subscription amount, in the subscription coin */ - amount: string; - /** - * Debit account. funding (default), uta, or otc. - * Comma-separated when more than one, e.g. funding,uta. - */ - accountType?: string; - /** Prevents a duplicate submit of the same subscription */ - idempotentNo?: string; +export interface FuturesBatchOrderResponseV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + errorCode: string; + }[]; } ⋮---- -/** From subscribe-info */ -⋮---- -/** Subscription amount, in the subscription coin */ -⋮---- -/** - * Debit account. funding (default), uta, or otc. - * Comma-separated when more than one, e.g. funding,uta. - */ -⋮---- -/** Prevents a duplicate submit of the same subscription */ +export interface FuturesClosePositionResponseV2 { + successList: { + orderId: string; + clientOid: string; + symbol: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + symbol: string; + errorMsg: string; + errorCode: string; + }[]; +} ⋮---- -export interface GetEarnCashPlusSubscribeResultRequestV3 { +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 EarnCashPlusRedeemRequestV3 { - productSubId: string; - /** Amount of Cash+ to redeem */ - amount: string; - /** Credit account. funding (default) or uta */ - accountType?: 'funding' | 'uta'; +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; } ⋮---- -/** Amount of Cash+ to redeem */ -⋮---- -/** Credit account. funding (default) or uta */ -⋮---- -export interface GetEarnCashPlusRedeemResultRequestV3 { +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 GetEarnCashPlusHistoryOrdersRequestV3 { - startTime?: string; - endTime?: string; - recordType?: EarnCashPlusRecordTypeV3; - /** Default 20, max 100 */ - limit?: string; - /** Pass nextCursor from the previous page. Omit on the first page */ - cursor?: 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; } ⋮---- -/** Default 20, max 100 */ +export interface FuturesCancelAllOrdersV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + errorCode: string; + }[]; +} ⋮---- -/** Pass nextCursor from the previous page. Omit on the first page */ - -================ -File: src/types/response/v2/broker.ts -================ /** * - * * Broker | Subaccount + * * Futures | Trigger Orders * */ ⋮---- -export interface CreateSubaccountResponseV2 { - subUid: string; - subaccountName: string; +export interface FuturesTriggerSubOrderV2 { + orderId: string; + price: string; + type: string; status: string; - permList: string[]; - label: string; - cTime: string; } ⋮---- -export interface BrokerSubaccountV2 { - subUid: string; - subaccountName: string; - status: string; - permList: string[]; - label: string; - language: 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 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; -} -⋮---- -export interface BrokerSubaccountSpotAssetV2 { - coin: string; - available: string; - frozen: string; - locked: string; - uTime: string; -} -⋮---- -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; -} -⋮---- -export interface CreateSubaccountDepositAddressV2 { - subUid: string; - coin: string; - address: string; - chain: string; - tag: string; - url: string; - cTime: 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 FuturesCancelPlanOrderV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + }[]; } ⋮---- -export interface BrokerSubaccountWithdrawalV2 { +export interface FuturesHistoryPlanOrderV2 { + planType: string; + symbol: string; + size: string; 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; + 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 | Api Key + * * Futures | Union Margin * */ ⋮---- -export interface CreateSubaccountApiKeyResponseV2 { - subUid: string; - apiKey: string; - secretKey: string; - label: string; - ipList: string[]; - permType: string; - permList: string[]; +export interface UnionTransferLimitsV2 { + coin: string; + maxTransferIn: string; } ⋮---- -export interface SubaccountApiKeyV2 { - subUid: string; - label: string; - apiKey: string; - secretKey: string; - permType: string; - permList: string[]; - ipList: string[]; +export interface UnionConfigV2 { + imr: string; + mmr: string; + individualLimit: string; + individualLimitRatio: string; } ⋮---- -export interface ModifySubaccountApiKeyResponseV2 { - subUid: string; - apiKey: string; - label: string; - ipList: string[]; - permType: string; - permList: string[]; +export interface UnionSwitchUsdtV2 { + usdtAmount: string; } ⋮---- -/** - * - * * Broker | All Sub-accounts Deposit and Withdrawal Records - * - */ -⋮---- -export interface AllSubDepositWithdrawalRecordV2 { - uid: string; - txId: string; - type: 'deposit' | 'withdrawal'; - subType: 'onchain' | 'internal' | 'fast'; - coin: string; - amount: string; - status: 'pending' | 'fail' | 'success'; - ts: string; +export interface UnionConvertV2 { + usdtAmount: string; } ⋮---- /** * - * * Broker | Subaccounts + * * Futures | Account | Max Openable Quantity * */ ⋮---- -export interface BrokerSubaccountInfoV2 { - uid: string; - asset: string; - firstTimeDeposit: string; - firstTimeTrade: string; - registerTime: string; +export interface FuturesMaxOpenV2 { + maxOpen: string; } ⋮---- /** * - * * Broker | Commissions + * * Futures | Account | Liquidation Price * */ ⋮---- -export interface BrokerCommissionV2 { - uid: string; - coin: string; - symbol: string; - dealtAmount: string; - totalFee: string; - deductedFee: string; - paidFee: string; - markUpFee: string; - totalCommission: string; +export interface FuturesLiquidationPriceV2 { + liqPrice: string; } ⋮---- /** * - * * Broker | Trade Volume + * * Futures | Account | Isolated Symbols * */ ⋮---- -export interface BrokerTradeVolumeV2 { - uid: string; - volume: string; - spotVolume: string; - futureVolume: string; +export interface FuturesIsolatedSymbolV2 { + symbol: string; + marginMode: 'isolated'; } -⋮---- + +================ +File: src/types/response/v2/spot.ts +================ /** * - * * Broker | Total Commission + * * Spot | Market * */ ⋮---- -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 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; } ⋮---- -/** - * - * * Broker | Order Commission - * - */ +export interface SpotCoinInfoV2 { + coinId: string; + coin: string; + transfer: boolean; + chains: SpotCoinChainV2[]; +} ⋮---- -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'; +export interface SpotSymbolInfoV2 { symbol: string; - volume: string; - fee: string; - pureFee: string; - rebateAmount: string; -} -⋮---- -export interface BrokerOrderCommissionV2 { - commissionlist: BrokerOrderCommissionItemV2[]; - endId: string; -} -⋮---- -/** - * - * * Broker | Rebate Info - * - */ -⋮---- -export interface BrokerRebateInfoV2 { - affiliationType: 'affiliate' | 'official'; - userLevel: string; - clientSpotRebateRatio: string; - clientFuturesRebateRatio: 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; } ⋮---- -/** - * - * * Broker | Agent (affiliate) customer APIs - * - */ -⋮---- -export interface AgentCustomerCommissionItemV2 { - uid: string; - date: string; - coin: string; - symbol: string; - productType: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES' - | string; +export interface SpotVipFeeRateV2 { + level: number; 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; + assetAmount: string; + takerFeeRate: string; + makerFeeRate: string; + btcWithdrawAmount: string; + usdtWithdrawAmount: string; } ⋮---- -export interface AgentCustomerCommissionsV2 { - endId: string; - commissionList: AgentCustomerCommissionItemV2[]; +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 AgentSubCustomerItemV2 { - uid: string; - registerTime: string; +export interface SpotCallAuctionV2 { + stage: string; + stageEndTime: string; + estOpeningPrice: string | null; + matchedVolume: string | null; + auctionEndTime: string; } ⋮---- -export interface AgentSubCustomerListV2 { - list: AgentSubCustomerItemV2[]; - minId: string; +export interface SpotMergeDepthV2 { + asks: [string, string][]; + bids: [string, string][]; + ts: string; + scale: string; + precision: string; + isMaxPrecision: string; } ⋮---- -export interface AgentCustomerTradeVolumeItemV2 { - uid: string; - /** API field name (Bitget spelling). */ - volumn: string; - spotVolume: string; - futuresVolume: string; - time: string; +export interface SpotOrderBookDepthV2 { + asks: [string, string][]; + bids: [string, string][]; + ts: string; } ⋮---- -/** API field name (Bitget spelling). */ +export type SpotCandlestickV2 = [ + string, // timestamp + string, // open + string, // high + string, // low + string, // close + string, // baseVolume + string, // usdtVolume + string, // quoteVolume +]; ⋮---- -export interface AgentCustomerListItemV2 { - uid: string; - registerTime: string; -} +string, // timestamp +string, // open +string, // high +string, // low +string, // close +string, // baseVolume +string, // usdtVolume +string, // quoteVolume ⋮---- -export interface AgentCustomerKycItemV2 { - uid: string; - kycResult: 'passed' | 'not_passed' | string; +export interface SpotTradeV2 { + symbol: string; + tradeId: string; + side: string; + price: string; + size: string; + ts: string; } ⋮---- -export interface AgentCustomerKycResultV2 { - userList: AgentCustomerKycItemV2[]; - endId: string; -} +/** + * + * * Spot | Trade + * + */ ⋮---- -export interface AgentCustomerDepositItemV2 { +export interface CancelAndSubmitSpotOrderResponseV2 { orderId: string; - uid: string; - depositTime: string; - depositCoin: string; - depositAmount: string; + clientOid: string | null; + success: string; + msg: string | null; } ⋮---- -export interface AgentCustomerAssetItemV2 { - balance: string; - uid: string; - uTime: string; - remark: string; +export interface SubmitSpotBatchOrdersResponseV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + errorCode?: string; + }[]; } ⋮---- -export interface AgentCommissionDetailItemV2 { - uid: string; - bizType: 'spot' | 'futures' | string; - subBizType: string; +export interface SpotOrderInfoV2 { + userId: 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; + 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 AgentCommissionDetailV2 { - endId: string; - commissionList: AgentCommissionDetailItemV2[]; +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 SubAffiliateRebateRateV2 { - rebateType: string; - rebateRate: 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 SubAffiliateInfoItemV2 { - uid: string; - uplineName: string; - rebateRateList: SubAffiliateRebateRateV2[]; - verificationStatus: string; - directReferrals: string; - subAffiliates: string; - subAffiliateDirectReferrals: string; - volume: string; - deposit: string; - transactionFee: string; - rebate: 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 SubAffiliateInfoV2 { - list: SubAffiliateInfoItemV2[]; - endId: 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; } - -================ -File: src/types/response/v2/futures.ts -================ +⋮---- +export interface SpotPlanSubOrderV2 { + orderId: string; + price: string; + type: string; + status: string; +} +⋮---- +export interface SpotCancelPlanOrdersV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + }[]; +} +⋮---- /** * - * * Futures | Market + * * Spot | Account * */ ⋮---- -export interface FuturesVipFeeRateV2 { - level: string; - dealAmount: string; - assetAmount: string; - takerFeeRate: string; - makerFeeRate: string; - btcWithdrawAmount: string; - usdtWithdrawAmount: string; +export interface SpotAccountInfoV2 { + userId: string; + inviterId: string; + ips: string; + authorities: string[]; + parentId: number; + traderType: string; + channelCode: string; + channel: string; + regisTime: string; } ⋮---- -export interface FuturesHistoryInterestRateV2 { - ts: string; - annualInterestRate: string; - dailyInterestRate: string; +export interface SpotAccountAssetV2 { + coin: string; + available: string; + frozen: string; + locked: string; + limitAvailable: string; + uTime: string; } ⋮---- -export interface FuturesInterestExchangeRateV2 { - tier: string; - minAmount: string; - maxAmount: string; - exchangeRate: string; +export interface SpotSubAccountAssetV2 { + coin: string; + available: string; + limitAvailable: string; + frozen: string; + locked: string; + uTime: string; } -⋮---- -export interface FuturesDiscountRateV2 { - tier: string; - minAmount: string; - maxAmount: string; - discountRate: string; +export interface SpotSubAccountAssetsV2 { + userId: number; + assetsList: SpotSubAccountAssetV2[]; } ⋮---- -export interface FuturesDiscountRatesV2 { +export interface SpotAccountBillV2 { + cTime: string; coin: string; - userLimit: string; - totalLimit: string; - discountRateList: FuturesDiscountRateV2[]; + groupType: string; + businessType: string; + size: string; + balance: string; + fees: string; + billId: string; } ⋮---- -export interface FuturesMergeDepthV2 { - asks: [number, number][]; - bids: [number, number][]; +export interface SpotMainSubTransferRecordV2 { + coin: string; + status: string; + toType: string; + fromType: string; + size: string; ts: string; - scale: string; - precision: string; - isMaxPrecision: string; + clientOid: string; + transferId: string; + fromUserId: string; + toUserId: string; } ⋮---- -export interface FuturesTickerV2 { - symbol: string; - lastPr: string; - askPr: string; - bidPr: string; - bidSz: string; - askSz: string; - high24h: string; - low24h: string; +export interface SpotTransferRecordV2 { + coin: string; + status: string; + toType: string; + toSymbol: string; + fromType: string; + fromSymbol: string; + size: 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; + clientOid: string; + transferId: string; } ⋮---- -export interface FuturesFillV2 { - tradeId: string; - price: string; - size: string; - side: string; - ts: string; - symbol: string; +export interface SpotDepositAddressV2 { + address: string; + chain: string; + coin: string; + tag: string; + url: string; } ⋮---- -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; +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; } ⋮---- -export interface FuturesFundingTimeV2 { - symbol: string; - nextFundingTime: string; - ratePeriod: 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 FuturesSymbolPriceV2 { - symbol: string; - price: string; - indexPrice: string; - markPrice: string; - ts: 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 FuturesHistoricalFundingRateV2 { - symbol: string; - fundingRate: string; - fundingTime: 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; } ⋮---- -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; +export interface BrokerSubAccountV3 { + subUid: string; + subaccountName: string; + subaccountEmail: string | null; + status: 'normal' | 'freeze'; + permList: string[]; + label: string; + language: string; + cTime: string; + uTime: 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; +export interface GetBrokerSubAccountListResponseV3 { + subList: BrokerSubAccountV3[]; } ⋮---- -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 ModifyBrokerSubAccountResponseV3 { + subUid: string; + subaccountName: string; + status: 'normal' | 'freeze'; + permList: string[]; + label: string; + cTime: string; + uTime: 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 BrokerSubWithdrawalResponseV3 { + orderId: string; + clientOid: string; } ⋮---- -export interface FuturesInterestV2 { +export interface BrokerSubDepositAddressV3 { + subUid: string; coin: string; - liability: string; - interestFreeLimit: string; - interestLimit: string; - hourInterestRate: string; - interest: string; + address: string; + chain: string; + tag: string | null; + url: 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 BrokerSubDepositWithdrawalRecordV3 { + uid: string; + txId: string; + type: 'deposit' | 'withdrawal'; + subType: 'onchain' | 'internal' | 'fast'; + coin: string; + amount: string; + status: 'pending' | 'fail' | 'success'; + ts: string; } ⋮---- -export interface SetMarginModeResponseV2 { - symbol: string; - marginCoin: string; - longLeverage: string; - shortLeverage: string; - marginMode: string; +export interface GetBrokerAllSubDepositWithdrawalResponseV3 { + list: BrokerSubDepositWithdrawalRecordV3[]; + endId: string; } ⋮---- -export interface FuturesAccountBillV2 { - billId: string; +export interface BrokerCommissionRecordV3 { + uid: string; + coin: string; symbol: string; - amount: string; - fee: string; - feeByCoupon: string; - businessType: string; - coin: string; - balance: string; - cTime: 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; } ⋮---- /** * - * * Futures | Position + * + * Broker | Email and Commissions + * * */ ⋮---- -export interface FuturesPositionTierV2 { - symbol: string; - level: string; - startUnit: string; - endUnit: string; - leverage: string; - keepMarginRate: string; -} +export type ModifySubaccountEmailResponseV3 = string; ⋮---- -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; +export interface SubaccountEmailV3 { + subUid: string; + subaccountName: string; + subaccountEmail: string; cTime: string; + uTime: string; } ⋮---- -/** Cash dividend, USDT */ +export interface BrokerTradeVolumeV3 { + uid: string; + volume: string; + spotVolume: string; + futureVolume: string; +} ⋮---- -export interface FuturesPositionAdlRankV2 { - symbol: string; - marginCoin: string; - adlRank: string; - rank: string; - holdSide: string; +export interface BrokerSpotCommissionV3 { + spotTradingVolume: string; + spotTradingFee: string; + spotPureTradingFee: string; + spotCommission: string; } ⋮---- -export interface FuturesHistoryPositionV2 { - positionId: string; - marginCoin: string; +export interface BrokerFuturesCommissionV3 { + futuresTradingVolume: string; + futuresTradingFee: string; + futuresPureTradingFee: string; + futuresCommission: string; +} +⋮---- +export interface BrokerTotalCommissionV3 { + date: string; + totalTradingVolume: string; + totalActiveTraders: string; + totalCommission: string; + spot: BrokerSpotCommissionV3; + futures: BrokerFuturesCommissionV3; +} +⋮---- +export interface BrokerOrderCommissionItemV3 { + fillId: string; + orderId: string; + ts: string; + clientOid: string; + bizType: string; + subBizType: 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; + volume: string; + fee: string; + pureFee: string; + rebateAmount: string; } ⋮---- -/** Cash dividend, USDT */ +export interface BrokerOrderCommissionV3 { + commissionlist: BrokerOrderCommissionItemV3[]; + endId: string; +} ⋮---- +export interface BrokerRebateInfoV3 { + affiliationType: string; + userLevel: string; + clientSpotRebateRatio: string; + clientFuturesRebateRatio: string; +} + +================ +File: src/types/response/v3/stockplus.ts +================ /** * - * * Futures | Trade + * + * Stock+ (UTA) + * * */ ⋮---- -export interface FuturesBatchOrderResponseV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - errorCode: 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 FuturesClosePositionResponseV2 { - successList: { - orderId: string; - clientOid: string; - symbol: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - symbol: string; - errorMsg: string; - errorCode: string; - }[]; +export interface StockPlusOptionQuoteV3 { + secuQuote: StockPlusOptionQuoteItemV3[]; } ⋮---- -export interface FuturesOrderDetailV2 { - symbol: string; - size: string; - orderId: string; - clientOid: string; - baseVolume: string; - priceAvg: string; - fee: string; +export interface StockPlusOptionStrikePriceInfoV3 { 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; + callSymbol: string; + putSymbol: string; + standard: boolean; } ⋮---- -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 StockPlusOptionChainInfoV3 { + strikePriceInfo: StockPlusOptionStrikePriceInfoV3[]; } ⋮---- -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 StockPlusOptionExpiryDateV3 { + expiryDate: 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 StockPlusOptionVolumeV3 { + c: string; + p: string; } ⋮---- -export interface FuturesCancelAllOrdersV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - errorCode: 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; } ⋮---- -/** - * - * * Futures | Trigger Orders - * - */ +export interface StockPlusStaticInfoV3 { + list: StockPlusStaticInfoItemV3[]; +} ⋮---- -export interface FuturesTriggerSubOrderV2 { - orderId: string; - price: string; - type: string; - status: string; +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 FuturesPendingPlanOrderV2 { - planType: string; +export interface StockPlusQuoteItemV3 { 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; + 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 FuturesCancelPlanOrderV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - }[]; +export interface StockPlusQuoteV3 { + list: StockPlusQuoteItemV3[]; } ⋮---- -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; +export interface StockPlusTradeDetailItemV3 { + price: string | number; + volume: string | number; + timestamp: string; + tradeType: string; + direction: string; + tradeSession: string; } ⋮---- -/** - * - * * Futures | Union Margin - * - */ +export type StockPlusTradeDetailV3 = StockPlusTradeDetailItemV3[]; ⋮---- -export interface UnionTransferLimitsV2 { - coin: string; - maxTransferIn: string; +export interface StockPlusIntradayItemV3 { + price: string | number; + timestamp: string; + volume: string | number; + turnover: string | number; + avgPrice: string | number; } ⋮---- -export interface UnionConfigV2 { - imr: string; - mmr: string; - individualLimit: string; - individualLimitRatio: string; +export interface StockPlusIntradayV3 { + list: StockPlusIntradayItemV3[]; } ⋮---- -export interface UnionSwitchUsdtV2 { - usdtAmount: string; +export interface StockPlusCandlestickItemV3 { + close: string; + open: string; + low: string; + high: string; + volume: string; + turnover: string; + timestamp: string; + tradeSession: string; } ⋮---- -export interface UnionConvertV2 { - usdtAmount: string; +export interface StockPlusCandlestickV3 { + list: StockPlusCandlestickItemV3[]; } ⋮---- -/** - * - * * Futures | Account | Max Openable Quantity - * - */ +export type StockPlusHistoryCandlestickV3 = StockPlusCandlestickV3; ⋮---- -export interface FuturesMaxOpenV2 { - maxOpen: string; +export interface StockPlusDepthLevelV3 { + position: number; + price: string; + volume: string; + orderNum: number; } ⋮---- -/** - * - * * Futures | Account | Liquidation Price - * - */ -⋮---- -export interface FuturesLiquidationPriceV2 { - liqPrice: string; +export interface StockPlusDepthV3 { + asks: StockPlusDepthLevelV3[]; + bids: StockPlusDepthLevelV3[]; } ⋮---- -/** - * - * * Futures | Account | Isolated Symbols - * - */ +export interface StockPlusPlaceOrderResponseV3 { + orderId: string; + clientOid: string; + symbol: string; +} ⋮---- -export interface FuturesIsolatedSymbolV2 { +export type StockPlusCancelOrderResponseV3 = StockPlusPlaceOrderResponseV3; +export type StockPlusModifyOrderResponseV3 = StockPlusPlaceOrderResponseV3; +⋮---- +export interface StockPlusMaxPurchaseV3 { + cashMaxQty: string; + marginMaxQty: 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; - marginMode: 'isolated'; + 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; } - -================ -File: src/types/response/v2/spot.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 StockPlusOrdersV3 { + orders: StockPlusOrderV3[]; } ⋮---- -export interface SpotCoinInfoV2 { - coinId: string; - coin: string; - transfer: boolean; - chains: SpotCoinChainV2[]; +export interface StockPlusHistoryOrdersV3 { + hasMore: boolean; + orders: StockPlusOrderV3[]; } ⋮---- -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 StockPlusOrderHistoryItemV3 { + price: string | number; + quantity: string | number; status: string; - buyLimitPriceRatio: string; - sellLimitPriceRatio: string; - orderQuantity: string; - areaSymbol: string; - maxLimitOrderValue?: string; - maxMarketOrderValue?: string; + msg: string; + time: string; } ⋮---- -export interface SpotVipFeeRateV2 { - level: number; - dealAmount: string; - assetAmount: string; - takerFeeRate: string; - makerFeeRate: string; - btcWithdrawAmount: string; - usdtWithdrawAmount: string; +export interface StockPlusChargeFeeItemV3 { + code: string; + name: string; + amount: number | string; + currency: 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; - ts: string; - changeUtc24h: string; - change24h: string; +export interface StockPlusChargeCategoryV3 { + code: string; + name: string; + fees: StockPlusChargeFeeItemV3[]; } ⋮---- -export interface SpotCallAuctionV2 { - stage: string; - stageEndTime: string; - estOpeningPrice: string | null; - matchedVolume: string | null; - auctionEndTime: string; +export interface StockPlusChargeDetailV3 { + totalAmount: number | string; + currency: string; + items: StockPlusChargeCategoryV3[]; } ⋮---- -export interface SpotMergeDepthV2 { - asks: [string, string][]; - bids: [string, string][]; - ts: string; - scale: string; - precision: string; - isMaxPrecision: string; +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 SpotOrderBookDepthV2 { - asks: [string, string][]; - bids: [string, string][]; - ts: string; +export interface StockPlusExecutionV3 { + orderId: string; + tradeId: string; + symbol: string; + tradeDoneAt: string; + quantity: number | string; + price: number | string; } ⋮---- -export type SpotCandlestickV2 = [ - string, // timestamp - string, // open - string, // high - string, // low - string, // close - string, // baseVolume - string, // usdtVolume - string, // quoteVolume -]; +export interface StockPlusTodayExecutionsV3 { + trades: StockPlusExecutionV3[]; +} ⋮---- -string, // timestamp -string, // open -string, // high -string, // low -string, // close -string, // baseVolume -string, // usdtVolume -string, // quoteVolume +export interface StockPlusHistoryExecutionsV3 { + hasMore: boolean; + trades: StockPlusExecutionV3[]; +} ⋮---- -export interface SpotTradeV2 { - symbol: string; - tradeId: string; - side: string; - price: string; - size: string; - ts: string; +export interface StockPlusCashInfoV3 { + withdrawCash: number | string; + availableCash: number | string; + frozenCash: number | string; + settlingCash: number | string; + currency: string; } ⋮---- -/** - * - * * Spot | Trade - * - */ +export interface StockPlusFrozenTransactionFeeV3 { + currency?: string; + amount?: number | string; + [key: string]: unknown; +} ⋮---- -export interface CancelAndSubmitSpotOrderResponseV2 { - orderId: string; - clientOid: string | null; - success: string; - msg: string | null; +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 SubmitSpotBatchOrdersResponseV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - errorCode?: string; - }[]; +export interface StockPlusAccountV3 { + list: StockPlusAccountItemV3[]; } ⋮---- -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 StockPlusCashFlowItemV3 { + transactionFlowName: string; + direction: string; + businessType: string; + balance: number | string; + currency: string; + businessTime: string; + symbol: string | null; + description: 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 StockPlusCashFlowV3 { + list: StockPlusCashFlowItemV3[]; } ⋮---- -export interface SpotFillV2 { - userId: string; +export interface StockPlusPositionItemV3 { 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; + symbolName: string; + quantity: number | string; + availableQuantity: number | string; + currency: string; + costPrice: number | string; + market: string; + initQuantity: number | 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 StockPlusPositionChannelV3 { + accountChannel: string; + positions: StockPlusPositionItemV3[]; } ⋮---- -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 StockPlusStockPositionV3 { + channels: StockPlusPositionChannelV3[]; } ⋮---- -export interface SpotPlanSubOrderV2 { - orderId: string; - price: string; - type: string; - status: string; +export interface StockPlusTransferResponseV3 { + transferId: string; } ⋮---- -export interface SpotCancelPlanOrdersV2 { - successList: { - orderId: string; - clientOid: string; - }[]; - failureList: { - orderId: string; - clientOid: string; - errorMsg: string; - }[]; +export interface StockPlusTransferRecordsV3 { + transferId: string; + coin: string; + amount: string; + direction: string; + cursor: string; } -⋮---- + +================ +File: src/types/request/v2/broker.ts +================ /** * - * * Spot | Account + * * Broker | Subaccount * */ ⋮---- -export interface SpotAccountInfoV2 { - userId: string; - inviterId: string; - ips: string; - authorities: string[]; - parentId: number; - traderType: string; - channelCode: string; - channel: string; - regisTime: string; +export interface GetSubAccountsRequestV2 { + limit?: string; + idLessThan?: string; + status?: 'normal' | 'freeze' | 'del'; + startTime?: string; + endTime?: string; } ⋮---- -export interface SpotAccountAssetV2 { - coin: string; - available: string; - frozen: string; - locked: string; - limitAvailable: string; - uTime: string; -} +export type SubAccountPermissionV2 = + | 'withdraw' + | 'transfer' + | 'spot_trade' + | 'contract_trade' + | 'read' + | 'deposit' + | 'margin_trade'; ⋮---- -export interface SpotSubAccountAssetV2 { - coin: string; - available: string; - limitAvailable: string; - frozen: string; - locked: string; - uTime: string; -} -export interface SpotSubAccountAssetsV2 { - userId: number; - assetsList: SpotSubAccountAssetV2[]; -} +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 SpotAccountBillV2 { - cTime: string; - coin: string; - groupType: string; - businessType: string; - size: string; - balance: string; - fees: string; - billId: string; +export type SubAccountStatusV2 = 'normal' | 'freeze'; +⋮---- +export interface ModifySubRequestV2 { + subUid: string; + permList: SubAccountPermissionV2[]; + status: SubAccountStatusV2; + language?: SubAccountLanguageV2; } ⋮---- -export interface SpotMainSubTransferRecordV2 { +export interface SubWithdrawalRequestV2 { + subUid: string; coin: string; - status: string; - toType: string; - fromType: string; - size: string; - ts: string; - clientOid: string; - transferId: string; - fromUserId: string; - toUserId: string; + dest: 'on_chain' | 'internal_transfer'; + chain?: string; + address: string; + amount: string; + tag?: string; + clientOid?: 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 SpotDepositAddressV2 { - address: string; - chain: string; - coin: string; - tag: string; - url: string; +export interface SubDepositRecordsRequestV2 { + orderId?: string; + userId?: string; + startTime?: string; + endTime?: string; + limit?: string; + idLessThan?: 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; +export interface SubWithdrawalRecordsRequestV2 { + orderId?: string; + userId?: string; + startTime?: string; + endTime?: string; + limit?: string; + idLessThan?: 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; -} +/** + * + * * Broker | Subaccount + * + */ ⋮---- -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; -} - -================ -File: src/types/response/v3/broker.ts -================ -export interface CreateBrokerSubAccountResponseV3 { +export interface CreateSubAccountApiKeyRequestV2 { subUid: string; - subaccountName: string; - subaccountEmail: string; - status: 'normal' | 'freeze'; + passphrase: string; + label?: string; + ipList: string[]; + permType: string; permList: string[]; - label: string; - cTime: string; } ⋮---- -export interface BrokerSubAccountV3 { +export interface ModifySubAccountApiKeyRequestV2 { subUid: string; - subaccountName: string; - subaccountEmail: string | null; - status: 'normal' | 'freeze'; + apiKey: string; + label?: string; + passphrase: string; + ipList?: string[]; + permType?: string; permList: string[]; - label: string; - language: string; - cTime: string; - uTime: string; } ⋮---- -export interface GetBrokerSubAccountListResponseV3 { - subList: BrokerSubAccountV3[]; -} -⋮---- -export interface ModifyBrokerSubAccountResponseV3 { +export interface DeleteSubAccountApiKeyRequestV2 { subUid: string; - subaccountName: string; - status: 'normal' | 'freeze'; - permList: string[]; - label: string; - cTime: string; - uTime: string; + apiKey: string; } ⋮---- -export interface BrokerSubWithdrawalResponseV3 { - orderId: string; - clientOid: string; +/** + * + * * Broker | All Sub-accounts Deposit and Withdrawal Records + * + */ +⋮---- +export interface GetAllSubDepositWithdrawalRequestV2 { + startTime?: string; + endTime?: string; + limit?: string; + idLessThan?: string; + type?: 'all' | 'deposit' | 'withdrawal'; } ⋮---- -export interface BrokerSubDepositAddressV3 { - subUid: string; - coin: string; - address: string; - chain: string; - tag: string | null; - url: string; - cTime: string; +/** + * + * * Broker | Subaccounts + * + */ +⋮---- +export interface GetBrokerSubaccountsRequestV2 { + 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 | 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 GetBrokerAllSubDepositWithdrawalResponseV3 { - list: BrokerSubDepositWithdrawalRecordV3[]; - endId: string; +/** + * + * * Broker | Trade Volume + * + */ +⋮---- +export interface GetBrokerTradeVolumeRequestV2 { + startTime?: string; + endTime?: string; + pageSize?: string; + pageNo?: string; } ⋮---- -export interface BrokerCommissionRecordV3 { - uid: string; - coin: string; - symbol: string; - dealtAmount: string; - totalFee: string; - deductedFee: string; - paidFee: string; - markUpFee: string; - totalCommission: string; +/** + * + * * Broker | Total Commission + * + */ +⋮---- +export interface GetBrokerTotalCommissionRequestV2 { + startTime?: string; + endTime?: string; } ⋮---- -export interface CreateBrokerSubApiKeyResponseV3 { - subUid: string; - label: string; - apiKey: string; - secretKey: string; - permType: 'read_write' | 'read_only'; - permList: string[]; - ipList: string[] | null; +/** + * + * * Broker | Order Commission + * + */ +⋮---- +export interface GetBrokerOrderCommissionRequestV2 { + startTime?: string; + endTime?: string; + limit?: string; + uid?: string; + orderId?: string; + idLessThan?: string; } ⋮---- -export interface ModifyBrokerSubApiKeyResponseV3 { - subUid: string; - label: string; - apiKey: string; - permType: 'read_write' | 'read_only'; - permList: string[]; - ipList: string[]; +/** + * + * * Broker | Rebate Info + * + */ +⋮---- +export interface GetBrokerRebateInfoRequestV2 { + uid: 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/cfd.ts -================ -import type { CfdOrderTypeV3, CfdSideV3 } from '../../request/v3/cfd.js'; +/** + * + * * Broker | Agent (affiliate) customer APIs + * + */ ⋮---- -export interface CfdTickerV3 { - symbol: string; - /** Replaced by askOpenPriceChange and bidOpenPriceChange */ - openPriceChange?: string; - askOpenPriceChange?: string; - bidOpenPriceChange?: string; - highPrice: string; - lowPrice: string; - quoteTime: string; - ask1?: string; - bid1?: string; +export interface GetAgentCustomerCommissionsRequestV2 { + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + uid?: string; + coin?: string; + symbol?: string; + showSub?: 'yes' | 'no'; } ⋮---- -/** Replaced by askOpenPriceChange and bidOpenPriceChange */ +export interface GetAgentSubCustomerListRequestV2 { + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + uid?: string; + showSub?: 'yes' | 'no'; +} ⋮---- -export interface CfdCandlestickV3 extends Array { - 0: string; - 1: string; - 2: string; - 3: string; - 4: string; +export interface AgentCustomerTradeVolumeRequestV2 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface PlaceCfdOrderResponseV3 { - trxId: string; +export interface AgentCustomerListRequestV2 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + referralCode?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface ModifyCfdOrderResponseV3 { - orderId: string; +export interface GetAgentCustomerKycResultRequestV2 { + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface CfdUnfilledOrderV3 { - symbol: string; - orderType: CfdOrderTypeV3 | string; - side: CfdSideV3 | string; - price: string; - qty: string; - takeProfit?: string; - stopLoss?: string; - trxId: string; - orderId: string; +export interface AgentCustomerDepositRequestV2 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface CfdHistoryOrderV3 { - symbol: string; - orderType: CfdOrderTypeV3 | string; - side: CfdSideV3 | string; - price: string; - qty: string; - cumExecQty?: string; - takeProfit?: string; - stopLoss?: string; - status: string; - trxId: string; - orderId: string; +export interface AgentCustomerAssetRequestV2 { + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; } ⋮---- -export interface CfdOrderHistoryV3 { - list: CfdHistoryOrderV3[]; +export interface GetAgentCommissionDetailRequestV2 { + startTime?: string; + endTime?: string; + limit?: string; + idLessThan?: string; } ⋮---- -export interface CfdCurrentPositionV3 { - positionId: string; - symbol: string; - orderType: CfdOrderTypeV3 | string; - side: CfdSideV3 | string; - qty: string; - openPrice: string; - takeProfit?: string; - stopLoss?: string; - interest: string; - unrealizedPnl: string; - totalProfit: string; +export interface GetSubAffiliateInfoRequestV2 { + uid?: string; + startTime?: string; + endTime?: string; + idLessThan?: string; + limit?: string; + includeDownLine?: 'yes' | 'no'; } + +================ +File: src/types/request/v3/earn.ts +================ +/** + * + * + * Earn | On-Chain Elite (UTA) + * + * + */ ⋮---- -export interface CfdFundDetailV3 { - leverage: string; - balance: string; - credit: string; - marginStopOut: string; - marginUsed: string; - marginCall: string; - marginFree: string; - marginLevel: string; - equity: string; - pnl: string; - status: string; - swap: string; - frozen: string; - currency: string; +export interface GetEarnEliteRecordsRequestV3 { + type: 'subscribe' | 'redeem' | 'interest'; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface CfdTransferResponseV3 { - transferId: string; +export interface GetEarnEliteSubscribeInfoRequestV3 { + productId: string; } ⋮---- -export interface CfdTransferRecordV3 { - transferId: string; - coin: string; +export interface EarnEliteSubscribeRequestV3 { + productSubId: string; amount: string; - direction: string; - status: string; - accountType: string; - createdTime: string; - updatedTime: string; + coin?: string; + paymentAccount?: 'spot' | 'unified'; } ⋮---- -export interface CfdTransferRecordsV3 { - list: CfdTransferRecordV3[]; - cursor?: string; +export interface GetEarnEliteSubscribeResultRequestV3 { + orderId: string; } ⋮---- -export interface CfdFinancialRecordV3 { - id: string | number; - symbol: string; - side: string | number; - qty: string | number; - swap: string | number; - fee: string | number; - cashFlow: string | number; - balanceBefore: string | number; - balanceChange: string | number; - balanceAfter: string | number; - creditBefore: string | number; - creditChange: string | number; - creditAfter: string | number; - openPrice: string | number; - closePrice: string | number; - orderId: string | number; - ts: string | number; +export interface GetEarnEliteRedeemInfoRequestV3 { + productId: string; } ⋮---- -export interface CfdInstrumentV3 { - symbol: string; - onlineTime: string; - currency: string; - digits: string; - spread: string; - contractSize: string; - marginCurrency: string; - profitCurrency: string; - stopLevel: string; - enable: string; - marginPercent: string; - initialMargin: string; - marginMode: string; - maintMargin: string; - maintMarginRateBuy: string; - maintMarginRateSell: string; - initialMarginRateBuy: string; - initialMarginRateSell: string; - maxVolume: string; - minVolume: string; - stepVolume: string; - priceCurrency: string; - tickSize: string; - tickValue: string; - leverage: string; - tradeTime: string; - commissionType: string; - commissionRate: string; - symbolCategory: string; - exchangeRate: string; - marginUsdRate: string; +export interface RedeemEarnEliteRequestV3 { + productId: string; + productSubId: string; + redeemType: 'fast' | 'standard'; + amount: string; + receiveAccount: 'spot' | 'unified'; + advancedSettle?: 'yes' | 'no'; + coin?: string; } - -================ -File: examples/V3 - UTA/WS-API/ws-api-client-trade.ts -================ -import { DefaultLogger, WebsocketAPIClient } from '../../../src/index.js'; -⋮---- -// or -// import { DefaultLogger, WS_KEY_MAP, WebsocketAPIClient } from 'bitget-api'; -⋮---- -// 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); -// }); -// } ⋮---- -// 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 -⋮---- -// Whether to use the demo trading wss connection -// demoTrading: true, +/** + * + * + * Earn | Cash+ (UTA) + * Master and sub-accounts can call these. + * + * + */ ⋮---- -// 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 type EarnCashPlusRecordTypeV3 = + | 'subscribe' + | 'redeem' + | 'compound_interest' + | 'liquidation_redeem'; ⋮---- -logger, // Optional: inject a custom logger +export interface EarnCashPlusSubscribeRequestV3 { + /** From subscribe-info */ + productSubId: string; + /** Subscription amount, in the subscription coin */ + amount: string; + /** + * Debit account. funding (default), uta, or otc. + * Comma-separated when more than one, e.g. funding,uta. + */ + accountType?: string; + /** Prevents a duplicate submit of the same subscription */ + idempotentNo?: string; +} ⋮---- -// Optional, see above "attachEventListeners". Attach basic event handlers, so nothing is left unhandled -// attachEventHandlers(wsClient.getWSClient()); +/** From subscribe-info */ ⋮---- -// 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. +/** Subscription amount, in the subscription coin */ ⋮---- /** - * 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! + * Debit account. funding (default), uta, or otc. + * Comma-separated when more than one, e.g. funding,uta. */ ⋮---- -/** - * Place Order - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters - */ +/** Prevents a duplicate submit of the same subscription */ ⋮---- -/** - 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 GetEarnCashPlusSubscribeResultRequestV3 { + orderId: string; +} ⋮---- -/** - * Batch Place Order Channel - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel - */ +export interface EarnCashPlusRedeemRequestV3 { + productSubId: string; + /** Amount of Cash+ to redeem */ + amount: string; + /** Credit account. funding (default) or uta */ + accountType?: 'funding' | 'uta'; +} ⋮---- -/** - * 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. - */ +/** Amount of Cash+ to redeem */ ⋮---- -/** - 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" - } - */ +/** Credit account. funding (default) or uta */ ⋮---- -/** - * Cancel Order - * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel - */ +export interface GetEarnCashPlusRedeemResultRequestV3 { + orderId: string; +} ⋮---- -/** - const res = { - "event": "trade", - "id": "1750034870205", - "topic": "cancel-order", - "args": [ - { - "orderId": "xxxxxxxx", - "clientOid": "xxxxxxxx" - } - ], - "code": "0", - "msg": "Success", - "ts": "1750034870597" - } - */ +export interface GetEarnCashPlusHistoryOrdersRequestV3 { + startTime?: string; + endTime?: string; + recordType?: EarnCashPlusRecordTypeV3; + /** Default 20, max 100 */ + limit?: string; + /** Pass nextCursor from the previous page. Omit on the first page */ + cursor?: string; +} ⋮---- -/** - * Batch Cancel Order - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel - */ +/** Default 20, max 100 */ +⋮---- +/** Pass nextCursor from the previous page. Omit on the first page */ ⋮---- -/** - 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 + * + * Earn | Savings (UTA) + * * */ ⋮---- -export interface GetSubAccountsRequestV2 { - limit?: string; - idLessThan?: string; - status?: 'normal' | 'freeze' | 'del'; +export interface GetEarnSavingsProductsRequestV3 { + coin?: string; + filter?: 'available' | 'held' | 'available_and_held' | 'all'; +} +⋮---- +export interface GetEarnSavingsAssetsRequestV3 { + periodType: 'flexible' | 'fixed'; startTime?: string; endTime?: string; + limit?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; } ⋮---- -export type SubAccountPermissionV2 = - | 'withdraw' - | 'transfer' - | 'spot_trade' - | 'contract_trade' - | 'read' - | 'deposit' - | 'margin_trade'; +/** Pass endId from the previous response. Omit on the first page. */ ⋮---- -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 GetEarnSavingsRecordsRequestV3 { + coin?: string; + periodType: 'flexible' | 'fixed'; + orderType?: 'subscribe' | 'redeem' | 'pay_interest' | 'deduction'; + startTime?: string; + endTime?: string; + limit?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; +} ⋮---- -export type SubAccountStatusV2 = 'normal' | 'freeze'; +/** Pass endId from the previous response. Omit on the first page. */ ⋮---- -export interface ModifySubRequestV2 { - subUid: string; - permList: SubAccountPermissionV2[]; - status: SubAccountStatusV2; - language?: SubAccountLanguageV2; +export interface GetEarnSavingsSubscriptionRequestV3 { + productId: string; + periodType: 'flexible' | 'fixed'; } ⋮---- -export interface SubWithdrawalRequestV2 { - subUid: string; - coin: string; - dest: 'on_chain' | 'internal_transfer'; - chain?: string; - address: string; +export interface SubscribeSavingsRequestV3 { + productId: string; + periodType: 'flexible' | 'fixed'; amount: string; - tag?: string; - clientOid?: string; } ⋮---- -export interface SubDepositRecordsRequestV2 { - orderId?: string; - userId?: string; - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: string; +export interface GetEarnSavingsSubscriptionResultRequestV3 { + orderId: string; + periodType: 'flexible' | 'fixed'; } ⋮---- -export interface SubWithdrawalRecordsRequestV2 { +export interface RedeemSavingsRequestV3 { + productId: string; + /** Assets order ID returned by getEarnSavingsAssets */ orderId?: string; - userId?: string; - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: string; -} -⋮---- -/** - * - * * Broker | Subaccount - * - */ -⋮---- -export interface CreateSubAccountApiKeyRequestV2 { - subUid: string; - passphrase: string; - label?: string; - ipList: string[]; - permType: string; - permList: string[]; + periodType: 'flexible' | 'fixed'; + amount: string; } ⋮---- -export interface ModifySubAccountApiKeyRequestV2 { - subUid: string; - apiKey: string; - label?: string; - passphrase: string; - ipList?: string[]; - permType?: string; - permList: string[]; -} +/** Assets order ID returned by getEarnSavingsAssets */ ⋮---- -export interface DeleteSubAccountApiKeyRequestV2 { - subUid: string; - apiKey: string; +export interface GetEarnSavingsRedemptionResultRequestV3 { + orderId: string; + periodType: 'flexible' | 'fixed'; } ⋮---- /** * - * * Broker | All Sub-accounts Deposit and Withdrawal Records * - */ -⋮---- -export interface GetAllSubDepositWithdrawalRequestV2 { - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: string; - type?: 'all' | 'deposit' | 'withdrawal'; -} -⋮---- -/** + * Earn | SharkFin (UTA) * - * * Broker | Subaccounts * */ ⋮---- -export interface GetBrokerSubaccountsRequestV2 { - startTime?: string; - endTime?: string; - pageSize?: string; - pageNo?: string; +export interface GetSharkfinProductsRequestV3 { + coin: string; + limit?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; } ⋮---- -/** - * - * * Broker | Commissions - * - */ +/** Pass endId from the previous response. Omit on the first page. */ ⋮---- -export interface GetBrokerCommissionsRequestV2 { +export interface GetSharkfinAssetsRequestV3 { + status: 'subscribed' | 'settled'; startTime?: string; endTime?: string; - pageSize?: string; - pageNo?: string; - bizType?: 'spot' | 'futures'; - subBizType?: - | 'spot_trade' - | 'spot_margin' - | 'usdt_futures' - | 'usdc_futures' - | 'coin_futures'; + limit?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; } ⋮---- -/** - * - * * Broker | Trade Volume - * - */ +/** Pass endId from the previous response. Omit on the first page. */ ⋮---- -export interface GetBrokerTradeVolumeRequestV2 { +export interface GetSharkfinRecordsRequestV3 { + coin?: string; + type: 'subscription' | 'redemption' | 'interest'; startTime?: string; endTime?: string; - pageSize?: string; - pageNo?: string; + limit?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; } ⋮---- -/** - * - * * Broker | Total Commission - * - */ +/** Pass endId from the previous response. Omit on the first page. */ ⋮---- -export interface GetBrokerTotalCommissionRequestV2 { - startTime?: string; - endTime?: string; +export interface GetSharkfinSubscriptionRequestV3 { + productId: string; } ⋮---- -/** - * - * * Broker | Order Commission - * - */ -⋮---- -export interface GetBrokerOrderCommissionRequestV2 { - startTime?: string; - endTime?: string; - limit?: string; - uid?: string; - orderId?: string; - idLessThan?: string; +export interface SubscribeSharkfinRequestV3 { + productId: string; + amount: string; } ⋮---- -/** - * - * * Broker | Rebate Info - * - */ +export interface GetSharkfinSubscriptionResultRequestV3 { + orderId: string; +} + +================ +File: src/types/response/v3/cfd.ts +================ +import type { CfdOrderTypeV3, CfdSideV3 } from '../../request/v3/cfd.js'; ⋮---- -export interface GetBrokerRebateInfoRequestV2 { - uid: string; +export interface CfdTickerV3 { + symbol: string; + /** Replaced by askOpenPriceChange and bidOpenPriceChange */ + openPriceChange?: string; + askOpenPriceChange?: string; + bidOpenPriceChange?: string; + highPrice: string; + lowPrice: string; + quoteTime: string; + ask1?: string; + bid1?: string; } ⋮---- -/** - * - * * Broker | Agent (affiliate) customer APIs - * - */ +/** Replaced by askOpenPriceChange and bidOpenPriceChange */ ⋮---- -export interface GetAgentCustomerCommissionsRequestV2 { - startTime?: string; - endTime?: string; - idLessThan?: string; - limit?: string; - uid?: string; - coin?: string; - symbol?: string; - showSub?: 'yes' | 'no'; +export interface CfdCandlestickV3 extends Array { + 0: string; + 1: string; + 2: string; + 3: string; + 4: string; } ⋮---- -export interface GetAgentSubCustomerListRequestV2 { - startTime?: string; - endTime?: string; - idLessThan?: string; - limit?: string; - uid?: string; - showSub?: 'yes' | 'no'; +export interface PlaceCfdOrderResponseV3 { + trxId: string; } ⋮---- -export interface AgentCustomerTradeVolumeRequestV2 { - startTime?: string; - endTime?: string; - pageNo?: string; - pageSize?: string; - uid?: string; - showSub?: 'yes' | 'no'; +export interface ModifyCfdOrderResponseV3 { + orderId: string; } ⋮---- -export interface AgentCustomerListRequestV2 { - startTime?: string; - endTime?: string; - pageNo?: string; - pageSize?: string; - uid?: string; - referralCode?: string; - showSub?: 'yes' | 'no'; +export interface CfdUnfilledOrderV3 { + symbol: string; + orderType: CfdOrderTypeV3 | string; + side: CfdSideV3 | string; + price: string; + qty: string; + takeProfit?: string; + stopLoss?: string; + trxId: string; + orderId: string; } ⋮---- -export interface GetAgentCustomerKycResultRequestV2 { - startTime?: string; - endTime?: string; - idLessThan?: string; - limit?: string; - uid?: string; - showSub?: 'yes' | 'no'; +export interface CfdHistoryOrderV3 { + symbol: string; + orderType: CfdOrderTypeV3 | string; + side: CfdSideV3 | string; + price: string; + qty: string; + cumExecQty?: string; + takeProfit?: string; + stopLoss?: string; + status: string; + trxId: string; + orderId: string; } ⋮---- -export interface AgentCustomerDepositRequestV2 { - startTime?: string; - endTime?: string; - pageNo?: string; - pageSize?: string; - uid?: string; - showSub?: 'yes' | 'no'; +export interface CfdOrderHistoryV3 { + list: CfdHistoryOrderV3[]; } ⋮---- -export interface AgentCustomerAssetRequestV2 { - pageNo?: string; - pageSize?: string; - uid?: string; - showSub?: 'yes' | 'no'; +export interface CfdCurrentPositionV3 { + positionId: string; + symbol: string; + orderType: CfdOrderTypeV3 | string; + side: CfdSideV3 | string; + qty: string; + openPrice: string; + takeProfit?: string; + stopLoss?: string; + interest: string; + unrealizedPnl: string; + totalProfit: string; } ⋮---- -export interface GetAgentCommissionDetailRequestV2 { - startTime?: string; - endTime?: string; - limit?: string; - idLessThan?: string; +export interface CfdFundDetailV3 { + leverage: string; + balance: string; + credit: string; + marginStopOut: string; + marginUsed: string; + marginCall: string; + marginFree: string; + marginLevel: string; + equity: string; + pnl: string; + status: string; + swap: string; + frozen: string; + currency: string; } ⋮---- -export interface GetSubAffiliateInfoRequestV2 { - uid?: string; - startTime?: string; - endTime?: string; - idLessThan?: string; - limit?: string; - includeDownLine?: 'yes' | 'no'; +export interface CfdTransferResponseV3 { + transferId: string; +} +⋮---- +export interface CfdTransferRecordV3 { + transferId: string; + coin: string; + amount: string; + direction: string; + status: string; + accountType: string; + createdTime: string; + updatedTime: string; +} +⋮---- +export interface CfdTransferRecordsV3 { + list: CfdTransferRecordV3[]; + cursor?: string; +} +⋮---- +export interface CfdFinancialRecordV3 { + id: string | number; + symbol: string; + side: string | number; + qty: string | number; + swap: string | number; + fee: string | number; + cashFlow: string | number; + balanceBefore: string | number; + balanceChange: string | number; + balanceAfter: string | number; + creditBefore: string | number; + creditChange: string | number; + creditAfter: string | number; + openPrice: string | number; + closePrice: string | number; + orderId: string | number; + ts: string | number; +} +⋮---- +export interface CfdInstrumentV3 { + symbol: string; + onlineTime: string; + currency: string; + digits: string; + spread: string; + contractSize: string; + marginCurrency: string; + profitCurrency: string; + stopLevel: string; + enable: string; + marginPercent: string; + initialMargin: string; + marginMode: string; + maintMargin: string; + maintMarginRateBuy: string; + maintMarginRateSell: string; + initialMarginRateBuy: string; + initialMarginRateSell: string; + maxVolume: string; + minVolume: string; + stepVolume: string; + priceCurrency: string; + tickSize: string; + tickValue: string; + leverage: string; + tradeTime: string; + /** Instrument trading timezone as UTC offset hours, e.g. "+2" */ + currentTimezone: string; + commissionType: string; + commissionRate: string; + symbolCategory: string; + exchangeRate: string; + marginUsdRate: string; } +⋮---- +/** Instrument trading timezone as UTC offset hours, e.g. "+2" */ ================ File: docs/BITGET_SDK_QUICKSTART_GUIDE.md @@ -11183,1253 +11694,1069 @@ export interface GetCopyFuturesTpSlOrderHistoryRequestV3 { } ================ -File: src/types/response/v3/earn.ts +File: src/types/websockets/ws-events.ts ================ -/** - * - * - * Earn | On-Chain Elite (UTA) - * - * - */ -⋮---- -export interface EarnEliteSubscriptionCoinV3 { - subscriptionCoin: string; - precision: string; - feeRate: string; - exchangeRate: string; - remainQuota?: string; - minAmount?: string; +export interface MessageEventLike { + target: WebSocket; + type: 'message'; + data: string; } ⋮---- -export interface EarnEliteProductV3 { - productId: string; - coin: string; - minApr: string; - maxApr: string; - subscriptionCoinList: EarnEliteSubscriptionCoinV3[]; - sellOut: 'YES' | 'NO' | string; -} +export function isMessageEvent(msg: unknown): msg is MessageEventLike ⋮---- -export interface EarnEliteAssetProjectV3 { - projectName: string; +export interface WsBaseEvent { + action: TAction; + arg: unknown; + data: TData[]; } ⋮---- -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; +export interface WsSnapshotChannelEvent extends WsBaseEvent<'snapshot'> { + arg: { + instType: string; + channel: string; + instId: string; + }; } ⋮---- -export interface EarnEliteAssetsV3 { - resultList: EarnEliteAssetV3[]; +export interface WsSnapshotAccountEvent extends WsBaseEvent<'snapshot'> { + arg: { + instType: string; + channel: 'account'; + instId: 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; - /** Business time, Unix ms */ - bizTime?: string; +export interface WsSnapshotPositionsEvent extends WsBaseEvent<'snapshot'> { + arg: { + instType: string; + channel: 'positions'; + instId: string; + }; } ⋮---- -/** Business time, Unix ms */ -⋮---- -export interface EarnEliteRecordsV3 { - recordList: EarnEliteRecordV3[]; - endId: string; +export interface WsAccountSnapshotDataUMCBL { + marginCoin: string; + locked: string; + available: string; + maxOpenPosAvailable: string; + maxTransferOut: string; + equity: string; + usdtEquity: string; } ⋮---- -export interface EarnEliteSubscribeInfoV3 { - productSubId: string; - minAmount: string; - remainQuota: string; - exchangeRate: string; - productCoin: string; - interestTime: string; - settleTime: string; - precision: string; - feeRate: string; - subscriptionCoinList?: EarnEliteSubscriptionCoinV3[]; +export interface WsAccountSnapshotUMCBL extends WsBaseEvent<'snapshot'> { + arg: { + instType: 'umcbl'; + channel: 'account'; + instId: string; + }; + data: WsAccountSnapshotDataUMCBL[]; } ⋮---- -export interface EarnEliteSubscribeResultV3 { - orderId: 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 EarnEliteSubscribeStatusV3 { - result: 'settled' | 'pending' | 'rejected' | string; -} +/** Cash dividend, USDT (Classic V2 positions channel) */ ⋮---- -export interface EarnEliteRedeemInfoBgusdReceiveCoinV3 { - bgusdReceiveCoin: string; - bgusdExchangeRate: string; +/** UTA reality-orderbook push (ts/seq/pseq removed July 2026). Every push is a full snapshot. */ +export interface WsRealityOrderBookDataV3 { + a: [string, string][]; + b: [string, string][]; } ⋮---- -export interface EarnEliteRedeemModeV3 { - redeemFeeRate: string; - remainQuota: string; - redeemType: 'fast' | 'standard' | string; - redeemScale: string; - redeemDelayDate: string; - minRedeemAmount: string; - redeemTime: string; +/** + * UTA reality-orderbook-segmented push. + * Each level is [price, onshoreQty, offshoreQty]. + * Every push is a full snapshot. Whitelist required. + * Go-live 20 Oct 2026. Pairs that have not finished the matching-engine upgrade do not push. + * A crossed book after the upgrade is expected. + */ +export interface WsRealityOrderBookSegmentedDataV3 { + a: [string, string, string][]; + b: [string, string, string][]; } ⋮---- -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 WSPositionSnapshotUMCBL extends WsBaseEvent<'snapshot'> { + arg: { + instType: 'umcbl'; + channel: 'positions'; + instId: string; + }; + data: WsPositionSnapshotDataUMCBL[]; } ⋮---- -export interface RedeemEarnEliteResultV3 { - orderId: 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; +} +⋮---- +/** Futures books channel only - previous push serial number */ +⋮---- +/** UTA account channel coin row */ +export interface WsAccountCoinV3 { + coin: string; + balance: string; + /** Coin balance before borrowing-related amounts are deducted */ + balanceOriginal?: string; + available: string; + locked: string; + equity: string; + usdValue: string; + borrow: string; + debts: string; + bonus?: string; +} +⋮---- +/** Coin balance before borrowing-related amounts are deducted */ +⋮---- +/** UTA account channel push. action is snapshot or update */ +export interface WsAccountDataV3 { + totalEquity: string; + effEquity: string; + mmr: string; + imr: string; + mgnRatio: string; + positionMgnRatio: string; + unrealisedPnL: string; + coin: WsAccountCoinV3[]; +} +⋮---- +/** + * UTA depth push. + * books1 and books5: every message is a full snapshot. + * books and books50: the first message is a snapshot, later messages are incremental updates. + * Do not replace the local book with a books or books50 update. + * pseq is set on books and books50. + * rToken: books1 pushes at all times. books5, books50, and books push only outside US market hours. + */ +export interface WsOrderBookDataV3 { + a: [string, string][]; + b: [string, string][]; + seq: string | number; + pseq?: string | number; + /** Present on the books topic */ + maxDepth?: string; + ts: string; } ⋮---- +/** Present on the books topic */ + +================ +File: src/types/response/v3/copytrading.ts +================ /** * * - * Earn | Cash+ (UTA) + * Copy Trading | Futures (UTA) * * */ ⋮---- -export interface EarnCashPlusSubscribeCoinV3 { - /** Used for subscribe and redeem */ - productSubId: string; - coin: string; - /** Minimum subscription amount, in this coin */ - minAmount: string; - /** How much Cash+ 1 unit of this coin converts into. Default 1 */ - conversionRate: string; - /** Decimal places for the subscription amount */ - subscribeScale: string; - /** Decimal places for profit */ - profitScale: string; - soldOut: 'yes' | 'no'; +export interface CopyFuturesMarginDetailV3 { + marginCoin: string; + maxLongCount: string; + remainingLongCount: string; + maxShortCount: string; + remainingShortCount: string; } ⋮---- -/** Used for subscribe and redeem */ -⋮---- -/** Minimum subscription amount, in this coin */ -⋮---- -/** How much Cash+ 1 unit of this coin converts into. Default 1 */ +export interface CopyFuturesTradingPairV3 { + symbol: string; + leverage: string; + marginDetails: CopyFuturesMarginDetailV3[]; +} ⋮---- -/** Decimal places for the subscription amount */ +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; +} ⋮---- -/** Decimal places for profit */ +export interface CopyFuturesMaxTransferableV3 { + maxTransferable: string; + available: string; +} ⋮---- -export interface EarnCashPlusSubscribeInfoV3 { - /** Profit source coin. Currently USDGO */ - profitSourceCoin: string; - /** Decimal APR. 0.04 means 4% */ - cashPlusApr: string; - subscribeCoinList: EarnCashPlusSubscribeCoinV3[]; - /** Unix ms */ - interestTime: string; - /** Unix ms */ - payInterestTime: string; - /** Unix ms */ - subscribeTime: string; +/** Follower copy account. Lead accounts use CopyFuturesMaxTransferableV3. */ +export interface CopyFuturesCopyMaxTransferableV3 { + maxTransferable: string; } ⋮---- -/** Profit source coin. Currently USDGO */ +export interface CopyFuturesTransferResponseV3 { + transferId: string; +} ⋮---- -/** Decimal APR. 0.04 means 4% */ +/** May be a single value or comma-separated values */ +export type CopyFuturesTransferAccountTypeV3 = + | 'spot' + | 'uta' + | 'lead' + | 'otc' + | string; ⋮---- -/** Unix ms */ +export interface CopyFuturesTransferRecordV3 { + transferId: string; + fromType: CopyFuturesTransferAccountTypeV3; + toType: CopyFuturesTransferAccountTypeV3; + amount: string; + coin: string; + status: 'Successful' | 'Failed' | 'Processing'; + createdTime: string; +} ⋮---- -/** Unix ms */ +export interface CopyFuturesTransferRecordListV3 { + list: CopyFuturesTransferRecordV3[]; +} ⋮---- -/** Unix ms */ +export interface CopyFuturesCurrentFollowerV3 { + followerName: string; + estimateAssets: string; + totalProfit: string; + totalShareProfit: string; + totalInvestment: string; + canRemove: 'yes' | 'no'; + followDays: string; + totalAssets: string; + startTime: string; +} ⋮---- -export interface EarnCashPlusSubscribeResultV3 { - orderId: string; +export interface CopyFuturesCurrentFollowersV3 { + list: CopyFuturesCurrentFollowerV3[]; } ⋮---- -export type EarnCashPlusOrderStatusV3 = 'processing' | 'success' | 'failed'; +export interface CopyFuturesHistoryFollowerV3 { + followerName: string; + totalProfit: string; + totalShareProfit: string; + totalInvestment: string; + startTime: string; + endTime: string; +} ⋮---- -export type EarnCashPlusAccountTypeV3 = 'funding' | 'uta' | 'otc'; +export interface CopyFuturesHistoryFollowersV3 { + list: CopyFuturesHistoryFollowerV3[]; +} ⋮---- -export interface EarnCashPlusPaymentAccountV3 { - accountType: EarnCashPlusAccountTypeV3; - payAmount: string; +export interface CopyFuturesProfitSummaryV3 { + totalProfit: string; + totalAllocatedProfit: string; + totalPendingProfit: string; } ⋮---- -export interface EarnCashPlusSubscribeStatusV3 { - orderId: string; - status: EarnCashPlusOrderStatusV3; - coin: string; - amount: string; - /** Unix ms */ - subscribeTime: string; - /** Unix ms */ - interestTime: string; - /** First interest distribution, Unix ms */ - dividendTime: string; - paymentAccountList: EarnCashPlusPaymentAccountV3[]; +export interface CopyFuturesProfitDetailV3 { + followerName: string; + profit: string; + allocatedPnl: string; + pendingPnl: string; + shareRatio: string; + shareProfit: string; + reason: 'period' | 'unfollow' | string; + settleTime: string; } ⋮---- -/** Unix ms */ +export interface CopyFuturesProfitDetailsV3 { + list: CopyFuturesProfitDetailV3[]; + nextCursor: string; +} ⋮---- -/** Unix ms */ +export interface CopyFuturesPortfolioOverviewV3 { + projectId: string; + asset: string; + roi: string; + totalProfit: string; + followerProfit: string; + maxDrawdown: string; +} ⋮---- -/** First interest distribution, Unix ms */ +export interface CopyFuturesCopySettingsV3 { + type: 'fixed_ratio' | 'fixed_margin' | string; + amount: string; + tradingPairList: string[]; + marginPerOrder: string; + autoCopy: 'on' | 'off' | string; + leverage: string; + maxEntrySlippage: string; + maxMarginRatio: string; + /** API field name (Bitget spelling). */ + maxPostionValue: string; +} ⋮---- -export interface EarnCashPlusRedeemCoinV3 { - productSubId: string; +/** API field name (Bitget spelling). */ +⋮---- +export interface CopyFuturesFollowerTransferRecordV3 { + fromType: string; + toType: string; + amount: string; coin: string; - /** How much of this coin 1 unit of Cash+ equals */ - conversionRate: string; - /** Redeemable Cash+ position */ - redeemAvailable: string; - redeemMinAmount: string; - /** Decimal places for the redemption amount */ - redeemScale: string; - /** Unlock request time, Unix ms */ - redeemTime: string; - /** Estimated arrival, Unix ms */ - receivedTime: string; + status: string; + createdTime: string; } ⋮---- -/** How much of this coin 1 unit of Cash+ equals */ +export interface CopyFuturesFollowerTransferRecordListV3 { + list: CopyFuturesFollowerTransferRecordV3[]; + nextCursor?: string; +} ⋮---- -/** Redeemable Cash+ position */ +export interface CopyFuturesCurrentCopyV3 { + eliteTrader: string; + estNetProfit: string; + profitShare: string; + estValue: string; + available: string; + currentInvestment: string; +} ⋮---- -/** Decimal places for the redemption amount */ +export interface CopyFuturesCopyProfitDetailItemV3 { + settleTime: string; + profit: string; + allocatedPnl: string; + pendingPnl: string; + shareRatio: string; + shareProfit: string; +} ⋮---- -/** Unlock request time, Unix ms */ +export interface CopyFuturesCopyProfitDetailsV3 { + list: CopyFuturesCopyProfitDetailItemV3[]; + nextCursor?: string; +} ⋮---- -/** Estimated arrival, Unix ms */ +export interface CopyFuturesFollowerPositionV3 { + symbol: string; + marginCoin: string; + posSide: 'long' | 'short' | string; + total: string; + leverage: string; + avgPrice: string; + marginMode: string; + holdMode: string; + createdTime: string; + positionId: string; +} ⋮---- -export interface EarnCashPlusRedeemInfoV3 { - redeemCoinList: EarnCashPlusRedeemCoinV3[]; - /** Remaining redemption quota for today */ - userRemainingQuota: string; +export interface CopyFuturesFollowerPositionsV3 { + list: CopyFuturesFollowerPositionV3[]; } ⋮---- -/** Remaining redemption quota for today */ +export interface CopyFuturesTpSlOrderV3 { + strategyId: string; + category: string; + symbol: string; + qty: string; + posSide: string; + status: string; + tpTriggerBy: string; + slTriggerBy: string; + takeProfit: string; + stopLoss: string; + tpOrderType: string; + slOrderType: string; +} ⋮---- -export interface EarnCashPlusRedeemResultV3 { - orderId: string; - /** Unix ms */ - redeemTime: number; - /** Estimated arrival, Unix ms */ - receiveTime: number; +export interface CopyFuturesTpSlResponseV3 { + strategyId: string; } ⋮---- -/** Unix ms */ +export interface CopyFuturesCurrentTpSlOrdersV3 { + list: CopyFuturesTpSlOrderV3[]; +} ⋮---- -/** Estimated arrival, Unix ms */ +export interface CopyFuturesTpSlOrderHistoryV3 { + list: CopyFuturesTpSlOrderV3[]; + cursor?: string; +} + +================ +File: src/types/response/v3/earn.ts +================ +/** + * + * + * Earn | On-Chain Elite (UTA) + * + * + */ ⋮---- -export interface EarnCashPlusRedeemStatusV3 { - orderId: string; - status: EarnCashPlusOrderStatusV3; - /** Unix ms */ - redeemTime: string; - /** Estimated arrival, Unix ms */ - receiveTime: string; +export interface EarnEliteSubscriptionCoinV3 { + subscriptionCoin: string; + precision: string; + feeRate: string; + exchangeRate: string; + remainQuota?: string; + minAmount?: string; } ⋮---- -/** Unix ms */ +export interface EarnEliteProductV3 { + productId: string; + coin: string; + minApr: string; + maxApr: string; + subscriptionCoinList: EarnEliteSubscriptionCoinV3[]; + sellOut: 'YES' | 'NO' | string; +} ⋮---- -/** Estimated arrival, Unix ms */ +export interface EarnEliteAssetProjectV3 { + projectName: string; +} ⋮---- -export interface EarnCashPlusPositionV3 { - /** Holding, converted to USD */ - balance: string; - /** Cumulative profit, converted to USD */ - totalProfit: string; - /** Yesterday's profit, converted to USD */ - yesterdayProfit: string; - /** Compound annual rate, for reference */ +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; } ⋮---- -/** Holding, converted to USD */ -⋮---- -/** Cumulative profit, converted to USD */ -⋮---- -/** Yesterday's profit, converted to USD */ -⋮---- -/** Compound annual rate, for reference */ +export interface EarnEliteAssetsV3 { + resultList: EarnEliteAssetV3[]; +} ⋮---- -export interface EarnCashPlusHistoryOrderV3 { +export interface EarnEliteRecordV3 { recordId: string; - recordType: - | 'subscribe' - | 'redeem' - | 'compound_interest' - | 'liquidation_redeem'; - status: EarnCashPlusOrderStatusV3; - amount: string; + productId: string; coin: string; - /** Unix ms */ - createdTime: number; - /** - * Debit account on a subscription. - * Credit account on interest or redemption. - */ - accountType: EarnCashPlusAccountTypeV3; + 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; + /** Business time, Unix ms */ + bizTime?: string; } ⋮---- -/** Unix ms */ +/** Business time, Unix ms */ ⋮---- -/** - * Debit account on a subscription. - * Credit account on interest or redemption. - */ +export interface EarnEliteRecordsV3 { + recordList: EarnEliteRecordV3[]; + endId: string; +} ⋮---- -export interface EarnCashPlusHistoryOrdersV3 { - items: EarnCashPlusHistoryOrderV3[]; - /** Pass back as cursor. Absent on the last page */ - nextCursor?: string; +export interface EarnEliteSubscribeInfoV3 { + productSubId: string; + minAmount: string; + remainQuota: string; + exchangeRate: string; + productCoin: string; + interestTime: string; + settleTime: string; + precision: string; + feeRate: string; + subscriptionCoinList?: EarnEliteSubscriptionCoinV3[]; } ⋮---- -/** Pass back as cursor. Absent on the last page */ - -================ -File: src/types/response/v3/strategy.ts -================ -import type { - StrategyIcebergParamsV3, - StrategyOcoParamsV3, - StrategyOrderStatusV3, - StrategyOrderTypeV3, - StrategyTrailingStopParamsV3, - StrategyTriggerByV3, - StrategyTriggerOrderTypeV3, - StrategyTwapParamsV3, -} from '../../request/v3/strategy.js'; -⋮---- -export interface PlaceStrategyOrderResponseV3 { +export interface EarnEliteSubscribeResultV3 { orderId: string; - clientOid: string; } ⋮---- -export interface ModifyStrategyOrderResponseV3 { - orderId: string; - clientOid: string; +export interface EarnEliteSubscribeStatusV3 { + result: 'settled' | 'pending' | 'rejected' | string; } ⋮---- -export interface StrategyOrderV3 { - orderId: string; - clientOid: string; - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES' | string; - symbol: string; - qty: string; - /** buy / sell. Same field as the WS order push. */ - side?: 'buy' | 'sell'; - posSide: 'long' | 'short'; - status: StrategyOrderStatusV3; - type?: StrategyOrderTypeV3 | string; - 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; - ocoParams?: StrategyOcoParamsV3; - trailingStopParams?: StrategyTrailingStopParamsV3; - icebergParams?: StrategyIcebergParamsV3; - twapParams?: StrategyTwapParamsV3; - createdTime: string; - updatedTime: string; - /** crossed or isolated. Returned by unfilled and history strategy orders */ - marginMode?: 'crossed' | 'isolated'; +export interface EarnEliteRedeemInfoBgusdReceiveCoinV3 { + bgusdReceiveCoin: string; + bgusdExchangeRate: string; } ⋮---- -/** buy / sell. Same field as the WS order push. */ -⋮---- -/** crossed or isolated. Returned by unfilled and history strategy orders */ +export interface EarnEliteRedeemModeV3 { + redeemFeeRate: string; + remainQuota: string; + redeemType: 'fast' | 'standard' | string; + redeemScale: string; + redeemDelayDate: string; + minRedeemAmount: string; + redeemTime: string; +} ⋮---- -export interface StrategySubOrderV3 { - subOrderId: string; - subClientOid?: string; - orderId?: string; - clientOid?: string; - category?: string; - symbol?: string; - side?: string; - posSide?: string; - orderType?: string; - price?: string; - qty?: string; - cumExecQty?: string; - avgPrice?: string; - status?: string; - createdTime?: string; - updatedTime?: string; +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[]; } - -================ -File: src/types/websockets/ws-events.ts -================ -export interface MessageEventLike { - target: WebSocket; - type: 'message'; - data: string; +⋮---- +export interface RedeemEarnEliteResultV3 { + orderId: string; } ⋮---- -export function isMessageEvent(msg: unknown): msg is MessageEventLike +/** + * + * + * Earn | Cash+ (UTA) + * + * + */ ⋮---- -export interface WsBaseEvent { - action: TAction; - arg: unknown; - data: TData[]; +export interface EarnCashPlusSubscribeCoinV3 { + /** Used for subscribe and redeem */ + productSubId: string; + coin: string; + /** Minimum subscription amount, in this coin */ + minAmount: string; + /** How much Cash+ 1 unit of this coin converts into. Default 1 */ + conversionRate: string; + /** Decimal places for the subscription amount */ + subscribeScale: string; + /** Decimal places for profit */ + profitScale: string; + soldOut: 'yes' | 'no'; } ⋮---- -export interface WsSnapshotChannelEvent extends WsBaseEvent<'snapshot'> { - arg: { - instType: string; - channel: string; - instId: string; - }; -} +/** Used for subscribe and redeem */ ⋮---- -export interface WsSnapshotAccountEvent extends WsBaseEvent<'snapshot'> { - arg: { - instType: string; - channel: 'account'; - instId: string; - }; -} +/** Minimum subscription amount, in this coin */ ⋮---- -export interface WsSnapshotPositionsEvent extends WsBaseEvent<'snapshot'> { - arg: { - instType: string; - channel: 'positions'; - instId: string; - }; -} +/** How much Cash+ 1 unit of this coin converts into. Default 1 */ ⋮---- -export interface WsAccountSnapshotDataUMCBL { - marginCoin: string; - locked: string; - available: string; - maxOpenPosAvailable: string; - maxTransferOut: string; - equity: string; - usdtEquity: string; -} +/** Decimal places for the subscription amount */ ⋮---- -export interface WsAccountSnapshotUMCBL extends WsBaseEvent<'snapshot'> { - arg: { - instType: 'umcbl'; - channel: 'account'; - instId: string; - }; - data: WsAccountSnapshotDataUMCBL[]; -} +/** Decimal places for profit */ ⋮---- -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 EarnCashPlusSubscribeInfoV3 { + /** Profit source coin. Currently USDGO */ + profitSourceCoin: string; + /** Decimal APR. 0.04 means 4% */ + cashPlusApr: string; + subscribeCoinList: EarnCashPlusSubscribeCoinV3[]; + /** Unix ms */ + interestTime: string; + /** Unix ms */ + payInterestTime: string; + /** Unix ms */ + subscribeTime: string; } ⋮---- -/** Cash dividend, USDT (Classic V2 positions channel) */ +/** Profit source coin. Currently USDGO */ ⋮---- -/** UTA reality-orderbook push (ts/seq/pseq removed July 2026). Every push is a full snapshot. */ -export interface WsRealityOrderBookDataV3 { - a: [string, string][]; - b: [string, string][]; -} +/** Decimal APR. 0.04 means 4% */ ⋮---- -/** - * UTA reality-orderbook-segmented push. - * Each level is [price, onshoreQty, offshoreQty]. - * Every push is a full snapshot. Whitelist required. - * Go-live 20 Oct 2026. Pairs that have not finished the matching-engine upgrade do not push. - * A crossed book after the upgrade is expected. - */ -export interface WsRealityOrderBookSegmentedDataV3 { - a: [string, string, string][]; - b: [string, string, string][]; -} +/** Unix ms */ ⋮---- -export interface WSPositionSnapshotUMCBL extends WsBaseEvent<'snapshot'> { - arg: { - instType: 'umcbl'; - channel: 'positions'; - instId: string; - }; - data: WsPositionSnapshotDataUMCBL[]; -} +/** Unix ms */ ⋮---- -/** 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; +/** Unix ms */ +⋮---- +export interface EarnCashPlusSubscribeResultV3 { + orderId: string; } ⋮---- -/** Futures books channel only - previous push serial number */ +export type EarnCashPlusOrderStatusV3 = 'processing' | 'success' | 'failed'; ⋮---- -/** UTA account channel coin row */ -export interface WsAccountCoinV3 { - coin: string; - balance: string; - /** Coin balance before borrowing-related amounts are deducted */ - balanceOriginal?: string; - available: string; - locked: string; - equity: string; - usdValue: string; - borrow: string; - debts: string; - bonus?: string; -} -⋮---- -/** Coin balance before borrowing-related amounts are deducted */ +export type EarnCashPlusAccountTypeV3 = 'funding' | 'uta' | 'otc'; ⋮---- -/** UTA account channel push. action is snapshot or update */ -export interface WsAccountDataV3 { - totalEquity: string; - effEquity: string; - mmr: string; - imr: string; - mgnRatio: string; - positionMgnRatio: string; - unrealisedPnL: string; - coin: WsAccountCoinV3[]; +export interface EarnCashPlusPaymentAccountV3 { + accountType: EarnCashPlusAccountTypeV3; + payAmount: string; } ⋮---- -/** - * UTA depth push. - * books1 and books5: every message is a full snapshot. - * books and books50: the first message is a snapshot, later messages are incremental updates. - * Do not replace the local book with a books or books50 update. - * pseq is set on books and books50. - * rToken: books1 pushes at all times. books5, books50, and books push only outside US market hours. - */ -export interface WsOrderBookDataV3 { - a: [string, string][]; - b: [string, string][]; - seq: string | number; - pseq?: string | number; - /** Present on the books topic */ - maxDepth?: string; - ts: string; +export interface EarnCashPlusSubscribeStatusV3 { + orderId: string; + status: EarnCashPlusOrderStatusV3; + coin: string; + amount: string; + /** Unix ms */ + subscribeTime: string; + /** Unix ms */ + interestTime: string; + /** First interest distribution, Unix ms */ + dividendTime: string; + paymentAccountList: EarnCashPlusPaymentAccountV3[]; } ⋮---- -/** Present on the books topic */ - -================ -File: src/websocket-api-client.ts -================ -import { - CancelOrderRequestV3, - ModifyOrderRequestV3, -} from './types/request/v3/trade.js'; -import { - CancelOrderResponseV3, - ModifyOrderResponseV3, -} from './types/response/v3/trade.js'; -import { WSAPIPlaceOrderRequestV3 } from './types/websockets/ws-api-request.js'; -import { WSAPIPlaceOrderResponseV3 } from './types/websockets/ws-api-response.js'; -import { WSAPIResponse } from './types/websockets/ws-api.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'; +/** Unix ms */ ⋮---- -/** - * 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; +/** Unix ms */ +⋮---- +/** First interest distribution, Unix ms */ +⋮---- +export interface EarnCashPlusRedeemCoinV3 { + productSubId: string; + coin: string; + /** How much of this coin 1 unit of Cash+ equals */ + conversionRate: string; + /** Redeemable Cash+ position */ + redeemAvailable: string; + redeemMinAmount: string; + /** Decimal places for the redemption amount */ + redeemScale: string; + /** Unlock request time, Unix ms */ + redeemTime: string; + /** Estimated arrival, Unix ms */ + receivedTime: 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(....)`. - */ +/** How much of this coin 1 unit of Cash+ equals */ ⋮---- -/** - * 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 +/** Redeemable Cash+ position */ ⋮---- -constructor( - options?: WSClientConfigurableOptions & - Partial, - logger?: DefaultLogger, -) +/** Decimal places for the redemption amount */ ⋮---- -public getWSClient(): WebsocketClientV3 +/** Unlock request time, Unix ms */ ⋮---- -public setTimeOffsetMs(newOffset: number): void +/** Estimated arrival, Unix ms */ ⋮---- -/* - * Bitget WebSocket API Methods - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel - */ +export interface EarnCashPlusRedeemInfoV3 { + redeemCoinList: EarnCashPlusRedeemCoinV3[]; + /** Remaining redemption quota for today */ + userRemainingQuota: string; +} ⋮---- -/** - * Submit a new order - * - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel - * - * @returns - */ -submitNewOrder( - category: BitgetInstTypeV3, - params: WSAPIPlaceOrderRequestV3, -): Promise> +/** Remaining redemption quota for today */ ⋮---- -/** - * Submit a batch of orders - * - * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel - * - * @returns - */ -placeBatchOrders( - category: BitgetInstTypeV3, - params: WSAPIPlaceOrderRequestV3[], -): Promise> +export interface EarnCashPlusRedeemResultV3 { + orderId: string; + /** Unix ms */ + redeemTime: number; + /** Estimated arrival, Unix ms */ + receiveTime: number; +} ⋮---- -/* - * Bitget WebSocket API Methods - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel - */ +/** Unix ms */ ⋮---- -/** - * Cancel Order - * - * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel - * - * @returns - */ -cancelOrder( - category: BitgetInstTypeV3, - params: CancelOrderRequestV3, -): Promise> +/** Estimated arrival, Unix ms */ ⋮---- -/** - * 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 EarnCashPlusRedeemStatusV3 { + orderId: string; + status: EarnCashPlusOrderStatusV3; + /** Unix ms */ + redeemTime: string; + /** Estimated arrival, Unix ms */ + receiveTime: string; +} ⋮---- -updateOrder( - category: BitgetInstTypeV3, - params: ModifyOrderRequestV3, -): Promise> +/** Unix ms */ ⋮---- -batchUpdateOrders( - category: BitgetInstTypeV3, - params: ModifyOrderRequestV3[], -): Promise> +/** Estimated arrival, Unix ms */ ⋮---- -/** - * - * - * - * - * - * - * - * Private methods for handling some of the convenience/automation provided by the WS API Client - * - * - * - * - * - * - * - */ +export interface EarnCashPlusPositionV3 { + /** Holding, converted to USD */ + balance: string; + /** Cumulative profit, converted to USD */ + totalProfit: string; + /** Yesterday's profit, converted to USD */ + yesterdayProfit: string; + /** Compound annual rate, for reference */ + apr: string; +} ⋮---- -private setupDefaultEventListeners() +/** Holding, converted to USD */ ⋮---- -/** - * General event handlers for monitoring the WebsocketClient - */ +/** Cumulative profit, converted to USD */ ⋮---- -// Blind JSON.stringify can fail on circular references +/** Yesterday's profit, converted to USD */ ⋮---- -// 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 { CHANNEL_API_CODE, 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. - * - * Your Bitget account needs to be upgraded to unified account mode, to use the account-level WebSocket topics. - */ -export class WebsocketClientV3 extends BaseWebsocketClient< -⋮---- -WsRequestOperationBitget // subscribe requests have an "args" parameter with an object within -⋮---- -/** - * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library - */ -public connectAll(): Promise[] +/** Compound annual rate, for reference */ ⋮---- -/** - * 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). +export interface EarnCashPlusHistoryOrderV3 { + recordId: string; + recordType: + | 'subscribe' + | 'redeem' + | 'compound_interest' + | 'liquidation_redeem'; + status: EarnCashPlusOrderStatusV3; + amount: string; + coin: string; + /** Unix ms */ + createdTime: number; + /** + * Debit account on a subscription. + * Credit account on interest or redemption. */ -public connectWSAPI(): Promise + accountType: EarnCashPlusAccountTypeV3; +} ⋮---- -/** This call automatically ensures the connection is active AND authenticated before resolving */ +/** Unix ms */ ⋮---- /** - * 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 + * Debit account on a subscription. + * Credit account on interest or redemption. */ -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 EarnCashPlusHistoryOrdersV3 { + items: EarnCashPlusHistoryOrderV3[]; + /** Pass back as cursor. Absent on the last page */ + nextCursor?: string; +} +⋮---- +/** Pass back as cursor. Absent on the last page */ ⋮---- /** - * - * - * Internal methods required to integrate with the BaseWSClient - * - * - */ + * + * + * Earn | Savings (UTA) + * + * + */ ⋮---- -protected sendPingEvent(wsKey: WsKey): void +export interface EarnSavingsApyV3 { + rateLevel: string; + minStepVal: string; + maxStepVal: string; + currentApy: string; +} ⋮---- -protected sendPongEvent(wsKey: WsKey): void +export interface EarnSavingsProductV3 { + productId: string; + coin: string; + periodType: 'flexible' | 'fixed'; + /** Only returned for fixed-term savings */ + period?: string; + apyType: string; + advanceRedeem: string; + settleMethod: string; + apyList: EarnSavingsApyV3[]; + status: string; + productLevel: string; +} ⋮---- -protected isWsPing(data: any): boolean +/** Only returned for fixed-term savings */ ⋮---- -protected isWsPong(data: any): boolean +export interface EarnSavingsAccountV3 { + btcAmount: string; + usdtAmount: string; + btc24hEarning: string; + usdt24hEarning: string; + btcTotalEarning: string; + usdtTotalEarning: string; +} ⋮---- -protected isPrivateTopicRequest( - _request: WsTopicRequest, - wsKey: WsKey, -): boolean +export interface EarnSavingsAssetApyV3 { + rateLevel: string; + minApy: string; + maxApy: string; + currentApy: string; +} ⋮---- -protected getPrivateWSKeys(): WsKey[] +export interface EarnSavingsAssetV3 { + productId: string; + /** Only returned for fixed-term savings */ + orderId?: string; + productCoin: string; + interestCoin: string; + periodType: 'flexible' | 'fixed'; + /** Only returned for fixed-term savings */ + period?: string; + holdAmount: string; + lastProfit: string; + totalProfit: string; + holdDays: string; + status: string; + allowRedemption: string; + productLevel: string; + apy: EarnSavingsAssetApyV3[]; +} ⋮---- -protected isAuthOnConnectWsKey(wsKey: WsKey): boolean +/** Only returned for fixed-term savings */ ⋮---- -protected async getWsUrl(wsKey: WsKey): Promise +/** Only returned for fixed-term savings */ ⋮---- -protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null +export interface EarnSavingsAssetsV3 { + resultList: EarnSavingsAssetV3[]; + endId: 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 EarnSavingsRecordV3 { + orderId: string; + coinName: string; + settleCoinName: string; + productType: 'flexible' | 'fixed'; + /** Only returned for fixed-term savings */ + period?: string; + productLevel: string; + amount: string; + ts: string; + orderType: string; +} ⋮---- -// Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values +/** Only returned for fixed-term savings */ ⋮---- -/** - { - "op":"subscribe", - "args":[ - { - "instType":"spot", - "topic":"ticker", - "symbol":"BTCUSDT" - }, - { - "instType":"spot", - "topic":"candle5m", - "symbol":"BTCUSDT" - } - ] - } - */ +export interface EarnSavingsRecordsV3 { + resultList: EarnSavingsRecordV3[]; + endId: string; +} ⋮---- -// const request = { -// topic: 'ticker', -// payload: { instType: 'spot', symbol: 'BTCUSDT' }, -// }; -// becomes: -// const request = { -// topic: 'ticker', -// instType: 'spot', -// symbol: 'BTCUSDT', -// }; +export interface EarnSavingsSubscriptionDetailV3 { + singleMinAmount: string; + singleMaxAmount: string; + remainingAmount: string; + subscribePrecision: string; + profitPrecision: string; + subscribeTime: string; + interestTime: string; + settleTime: string; + expireTime: string; + redeemTime: string; + settleMethod: string; + apyList: EarnSavingsApyV3[]; + redeemDelay: string; +} ⋮---- -private async getWsAuthSignature( - wsKey: WsKey, -): Promise< +export interface SubscribeSavingsResponseV3 { + orderId: string; +} ⋮---- -private async signMessage( - paramsStr: string, - secret: string, - method: 'hex' | 'base64', - algorithm: SignAlgorithm, -): Promise +export interface EarnSavingsSubscriptionResultV3 { + result: 'success' | 'fail'; + msg: string; +} ⋮---- -protected async getWsAuthRequestEvent( - wsKey: WsKey, -): Promise> +export interface RedeemSavingsResponseV3 { + orderId: string; + status: 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[] +export interface EarnSavingsRedemptionResultV3 { + result: 'success' | 'fail'; + msg: string; +} ⋮---- /** - * WS API response handling - */ + * + * + * Earn | SharkFin (UTA) + * + * + */ ⋮---- -// const eg1 = { -// event: 'error', -// id: '1', -// code: '43012', -// msg: 'Insufficient balance', -// }; -⋮---- -// WS API Success -⋮---- -/** - * V3 event handling for consumers - behaves the same as V2 - */ -⋮---- -// v2 authentication event -⋮---- -// messageType: typeof msg, -// messageString: JSON.stringify(msg), -⋮---- -// Service upgrade (30033): Bitget sends this ~60s before disconnect. Log and let automatic reconnect handle when connection drops. -⋮---- -// messageType: typeof msg, -// messageString: JSON.stringify(msg), -⋮---- -// fallback emit anyway -⋮---- -/** - * 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 -⋮---- -// this.logger.trace('sendWSAPIRequest(): assertIsAuthenticated(${wsKey})...'); -⋮---- -// this.logger.trace('sendWSAPIRequest(): assertIsAuthenticated(${wsKey}) ok'); -⋮---- -// apiCode is a top-level field on the trade envelope, not an arg. -⋮---- -// Ensure "args" is always wrapped as array -⋮---- -// Store deferred promise, resolved within the "resolveEmittableEvents" method while parsing incoming events -⋮---- -// eslint-disable-next-line @typescript-eslint/no-explicit-any -⋮---- -// Enrich returned promise with request context for easier debugging -⋮---- -// throw e; -⋮---- -// Send event -⋮---- -// Return deferred promise, so caller can await this call - -================ -File: src/types/response/v3/copytrading.ts -================ -/** - * - * - * Copy Trading | Futures (UTA) - * - * - */ -⋮---- -export interface CopyFuturesMarginDetailV3 { - marginCoin: string; - maxLongCount: string; - remainingLongCount: string; - maxShortCount: string; - remainingShortCount: string; -} -⋮---- -export interface CopyFuturesTradingPairV3 { - symbol: string; - leverage: string; - marginDetails: CopyFuturesMarginDetailV3[]; +export interface EarnSharkfinProductV3 { + 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; + startTime: string; + endTime: 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 EarnSharkfinProductsV3 { + resultList: EarnSharkfinProductV3[]; + endId: string; } ⋮---- -export interface CopyFuturesMaxTransferableV3 { - maxTransferable: string; - available: string; +export interface EarnSharkfinAccountV3 { + btcSubscribeAmount: string; + usdtSubscribeAmount: string; + btcHistoricalAmount: string; + usdtHistoricalAmount: string; + btcTotalEarning: string; + usdtTotalEarning: string; } ⋮---- -/** Follower copy account. Lead accounts use CopyFuturesMaxTransferableV3. */ -export interface CopyFuturesCopyMaxTransferableV3 { - maxTransferable: string; +export interface EarnSharkfinAssetV3 { + productId: string; + interestStartTime: string; + interestEndTime: string; + productCoin: string; + subscribeCoin: string; + trend: string; + settleTime: string; + interestAmount: string; + productStatus: string; } ⋮---- -export interface CopyFuturesTransferResponseV3 { - transferId: string; +export interface EarnSharkfinAssetsV3 { + resultList: EarnSharkfinAssetV3[]; + endId: 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; +export interface EarnSharkfinRecordV3 { + orderId: string; + product: string; + period: string; amount: string; - coin: string; - status: 'Successful' | 'Failed' | 'Processing'; - createdTime: string; -} -⋮---- -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[]; + ts: string; + type: string; } ⋮---- -export interface CopyFuturesHistoryFollowerV3 { - followerName: string; - totalProfit: string; - totalShareProfit: string; - totalInvestment: string; - startTime: string; - endTime: string; +export interface EarnSharkfinRecordsV3 { + resultList: EarnSharkfinRecordV3[]; + endId: string; } ⋮---- -export interface CopyFuturesHistoryFollowersV3 { - list: CopyFuturesHistoryFollowerV3[]; +export interface EarnSharkfinSubscriptionDetailV3 { + 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 CopyFuturesProfitSummaryV3 { - totalProfit: string; - totalAllocatedProfit: string; - totalPendingProfit: string; +export interface SubscribeSharkfinResponseV3 { + orderId: string; + status: string; } ⋮---- -export interface CopyFuturesProfitDetailV3 { - followerName: string; - profit: string; - allocatedPnl: string; - pendingPnl: string; - shareRatio: string; - shareProfit: string; - reason: 'period' | 'unfollow' | string; - settleTime: string; +export interface EarnSharkfinSubscriptionResultV3 { + result: 'success' | 'fail'; + msg: string; } + +================ +File: src/types/response/v3/strategy.ts +================ +import type { + StrategyIcebergParamsV3, + StrategyOcoParamsV3, + StrategyOrderStatusV3, + StrategyOrderTypeV3, + StrategyTrailingStopParamsV3, + StrategyTriggerByV3, + StrategyTriggerOrderTypeV3, + StrategyTwapParamsV3, +} from '../../request/v3/strategy.js'; ⋮---- -export interface CopyFuturesProfitDetailsV3 { - list: CopyFuturesProfitDetailV3[]; - nextCursor: string; +export interface PlaceStrategyOrderResponseV3 { + orderId: string; + clientOid: string; } ⋮---- -export interface CopyFuturesPortfolioOverviewV3 { - projectId: string; - asset: string; - roi: string; - totalProfit: string; - followerProfit: string; - maxDrawdown: string; +export interface ModifyStrategyOrderResponseV3 { + orderId: string; + clientOid: string; } ⋮---- -export interface CopyFuturesCopySettingsV3 { - type: 'fixed_ratio' | 'fixed_margin' | string; - amount: string; - tradingPairList: string[]; - marginPerOrder: string; - autoCopy: 'on' | 'off' | string; - leverage: string; - maxEntrySlippage: string; - maxMarginRatio: string; - /** API field name (Bitget spelling). */ - maxPostionValue: string; -} -⋮---- -/** API field name (Bitget spelling). */ -⋮---- -export interface CopyFuturesFollowerTransferRecordV3 { - fromType: string; - toType: string; - amount: string; - coin: string; - status: string; - createdTime: string; -} -⋮---- -export interface CopyFuturesFollowerTransferRecordListV3 { - list: CopyFuturesFollowerTransferRecordV3[]; - nextCursor?: string; -} -⋮---- -export interface CopyFuturesCurrentCopyV3 { - eliteTrader: string; - estNetProfit: string; - profitShare: string; - estValue: string; - available: string; - currentInvestment: string; -} -⋮---- -export interface CopyFuturesCopyProfitDetailItemV3 { - settleTime: string; - profit: string; - allocatedPnl: string; - pendingPnl: string; - shareRatio: string; - shareProfit: string; -} -⋮---- -export interface CopyFuturesCopyProfitDetailsV3 { - list: CopyFuturesCopyProfitDetailItemV3[]; - nextCursor?: string; -} -⋮---- -export interface CopyFuturesFollowerPositionV3 { +export interface StrategyOrderV3 { + orderId: string; + clientOid: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES' | string; symbol: string; - marginCoin: string; - posSide: 'long' | 'short' | string; - total: string; - leverage: string; - avgPrice: string; - marginMode: string; - holdMode: string; + qty: string; + /** buy / sell. Same field as the WS order push. */ + side?: 'buy' | 'sell'; + /** Can be null (seen live on unfilled trigger orders; user report t.me/bitgetOpenapi/153322, staff checking) */ + posSide: 'long' | 'short' | null; + status: StrategyOrderStatusV3; + type?: StrategyOrderTypeV3 | string; + 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; + ocoParams?: StrategyOcoParamsV3; + trailingStopParams?: StrategyTrailingStopParamsV3; + icebergParams?: StrategyIcebergParamsV3; + twapParams?: StrategyTwapParamsV3; createdTime: string; - positionId: string; -} -⋮---- -export interface CopyFuturesFollowerPositionsV3 { - list: CopyFuturesFollowerPositionV3[]; + updatedTime: string; + /** crossed or isolated. Returned by unfilled and history strategy orders */ + marginMode?: 'crossed' | 'isolated'; } ⋮---- -export interface CopyFuturesTpSlOrderV3 { - strategyId: string; - category: string; - symbol: string; - qty: string; - posSide: string; - status: string; - tpTriggerBy: string; - slTriggerBy: string; - takeProfit: string; - stopLoss: string; - tpOrderType: string; - slOrderType: string; -} +/** buy / sell. Same field as the WS order push. */ ⋮---- -export interface CopyFuturesTpSlResponseV3 { - strategyId: string; -} +/** Can be null (seen live on unfilled trigger orders; user report t.me/bitgetOpenapi/153322, staff checking) */ ⋮---- -export interface CopyFuturesCurrentTpSlOrdersV3 { - list: CopyFuturesTpSlOrderV3[]; -} +/** crossed or isolated. Returned by unfilled and history strategy orders */ ⋮---- -export interface CopyFuturesTpSlOrderHistoryV3 { - list: CopyFuturesTpSlOrderV3[]; - cursor?: string; +export interface StrategySubOrderV3 { + subOrderId: string; + subClientOid?: string; + orderId?: string; + clientOid?: string; + category?: string; + symbol?: string; + side?: string; + posSide?: string; + orderType?: string; + price?: string; + qty?: string; + cumExecQty?: string; + avgPrice?: string; + status?: string; + createdTime?: string; + updatedTime?: string; } ================ @@ -12620,5564 +12947,5749 @@ export interface WsAPIOperationResponseMap { // https://www.bitget.com/docs/uta/websocket/private/Batch-Cancel-Order-Channel ================ -File: src/types/websockets/ws-general.ts +File: src/index.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'; + + +================ +File: src/websocket-api-client.ts +================ +import { + CancelOrderRequestV3, + ModifyOrderRequestV3, +} from './types/request/v3/trade.js'; +import { + CancelOrderResponseV3, + ModifyOrderResponseV3, +} 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 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'; +/** + * 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; +} ⋮---- -| 'UTA' // for account-level topics +/** + * 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(....)`. + */ ⋮---- /** + * This is a minimal Websocket API wrapper around the WebsocketClient. * - * V1 list of topics for WebSocket consumers + * 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 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'; +constructor( + options?: WSClientConfigurableOptions & + Partial, + logger?: DefaultLogger, + ) ⋮---- -export type WsPrivateFuturesTopic = - | 'account' - | 'positions' - | 'orders' - | 'ordersAlgo'; +public getWSClient(): WebsocketClientV3 ⋮---- -export type WsPublicTopic = WsPublicSpotTopic | WsPublicFuturesTopic; +public setTimeOffsetMs(newOffset: number): void ⋮---- -export type WsPrivateTopic = WsPrivateSpotTopic | WsPrivateFuturesTopic; -export type WsTopic = WsPublicTopic | WsPrivateTopic; +/* + * Bitget WebSocket API Methods + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel + */ ⋮---- /** - * - * V2 list of topics for WebSocket consumers - * - */ + * 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 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'; +/** + * Submit a batch of orders + * + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Place-Order-Channel + * + * @returns + */ +placeBatchOrders( + category: BitgetInstTypeV3, + params: WSAPIPlaceOrderRequestV3[], + ): Promise> ⋮---- -| 'index-price' // margin only +/* + * Bitget WebSocket API Methods + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel + */ ⋮---- -// Also update PRIVATE_TOPICS_V2 if this is updated -export type WSPrivateTopicFuturesV2 = - | 'positions' - | 'orders-algo' - | 'positions-history'; +/** + * Cancel Order + * + * https://www.bitget.com/api-doc/uta/websocket/private/Cancel-Order-Channel + * + * @returns + */ +cancelOrder( + category: BitgetInstTypeV3, + params: CancelOrderRequestV3, + ): Promise> ⋮---- -// Also update PRIVATE_TOPICS_V2 if this is updated -export type WSPrivateTopicMarginV2 = - | 'orders-crossed' - | 'account-crossed' - | 'account-isolated' - | 'orders-isolated'; +/** + * Batch Cancel Order + * + * https://www.bitget.com/api-doc/uta/websocket/private/Batch-Cancel-Order-Channel + * + * @returns + */ +cancelBatchOrders( + category: BitgetInstTypeV3, + params: CancelOrderRequestV3[], + ): Promise> ⋮---- -// Also update PRIVATE_TOPICS_V2 if this is updated -export type WsPrivateTopicV2 = - | 'account' - | 'orders' - | WSPrivateTopicFuturesV2 - | WSPrivateTopicMarginV2; +updateOrder( + category: BitgetInstTypeV3, + params: ModifyOrderRequestV3, + ): Promise> ⋮---- -export type WsTopicV2 = WsPublicTopicV2 | WsPrivateTopicV2; +batchUpdateOrders( + category: BitgetInstTypeV3, + params: ModifyOrderRequestV3[], + ): Promise> ⋮---- /** - * - * V3 / UTA list of topics for WebSocket consumers - * - */ -export type WsPublicTopicV3 = - | 'ticker' - | 'kline' - | 'books' - | 'books1' - | 'books5' - | 'books50' - | 'publicTrade'; -// Also update PRIVATE_TOPICS_V3 if this is updated. -// `order` includes venue and rTokenTimeInForce for rToken orders. -export type WsPrivateTopicV3 = - | 'account' - | 'position' - | 'fill' - | 'order' - | 'strategy-order' - | 'reality-orderbook' - | 'reality-orderbook-segmented'; -export type WsTopicV3 = WsPublicTopicV3 | WsPrivateTopicV3; + * + * + * + * + * + * + * + * Private methods for handling some of the convenience/automation provided by the WS API Client + * + * + * + * + * + * + * + */ ⋮---- -/** This is used to differentiate between each of the available websocket streams */ -export type WsKey = (typeof WS_KEY_MAP)[keyof typeof WS_KEY_MAP]; +private setupDefaultEventListeners() ⋮---- /** - * 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" */ + * General event handlers for monitoring the WebsocketClient + */ ⋮---- -export type WsInstIdChannelsV2 = - | 'orders' - | WSPrivateTopicFuturesV2 - | 'orders-crossed' - | 'orders-isolated'; +// Blind JSON.stringify can fail on circular references ⋮---- -export type WsTopicSubscribePrivateInstIdArgsV2 = { - instType: BitgetInstTypeV2; - channel: WsInstIdChannelsV2; - /** The symbol, e.g. "BTCUSDT" */ - instId?: string; -}; +// 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 { CHANNEL_API_CODE, 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'; ⋮---- -/** The symbol, e.g. "BTCUSDT" */ +/** + * 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. + */ +export class WebsocketClientV3 extends BaseWebsocketClient< ⋮---- -export type WsCoinChannelsV2 = - | 'account' - | 'account-crossed' - | 'account-isolated'; +WsRequestOperationBitget // subscribe requests have an "args" parameter with an object within ⋮---- -export type WsTopicSubscribePrivateCoinArgsV2 = { - instType: BitgetInstTypeV2; - channel: WsCoinChannelsV2; - coin: 'default' | string; -}; +/** + * Request connection of all dependent (public & private) websockets, instead of waiting for automatic connection by library + */ +public connectAll(): Promise[] ⋮---- -export type WsTopicSubscribePrivateArgsV2 = - | WsTopicSubscribePrivateInstIdArgsV2 - | WsTopicSubscribePrivateCoinArgsV2; +/** + * 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 type WsTopicSubscribeEventArgsV2 = - | WsTopicSubscribePublicArgsV2 - | WsTopicSubscribePrivateArgsV2; +/** This call automatically ensures the connection is active AND authenticated before resolving */ ⋮---- -/** 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: +/** + * Request subscription to one or more topics. Pass topics as either an array of strings, + * or array of objects (if the topic has parameters). * - * - V2: https://www.bitget.com/api-doc/common/demotrading/websocket - * - V3/UTA: https://www.bitget.com/api-doc/uta/guide#demo-trading + * 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 */ - 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 +public subscribe( + requests: + | (WsTopicRequest | WsTopicV3) + | (WsTopicRequest | WsTopicV3)[], + wsKey: WsKey, + ): Promise +⋮---- +/** + * Unsubscribe from one or more topics. Similar to subscribe() but in reverse. * - * Look in the examples folder for a demonstration on using node's createHmac instead. + * - 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. */ - customSignMessageFn?: (message: string, secret: string) => Promise; -} +public unsubscribe( + requests: + | (WsTopicRequest | WsTopicV3) + | (WsTopicRequest | WsTopicV3)[], + wsKey: WsKey, + ) ⋮---- -/** Your API key */ +/** + * + * + * Internal methods required to integrate with the BaseWSClient + * + * + */ ⋮---- -/** Your API secret */ +protected sendPingEvent(wsKey: WsKey): void ⋮---- -/** The passphrase you set when creating the API Key (NOT your account password) */ +protected sendPongEvent(wsKey: WsKey): void +⋮---- +protected isWsPing(data: any): boolean +⋮---- +protected isWsPong(data: any): boolean +⋮---- +protected isPrivateTopicRequest( + _request: WsTopicRequest, + wsKey: WsKey, + ): boolean +⋮---- +protected getPrivateWSKeys(): WsKey[] +⋮---- +protected isAuthOnConnectWsKey(wsKey: WsKey): boolean +⋮---- +protected async getWsUrl(wsKey: WsKey): Promise +⋮---- +protected getMaxTopicsPerSubscribeEvent(wsKey: WsKey): number | null ⋮---- /** - * 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 + * @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>[]> ⋮---- -/** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ +// Previously used to track topics in a request. Keeping this for subscribe/unsubscribe requests, no need for incremental values ⋮---- -// Disable ping/pong ws heartbeat mechanism (not recommended) +/** + { + "op":"subscribe", + "args":[ + { + "instType":"spot", + "topic":"ticker", + "symbol":"BTCUSDT" + }, + { + "instType":"spot", + "topic":"candle5m", + "symbol":"BTCUSDT" + } + ] + } + */ ⋮---- -/** How often to check if the connection is alive */ +// const request = { +// topic: 'ticker', +// payload: { instType: 'spot', symbol: 'BTCUSDT' }, +// }; +// becomes: +// const request = { +// topic: 'ticker', +// instType: 'spot', +// symbol: 'BTCUSDT', +// }; ⋮---- -/** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ +private async getWsAuthSignature( + wsKey: WsKey, + ): Promise<{ expiresAt: number; signature: string }> ⋮---- -/** Delay in milliseconds before respawning the connection */ +private async signMessage( + paramsStr: string, + secret: string, + method: 'hex' | 'base64', + algorithm: SignAlgorithm, + ): Promise +⋮---- +protected async getWsAuthRequestEvent( + wsKey: WsKey, + ): Promise> ⋮---- /** - * Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method + * Abstraction called to sort ws events into emittable event types (response to a request, data update, etc) + */ +protected resolveEmittableEvents( + wsKey: WsKey, + event: MessageEventLike, + ): EmittableEvent[] +⋮---- +/** + * WS API response handling + */ +⋮---- +// const eg1 = { +// event: 'error', +// id: '1', +// code: '43012', +// msg: 'Insufficient balance', +// }; +⋮---- +// WS API Success +⋮---- +/** + * V3 event handling for consumers - behaves the same as V2 + */ +⋮---- +// v2 authentication event +⋮---- +// messageType: typeof msg, +// messageString: JSON.stringify(msg), +⋮---- +// Service upgrade (30033): Bitget sends this ~60s before disconnect. Log and let automatic reconnect handle when connection drops. +⋮---- +// messageType: typeof msg, +// messageString: JSON.stringify(msg), +⋮---- +// fallback emit anyway +⋮---- +/** + * V3/UTA supports order placement via WebSockets. This is the WS API: + * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel * - * Look in the examples folder for a demonstration on using node's createHmac instead. + * @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 WebsocketClientOptions extends WSClientConfigurableOptions { - pingInterval: number; - pongTimeout: number; - reconnectTimeout: number; - recvWindow: number; - authPrivateConnectionsOnConnect: boolean; - authPrivateRequests: boolean; -} - -================ -File: src/index.ts -================ - +// this.logger.trace('sendWSAPIRequest(): assertIsAuthenticated(${wsKey})...'); +⋮---- +// this.logger.trace('sendWSAPIRequest(): assertIsAuthenticated(${wsKey}) ok'); +⋮---- +// Ensure "args" is always wrapped as array +⋮---- +// Store deferred promise, resolved within the "resolveEmittableEvents" method while parsing incoming events +⋮---- +// eslint-disable-next-line @typescript-eslint/no-explicit-any +⋮---- +// Enrich returned promise with request context for easier debugging +⋮---- +// throw e; +⋮---- +// Send event +⋮---- +// Return deferred promise, so caller can await this call ================ -File: src/rest-client-v2.ts +File: src/types/request/v3/public.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, - GetSubAffiliateInfoRequestV2, - 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'; -import { - BorrowLoanRequestV2, - EarnEliteSubscribeRequestV2, - GetEarnEliteRecordsRequestV2, - GetEarnEliteRedeemInfoRequestV2, - GetEarnEliteSubscribeInfoRequestV2, - GetEarnEliteSubscribeResultRequestV2, - GetEarnSavingsAssetsRequestV2, - GetEarnSavingsRecordsRequestV2, - GetLiquidationRecordsRequestV2, - GetLoanEstInterestAndBorrowableRequestV2, - GetLoanHistoryRequestV2, - GetLoanPledgeRateHistoryRequestV2, - GetLoanRepayHistoryRequestV2, - GetSharkfinAssetsRequestV2, - GetSharkfinRecordsRequestV2, - ModifyLoanPledgeRateRequestV2, - RedeemEarnEliteRequestV2, - RedeemSavingsRequestV2, - RepayLoanRequestV2, -} from './types/request/v2/earn.js'; -import { - FuturesAccountBillRequestV2, - FuturesBatchCancelOrderRequestV2, - FuturesBatchOrderRequestV2, - FuturesCancelAllOrdersRequestV2, - FuturesCancelOrderRequestV2, - FuturesCancelPlanOrderRequestV2, - FuturesCandlesRequestV2, - FuturesFlashClosePositionsRequestV2, - FuturesGetHistoricalFillsRequestV2, - FuturesGetHistoryOrdersRequestV2, - FuturesGetHistoryPlanOrdersRequestV2, - FuturesGetOpenOrdersRequestV2, - FuturesGetOrderFillsRequestV2, - FuturesGetOrderRequestV2, - FuturesGetPlanOrdersRequestV2, - FuturesHistoricalPositionsRequestV2, - FuturesHistoricTradesRequestV2, - FuturesInterestHistoryRequestV2, - FuturesIsolatedSymbolsRequestV2, - FuturesLiquidationPriceRequestV2, - FuturesMaxOpenRequestV2, - FuturesMergeDepthRequestV2, - FuturesModifyOrderRequestV2, - FuturesModifyPlanOrderRequestV2, - FuturesModifyTPSLOrderRequestV2, - FuturesOiLimitRequestV2, - FuturesOpenCountRequestV2, - FuturesPlaceOrderRequestV2, - FuturesPlanOrderRequestV2, - FuturesPositionAdlRankRequestV2, - FuturesPositionTPSLOrderRequestV2, - FuturesRecentTradesRequestV2, - FuturesReversalOrderRequestV2, - FuturesSetAutoMarginRequestV2, - FuturesSetLeverageRequestV2, - FuturesSetMarginModeRequestV2, - FuturesSetPositionMarginRequestV2, - FuturesSingleAccountRequestV2, - FuturesTPSLOrderRequestV2, - GetUnionTransferLimitsRequestV2, - UnionConvertRequestV2, -} from './types/request/v2/futures.js'; -import { - GetInstLoanLTVConvertRequestV2, - GetInstLoanMarginCoinInfoRequestV2, - GetInstLoanOrderRequestV2, - GetInstLoanProductInfoRequestV2, - GetInstLoanRepaidHistoryRequestV2, - GetInstLoanSymbolsRequestV2, -} from './types/request/v2/instloan.js'; -import { - GetBorrowHistoryRequestV2, - GetFinancialHistoryRequestV2, - GetHistoryOrdersRequestV2, - GetInterestHistoryRequestV2, - GetLiquidationHistoryRequestV2, - GetMarginCurrentOrdersRequestV2, - GetMarginLiquidationOrdersRequestV2, - GetMarginOrderFillsRequestV2, - GetRepayHistoryRequestV2, - MarginBatchOrdersRequestV2, - MarginPlaceOrderRequestV2, -} from './types/request/v2/margin.js'; -import { - GetSpotAccountBillsRequestV2, - GetSpotCurrentPlanOrdersRequestV2, - GetSpotDepositRecordRequestV2, - GetSpotFillsRequestV2, - GetSpotHistoryOrdersRequestV2, - GetSpotHistoryPlanOrdersRequestV2, - GetSpotOpenOrdersRequestV2, - GetSpotOrderInfoRequestV2, - GetSpotSubAccountDepositRecordRequestV2, - GetSpotTransferRecordRequestV2, - GetSpotWithdrawalRecordRequestV2, - SpotAccountTypeV2, - SpotBatchCancelOrderRequestV2, - SpotBatchOrderRequestV2, - SpotCallAuctionRequestV2, - SpotCancelandSubmitOrderRequestV2, - SpotCancelOrderRequestV2, - SpotCandlesRequestV2, - SpotHistoricCandlesRequestV2, - SpotHistoricTradesRequestV2, - SpotMainSubTransferRecordRequestV2, - SpotModifyPlanOrderRequestV2, - SpotOrderRequestV2, - SpotPlanOrderRequestV2, - SpotSubAccountTransferRequestV2, - SpotTransferRequestV2, - SpotWithdrawalRequestV2, -} from './types/request/v2/spot.js'; -import { - AgentCommissionDetailV2, - AgentCustomerAssetItemV2, - AgentCustomerCommissionsV2, - AgentCustomerDepositItemV2, - AgentCustomerKycResultV2, - AgentCustomerListItemV2, - AgentCustomerTradeVolumeItemV2, - AgentSubCustomerListV2, - AllSubDepositWithdrawalRecordV2, - BrokerCommissionV2, - BrokerOrderCommissionV2, - BrokerRebateInfoV2, - BrokerSubaccountFutureAssetV2, - BrokerSubaccountInfoV2, - BrokerSubaccountSpotAssetV2, - BrokerSubaccountV2, - BrokerSubaccountWithdrawalV2, - BrokerTotalCommissionV2, - BrokerTradeVolumeV2, - CreateSubaccountApiKeyResponseV2, - CreateSubaccountDepositAddressV2, - CreateSubaccountResponseV2, - ModifySubaccountApiKeyResponseV2, - ModifySubaccountResponseV2, - SubaccountApiKeyV2, - SubaccountDepositV2, - SubaccountEmailV2, - SubAffiliateInfoV2, -} from './types/response/v2/broker.js'; -import { - AnnouncementV2, - BGBConvertCoinV2, - BGBConvertHistoryV2, - BotAssetV2, - ConvertBGBResponseV2, - ConvertCurrencyV2, - ConvertQuotedPriceV2, - ConvertRecordV2, - ConvertTradeResponseV2, - CreateAgentSubaccountV2, - CreateVirtualSubAccountAndApiKeyV2, - CreateVirtualSubAccountApiKeyV2, - CreateVirtualSubAccountV2, - FundingAssetV2, - FuturesActiveBuySellVolumeV2, - FuturesActiveLongShortAccountV2, - FuturesActiveLongShortPositionV2, - FuturesLongShortRatioV2, - FuturesTransactionRecordV2, - IsolatedMarginBorrowingRatioV2, - LeveragedLongShortRatioV2, - MarginLoanGrowthRateV2, - MarginTransactionRecordV2, - ModifyVirtualSubAccountApiKeyV2, - P2PMerchantAdvertismentV2, - P2PMerchantInfoV2, - P2PMerchantOrdersV2, - P2PMerchantOrderV2, - P2PMerchantV2, - SpotFundFlowV2, - SpotTransactionRecordV2, - SpotWhaleNetFlowV2, - SubAccountApiKeyItemV2, - VirtualSubAccountV2, -} from './types/response/v2/common.js'; -import { - CTFuturesFollowerCurrentOrdersV2, - CTFuturesFollowerHistoryOrdersV2, - CTFuturesFollowerMyTradersV2, - CTFuturesFollowerSettingsV2, - CTFuturesTraderCurrentOrdersV2, - CTFuturesTraderHistoryOrderV2, - CTFuturesTraderHistoryProfitSummaryV2, - CTFuturesTraderMyFollowersV2, - CTFuturesTraderProfitShareHistoryV2, - CTFuturesTraderSymbolSettingsV2, - CTFuturesTraderTotalOrderSummaryV2, - CTSpotFollowerCurrentOrdersV2, - CTSpotFollowerFollowConfigurationV2, - CTSpotFollowerHistoryOrdersV2, - CTSpotFollowerMyTradersV2, - CTSpotTraderCurrentTrackingOrdersV2, - CTSpotTraderFollowerListV2, - CTSpotTraderHistoryOrdersV2, - CTSpotTraderHistoryProfitSharingV2, - CTSpotTraderProfitSummaryV2, - CTSpotTraderTotalOrderDetailV2, - CTSpotTraderUnrealizedProfitV2, -} from './types/response/v2/copy-trading.js'; -import { - EarnEliteAssetsV2, - EarnEliteProductV2, - EarnEliteRecordsV2, - EarnEliteRedeemInfoV2, - EarnEliteSubscribeInfoV2, - EarnEliteSubscribeResultV2, - EarnEliteSubscribeStatusV2, - EarnLoanCurrenciesV2, - EarnLoanDebtsV2, - EarnLoanHistoryV2, - EarnLoanLiquidationRecordsV2, - EarnLoanOrdersV2, - EarnLoanPledgeRateHistoryV2, - EarnLoanRepayHistoryV2, - EarnLoanRepayResponseV2, - EarnSavingsAccountV2, - EarnSavingsAssetsV2, - EarnSavingsProductsV2, - EarnSavingsRecordsV2, - EarnSavingsSubscriptionDetailV2, - EarnSharkfinAccountV2, - EarnSharkfinAssetsV2, - EarnSharkfinProductsV2, - EarnSharkfinRecordsV2, - EarnSharkfinSubscriptionDetailV2, - RedeemEarnEliteResultV2, -} from './types/response/v2/earn.js'; -import { - FuturesAccountBillV2, - FuturesAccountsV2, - FuturesAccountV2, - FuturesBatchOrderResponseV2, - FuturesCancelAllOrdersV2, - FuturesCancelPlanOrderV2, - FuturesCandlestickV2, - FuturesClosePositionResponseV2, - FuturesContractConfigV2, - FuturesDiscountRatesV2, - FuturesFillV2, - FuturesFundingTimeV2, - FuturesHistoricalFundingRateV2, - FuturesHistoryInterestRateV2, - FuturesHistoryOrderV2, - FuturesHistoryPlanOrderV2, - FuturesHistoryPositionV2, - FuturesInterestExchangeRateV2, - FuturesInterestHistoryV2, - FuturesIsolatedSymbolV2, - FuturesLiquidationPriceV2, - FuturesMaxOpenV2, - FuturesMergeDepthV2, - FuturesOpenInterestV2, - FuturesOpenOrderV2, - FuturesOrderDetailV2, - FuturesOrderFillV2, - FuturesPendingPlanOrderV2, - FuturesPositionAdlRankV2, - FuturesPositionTierV2, - FuturesPositionV2, - FuturesSubAccountAssetV2, - FuturesSymbolPriceV2, - FuturesTickerV2, - FuturesTriggerSubOrderV2, - FuturesVipFeeRateV2, - SetLeverageResponseV2, - SetMarginModeResponseV2, - UnionConfigV2, - UnionConvertV2, - UnionSwitchUsdtV2, - UnionTransferLimitsV2, -} from './types/response/v2/futures.js'; -import { - InstLoanCoinInfoV2, - InstLoanLTVConvertV2, - InstLoanOrderV2, - InstLoanProductInfoV2, - InstLoanRepaidHistoryItemV2, - InstLoanSymbolsV2, -} from './types/response/v2/instloan.js'; -import { - CrossInterestRateAndLimitResponseV2, - CrossMaxBorrowableResponseV2, - CrossMaxTransferableResponseV2, - CrossTierConfigurationResponseV2, - IsolatedInterestRateAndLimitResponseV2, - IsolatedMaxBorrowableResponseV2, - IsolatedMaxTransferableResponseV2, - IsolatedTierConfigurationResponseV2, - MarginAccountAssetV2, - MarginBatchOrdersResponseV2, - MarginBorrowHistoryItemV2, - MarginCurrencyV2, - MarginCurrentOrderV2, - MarginFinancialHistoryItemV2, - MarginHistoryOrderV2, - MarginInterestHistoryItemV2, - MarginLiquidationHistoryItemV2, - MarginLiquidationOrderV2, - MarginOrderFillV2, - MarginRepaymentHistoryItemV2, -} from './types/response/v2/margin.js'; -import { - CancelAndSubmitSpotOrderResponseV2, - SpotAccountAssetV2, - SpotAccountBillV2, - SpotAccountInfoV2, - SpotCallAuctionV2, - SpotCancelPlanOrdersV2, - SpotCandlestickV2, - SpotCoinInfoV2, - SpotCurrentPlanOrderV2, - SpotDepositAddressV2, - SpotDepositRecordV2, - SpotFillV2, - SpotHistoryPlanOrderV2, - SpotMainSubTransferRecordV2, - SpotMergeDepthV2, - SpotOpenOrderV2, - SpotOrderBookDepthV2, - SpotOrderInfoV2, - SpotPlanSubOrderV2, - SpotSubAccountAssetsV2, - SpotSubAccountDepositRecordV2, - SpotSymbolInfoV2, - SpotTickerV2, - SpotTradeV2, - SpotTransferRecordV2, - SpotVipFeeRateV2, - SpotWithdrawalRecordV2, - SubmitSpotBatchOrdersResponseV2, -} from './types/response/v2/spot.js'; -import { APIResponse } from './types/shared.js'; -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 -⋮---- -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> -⋮---- -getSpotTransferHistory( - params: GetSpotTransferRecordRequestV2, -): Promise> -⋮---- -spotSwitchBGBDeduct(params: { - deduct: boolean; -}): Promise> -⋮---- -getSpotDepositAddress(params: { - coin: string; - chain?: string; - size: string; -}): Promise> -⋮---- -getSpotSubDepositAddress(params: { - subUid: string; - coin: string; - chain?: string; - size: string; -}): Promise> -⋮---- -getSpotBGBDeductInfo(): Promise< - APIResponse<{ - deduct: 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> -⋮---- -/** - * 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> -⋮---- -/** - * 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); -⋮---- -/** - * - * - * Futures - * - * - */ -⋮---- -/** - * - * * Futures | Market - * - */ -⋮---- -getFuturesVIPFeeRate(): Promise> -⋮---- -getFuturesInterestRateHistory(params: { coin: string }): Promise< - APIResponse<{ - coin: string; - historyInterestRateList: FuturesHistoryInterestRateV2[]; - }> - > { - 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> -⋮---- -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> -⋮---- -getFuturesHistoricFundingRates(params: { - symbol: string; - productType: FuturesProductTypeV2; - pageSize?: string; - pageNo?: 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; - }[] - > - > { - 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 -⋮---- -getFuturesContractConfig(params: { - symbol?: string; - productType: FuturesProductTypeV2; -}): Promise> -⋮---- -getFuturesOiLimit(params: FuturesOiLimitRequestV2): Promise< - APIResponse< - { - symbol: string; - notionalValue: string; - totalNotionalValue: string; - }[] - > - > { - return this.get('/api/v2/mix/market/oi-limit', params); -⋮---- -/** - * - * * Futures | Account - * - */ -⋮---- -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<{ - size: string; - }> - > { - return this.getPrivate('/api/v2/mix/account/open-count', params); -⋮---- -setFuturesPositionAutoMargin( - params: FuturesSetAutoMarginRequestV2, -): Promise> -⋮---- -setFuturesLeverage( - params: FuturesSetLeverageRequestV2, -): 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<{ - posMode: 'one_way_mode' | 'hedge_mode'; - }> - > { - return this.postPrivate('/api/v2/mix/account/set-position-mode', params); -⋮---- -getFuturesAccountBills(params: FuturesAccountBillRequestV2): Promise< - APIResponse<{ - bills: FuturesAccountBillV2[]; - endId: string; - }> - > { - return this.getPrivate('/api/v2/mix/account/bill', params); -⋮---- -/** - * Get Union Transfer Limits - * - * - Rate limit: 1 time/1s (uid) - * - Get union margin currency transfer limits - */ -getUnionTransferLimits( - params: GetUnionTransferLimitsRequestV2, -): 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> -⋮---- -/** - * 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 - * - * - 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> -⋮---- -/** - * - * * Futures | Position - * - */ -⋮---- -getFuturesPositionTier(params: { - productType: FuturesProductTypeV2; - symbol: string; -}): Promise> -⋮---- -getFuturesPosition(params: { - productType: FuturesProductTypeV2; - symbol: string; - marginCoin: string; -}): Promise> -⋮---- -getFuturesPositions(params: { - productType: FuturesProductTypeV2; - marginCoin?: string; -}): Promise> -⋮---- -getFuturesHistoricPositions( - params?: FuturesHistoricalPositionsRequestV2, - ): Promise< - APIResponse<{ - list: FuturesHistoryPositionV2[]; - endId: string; - }> - > { - return this.getPrivate('/api/v2/mix/position/history-position', params); -⋮---- -getFuturesPositionAdlRank( - params: FuturesPositionAdlRankRequestV2, -): Promise> -⋮---- -/** - * - * * Futures | Trade - * - */ -⋮---- -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); -⋮---- -futuresBatchSubmitOrders( - params: FuturesBatchOrderRequestV2, -): Promise> -⋮---- -futuresModifyOrder(params: FuturesModifyOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - return this.postPrivate('/api/v2/mix/order/modify-order', params); -⋮---- -futuresCancelOrder(params: FuturesCancelOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - return this.postPrivate('/api/v2/mix/order/cancel-order', params); -⋮---- -futuresBatchCancelOrders( - params: FuturesBatchCancelOrderRequestV2, -): Promise> -⋮---- -futuresFlashClosePositions( - params: FuturesFlashClosePositionsRequestV2, -): Promise> -⋮---- -getFuturesOrder( - params: FuturesGetOrderRequestV2, -): Promise> -⋮---- -getFuturesFills(params: FuturesGetOrderFillsRequestV2): Promise< - APIResponse<{ - fillList: FuturesOrderFillV2[]; - endId: string; - }> - > { - return this.getPrivate('/api/v2/mix/order/fills', params); -⋮---- -getFuturesHistoricOrderFills( - params: FuturesGetHistoricalFillsRequestV2, - ): Promise< - APIResponse<{ - fillList: FuturesOrderFillV2[]; - endId: string; - }> - > { - return this.getPrivate('/api/v2/mix/order/fill-history', params); -⋮---- -getFuturesOpenOrders(params: FuturesGetOpenOrdersRequestV2): Promise< - APIResponse<{ - entrustedList: FuturesOpenOrderV2[]; - endId: string; - }> - > { - return this.getPrivate('/api/v2/mix/order/orders-pending', params); -⋮---- -getFuturesHistoricOrders(params: FuturesGetHistoryOrdersRequestV2): Promise< - APIResponse<{ - entrustedList: FuturesHistoryOrderV2[]; - endId: string; - }> - > { - return this.getPrivate('/api/v2/mix/order/orders-history', params); -⋮---- -futuresCancelAllOrders( - params: FuturesCancelAllOrdersRequestV2, -): Promise> -⋮---- -/** - * - * * Futures | Trigger Orders - * - */ -⋮---- -getFuturesTriggerSubOrder(params: { - planType: 'normal_plan' | 'track_plan'; - planOrderId: string; - productType: FuturesProductTypeV2; -}): Promise> -⋮---- -futuresSubmitTPSLOrder(params: FuturesTPSLOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - return this.postPrivate('/api/v2/mix/order/place-tpsl-order', params); -⋮---- -futuresSubmitPositionTPSL(params: FuturesPositionTPSLOrderRequestV2): Promise< - APIResponse< - { - orderId: string; - stopSurplusClientOid: string; - stopLossClientOid: string; - }[] - > - > { - return this.postPrivate('/api/v2/mix/order/place-pos-tpsl', params); -⋮---- -futuresSubmitPlanOrder(params: FuturesPlanOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - return this.postPrivate('/api/v2/mix/order/place-plan-order', params); -⋮---- -futuresModifyTPSLPOrder(params: FuturesModifyTPSLOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - return this.postPrivate('/api/v2/mix/order/modify-tpsl-order', params); -⋮---- -futuresModifyPlanOrder(params: FuturesModifyPlanOrderRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - return this.postPrivate('/api/v2/mix/order/modify-plan-order', params); -⋮---- -getFuturesPlanOrders(params: FuturesGetPlanOrdersRequestV2): Promise< - APIResponse<{ - entrustedList: FuturesPendingPlanOrderV2[]; - endId: string; - }> - > { - return this.getPrivate('/api/v2/mix/order/orders-plan-pending', params); -⋮---- -futuresCancelPlanOrder( - params: FuturesCancelPlanOrderRequestV2, -): Promise> -⋮---- -getFuturesHistoricPlanOrders( - params: FuturesGetHistoryPlanOrdersRequestV2, - ): Promise< - APIResponse<{ - entrustedList: FuturesHistoryPlanOrderV2[]; - endId: string; - }> - > { - return this.getPrivate('/api/v2/mix/order/orders-plan-history', params); -⋮---- -/** - * - * - * Broker - * - * - */ -⋮---- -/** - * - * * Broker | Subaccount - * - */ -⋮---- -modifySubaccountEmail(params: { - subUid: string; - subaccountEmail: string; -}): Promise> -⋮---- -getBrokerInfo(): Promise< - APIResponse<{ - subAccountSize: string; - maxSubAccountSize: string; - uTime: string; - }> - > { - return this.getPrivate('/api/v2/broker/account/info'); -⋮---- -createSubaccount(params: { - subaccountName: string; - label: string; -}): Promise> -⋮---- -getSubaccounts(params?: GetSubAccountsRequestV2): Promise< - APIResponse<{ - hasNextPage: boolean; - idLessThan: number; - subList: BrokerSubaccountV2[]; - }> - > { - return this.getPrivate('/api/v2/broker/account/subaccount-list', params); -⋮---- -modifySubaccount( - params: ModifySubRequestV2, -): Promise> -⋮---- -getSubaccountEmail(params: { - subUid: string; -}): 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, - ); -⋮---- -getSubaccountFuturesAssets(params: { - subUid: string; - productType: FuturesProductTypeV2; - }): Promise< - APIResponse<{ - assetsList: BrokerSubaccountFutureAssetV2[]; - }> - > { - return this.getPrivate( - '/api/v2/broker/account/subaccount-future-assets', - params, - ); -⋮---- -createSubaccountDepositAddress(params: { - subUid: string; - coin: string; - chain?: string; -}): Promise> -⋮---- -subaccountWithdrawal(params: SubWithdrawalRequestV2): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - return this.postPrivate( - '/api/v2/broker/account/subaccount-withdrawal', - 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> -⋮---- -/** - * 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 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> -⋮---- -/** - * 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> -⋮---- -/** - * Get Rebate Info - * - * - Rate limit: 20 req/sec/UID - * - Data retention: 30 days - * - Real-time data - */ -getBrokerRebateInfo( - params: GetBrokerRebateInfoRequestV2, -): Promise> -⋮---- -/** - * - * * Broker | Agent (affiliate) customer APIs - * - */ -⋮---- -getAgentCustomerCommissions( - params?: GetAgentCustomerCommissionsRequestV2, -): Promise> -⋮---- -/** - * Without startTime/endTime, returns all registered sub-customers (no time restriction). - */ -getAgentSubCustomerList( - params?: GetAgentSubCustomerListRequestV2, -): Promise> -⋮---- -getSubAffiliateInfo( - params?: GetSubAffiliateInfoRequestV2, -): 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> -⋮---- -/** - * - * - * Margin - * - * - */ -⋮---- -/** - * - * * Margin | Common - * - */ -⋮---- -getMarginCurrencies(): 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); -⋮---- -getMarginLiquidationHistory( - marginType: MarginType, - params: GetLiquidationHistoryRequestV2, - ): Promise< - APIResponse<{ - resultList: MarginLiquidationHistoryItemV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); -⋮---- -getMarginFinancialHistory( - marginType: MarginType, - params: GetFinancialHistoryRequestV2, - ): Promise< - APIResponse<{ - resultList: MarginFinancialHistoryItemV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); -⋮---- -/** - * - * * Margin | Cross/Isolated | Account - * - */ -⋮---- -getMarginAccountAssets( - marginType: MarginType, - params?: { coin?: 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); -⋮---- -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); -⋮---- -getMarginRiskRate(marginType: MarginType): Promise< - APIResponse< - { - symbol: string; - riskRateRatio: string; - }[] - > - > { - assertMarginType(marginType); -⋮---- -getMarginMaxBorrowable( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse - > { - assertMarginType(marginType); -⋮---- -getMarginMaxTransferable( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse< - CrossMaxTransferableResponseV2 | IsolatedMaxTransferableResponseV2 - > - > { - assertMarginType(marginType); -⋮---- -getMarginInterestRateAndMaxBorrowable( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse< - | IsolatedInterestRateAndLimitResponseV2[] - | CrossInterestRateAndLimitResponseV2[] - > - > { - assertMarginType(marginType); -⋮---- -getMarginTierConfiguration( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse< - CrossTierConfigurationResponseV2[] | IsolatedTierConfigurationResponseV2[] - > - > { - assertMarginType(marginType); -⋮---- -marginFlashRepay( - marginType: MarginType, - params: { coin: string }, - ): Promise< - APIResponse<{ - repayId: string; - coin?: string; - symbol?: string; - result?: string; - }> - > { - assertMarginType(marginType); -⋮---- -getMarginFlashRepayResult( - marginType: MarginType, - params: { idList: string }, - ): Promise< - APIResponse< - { - repayId: string; - status: string; - }[] - > - > { - assertMarginType(marginType); -⋮---- -/** - * - * * Margin | Cross/Isolated | Trade - * - */ -⋮---- -marginSubmitOrder( - marginType: MarginType, - params: MarginPlaceOrderRequestV2, - ): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - assertMarginType(marginType); -⋮---- -marginBatchSubmitOrders( - marginType: MarginType, - params: MarginBatchOrdersRequestV2, -): Promise> -⋮---- -marginCancelOrder( - marginType: MarginType, - params: { - symbol: string; - orderId?: string; - clientOid?: string; - }, - ): Promise< - APIResponse<{ - orderId: string; - clientOid: string; - }> - > { - assertMarginType(marginType); -⋮---- -marginBatchCancelOrders( - marginType: MarginType, - params: { - symbol: string; - orderIdList: string[]; - }, -): Promise> -⋮---- -getMarginOpenOrders( - marginType: MarginType, - params: GetMarginCurrentOrdersRequestV2, - ): Promise< - APIResponse<{ - orderList: MarginCurrentOrderV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); -⋮---- -getMarginHistoricOrders( - marginType: MarginType, - params: GetHistoryOrdersRequestV2, - ): Promise< - APIResponse<{ - orderList: MarginHistoryOrderV2[]; - maxId: string; - minId: string; - }> - > { - assertMarginType(marginType); -⋮---- -getMarginHistoricOrderFills( - marginType: MarginType, - params: GetMarginOrderFillsRequestV2, - ): Promise< - APIResponse<{ - fills: MarginOrderFillV2[]; - minId: string; - maxId: string; - }> - > { - assertMarginType(marginType); -⋮---- -getMarginLiquidationOrders( - marginType: MarginType, - params: GetMarginLiquidationOrdersRequestV2, - ): Promise< - APIResponse<{ - resultList: MarginLiquidationOrderV2[]; - idLessThan: string; - }> - > { - assertMarginType(marginType); -⋮---- -/** - * - * - * Copy Trading - * - * - */ -⋮---- -/** - * - * - * Copy Trading | Future copy trading | Trader Api - * - * - */ -⋮---- -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, - ); -⋮---- -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); -⋮---- -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, - ); -⋮---- -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> -⋮---- -/** - * - * - * Copy Trading | Future copy trading | Follower Api - * - * - */ -⋮---- -getFuturesFollowerCurrentOrders( - params: GetFollowerFuturesCurrentTrackingOrdersRequestV2, -): Promise> -⋮---- -getFuturesFollowerHistoryOrders( - params: GetFollowerFuturesHistoryTrackingOrdersRequestV2, -): Promise> -⋮---- -updateFuturesFollowerTPSL( - params: UpdateFuturesFollowerTPSLRequestV2, -): Promise> -⋮---- -updateFuturesFollowerSettings( - params: UpdateFuturesFollowerSettingsRequestV2, -): Promise> -⋮---- -getFuturesFollowerSettings(params: { - traderId: string; -}): Promise> -⋮---- -closeFuturesFollowerPositions( - params: CloseFuturesFollowerPositionsRequestV2, - ): Promise< - APIResponse<{ - orderIdList: string[]; - }> - > { - return this.postPrivate( - '/api/v2/copy/mix-follower/close-positions', - params, - ); -⋮---- -getFuturesFollowerTraders( - params: GetFuturesFollowerTradersRequestV2, -): 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> -⋮---- -/** - * - * - * Copy Trading | Future copy trading | Broker api - * - * - */ -⋮---- -getBrokerTraders(params: object): Promise> -⋮---- -getBrokerTradersHistoricalOrders(params: object): Promise> -⋮---- -getBrokerTradersPendingOrders(params: object): Promise> -⋮---- -/** - * - * - * Copy Trading | Spot copy trading | Trader api - * - * - */ -⋮---- -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> -⋮---- -getSpotTraderFollowers( - params: GetSpotTraderFollowersRequestV2, -): Promise> -⋮---- -/** - * - * - * Copy Trading | Spot copy trading | Follower api - * - * - */ -⋮---- -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> -⋮---- -getSpotFollowerCurrentTraderSymbols(params: { traderId: string }): Promise< - APIResponse<{ - currentTradingList: string[]; - }> - > { - return this.getPrivate( - '/api/v2/copy/spot-follower/query-trader-symbols', - params, - ); -⋮---- -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> -⋮---- -/** - * - * - * Earn | Savings - * - * - */ -⋮---- -getEarnSavingsProducts(params?: { - coin?: string; - filter?: string; -}): Promise> -⋮---- -getEarnSavingsAccount(): Promise> -⋮---- -getEarnSavingsAssets( - params: GetEarnSavingsAssetsRequestV2, -): Promise> -⋮---- -getEarnSavingsRecords( - params: GetEarnSavingsRecordsRequestV2, -): Promise> -⋮---- -getEarnSavingsSubscription(params: { - productId: string; - periodType: string; -}): Promise> -⋮---- -earnSubscribeSavings(params: { - productId: string; - periodType: string; - amount: string; - }): Promise< - APIResponse<{ - orderId: string; - status: string; - }> - > { - return this.postPrivate('/api/v2/earn/savings/subscribe', params); -⋮---- -getEarnSavingsSubscriptionResult(params: { - productId: string; - periodType: string; - }): Promise< - APIResponse<{ - result: 'success' | 'fail'; - msg: string; - }> - > { - return this.getPrivate('/api/v2/earn/savings/subscribe-result', params); -⋮---- -earnRedeemSavings(params: RedeemSavingsRequestV2): Promise< - APIResponse<{ - orderId: string; - status: string; - }> - > { - return this.postPrivate('/api/v2/earn/savings/redeem', params); -⋮---- -getEarnSavingsRedemptionResult(params: { - orderId: string; - periodType: string; - }): Promise< - APIResponse<{ - result: 'success' | 'fail'; - msg: string; - }> - > { - return this.getPrivate('/api/v2/earn/savings/redeem-result', params); -⋮---- -/** - * - * - * Earn | Earn Account - * - * - */ -⋮---- -getEarnAccount(params?: { coin?: string }): Promise< - APIResponse< - { - coin: string; - amount: string; - }[] - > - > { - return this.getPrivate('/api/v2/earn/account/assets', params); -⋮---- -/** - * - * - * Earn | On-Chain Elite - * - * - */ -⋮---- -getEarnEliteProducts(): Promise> -⋮---- -getEarnEliteAssets(): Promise> -⋮---- -getEarnEliteRecords( - params: GetEarnEliteRecordsRequestV2, -): Promise> -⋮---- -getEarnEliteSubscribeInfo( - params: GetEarnEliteSubscribeInfoRequestV2, -): Promise> -⋮---- -subscribeEarnElite( - params: EarnEliteSubscribeRequestV2, -): Promise> -⋮---- -getEarnEliteSubscribeResult( - params: GetEarnEliteSubscribeResultRequestV2, -): Promise> -⋮---- -getEarnEliteRedeemInfo( - params: GetEarnEliteRedeemInfoRequestV2, -): Promise> -⋮---- -redeemEarnElite( - params: RedeemEarnEliteRequestV2, -): Promise> -⋮---- -/** - * - * - * Earn | Shark Fin - * - * - */ -⋮---- -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); -⋮---- -/** - * - * - * 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> -⋮---- -/** - * - * * Inst Loan | Product Info - * - */ -⋮---- -getLoanProductInfo( - params: GetInstLoanProductInfoRequestV2, -): Promise> -⋮---- -getLoanSymbols( - params: GetInstLoanSymbolsRequestV2, -): 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 - * - */ -⋮---- -getLoanRiskUnit(): Promise< - APIResponse<{ - riskUnitId: string[]; - }> - > { - return this.getPrivate('/api/v2/spot/ins-loan/risk-unit'); -⋮---- -getLoanLTVConvert( - params?: GetInstLoanLTVConvertRequestV2, -): Promise> -⋮---- -/** - * - * * Inst Loan | Orders - * - */ -⋮---- -getLoanRepaidHistory( - params?: GetInstLoanRepaidHistoryRequestV2, -): Promise> -⋮---- -getLoanOrder( - params?: GetInstLoanOrderRequestV2, -): Promise> - -================ -File: src/types/request/v3/strategy.ts -================ -export type StrategyOrderTypeV3 = - | 'tpsl' - | 'trigger' - | 'oco' - | 'trailing_stop' - | 'iceberg' - | 'twap'; -⋮---- -export type StrategyOrderStatusV3 = - | 'pending' - | 'success' - | 'failed' - | 'cancelled' - | 'submitting'; -⋮---- -export type StrategyTriggerByV3 = 'market' | 'mark'; -⋮---- -export type StrategyTriggerOrderTypeV3 = 'limit' | 'market'; -⋮---- -export interface StrategyOcoParamsV3 { - ocoLimitPrice?: string; - ocoTriggerPrice?: string; - ocoOrderType?: StrategyTriggerOrderTypeV3; - ocoOrderPrice?: string; -} -⋮---- -export interface StrategyTrailingStopParamsV3 { - activationPrice?: string; - activationType?: string; - trailType?: string; - trailVariance?: string; - preOrderType?: StrategyTriggerOrderTypeV3; - preOrderPrice?: string; -} -⋮---- -export interface StrategyIcebergParamsV3 { - splitMode?: string; - qtyPerOrder?: string; - splitOrderNumbers?: string; - orderPreference?: string; - executionStrategy?: string; - fixedDistanceType?: string; - distance?: string; - fixedPrice?: string; - priceLimit?: string; -} -⋮---- -export interface StrategyTwapParamsV3 { - duration?: string; - interval?: string; - orderType?: StrategyTriggerOrderTypeV3; - limitOffsetType?: string; - limitOffsetPercentage?: string; - limitOffsetSpread?: string; - twapTriggerPrice?: string; - twapTerminationPrice?: string; -} -⋮---- -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'; - /** - * Margin mode. Defaults to crossed. Required for isolated positions - * (isolated TP/SL fails with 31008 if omitted). - * Not in Bitget's official API docs yet. Confirmed by Bitget API devs - * in their OpenAPI Telegram: https://t.me/bitgetOpenapi/152235 - */ - marginMode?: 'isolated' | 'crossed'; - tpTriggerBy?: StrategyTriggerByV3; - slTriggerBy?: StrategyTriggerByV3; - takeProfit?: string; - stopLoss?: string; - tpOrderType?: StrategyTriggerOrderTypeV3; - slOrderType?: StrategyTriggerOrderTypeV3; - tpLimitPrice?: string; - slLimitPrice?: string; - triggerBy?: StrategyTriggerByV3; - triggerPrice?: string; - triggerOrderType?: StrategyTriggerOrderTypeV3; - triggerOrderPrice?: string; - ocoParams?: StrategyOcoParamsV3; - trailingStopParams?: StrategyTrailingStopParamsV3; - icebergParams?: StrategyIcebergParamsV3; - twapParams?: StrategyTwapParamsV3; -} -⋮---- -/** Required when tpslMode=partial or for trigger orders */ -⋮---- -/** - * Margin mode. Defaults to crossed. Required for isolated positions - * (isolated TP/SL fails with 31008 if omitted). - * Not in Bitget's official API docs yet. Confirmed by Bitget API devs - * in their OpenAPI Telegram: https://t.me/bitgetOpenapi/152235 - */ -⋮---- -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 GetHistoryStrategyOrdersRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - type?: StrategyOrderTypeV3; - startTime?: string; - endTime?: string; - limit?: string; - /** Observed as a number though the docs say string. */ - cursor?: string | number; -} -⋮---- -/** Observed as a number though the docs say string. */ -⋮---- -export interface GetStrategySubOrdersRequestV3 { - orderId?: string; - clientOid?: string; - limit?: string; - cursor?: 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 CancelBatchOrdersResponseV3 { - orderId: string; - clientOid: string; - code?: string; - msg?: string; -} -⋮---- -export interface CloseAllPositionsResponseV3 { - list: { - orderId: string; - clientOid: string; - code: string; - msg: string; - }[]; -} -⋮---- -export interface CancelOrderResponseV3 { - orderId: string; - clientOid: string; -} -⋮---- -export interface GetMaxOpenAvailableResponseV3 { - available: string; - maxOpen: string; - buyOpenCost: string; - sellOpenCost: string; - maxBuyOpen: string; - maxSellOpen: string; - maxBuyAvailable?: string; - maxSellAvailable?: string; -} -⋮---- -export interface FeeDetailV3 { - feeCoin: string; - fee: string; -} -⋮---- -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; - /** - * rToken routing. internalization or lit_market. - * Also pushed on the WS order channel. - */ - venue?: 'internalization' | 'lit_market' | string; - /** rToken time in force. gtd = current session, gtc = 90 days. */ - rTokenTimeInForce?: 'gtd' | 'gtc' | string; - orderStatus: string; - posSide: string; - holdMode: string; - delegateType?: string; - reduceOnly: string; - feeDetail: FeeDetailV3[]; - cancelReason: string; - execType: string; - stpMode?: string; - createdTime: string; - updatedTime: string; -} -⋮---- -/** - * rToken routing. internalization or lit_market. - * Also pushed on the WS order channel. - */ -⋮---- -/** rToken time in force. gtd = current session, gtc = 90 days. */ -⋮---- -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; - 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 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 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; -} -⋮---- -/** 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 */ -⋮---- -export interface LoanDataDebtCoinV3 { - coin: string; - debt: string; - interestFreeAmount: string; - interestRateNextHour: string; -} -⋮---- -export interface LoanDataV3 { - currentLoans: string; - interestPaymentTime: string; - debtCoinList: LoanDataDebtCoinV3[]; -} -⋮---- -export interface ModifyOrderResponseV3 { - orderId: string; - clientOid: string; -} -⋮---- -export interface PlaceBatchOrdersResponseV3 { - orderId: string; - clientOid: string; - code?: string; - msg?: string; -} -⋮---- -export interface PlaceOrderResponseV3 { - orderId: string; - clientOid: string; -} -⋮---- -export interface PositionAdlRankV3 { - symbol: 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; -} -⋮---- -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 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 GetContractsOiRequestV3 { - symbol?: string; - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; -} -⋮---- -export interface GetCurrentFundingRateRequestV3 { - category?: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; -} -⋮---- -export interface GetLiquidationsRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - limit?: string; - cursor?: string; -} -⋮---- -export interface GetHistoryFundingRateRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - cursor?: string; - limit?: string; -} -⋮---- -export interface GetMarginLoansRequestV3 { - coin: string; - /** User level. Default: vip0 */ - level?: - | 'vip0' - | 'vip1' - | 'vip2' - | 'vip3' - | 'vip4' - | 'vip5' - | 'vip6' - | 'vip7' - | 'pro1' - | 'pro2' - | 'pro3' - | 'pro4' - | 'pro5' - | 'pro6'; -} -⋮---- -/** User level. Default: vip0 */ -⋮---- -export interface GetSplitRecordsRequestV3 { - symbol?: string; -} -⋮---- -export interface GetOpenInterestRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; -} -⋮---- -export type OpenInterestHistoryPeriodV3 = - | '5m' - | '15m' - | '30m' - | '1h' - | '2h' - | '4h' - | '6h' - | '12h' - | '1d'; -⋮---- -export interface GetOpenInterestHistoryRequestV3 { - symbol: string; - /** Default 5m */ - period: OpenInterestHistoryPeriodV3; -} -⋮---- -/** Default 5m */ -⋮---- -export type InterestRateLevelV3 = - | 'vip0' - | 'vip1' - | 'vip2' - | 'vip3' - | 'vip4' - | 'vip5' - | 'vip6' - | 'vip7' - | 'pro1' - | 'pro2' - | 'pro3' - | 'pro4' - | 'pro5' - | 'pro6'; -⋮---- -export interface GetMarginLoansAllRequestV3 { - /** Omit to return every supported coin */ - coin?: string; - /** User level. Default: vip0 */ - level?: InterestRateLevelV3; -} -⋮---- -/** Omit to return every supported coin */ -⋮---- -/** User level. Default: vip0 */ -⋮---- -export interface GetInterestRateHistoryRequestV3 { - coin: string; - /** - * VIP tier. Query name is level, not vipLevel (vipLevel is ignored). - * Omitting it returns the vip0 series. - */ - level?: InterestRateLevelV3; - limit?: string; - /** Pass the cursor from the previous response. */ - cursor?: string; -} -⋮---- -/** - * VIP tier. Query name is level, not vipLevel (vipLevel is ignored). - * Omitting it returns the vip0 series. - */ -⋮---- -/** Pass the cursor from the previous response. */ -⋮---- -export type AnnouncementTypeV3 = - | 'latest_news' - | 'coin_listings' - | 'product_updates' - | 'security' - | 'api_trading' - | 'maintenance_system_updates' - | 'symbol_delisting'; -⋮---- -export interface GetAnnouncementsRequestV3 { - /** zh_CN or en_US. Unsupported languages fall back to English. */ - language: string; - annType?: AnnouncementTypeV3; - startTime?: string; - endTime?: string; - /** Last annId from the previous page. Omit on the first call. */ - cursor?: string; - /** Default 10. Maximum 10. */ - limit?: string; -} -⋮---- -/** zh_CN or en_US. Unsupported languages fall back to English. */ -⋮---- -/** Last annId from the previous page. Omit on the first call. */ -⋮---- -/** Default 10. Maximum 10. */ -⋮---- -export interface GetCoinsRequestV3 { - /** Omit to return every coin. */ - coin?: string; -} -⋮---- -/** Omit to return every coin. */ -⋮---- -export interface GetPositionTierRequestV3 { - category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - coin?: string; -} -⋮---- -export interface GetRiskReserveRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - marginCoin?: string; -} -⋮---- -export interface GetRiskReserveAllRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; -} -⋮---- -export interface GetInstrumentsRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: string; -} -⋮---- -export interface GetMarketFeeGroupRequestV3 { - category: 'SPOT' | 'FUTURES'; - group?: 'DEFAULT' | 'GROUP_A' | 'GROUP_B' | 'GROUP_C'; -} -⋮---- -export interface GetMarketScoreWeightsRequestV3 { - category?: 'SPOT' | 'FUTURES'; -} -⋮---- -export interface GetOrderBookRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - limit?: string; -} -⋮---- -export interface GetTickersRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; -} -⋮---- -export interface GetIndexComponentsRequestV3 { - symbol: string; -} -⋮---- -export interface GetRpiOrderBookRequestV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - limit?: string; -} -⋮---- -export interface GetCashDividendRecordsRequestV3 { - symbol: string; - type: 'pending' | 'paid'; - cursor?: string; - limit?: string; -} -⋮---- -export interface GetSpotWhaleFlowRequestV3 { - symbol: string; -} -⋮---- -export interface GetSpotFundFlowRequestV3 { - symbol: string; - period?: string; -} -⋮---- -export interface GetSpotNetFlowRequestV3 { - symbol: string; -} -⋮---- -export interface GetMarginLongShortRequestV3 { - symbol: string; - period?: '24h' | '30d'; - coin?: string; -} -⋮---- -export interface GetMarginLoanGrowthRequestV3 { - symbol: string; - period?: string; - coin?: string; -} -⋮---- -export interface GetMarginIsolatedBorrowRequestV3 { - symbol: string; - period?: string; -} -⋮---- -export interface GetFuturesTradingDataRequestV3 { - symbol: string; - period?: 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' | 'rpi'; - 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; - /** Spot only. Default: no */ - autoBorrow?: 'yes' | 'no'; - /** Limit orders only. no rejects a price outside the band (default). yes clamps it */ - pxAmendType?: 'yes' | 'no'; - /** - * rToken routing. internalization or lit_market (default). - * Ignored for non-rToken symbols. - */ - venue?: 'internalization' | 'lit_market'; - /** rToken time in force. gtd (default) or gtc (90 days). */ - rTokenTimeInForce?: 'gtd' | 'gtc'; -} -⋮---- -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 */ -⋮---- -/** Spot only. Default: no */ -⋮---- -/** Limit orders only. no rejects a price outside the band (default). yes clamps it */ -⋮---- -/** - * rToken routing. internalization or lit_market (default). - * Ignored for non-rToken symbols. - */ -⋮---- -/** rToken time in force. gtd (default) or gtc (90 days). */ - -================ -File: src/types/request/v3/trade.ts -================ -export interface BatchModifyOrderRequestV3 { - orderId?: string; - clientOid?: string; - qty?: string; - price?: string; - /** Custom request ID. Numbers within 18 digits. */ - requestId?: number; - autoCancel?: 'yes' | 'no'; - /** Required since 30 Sep 2026 */ - symbol: string; - /** Required since 30 Sep 2026 */ - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - /** Limit orders only. no rejects a price outside the band (default). yes clamps it */ - pxAmendType?: 'yes' | 'no'; -} -⋮---- -/** Custom request ID. Numbers within 18 digits. */ -⋮---- -/** Required since 30 Sep 2026 */ -⋮---- -/** Required since 30 Sep 2026 */ -⋮---- -/** Limit orders only. no rejects a price outside the band (default). yes clamps it */ -⋮---- -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 CloseAllPositionsRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - posSide?: 'long' | 'short'; -} -⋮---- -export interface CancelOrderRequestV3 { - orderId?: string; - clientOid?: string; - category?: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; -} -⋮---- -export type FuturesMarginModeV3 = 'crossed' | 'isolated'; -⋮---- -export interface GetMaxOpenAvailableRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol: string; - orderType: 'limit' | 'market'; - side: 'buy' | 'sell'; - price?: string; - size?: string; - /** Spot only. Default: no */ - autoBorrow?: 'yes' | 'no'; - /** - * crossed (default) or isolated. - * Under isolated margin, available excludes futures trial funds. - */ - marginMode?: FuturesMarginModeV3; -} -⋮---- -/** Spot only. Default: no */ -⋮---- -/** - * crossed (default) or isolated. - * Under isolated margin, available excludes futures trial funds. - */ -⋮---- -export interface GetOrderInfoRequestV3 { - orderId?: string; - clientOid?: string; -} -⋮---- -export interface GetFillsRequestV3 { - category?: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - orderId?: string; - 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 GetHistoryOrdersRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol?: 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 GetCurrentPositionRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - posSide?: 'long' | 'short'; -} -⋮---- -export interface ModifyOrderRequestV3 { - orderId?: string; - clientOid?: string; - qty?: string; - price?: string; - /** Custom request ID. Numbers within 18 digits. */ - requestId?: number; - autoCancel?: 'yes' | 'no'; - /** Required since 30 Sep 2026 */ - symbol: string; - /** Required since 30 Sep 2026 */ - 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; - /** Limit orders only. no rejects a price outside the band (default). yes clamps it */ - pxAmendType?: 'yes' | 'no'; -} -⋮---- -/** Custom request ID. Numbers within 18 digits. */ -⋮---- -/** Required since 30 Sep 2026 */ -⋮---- -/** Required since 30 Sep 2026 */ -⋮---- -/** Limit orders only. no rejects a price outside the band (default). yes clamps it */ -⋮---- -export interface PlaceRealityOrderRequestV3 { - category?: 'SPOT' | 'MARGIN'; - symbol: string; - side: 'buy' | 'sell'; - orderType: 'limit' | 'market'; - qty: string; - price?: string; - clientOid?: string; - /** - * rToken routing. internalization = on-exchange pool only. - * lit_market (default) = internal first, then the public market. - * The 13 Oct changelog applies this to place-reality-order as well. - * The place-reality-order parameter table does not list it yet. - */ - venue?: 'internalization' | 'lit_market'; - /** - * rToken time in force. gtd (default) = current session. - * gtc = 90 days. Same changelog note as venue. - */ - rTokenTimeInForce?: 'gtd' | 'gtc'; -} -⋮---- -/** - * rToken routing. internalization = on-exchange pool only. - * lit_market (default) = internal first, then the public market. - * The 13 Oct changelog applies this to place-reality-order as well. - * The place-reality-order parameter table does not list it yet. - */ -⋮---- -/** - * rToken time in force. gtd (default) = current session. - * gtc = 90 days. Same changelog note as venue. - */ -⋮---- -export interface CancelRealityOrderRequestV3 { - category?: 'SPOT' | 'MARGIN'; - symbol: string; - orderId?: string; - clientOid?: 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'; - /** Limit orders only. no rejects a price outside the band (default). yes clamps it */ - pxAmendType?: 'yes' | 'no'; - /** - * Unix ms. Used with receiveWindow. - * If omitted, receiveWindow has no effect. - * An order that reaches the matching engine after requestTime + receiveWindow is canceled. - */ - requestTime?: string; - /** Validity window in ms. Range [10, 60000]. Requires requestTime. */ - receiveWindow?: string; -} -⋮---- -/** Limit orders only. no rejects a price outside the band (default). yes clamps it */ -⋮---- -/** - * Unix ms. Used with receiveWindow. - * If omitted, receiveWindow has no effect. - * An order that reaches the matching engine after requestTime + receiveWindow is canceled. - */ -⋮---- -/** Validity window in ms. Range [10, 60000]. Requires requestTime. */ -⋮---- -export interface PlaceOrderRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - symbol: string; - /** - * Futures qty must be a multiple of quantityMultiplier - * and have at most quantityPrecision decimal places. - * Both come from /api/v3/market/instruments. Futures only. - */ - qty: string; - price?: string; - side: 'buy' | 'sell'; - /** - * Market orders always run as IOC. - * Staff-confirmed: t.me/bitgetOpenapi/153169. - * timeInForce does not change that. - */ - orderType: 'limit' | 'market'; - timeInForce?: 'ioc' | 'fok' | 'gtc' | 'post_only' | 'rpi'; - 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; - /** Spot only. Default: no */ - autoBorrow?: 'yes' | 'no'; - /** Limit orders only. no rejects a price outside the band (default). yes clamps it */ - pxAmendType?: 'yes' | 'no'; - /** Limit orders only. queue1, queue5, counterparty1, or counterparty5 */ - bboLevel?: 'queue1' | 'queue5' | 'counterparty1' | 'counterparty5'; - /** Market orders only. Decimal, default 0.02, range 0.01-0.05 */ - slippageTolerance?: string; - /** - * rToken routing. internalization = on-exchange pool only. - * lit_market (default) = internal first, then the public market. - * Ignored for non-rToken symbols. timeInForce is also ignored for rToken. - */ - venue?: 'internalization' | 'lit_market'; - /** - * rToken time in force. gtd (default) lasts the current session. - * gtc lasts 90 days. Ignored for non-rToken symbols. - */ - rTokenTimeInForce?: 'gtd' | 'gtc'; - /** - * Unix ms. Used with receiveWindow. - * If omitted, receiveWindow has no effect. - * An order that reaches the matching engine after requestTime + receiveWindow is canceled. - */ - requestTime?: string; - /** Validity window in ms. Range [10, 60000]. Requires requestTime. */ - receiveWindow?: string; -} -⋮---- -/** - * Futures qty must be a multiple of quantityMultiplier - * and have at most quantityPrecision decimal places. - * Both come from /api/v3/market/instruments. Futures only. - */ -⋮---- -/** - * Market orders always run as IOC. - * Staff-confirmed: t.me/bitgetOpenapi/153169. - * timeInForce does not change that. - */ -⋮---- -/** Futures only. Defaults to crossed */ -⋮---- -/** Spot only. Default: no */ -⋮---- -/** Limit orders only. no rejects a price outside the band (default). yes clamps it */ -⋮---- -/** Limit orders only. queue1, queue5, counterparty1, or counterparty5 */ -⋮---- -/** Market orders only. Decimal, default 0.02, range 0.01-0.05 */ -⋮---- -/** - * rToken routing. internalization = on-exchange pool only. - * lit_market (default) = internal first, then the public market. - * Ignored for non-rToken symbols. timeInForce is also ignored for rToken. - */ -⋮---- -/** - * rToken time in force. gtd (default) lasts the current session. - * gtc lasts 90 days. Ignored for non-rToken symbols. - */ -⋮---- -/** - * Unix ms. Used with receiveWindow. - * If omitted, receiveWindow has no effect. - * An order that reaches the matching engine after requestTime + receiveWindow is canceled. - */ -⋮---- -/** Validity window in ms. Range [10, 60000]. Requires requestTime. */ -⋮---- -export interface CountdownCancelAllRequestV3 { - countdown: string; // seconds until auto-cancel (5-60, or 0 to disable) -} -⋮---- -countdown: string; // seconds until auto-cancel (5-60, or 0 to disable) - -================ -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) -[![Bitget Tutorial](https://img.shields.io/badge/Bitget%20Tutorial-siebly.io-blue)](https://siebly.io/sdk/bitget/javascript/tutorial) - -

- - - - 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 -- Bitget JavaScript Tutorial: https://siebly.io/sdk/bitget/javascript/tutorial - -## 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/sieblyio/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, -}); +export interface GetPublicFillsRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; + limit?: 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 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 GetContractsOiRequestV3 { + symbol?: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +} +⋮---- +export interface GetCurrentFundingRateRequestV3 { + category?: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; +} +⋮---- +export interface GetLiquidationsRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + limit?: string; + cursor?: string; +} +⋮---- +export interface GetHistoryFundingRateRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + cursor?: string; + limit?: string; +} +⋮---- +export interface GetMarginLoansRequestV3 { + coin: string; + /** User level. Default: vip0 */ + level?: + | 'vip0' + | 'vip1' + | 'vip2' + | 'vip3' + | 'vip4' + | 'vip5' + | 'vip6' + | 'vip7' + | 'pro1' + | 'pro2' + | 'pro3' + | 'pro4' + | 'pro5' + | 'pro6'; +} +⋮---- +/** User level. Default: vip0 */ +⋮---- +export interface GetSplitRecordsRequestV3 { + symbol?: string; +} +⋮---- +export interface GetOpenInterestRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; +} +⋮---- +export type OpenInterestHistoryPeriodV3 = + | '5m' + | '15m' + | '30m' + | '1h' + | '2h' + | '4h' + | '6h' + | '12h' + | '1d'; +⋮---- +export interface GetOpenInterestHistoryRequestV3 { + symbol: string; + /** Default 5m */ + period: OpenInterestHistoryPeriodV3; +} +⋮---- +/** Default 5m */ +⋮---- +export type InterestRateLevelV3 = + | 'vip0' + | 'vip1' + | 'vip2' + | 'vip3' + | 'vip4' + | 'vip5' + | 'vip6' + | 'vip7' + | 'pro1' + | 'pro2' + | 'pro3' + | 'pro4' + | 'pro5' + | 'pro6'; +⋮---- +export interface GetMarginLoansAllRequestV3 { + /** Omit to return every supported coin */ + coin?: string; + /** User level. Default: vip0 */ + level?: InterestRateLevelV3; +} +⋮---- +/** Omit to return every supported coin */ +⋮---- +/** User level. Default: vip0 */ +⋮---- +export interface GetInterestRateHistoryRequestV3 { + coin: string; + /** + * VIP tier. Query name is level, not vipLevel (vipLevel is ignored). + * Omitting it returns the vip0 series. + */ + level?: InterestRateLevelV3; + limit?: string; + /** Pass the cursor from the previous response. */ + cursor?: string; +} +⋮---- +/** + * VIP tier. Query name is level, not vipLevel (vipLevel is ignored). + * Omitting it returns the vip0 series. + */ +⋮---- +/** Pass the cursor from the previous response. */ +⋮---- +export type AnnouncementTypeV3 = + | 'latest_news' + | 'coin_listings' + | 'product_updates' + | 'security' + | 'api_trading' + | 'maintenance_system_updates' + | 'symbol_delisting'; +⋮---- +export interface GetAnnouncementsRequestV3 { + /** zh_CN or en_US. Unsupported languages fall back to English. */ + language: string; + annType?: AnnouncementTypeV3; + startTime?: string; + endTime?: string; + /** Last annId from the previous page. Omit on the first call. */ + cursor?: string; + /** Default 10. Maximum 10. */ + limit?: string; +} +⋮---- +/** zh_CN or en_US. Unsupported languages fall back to English. */ +⋮---- +/** Last annId from the previous page. Omit on the first call. */ +⋮---- +/** Default 10. Maximum 10. */ +⋮---- +export interface GetCoinsRequestV3 { + /** Omit to return every coin. */ + coin?: string; +} +⋮---- +/** Omit to return every coin. */ +⋮---- +export interface GetPositionTierRequestV3 { + category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + coin?: string; +} +⋮---- +export interface GetRiskReserveRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + marginCoin?: string; +} +⋮---- +export interface GetRiskReserveAllRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +} +⋮---- +export interface GetInstrumentsRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; +} +⋮---- +export interface GetMarketFeeGroupRequestV3 { + category: 'SPOT' | 'FUTURES'; + group?: 'DEFAULT' | 'GROUP_A' | 'GROUP_B' | 'GROUP_C'; +} +⋮---- +export interface GetMarketScoreWeightsRequestV3 { + category?: 'SPOT' | 'FUTURES'; +} +⋮---- +export interface GetOrderBookRequestV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + limit?: string; +} +⋮---- +export interface GetTickersRequestV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; +} +⋮---- +export interface GetIndexComponentsRequestV3 { + symbol: string; +} +⋮---- +export interface GetRpiOrderBookRequestV3 { + category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol: string; + limit?: string; +} +⋮---- +export interface GetCashDividendRecordsRequestV3 { + symbol: string; + type: 'pending' | 'paid'; + cursor?: string; + limit?: string; +} +⋮---- +export interface GetSpotWhaleFlowRequestV3 { + symbol: string; +} +⋮---- +export interface GetSpotFundFlowRequestV3 { + symbol: string; + period?: string; +} +⋮---- +export interface GetSpotNetFlowRequestV3 { + symbol: string; +} +⋮---- +export interface GetMarginLongShortRequestV3 { + symbol: string; + period?: '24h' | '30d'; + coin?: string; +} +⋮---- +export interface GetMarginLoanGrowthRequestV3 { + symbol: string; + period?: string; + coin?: string; +} +⋮---- +export interface GetMarginIsolatedBorrowRequestV3 { + symbol: string; + period?: string; +} +⋮---- +export interface GetFuturesTradingDataRequestV3 { + symbol: string; + period?: string; +} -async function start() { - // Start using it like a REST API. All actions are sent via a persisted WebSocket connection. +================ +File: src/types/request/v3/strategy.ts +================ +export type StrategyOrderTypeV3 = + | 'tpsl' + | 'trigger' + | 'oco' + | 'trailing_stop' + | 'iceberg' + | 'twap'; +⋮---- +export type StrategyOrderStatusV3 = + | 'pending' + | 'success' + | 'failed' + | 'cancelled' + | 'submitting'; +⋮---- +export type StrategyTriggerByV3 = 'market' | 'mark'; +⋮---- +export type StrategyTriggerOrderTypeV3 = 'limit' | 'market'; +⋮---- +export interface StrategyOcoParamsV3 { + ocoLimitPrice?: string; + ocoTriggerPrice?: string; + ocoOrderType?: StrategyTriggerOrderTypeV3; + ocoOrderPrice?: string; +} +⋮---- +export interface StrategyTrailingStopParamsV3 { + activationPrice?: string; + activationType?: string; + trailType?: string; + trailVariance?: string; + preOrderType?: StrategyTriggerOrderTypeV3; + preOrderPrice?: string; +} +⋮---- +export interface StrategyIcebergParamsV3 { + splitMode?: string; + qtyPerOrder?: string; + splitOrderNumbers?: string; + orderPreference?: string; + executionStrategy?: string; + fixedDistanceType?: string; + distance?: string; + fixedPrice?: string; + priceLimit?: string; +} +⋮---- +export interface StrategyTwapParamsV3 { + duration?: string; + interval?: string; + orderType?: StrategyTriggerOrderTypeV3; + limitOffsetType?: string; + limitOffsetPercentage?: string; + limitOffsetSpread?: string; + twapTriggerPrice?: string; + twapTerminationPrice?: string; +} +⋮---- +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'; + /** + * Margin mode. Defaults to crossed. Required for isolated positions + * (isolated TP/SL fails with 31008 if omitted). + * Not in Bitget's official API docs yet. Confirmed by Bitget API devs + * in their OpenAPI Telegram: https://t.me/bitgetOpenapi/152235 + */ + marginMode?: 'isolated' | 'crossed'; + tpTriggerBy?: StrategyTriggerByV3; + slTriggerBy?: StrategyTriggerByV3; + takeProfit?: string; + stopLoss?: string; + tpOrderType?: StrategyTriggerOrderTypeV3; + slOrderType?: StrategyTriggerOrderTypeV3; + tpLimitPrice?: string; + slLimitPrice?: string; + triggerBy?: StrategyTriggerByV3; + triggerPrice?: string; + triggerOrderType?: StrategyTriggerOrderTypeV3; + triggerOrderPrice?: string; + ocoParams?: StrategyOcoParamsV3; + trailingStopParams?: StrategyTrailingStopParamsV3; + icebergParams?: StrategyIcebergParamsV3; + twapParams?: StrategyTwapParamsV3; +} +⋮---- +/** Required when tpslMode=partial or for trigger orders */ +⋮---- +/** + * Margin mode. Defaults to crossed. Required for isolated positions + * (isolated TP/SL fails with 31008 if omitted). + * Not in Bitget's official API docs yet. Confirmed by Bitget API devs + * in their OpenAPI Telegram: https://t.me/bitgetOpenapi/152235 + */ +⋮---- +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 GetHistoryStrategyOrdersRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + type?: StrategyOrderTypeV3; + startTime?: string; + endTime?: string; + limit?: string; + /** Observed as a number though the docs say string. */ + cursor?: string | number; +} +⋮---- +/** Observed as a number though the docs say string. */ +⋮---- +export interface GetStrategySubOrdersRequestV3 { + orderId?: string; + clientOid?: string; + limit?: string; + cursor?: 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 CancelBatchOrdersResponseV3 { + orderId: string; + clientOid: string; + code?: string; + msg?: string; +} +⋮---- +export interface CloseAllPositionsResponseV3 { + list: { + orderId: string; + clientOid: string; + code: string; + msg: string; + }[]; +} +⋮---- +export interface CancelOrderResponseV3 { + orderId: string; + clientOid: string; +} +⋮---- +export interface GetMaxOpenAvailableResponseV3 { + available: string; + maxOpen: string; + buyOpenCost: string; + sellOpenCost: string; + maxBuyOpen: string; + maxSellOpen: string; + maxBuyAvailable?: string; + maxSellAvailable?: string; +} +⋮---- +export interface FeeDetailV3 { + feeCoin: string; + fee: string; +} +⋮---- +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; /** - * Place Order - * https://www.bitget.com/api-doc/uta/websocket/private/Place-Order-Channel#request-parameters + * rToken routing returned on order details / WS order channel. + * internal_market = on-exchange only; lit_market = broker only; + * default = internal first then broker (former lit_market meaning, since 5 Nov 2026). + */ + venue?: 'internal_market' | 'lit_market' | 'default' | string; + /** rToken time in force. gtd = current session, gtc = 90 days. */ + rTokenTimeInForce?: 'gtd' | 'gtc' | string; + orderStatus: string; + posSide: string; + holdMode: string; + delegateType?: string; + reduceOnly: string; + feeDetail: FeeDetailV3[]; + cancelReason: string; + execType: string; + stpMode?: string; + createdTime: string; + updatedTime: string; +} +⋮---- +/** + * rToken routing returned on order details / WS order channel. + * internal_market = on-exchange only; lit_market = broker only; + * default = internal first then broker (former lit_market meaning, since 5 Nov 2026). + */ +⋮---- +/** rToken time in force. gtd = current session, gtc = 90 days. */ +⋮---- +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; + 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 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 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; +} +⋮---- +/** 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 */ +⋮---- +export interface LoanDataDebtCoinV3 { + coin: string; + debt: string; + interestFreeAmount: string; + interestRateNextHour: string; +} +⋮---- +export interface LoanDataV3 { + currentLoans: string; + interestPaymentTime: string; + debtCoinList: LoanDataDebtCoinV3[]; +} +⋮---- +export interface ModifyOrderResponseV3 { + orderId: string; + clientOid: string; +} +⋮---- +export interface PlaceBatchOrdersResponseV3 { + orderId: string; + clientOid: string; + code?: string; + msg?: string; +} +⋮---- +export interface PlaceOrderResponseV3 { + orderId: string; + clientOid: string; +} +⋮---- +export interface PositionAdlRankV3 { + symbol: string; + marginCoin: string; + adlRank: string; + holdSide: 'long' | 'short'; +} + +================ +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, + GetSubAffiliateInfoRequestV2, + 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'; +import { + BorrowLoanRequestV2, + EarnEliteSubscribeRequestV2, + GetEarnEliteRecordsRequestV2, + GetEarnEliteRedeemInfoRequestV2, + GetEarnEliteSubscribeInfoRequestV2, + GetEarnEliteSubscribeResultRequestV2, + GetEarnSavingsAssetsRequestV2, + GetEarnSavingsRecordsRequestV2, + GetLiquidationRecordsRequestV2, + GetLoanEstInterestAndBorrowableRequestV2, + GetLoanHistoryRequestV2, + GetLoanPledgeRateHistoryRequestV2, + GetLoanRepayHistoryRequestV2, + GetSharkfinAssetsRequestV2, + GetSharkfinRecordsRequestV2, + ModifyLoanPledgeRateRequestV2, + RedeemEarnEliteRequestV2, + RedeemSavingsRequestV2, + RepayLoanRequestV2, +} from './types/request/v2/earn.js'; +import { + FuturesAccountBillRequestV2, + FuturesBatchCancelOrderRequestV2, + FuturesBatchOrderRequestV2, + FuturesCancelAllOrdersRequestV2, + FuturesCancelOrderRequestV2, + FuturesCancelPlanOrderRequestV2, + FuturesCandlesRequestV2, + FuturesFlashClosePositionsRequestV2, + FuturesGetHistoricalFillsRequestV2, + FuturesGetHistoryOrdersRequestV2, + FuturesGetHistoryPlanOrdersRequestV2, + FuturesGetOpenOrdersRequestV2, + FuturesGetOrderFillsRequestV2, + FuturesGetOrderRequestV2, + FuturesGetPlanOrdersRequestV2, + FuturesHistoricalPositionsRequestV2, + FuturesHistoricTradesRequestV2, + FuturesInterestHistoryRequestV2, + FuturesIsolatedSymbolsRequestV2, + FuturesLiquidationPriceRequestV2, + FuturesMaxOpenRequestV2, + FuturesMergeDepthRequestV2, + FuturesModifyOrderRequestV2, + FuturesModifyPlanOrderRequestV2, + FuturesModifyTPSLOrderRequestV2, + FuturesOiLimitRequestV2, + FuturesOpenCountRequestV2, + FuturesPlaceOrderRequestV2, + FuturesPlanOrderRequestV2, + FuturesPositionAdlRankRequestV2, + FuturesPositionTPSLOrderRequestV2, + FuturesRecentTradesRequestV2, + FuturesReversalOrderRequestV2, + FuturesSetAutoMarginRequestV2, + FuturesSetLeverageRequestV2, + FuturesSetMarginModeRequestV2, + FuturesSetPositionMarginRequestV2, + FuturesSingleAccountRequestV2, + FuturesTPSLOrderRequestV2, + GetUnionTransferLimitsRequestV2, + UnionConvertRequestV2, +} from './types/request/v2/futures.js'; +import { + GetInstLoanLTVConvertRequestV2, + GetInstLoanMarginCoinInfoRequestV2, + GetInstLoanOrderRequestV2, + GetInstLoanProductInfoRequestV2, + GetInstLoanRepaidHistoryRequestV2, + GetInstLoanSymbolsRequestV2, +} from './types/request/v2/instloan.js'; +import { + GetBorrowHistoryRequestV2, + GetFinancialHistoryRequestV2, + GetHistoryOrdersRequestV2, + GetInterestHistoryRequestV2, + GetLiquidationHistoryRequestV2, + GetMarginCurrentOrdersRequestV2, + GetMarginLiquidationOrdersRequestV2, + GetMarginOrderFillsRequestV2, + GetRepayHistoryRequestV2, + MarginBatchOrdersRequestV2, + MarginPlaceOrderRequestV2, +} from './types/request/v2/margin.js'; +import { + GetSpotAccountBillsRequestV2, + GetSpotCurrentPlanOrdersRequestV2, + GetSpotDepositRecordRequestV2, + GetSpotFillsRequestV2, + GetSpotHistoryOrdersRequestV2, + GetSpotHistoryPlanOrdersRequestV2, + GetSpotOpenOrdersRequestV2, + GetSpotOrderInfoRequestV2, + GetSpotSubAccountDepositRecordRequestV2, + GetSpotTransferRecordRequestV2, + GetSpotWithdrawalRecordRequestV2, + SpotAccountTypeV2, + SpotBatchCancelOrderRequestV2, + SpotBatchOrderRequestV2, + SpotCallAuctionRequestV2, + SpotCancelandSubmitOrderRequestV2, + SpotCancelOrderRequestV2, + SpotCandlesRequestV2, + SpotHistoricCandlesRequestV2, + SpotHistoricTradesRequestV2, + SpotMainSubTransferRecordRequestV2, + SpotModifyPlanOrderRequestV2, + SpotOrderRequestV2, + SpotPlanOrderRequestV2, + SpotSubAccountTransferRequestV2, + SpotTransferRequestV2, + SpotWithdrawalRequestV2, +} from './types/request/v2/spot.js'; +import { + AgentCommissionDetailV2, + AgentCustomerAssetItemV2, + AgentCustomerCommissionsV2, + AgentCustomerDepositItemV2, + AgentCustomerKycResultV2, + AgentCustomerListItemV2, + AgentCustomerTradeVolumeItemV2, + AgentSubCustomerListV2, + AllSubDepositWithdrawalRecordV2, + BrokerCommissionV2, + BrokerOrderCommissionV2, + BrokerRebateInfoV2, + BrokerSubaccountFutureAssetV2, + BrokerSubaccountInfoV2, + BrokerSubaccountSpotAssetV2, + BrokerSubaccountV2, + BrokerSubaccountWithdrawalV2, + BrokerTotalCommissionV2, + BrokerTradeVolumeV2, + CreateSubaccountApiKeyResponseV2, + CreateSubaccountDepositAddressV2, + CreateSubaccountResponseV2, + ModifySubaccountApiKeyResponseV2, + ModifySubaccountResponseV2, + SubaccountApiKeyV2, + SubaccountDepositV2, + SubaccountEmailV2, + SubAffiliateInfoV2, +} from './types/response/v2/broker.js'; +import { + AnnouncementV2, + BGBConvertCoinV2, + BGBConvertHistoryV2, + BotAssetV2, + ConvertBGBResponseV2, + ConvertCurrencyV2, + ConvertQuotedPriceV2, + ConvertRecordV2, + ConvertTradeResponseV2, + CreateAgentSubaccountV2, + CreateVirtualSubAccountAndApiKeyV2, + CreateVirtualSubAccountApiKeyV2, + CreateVirtualSubAccountV2, + FundingAssetV2, + FuturesActiveBuySellVolumeV2, + FuturesActiveLongShortAccountV2, + FuturesActiveLongShortPositionV2, + FuturesLongShortRatioV2, + FuturesTransactionRecordV2, + IsolatedMarginBorrowingRatioV2, + LeveragedLongShortRatioV2, + MarginLoanGrowthRateV2, + MarginTransactionRecordV2, + ModifyVirtualSubAccountApiKeyV2, + P2PMerchantAdvertismentV2, + P2PMerchantInfoV2, + P2PMerchantOrdersV2, + P2PMerchantOrderV2, + P2PMerchantV2, + SpotFundFlowV2, + SpotTransactionRecordV2, + SpotWhaleNetFlowV2, + SubAccountApiKeyItemV2, + VirtualSubAccountV2, +} from './types/response/v2/common.js'; +import { + CTFuturesFollowerCurrentOrdersV2, + CTFuturesFollowerHistoryOrdersV2, + CTFuturesFollowerMyTradersV2, + CTFuturesFollowerSettingsV2, + CTFuturesTraderCurrentOrdersV2, + CTFuturesTraderHistoryOrderV2, + CTFuturesTraderHistoryProfitSummaryV2, + CTFuturesTraderMyFollowersV2, + CTFuturesTraderProfitShareHistoryV2, + CTFuturesTraderSymbolSettingsV2, + CTFuturesTraderTotalOrderSummaryV2, + CTSpotFollowerCurrentOrdersV2, + CTSpotFollowerFollowConfigurationV2, + CTSpotFollowerHistoryOrdersV2, + CTSpotFollowerMyTradersV2, + CTSpotTraderCurrentTrackingOrdersV2, + CTSpotTraderFollowerListV2, + CTSpotTraderHistoryOrdersV2, + CTSpotTraderHistoryProfitSharingV2, + CTSpotTraderProfitSummaryV2, + CTSpotTraderTotalOrderDetailV2, + CTSpotTraderUnrealizedProfitV2, +} from './types/response/v2/copy-trading.js'; +import { + EarnEliteAssetsV2, + EarnEliteProductV2, + EarnEliteRecordsV2, + EarnEliteRedeemInfoV2, + EarnEliteSubscribeInfoV2, + EarnEliteSubscribeResultV2, + EarnEliteSubscribeStatusV2, + EarnLoanCurrenciesV2, + EarnLoanDebtsV2, + EarnLoanHistoryV2, + EarnLoanLiquidationRecordsV2, + EarnLoanOrdersV2, + EarnLoanPledgeRateHistoryV2, + EarnLoanRepayHistoryV2, + EarnLoanRepayResponseV2, + EarnSavingsAccountV2, + EarnSavingsAssetsV2, + EarnSavingsProductsV2, + EarnSavingsRecordsV2, + EarnSavingsSubscriptionDetailV2, + EarnSharkfinAccountV2, + EarnSharkfinAssetsV2, + EarnSharkfinProductsV2, + EarnSharkfinRecordsV2, + EarnSharkfinSubscriptionDetailV2, + RedeemEarnEliteResultV2, +} from './types/response/v2/earn.js'; +import { + FuturesAccountBillV2, + FuturesAccountsV2, + FuturesAccountV2, + FuturesBatchOrderResponseV2, + FuturesCancelAllOrdersV2, + FuturesCancelPlanOrderV2, + FuturesCandlestickV2, + FuturesClosePositionResponseV2, + FuturesContractConfigV2, + FuturesDiscountRatesV2, + FuturesFillV2, + FuturesFundingTimeV2, + FuturesHistoricalFundingRateV2, + FuturesHistoryInterestRateV2, + FuturesHistoryOrderV2, + FuturesHistoryPlanOrderV2, + FuturesHistoryPositionV2, + FuturesInterestExchangeRateV2, + FuturesInterestHistoryV2, + FuturesIsolatedSymbolV2, + FuturesLiquidationPriceV2, + FuturesMaxOpenV2, + FuturesMergeDepthV2, + FuturesOpenInterestV2, + FuturesOpenOrderV2, + FuturesOrderDetailV2, + FuturesOrderFillV2, + FuturesPendingPlanOrderV2, + FuturesPositionAdlRankV2, + FuturesPositionTierV2, + FuturesPositionV2, + FuturesSubAccountAssetV2, + FuturesSymbolPriceV2, + FuturesTickerV2, + FuturesTriggerSubOrderV2, + FuturesVipFeeRateV2, + SetLeverageResponseV2, + SetMarginModeResponseV2, + UnionConfigV2, + UnionConvertV2, + UnionSwitchUsdtV2, + UnionTransferLimitsV2, +} from './types/response/v2/futures.js'; +import { + InstLoanCoinInfoV2, + InstLoanLTVConvertV2, + InstLoanOrderV2, + InstLoanProductInfoV2, + InstLoanRepaidHistoryItemV2, + InstLoanSymbolsV2, +} from './types/response/v2/instloan.js'; +import { + CrossInterestRateAndLimitResponseV2, + CrossMaxBorrowableResponseV2, + CrossMaxTransferableResponseV2, + CrossTierConfigurationResponseV2, + IsolatedInterestRateAndLimitResponseV2, + IsolatedMaxBorrowableResponseV2, + IsolatedMaxTransferableResponseV2, + IsolatedTierConfigurationResponseV2, + MarginAccountAssetV2, + MarginBatchOrdersResponseV2, + MarginBorrowHistoryItemV2, + MarginCurrencyV2, + MarginCurrentOrderV2, + MarginFinancialHistoryItemV2, + MarginHistoryOrderV2, + MarginInterestHistoryItemV2, + MarginLiquidationHistoryItemV2, + MarginLiquidationOrderV2, + MarginOrderFillV2, + MarginRepaymentHistoryItemV2, +} from './types/response/v2/margin.js'; +import { + CancelAndSubmitSpotOrderResponseV2, + SpotAccountAssetV2, + SpotAccountBillV2, + SpotAccountInfoV2, + SpotCallAuctionV2, + SpotCancelPlanOrdersV2, + SpotCandlestickV2, + SpotCoinInfoV2, + SpotCurrentPlanOrderV2, + SpotDepositAddressV2, + SpotDepositRecordV2, + SpotFillV2, + SpotHistoryPlanOrderV2, + SpotMainSubTransferRecordV2, + SpotMergeDepthV2, + SpotOpenOrderV2, + SpotOrderBookDepthV2, + SpotOrderInfoV2, + SpotPlanSubOrderV2, + SpotSubAccountAssetsV2, + SpotSubAccountDepositRecordV2, + SpotSymbolInfoV2, + SpotTickerV2, + SpotTradeV2, + SpotTransferRecordV2, + SpotVipFeeRateV2, + SpotWithdrawalRecordV2, + SubmitSpotBatchOrdersResponseV2, +} from './types/response/v2/spot.js'; +import { APIResponse } from './types/shared.js'; +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 +⋮---- +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; + }> + > +⋮---- +getTradeRate(params: GetTradeRateRequestV2): Promise< + APIResponse<{ + makerFeeRate: string; + takerFeeRate: string; + }> + > +⋮---- +getAllTradeRates(params: GetAllTradeRatesRequestV2): Promise< + APIResponse< + { + symbol: string; + makerFeeRate: string; + takerFeeRate: string; + }[] + > + > +⋮---- +/** + * + * * 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; + }> + > +⋮---- +getP2PMerchantInfo(): Promise> +⋮---- +getP2PMerchantOrders(params: GetMerchantP2POrdersRequestV2): Promise< + APIResponse<{ + orderList: P2PMerchantOrderV2[]; + minOrderId: string; + }> + > +⋮---- +getP2PMerchantAdvertisementList( + params: GetMerchantAdvertisementsRequestV2, + ): Promise< + APIResponse<{ + advList: P2PMerchantAdvertismentV2[]; + minAdvId: string; + }> + > +⋮---- +/** + * + * * 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[]; + }> + > +⋮---- +getSpotFundNetFlowData(params: { symbol: string }): Promise< + APIResponse< + { + netFlow: string; + ts: string; + }[] + > + > +⋮---- +getFuturesActiveLongShortAccountData(params: { + symbol: string; + period?: string; + }): Promise> +⋮---- +/** + * + * * Common | Virtual Subaccount + * + */ +⋮---- +createVirtualSubaccount(params: { + subAccountList: string[]; + }): Promise> +⋮---- +modifyVirtualSubaccount(params: ModifyVirtualSubRequestV2): Promise< + APIResponse<{ + result: string; + }> + > +⋮---- +batchCreateVirtualSubaccountAndAPIKey( + params: CreateVirtualSubRequestV2, + ): Promise> +⋮---- +getVirtualSubaccounts(params?: { + limit?: string; + idLessThan?: string; + status?: 'normal' | 'freeze'; + }): Promise< + APIResponse<{ + endId: string; + subAccountList: VirtualSubAccountV2[]; + }> + > +⋮---- +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; + }[] + > + > +⋮---- +/** + * + * * Common | Convert + * + */ +⋮---- +getConvertCoins(): Promise> +⋮---- +getConvertQuotedPrice( + params: ConvertQuoteRequestV2, + ): Promise> +⋮---- +convert( + params: ConvertRequestV2, + ): Promise> +⋮---- +getConvertHistory(params: GetConvertHistoryRequestV2): Promise< + APIResponse<{ + dataList: ConvertRecordV2[]; + endId: string; + }> + > +⋮---- +/** + * + * * Common | BGB Convert + * + */ +⋮---- +getConvertBGBCoins(): Promise< + APIResponse<{ + coinList: BGBConvertCoinV2[]; + }> + > +⋮---- +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; + }> + > +⋮---- +spotCancelandSubmitOrder( + params: SpotCancelandSubmitOrderRequestV2, + ): Promise> +⋮---- +spotBatchCancelandSubmitOrder(params: { + orderList: SpotCancelandSubmitOrderRequestV2[]; + }): Promise> +⋮---- +spotCancelOrder(params: SpotCancelOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +spotBatchSubmitOrders( + params: SpotBatchOrderRequestV2, + ): Promise> +⋮---- +spotBatchCancelOrders( + params: SpotBatchCancelOrderRequestV2, + ): Promise> +⋮---- +spotCancelSymbolOrder(params: { symbol: string }): Promise< + APIResponse<{ + symbol: string; + }> + > +⋮---- +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; + }> + > +⋮---- +spotModifyPlanOrder(params: SpotModifyPlanOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +spotCancelPlanOrder(params: { + clientOid?: string; + orderId?: string; + }): Promise< + APIResponse<{ + result: string; + }> + > +⋮---- +getSpotCurrentPlanOrders(params: GetSpotCurrentPlanOrdersRequestV2): Promise< + APIResponse<{ + nextFlag: boolean; + idLessThan: string; + orderList: SpotCurrentPlanOrderV2[]; + }> + > +⋮---- +getSpotPlanSubOrder(params: { + planOrderId: string; + }): Promise> +⋮---- +getSpotHistoricPlanOrders(params: GetSpotHistoryPlanOrdersRequestV2): Promise< + APIResponse<{ + nextFlag: boolean; + idLessThan: string; + orderList: SpotHistoryPlanOrderV2[]; + }> + > +⋮---- +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; + }> + > +⋮---- +getSpotTransferableCoins(params: { + fromType: SpotAccountTypeV2; + toType: SpotAccountTypeV2; + }): Promise> +⋮---- +spotSubTransfer(params: SpotSubAccountTransferRequestV2): Promise< + APIResponse<{ + transferId: string; + clientOid: string; + }> + > +⋮---- +spotWithdraw(params: SpotWithdrawalRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +getSpotMainSubTransferRecord( + params: SpotMainSubTransferRecordRequestV2, + ): Promise> +⋮---- +getSpotTransferHistory( + params: GetSpotTransferRecordRequestV2, + ): Promise> +⋮---- +spotSwitchBGBDeduct(params: { + deduct: boolean; + }): Promise> +⋮---- +getSpotDepositAddress(params: { + coin: string; + chain?: string; + size: string; + }): Promise> +⋮---- +getSpotSubDepositAddress(params: { + subUid: string; + coin: string; + chain?: string; + size: string; + }): Promise> +⋮---- +getSpotBGBDeductInfo(): Promise< + APIResponse<{ + deduct: string; + }> + > +⋮---- +spotCancelWithdrawal(params: { + orderId: string; + }): Promise> +⋮---- +getSubAccountDepositRecords( + params: GetSpotSubAccountDepositRecordRequestV2, + ): Promise> +⋮---- +getSpotWithdrawalHistory( + params: GetSpotWithdrawalRecordRequestV2, + ): Promise> +⋮---- +getSpotDepositHistory( + params: GetSpotDepositRecordRequestV2, + ): Promise> +⋮---- +/** + * 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> +⋮---- +/** + * 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'; + }> + > +⋮---- +/** + * + * + * Futures + * + * + */ +⋮---- +/** + * + * * Futures | Market + * + */ +⋮---- +getFuturesVIPFeeRate(): Promise> +⋮---- +getFuturesInterestRateHistory(params: { coin: string }): Promise< + APIResponse<{ + coin: string; + historyInterestRateList: FuturesHistoryInterestRateV2[]; + }> + > +⋮---- +getFuturesInterestExchangeRate(): Promise< + APIResponse< + { + coin: string; + exchangeRateList: FuturesInterestExchangeRateV2[]; + }[] + > + > +⋮---- +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> +⋮---- +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; + }> + > +⋮---- +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> +⋮---- +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; + }[] + > + > +⋮---- +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< + { + symbol: string; + notionalValue: string; + totalNotionalValue: string; + }[] + > + > +⋮---- +/** + * + * * Futures | Account + * + */ +⋮---- +getFuturesAccountAsset( + params: FuturesSingleAccountRequestV2, + ): Promise> +⋮---- +getFuturesAccountAssets(params: { + productType: FuturesProductTypeV2; + }): Promise> +⋮---- +getFuturesSubAccountAssets(params: { + productType: FuturesProductTypeV2; + }): Promise< + APIResponse< + { + userId: number; + assetList: FuturesSubAccountAssetV2[]; + }[] + > + > +⋮---- +getFuturesInterestHistory( + params: FuturesInterestHistoryRequestV2, + ): Promise> +⋮---- +getFuturesOpenCount(params: FuturesOpenCountRequestV2): Promise< + APIResponse<{ + size: string; + }> + > +⋮---- +setFuturesPositionAutoMargin( + params: FuturesSetAutoMarginRequestV2, + ): Promise> +⋮---- +setFuturesLeverage( + params: FuturesSetLeverageRequestV2, + ): 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<{ + posMode: 'one_way_mode' | 'hedge_mode'; + }> + > +⋮---- +getFuturesAccountBills(params: FuturesAccountBillRequestV2): Promise< + APIResponse<{ + bills: FuturesAccountBillV2[]; + endId: string; + }> + > +⋮---- +/** + * Get Union Transfer Limits + * + * - Rate limit: 1 time/1s (uid) + * - Get union margin currency transfer limits + */ +getUnionTransferLimits( + params: GetUnionTransferLimitsRequestV2, + ): 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> +⋮---- +/** + * 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 + * + * - 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> +⋮---- +/** + * + * * Futures | Position + * + */ +⋮---- +getFuturesPositionTier(params: { + productType: FuturesProductTypeV2; + symbol: string; + }): Promise> +⋮---- +getFuturesPosition(params: { + productType: FuturesProductTypeV2; + symbol: string; + marginCoin: string; + }): Promise> +⋮---- +getFuturesPositions(params: { + productType: FuturesProductTypeV2; + marginCoin?: string; + }): Promise> +⋮---- +getFuturesHistoricPositions( + params?: FuturesHistoricalPositionsRequestV2, + ): Promise< + APIResponse<{ + list: FuturesHistoryPositionV2[]; + endId: string; + }> + > +⋮---- +getFuturesPositionAdlRank( + params: FuturesPositionAdlRankRequestV2, + ): Promise> +⋮---- +/** + * + * * Futures | Trade + * + */ +⋮---- +futuresSubmitOrder(params: FuturesPlaceOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +futuresSubmitReversal(params: FuturesReversalOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +futuresBatchSubmitOrders( + params: FuturesBatchOrderRequestV2, + ): Promise> +⋮---- +futuresModifyOrder(params: FuturesModifyOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +futuresCancelOrder(params: FuturesCancelOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +futuresBatchCancelOrders( + params: FuturesBatchCancelOrderRequestV2, + ): Promise> +⋮---- +futuresFlashClosePositions( + params: FuturesFlashClosePositionsRequestV2, + ): Promise> +⋮---- +getFuturesOrder( + params: FuturesGetOrderRequestV2, + ): Promise> +⋮---- +getFuturesFills(params: FuturesGetOrderFillsRequestV2): Promise< + APIResponse<{ + fillList: FuturesOrderFillV2[]; + endId: string; + }> + > +⋮---- +getFuturesHistoricOrderFills( + params: FuturesGetHistoricalFillsRequestV2, + ): Promise< + APIResponse<{ + fillList: FuturesOrderFillV2[]; + endId: string; + }> + > +⋮---- +getFuturesOpenOrders(params: FuturesGetOpenOrdersRequestV2): Promise< + APIResponse<{ + /** + * Undocumented but staff-confirmed: null and [] can both represent an empty page. + * @see https://t.me/bitgetOpenapi/153977 + */ + entrustedList: FuturesOpenOrderV2[] | null; + endId: string; + }> + > +⋮---- +/** + * Undocumented but staff-confirmed: null and [] can both represent an empty page. + * @see https://t.me/bitgetOpenapi/153977 + */ +⋮---- +getFuturesHistoricOrders(params: FuturesGetHistoryOrdersRequestV2): Promise< + APIResponse<{ + entrustedList: FuturesHistoryOrderV2[]; + endId: string; + }> + > +⋮---- +futuresCancelAllOrders( + params: FuturesCancelAllOrdersRequestV2, + ): Promise> +⋮---- +/** + * + * * Futures | Trigger Orders + * + */ +⋮---- +getFuturesTriggerSubOrder(params: { + planType: 'normal_plan' | 'track_plan'; + planOrderId: string; + productType: FuturesProductTypeV2; + }): Promise> +⋮---- +futuresSubmitTPSLOrder(params: FuturesTPSLOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +futuresSubmitPositionTPSL(params: FuturesPositionTPSLOrderRequestV2): Promise< + APIResponse< + { + orderId: string; + stopSurplusClientOid: string; + stopLossClientOid: string; + }[] + > + > +⋮---- +futuresSubmitPlanOrder(params: FuturesPlanOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +futuresModifyTPSLPOrder(params: FuturesModifyTPSLOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +futuresModifyPlanOrder(params: FuturesModifyPlanOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +getFuturesPlanOrders(params: FuturesGetPlanOrdersRequestV2): Promise< + APIResponse<{ + /** + * Undocumented but staff-confirmed: null and [] can both represent an empty page. + * @see https://t.me/bitgetOpenapi/153977 + */ + entrustedList: FuturesPendingPlanOrderV2[] | null; + endId: string; + }> + > +⋮---- +/** + * Undocumented but staff-confirmed: null and [] can both represent an empty page. + * @see https://t.me/bitgetOpenapi/153977 + */ +⋮---- +futuresCancelPlanOrder( + params: FuturesCancelPlanOrderRequestV2, + ): Promise> +⋮---- +getFuturesHistoricPlanOrders( + params: FuturesGetHistoryPlanOrdersRequestV2, + ): Promise< + APIResponse<{ + entrustedList: FuturesHistoryPlanOrderV2[]; + endId: string; + }> + > +⋮---- +/** + * + * + * Broker + * + * + */ +⋮---- +/** + * + * * Broker | Subaccount + * + */ +⋮---- +modifySubaccountEmail(params: { + subUid: string; + subaccountEmail: string; + }): Promise> +⋮---- +getBrokerInfo(): Promise< + APIResponse<{ + subAccountSize: string; + maxSubAccountSize: string; + uTime: string; + }> + > +⋮---- +createSubaccount(params: { + subaccountName: string; + label: string; + }): Promise> +⋮---- +getSubaccounts(params?: GetSubAccountsRequestV2): Promise< + APIResponse<{ + hasNextPage: boolean; + idLessThan: number; + subList: BrokerSubaccountV2[]; + }> + > +⋮---- +modifySubaccount( + params: ModifySubRequestV2, + ): Promise> +⋮---- +getSubaccountEmail(params: { + subUid: string; + }): Promise> +⋮---- +getSubaccountSpotAssets(params: { + subUid: string; + coin?: string; + assetType?: 'hold_only' | 'all'; + }): Promise< + APIResponse<{ + assetsList: BrokerSubaccountSpotAssetV2[]; + }> + > +⋮---- +getSubaccountFuturesAssets(params: { + subUid: string; + productType: FuturesProductTypeV2; + }): Promise< + APIResponse<{ + assetsList: BrokerSubaccountFutureAssetV2[]; + }> + > +⋮---- +createSubaccountDepositAddress(params: { + subUid: string; + coin: string; + chain?: string; + }): Promise> +⋮---- +subaccountWithdrawal(params: SubWithdrawalRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +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; + }> + > +⋮---- +/** + * + * 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; + }> + > +⋮---- +/** + * 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> +⋮---- +/** + * 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 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> +⋮---- +/** + * 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> +⋮---- +/** + * Get Rebate Info + * + * - Rate limit: 20 req/sec/UID + * - Data retention: 30 days + * - Real-time data + */ +getBrokerRebateInfo( + params: GetBrokerRebateInfoRequestV2, + ): Promise> +⋮---- +/** + * + * * Broker | Agent (affiliate) customer APIs + * + */ +⋮---- +getAgentCustomerCommissions( + params?: GetAgentCustomerCommissionsRequestV2, + ): Promise> +⋮---- +/** + * Without startTime/endTime, returns all registered sub-customers (no time restriction). + */ +getAgentSubCustomerList( + params?: GetAgentSubCustomerListRequestV2, + ): Promise> +⋮---- +getSubAffiliateInfo( + params?: GetSubAffiliateInfoRequestV2, + ): 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> +⋮---- +/** + * + * + * Margin + * + * + */ +⋮---- +/** + * + * * Margin | Common + * + */ +⋮---- +getMarginCurrencies(): Promise> +⋮---- +/** + * + * * Margin | Cross/Isolated | Order Record + * + */ +⋮---- +getMarginBorrowHistory( + marginType: MarginType, + params: GetBorrowHistoryRequestV2, + ): Promise< + APIResponse<{ + resultList: MarginBorrowHistoryItemV2[]; + maxId: string; + minId: string; + }> + > +⋮---- +getMarginRepayHistory( + marginType: MarginType, + params: GetRepayHistoryRequestV2, + ): Promise< + APIResponse<{ + resultList: MarginRepaymentHistoryItemV2[]; + maxId: string; + minId: string; + }> + > +⋮---- +getMarginInterestHistory( + marginType: MarginType, + params: GetInterestHistoryRequestV2, + ): Promise< + APIResponse<{ + resultList: MarginInterestHistoryItemV2[]; + maxId: string; + minId: string; + }> + > +⋮---- +getMarginLiquidationHistory( + marginType: MarginType, + params: GetLiquidationHistoryRequestV2, + ): Promise< + APIResponse<{ + resultList: MarginLiquidationHistoryItemV2[]; + maxId: string; + minId: string; + }> + > +⋮---- +getMarginFinancialHistory( + marginType: MarginType, + params: GetFinancialHistoryRequestV2, + ): Promise< + APIResponse<{ + resultList: MarginFinancialHistoryItemV2[]; + maxId: string; + minId: string; + }> + > +⋮---- +/** + * + * * Margin | Cross/Isolated | Account + * + */ +⋮---- +getMarginAccountAssets( + marginType: MarginType, + params?: { coin?: string }, + ): Promise> +⋮---- +marginBorrow( + marginType: MarginType, + params: { + loanId: string; + symbol: string; + coin: string; + borrowAmount: string; + }, + ): Promise< + APIResponse<{ + loanId: string; + symbol: string; + coin: string; + borrowAmount: string; + }> + > +⋮---- +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; + }> + > +⋮---- +getMarginRiskRate(marginType: MarginType): Promise< + APIResponse< + { + symbol: string; + riskRateRatio: string; + }[] + > + > +⋮---- +getMarginMaxBorrowable( + marginType: MarginType, + params: { coin: string }, + ): Promise< + APIResponse + > +⋮---- +getMarginMaxTransferable( + marginType: MarginType, + params: { coin: string }, + ): Promise< + APIResponse< + CrossMaxTransferableResponseV2 | IsolatedMaxTransferableResponseV2 + > + > +⋮---- +getMarginInterestRateAndMaxBorrowable( + marginType: MarginType, + params: { coin: string }, + ): Promise< + APIResponse< + | IsolatedInterestRateAndLimitResponseV2[] + | CrossInterestRateAndLimitResponseV2[] + > + > +⋮---- +getMarginTierConfiguration( + marginType: MarginType, + params: { coin: string }, + ): Promise< + APIResponse< + CrossTierConfigurationResponseV2[] | IsolatedTierConfigurationResponseV2[] + > + > +⋮---- +marginFlashRepay( + marginType: MarginType, + params: { coin: string }, + ): Promise< + APIResponse<{ + repayId: string; + coin?: string; + symbol?: string; + result?: string; + }> + > +⋮---- +getMarginFlashRepayResult( + marginType: MarginType, + params: { idList: string }, + ): Promise< + APIResponse< + { + repayId: string; + status: string; + }[] + > + > +⋮---- +/** + * + * * Margin | Cross/Isolated | Trade + * + */ +⋮---- +marginSubmitOrder( + marginType: MarginType, + params: MarginPlaceOrderRequestV2, + ): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +marginBatchSubmitOrders( + marginType: MarginType, + params: MarginBatchOrdersRequestV2, + ): Promise> +⋮---- +marginCancelOrder( + marginType: MarginType, + params: { + symbol: string; + orderId?: string; + clientOid?: string; + }, + ): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > +⋮---- +marginBatchCancelOrders( + marginType: MarginType, + params: { + symbol: string; + orderIdList: string[]; + }, + ): Promise> +⋮---- +getMarginOpenOrders( + marginType: MarginType, + params: GetMarginCurrentOrdersRequestV2, + ): Promise< + APIResponse<{ + orderList: MarginCurrentOrderV2[]; + maxId: string; + minId: string; + }> + > +⋮---- +getMarginHistoricOrders( + marginType: MarginType, + params: GetHistoryOrdersRequestV2, + ): Promise< + APIResponse<{ + orderList: MarginHistoryOrderV2[]; + maxId: string; + minId: string; + }> + > +⋮---- +getMarginHistoricOrderFills( + marginType: MarginType, + params: GetMarginOrderFillsRequestV2, + ): Promise< + APIResponse<{ + fills: MarginOrderFillV2[]; + minId: string; + maxId: string; + }> + > +⋮---- +getMarginLiquidationOrders( + marginType: MarginType, + params: GetMarginLiquidationOrdersRequestV2, + ): Promise< + APIResponse<{ + resultList: MarginLiquidationOrderV2[]; + idLessThan: string; + }> + > +⋮---- +/** + * + * + * Copy Trading + * + * + */ +⋮---- +/** + * + * + * Copy Trading | Future copy trading | Trader Api + * + * + */ +⋮---- +getFuturesTraderCurrentOrder( + params: GetFuturesTraderCurrentOrdersRequestV2, + ): Promise> +⋮---- +getFuturesTraderHistoryOrders( + params: GetFuturesTraderHistoryOrdersRequestV2, + ): Promise> +⋮---- +modifyFuturesTraderOrderTPSL( + params: ModifyFuturesTraderOrderTPSLRequestV2, + ): Promise> +⋮---- +getFuturesTraderOrder(): Promise< + APIResponse + > +⋮---- +getFuturesTraderProfitHistory(): Promise< + APIResponse + > +⋮---- +getFuturesTraderProfitShareHistory( + params: GetFuturesTraderProfitShareDetailRequestV2, + ): Promise> +⋮---- +closeFuturesTraderOrder(params: { + trackingNo: string; + symbol: string; + productType: CopyTradingProductTypeV2; + }): Promise< + APIResponse< + { + trackingNo: string; + symbol: string; + productType: string; + }[] + > + > +⋮---- +getFuturesTraderProfitShare(params?: { + coin?: string; + pageSize?: string; + pageNo?: string; + }): Promise< + APIResponse< + { + coin: string; + profit: string; + nickName: string; + }[] + > + > +⋮---- +getFuturesTraderProfitShareGroup(params?: { + pageSize?: string; + pageNo?: string; + }): Promise< + APIResponse< + { + coin: string; + profit: string; + profitTime: string; + }[] + > + > +⋮---- +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> +⋮---- +/** + * + * + * Copy Trading | Future copy trading | Follower Api + * + * + */ +⋮---- +getFuturesFollowerCurrentOrders( + params: GetFollowerFuturesCurrentTrackingOrdersRequestV2, + ): Promise> +⋮---- +getFuturesFollowerHistoryOrders( + params: GetFollowerFuturesHistoryTrackingOrdersRequestV2, + ): Promise> +⋮---- +updateFuturesFollowerTPSL( + params: UpdateFuturesFollowerTPSLRequestV2, + ): Promise> +⋮---- +updateFuturesFollowerSettings( + params: UpdateFuturesFollowerSettingsRequestV2, + ): Promise> +⋮---- +getFuturesFollowerSettings(params: { + traderId: string; + }): Promise> +⋮---- +closeFuturesFollowerPositions( + params: CloseFuturesFollowerPositionsRequestV2, + ): Promise< + APIResponse<{ + orderIdList: string[]; + }> + > +⋮---- +getFuturesFollowerTraders( + params: GetFuturesFollowerTradersRequestV2, + ): Promise> +⋮---- +getFuturesFollowerFollowLimit(params: { + symbol: string; + productType: CopyTradingProductTypeV2; + }): Promise< + APIResponse< + { + maxFollowSize: string; + minFollowSize: string; + symbol: string; + }[] + > + > +⋮---- +unfollowFuturesTrader(params: { + traderId: string; + }): Promise> +⋮---- +/** + * + * + * Copy Trading | Future copy trading | Broker api + * + * + */ +⋮---- +getBrokerTraders(params: object): Promise> +⋮---- +getBrokerTradersHistoricalOrders(params: object): Promise> +⋮---- +getBrokerTradersPendingOrders(params: object): Promise> +⋮---- +/** + * + * + * Copy Trading | Spot copy trading | Trader api + * + * + */ +⋮---- +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> +⋮---- +getSpotTraderFollowers( + params: GetSpotTraderFollowersRequestV2, + ): Promise> +⋮---- +/** + * + * + * Copy Trading | Spot copy trading | Follower api + * + * + */ +⋮---- +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> +⋮---- +getSpotFollowerCurrentTraderSymbols(params: { traderId: string }): Promise< + APIResponse<{ + currentTradingList: string[]; + }> + > +⋮---- +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> +⋮---- +/** + * + * + * Earn | Savings + * + * */ - 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); -}); - +⋮---- +getEarnSavingsProducts(params?: { + coin?: string; + filter?: string; + }): Promise> +⋮---- +getEarnSavingsAccount(): Promise> +⋮---- +getEarnSavingsAssets( + params: GetEarnSavingsAssetsRequestV2, + ): Promise> +⋮---- +getEarnSavingsRecords( + params: GetEarnSavingsRecordsRequestV2, + ): Promise> +⋮---- +getEarnSavingsSubscription(params: { + productId: string; + periodType: string; + }): Promise> +⋮---- +earnSubscribeSavings(params: { + productId: string; + periodType: string; + amount: string; + }): Promise< + APIResponse<{ + orderId: string; + status: string; + }> + > +⋮---- +getEarnSavingsSubscriptionResult(params: { + productId: string; + periodType: string; + }): Promise< + APIResponse<{ + result: 'success' | 'fail'; + msg: string; + }> + > +⋮---- +earnRedeemSavings(params: RedeemSavingsRequestV2): Promise< + APIResponse<{ + orderId: string; + status: string; + }> + > +⋮---- +getEarnSavingsRedemptionResult(params: { + orderId: string; + periodType: string; + }): Promise< + APIResponse<{ + result: 'success' | 'fail'; + msg: string; + }> + > +⋮---- +/** + * + * + * Earn | Earn Account + * + * + */ +⋮---- +getEarnAccount(params?: { coin?: string }): Promise< + APIResponse< + { + coin: string; + amount: string; + }[] + > + > +⋮---- +/** + * + * + * Earn | On-Chain Elite + * + * + */ +⋮---- +getEarnEliteProducts(): Promise> +⋮---- +getEarnEliteAssets(): Promise> +⋮---- +getEarnEliteRecords( + params: GetEarnEliteRecordsRequestV2, + ): Promise> +⋮---- +getEarnEliteSubscribeInfo( + params: GetEarnEliteSubscribeInfoRequestV2, + ): Promise> +⋮---- +subscribeEarnElite( + params: EarnEliteSubscribeRequestV2, + ): Promise> +⋮---- +getEarnEliteSubscribeResult( + params: GetEarnEliteSubscribeResultRequestV2, + ): Promise> +⋮---- +getEarnEliteRedeemInfo( + params: GetEarnEliteRedeemInfoRequestV2, + ): Promise> +⋮---- +redeemEarnElite( + params: RedeemEarnEliteRequestV2, + ): Promise> +⋮---- +/** + * + * + * Earn | Shark Fin + * + * + */ +⋮---- +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; + }> + > +⋮---- +getSharkfinSubscriptionResult(params: { orderId: string }): Promise< + APIResponse<{ + result: 'success' | 'fail'; + msg: string; + }> + > +⋮---- +/** + * + * + * Earn | Loan + * + * + */ +⋮---- +getLoanCurrencies(params?: { + coin?: string; + }): Promise> +⋮---- +getLoanEstInterestAndBorrowable( + params: GetLoanEstInterestAndBorrowableRequestV2, + ): Promise< + APIResponse<{ + hourInterest: string; + loanAmount: string; + }> + > +⋮---- +borrowLoan(params: BorrowLoanRequestV2): Promise< + APIResponse<{ + orderId: 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; + }> + > +⋮---- +getLoanPledgeRateHistory( + params: GetLoanPledgeRateHistoryRequestV2, + ): Promise> +⋮---- +getLoanHistory( + params: GetLoanHistoryRequestV2, + ): Promise> +⋮---- +getLoanDebts(): Promise> +⋮---- +getLoanLiquidationRecords( + params: GetLiquidationRecordsRequestV2, + ): Promise> +⋮---- +/** + * + * * Inst Loan | Product Info + * + */ +⋮---- +getLoanProductInfo( + params: GetInstLoanProductInfoRequestV2, + ): Promise> +⋮---- +getLoanSymbols( + params: GetInstLoanSymbolsRequestV2, + ): Promise> +⋮---- +getLoanMarginCoinInfo(params: GetInstLoanMarginCoinInfoRequestV2): Promise< + APIResponse<{ + productId: string; + coinInfo: InstLoanCoinInfoV2[]; + }> + > +⋮---- /** - * 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) + * + * * Inst Loan | Account + * + */ +⋮---- +getLoanRiskUnit(): Promise< + APIResponse<{ + riskUnitId: string[]; + }> + > +⋮---- +getLoanLTVConvert( + params?: GetInstLoanLTVConvertRequestV2, + ): Promise> +⋮---- +/** + * + * * Inst Loan | Orders + * + */ +⋮---- +getLoanRepaidHistory( + params?: GetInstLoanRepaidHistoryRequestV2, + ): Promise> +⋮---- +getLoanOrder( + params?: GetInstLoanOrderRequestV2, + ): Promise> ---- +================ +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 + | 'uta' + | 'spot' + | 'usdt-futures' + | 'coin-futures' + | 'usdc-futures'; +⋮---- +| 'UTA' // for account-level topics +⋮---- +/** + * + * V1 list of topics for WebSocket consumers + * + */ +⋮---- +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 + * + * Spot/futures candle and trade channels send only action=update, without a + * subscription snapshot, from 4 Nov 2026 on demo; live expected 17 Nov 2026. + * Use the corresponding REST API for historical candles and trades. + * https://www.bitget.com/docs/classic/changelog/2026-11 + */ +⋮---- +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 + * + * kline and publicTrade send only action=update, without a subscription snapshot, + * from 4 Nov 2026 on demo; live expected 17 Nov 2026. + * Use the corresponding REST API for historical candles and trades. + * https://www.bitget.com/docs/uta/update-preview + */ +export type WsPublicTopicV3 = + | 'ticker' + | 'kline' + | 'books' + | 'books1' + | 'books5' + | 'books50' + | 'publicTrade' + /** Futures public liquidations. Optional payload.symbol filters to that symbol */ + | 'liquidation' + | 'instruments' + | 'open-interest-limit' + | 'position-tier' + | 'funding-rate' + | 'margin-loan' + | 'margin-coins'; +⋮---- +/** Futures public liquidations. Optional payload.symbol filters to that symbol */ +⋮---- +// Also update PRIVATE_TOPICS_V3 if this is updated. +// `order` includes venue and rTokenTimeInForce for rToken orders. +export type WsPrivateTopicV3 = + | 'account' + | 'position' + | 'fill' + | 'order' + | 'strategy-order' + | 'reality-orderbook' + | 'reality-orderbook-segmented'; +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; -### Contributions & Thanks + /** The passphrase you set when creating the API Key (NOT your account password) */ + apiPass?: string; -Have my projects helped you? Share the love, there are many ways you can show your thanks: + /** + * 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; -- 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 + /** Define a recv window when preparing a private websocket signature. This is in milliseconds, so 5000 == 5 seconds */ + recvWindow?: number; - - + /** How often to check if the connection is alive */ + pingInterval?: number; -### Contributions & Pull Requests + /** How long to wait for a pong (heartbeat reply) before assuming the connection is dead */ + pongTimeout?: number; -Contributions are encouraged, I will review any incoming pull requests. See the issues tab for todo items. + /** Delay in milliseconds before respawning the connection */ + reconnectTimeout?: number; - + requestOptions?: RestClientOptions; -## Star History + wsOptions?: { + protocols?: string[]; + agent?: any; + } & ( + | Omit, 'agent'> + | Omit, 'agent'> + ); -[![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) + 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/types/request/v3/account.ts +File: src/types/response/v3/public.ts ================ -// Account Management Request Types +export interface PublicFillV3 { + execId: string; + execLinkId?: string; + price: string; + size: string; + side: 'sell' | 'buy'; + ts: string; + isRPI?: 'yes' | 'no' | string; +} ⋮---- -export type AccountAdjustModeV3 = 'basic' | 'advanced' | 'delta' | 'isolated'; +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 AdjustAccountModeRequestV3 { - mode: AccountAdjustModeV3; - /** Enable/disable delta-neutral mode when mode is advanced. `delta` mode is deprecated. */ - deltaSwitch?: 'yes' | 'no'; - /** Sub-account UID when the master account switches mode for a sub-account */ - targetUid?: 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 ContractOiV3 { + symbol: string; + notionalValue: string; + totalNotionalValue: string; + /** Single UID position ratio. Decimal, 0.1 means 10% */ + singlePositionRatio?: string; + /** Master and sub-account position ratio. Decimal, 0.1 means 10% */ + totalPositionRatio?: string; +} +⋮---- +/** Single UID position ratio. Decimal, 0.1 means 10% */ +⋮---- +/** Master and sub-account position ratio. Decimal, 0.1 means 10% */ +⋮---- +export interface CurrentFundingRateV3 { + symbol: string; + fundingRate: string; + fundingRateInterval: string; + nextUpdate: string; + minFundingRate: string; + maxFundingRate: string; + /** Previous settlement, decimal */ + lastFundingRate?: string; + /** Upcoming settlement, decimal */ + nextFundingRate?: string; + /** Decimal. 0.0001 means 0.01%. Docs name. Live rows still use baselnterestRate. */ + baseInterestRate?: string; + /** + * Live spelling of baseInterestRate (lowercase L, not i). + * Decimal. 0.0001 means 0.01%. + */ + baselnterestRate?: string; + /** Quote-coin notional used for the impact price */ + impactMarginNotional?: string; + cashDividend?: string; + cashDividendNextUpdate?: string; +} +⋮---- +/** Previous settlement, decimal */ +⋮---- +/** Upcoming settlement, decimal */ +⋮---- +/** Decimal. 0.0001 means 0.01%. Docs name. Live rows still use baselnterestRate. */ +⋮---- +/** + * Live spelling of baseInterestRate (lowercase L, not i). + * Decimal. 0.0001 means 0.01%. + */ +⋮---- +/** Quote-coin notional used for the impact price */ +⋮---- +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; +} +⋮---- +/** Bitget spelling */ +⋮---- +export interface MarginLoanAllV3 extends MarginLoanV3 { + coin: string; +} +⋮---- +export interface OpenInterestItemV3 { + symbol: string; + openInterest: string; +} +⋮---- +export interface OpenInterestV3 { + list: OpenInterestItemV3[]; + ts: string; +} +⋮---- +export interface OpenInterestHistoryItemV3 { + symbol: string; + openInterest: string; + oneSideOpenInterest: string; + openInterestValue: string; + oneSideOpenInterestValue: string; + timestamp: string; +} +⋮---- +export interface OpenInterestHistoryV3 { + list: OpenInterestHistoryItemV3[]; +} +⋮---- +export interface InterestRateHistoryItemV3 { + coin: string; + dailyInterestRate: string; + annualInterestRate: string; + ts: string; +} +⋮---- +export interface InterestRateHistoryV3 { + list: InterestRateHistoryItemV3[]; + cursor?: string; +} +⋮---- +export interface AnnouncementV3 { + annId: string; + annTitle: string; + language: string; + annUrl: string; + annType: string; + annSubType?: string; + /** Documented release time. The live payload uses cTime instead. */ + createdTime?: string; + /** Observed live. Unix ms. Docs call this createdTime. */ + cTime?: string; + /** Observed live. Not in the docs example. */ + annDesc?: string; +} +⋮---- +/** Documented release time. The live payload uses cTime instead. */ +⋮---- +/** Observed live. Unix ms. Docs call this createdTime. */ +⋮---- +/** Observed live. Not in the docs example. */ +⋮---- +export interface MarketCoinChainV3 { + chain: string; + needTag: string; + withdrawable: string; + rechargeable: string; + withdrawFee: string; + extraWithdrawFee: string; + depositConfirm: string; + withdrawConfirm: string; + minDepositAmount: string; + minWithdrawAmount: string; + browserUrl: string; + contractAddress: string | null; + withdrawStep: string; + /** + * Live field. The docs example names this withdrawPrecision. + */ + withdrawMinScale: string; + congestion: string; +} +⋮---- +/** + * Live field. The docs example names this withdrawPrecision. + */ +⋮---- +export interface MarketCoinV3 { + coinId?: string; + coin: string; + /** "true" / "false" */ + transfer: string; + areaCoin?: string; + chains: MarketCoinChainV3[]; } ⋮---- -/** Enable/disable delta-neutral mode when mode is advanced. `delta` mode is deprecated. */ -⋮---- -/** Sub-account UID when the master account switches mode for a sub-account */ +/** "true" / "false" */ ⋮---- -export interface SetLeverageRequestV3 { - category: 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; - /** - * Error 25159 means a low-liquidity period capped leverage at 5x. - * There is no pre-check API for that cap. - */ +export interface PositionTierV3 { + tier: string; + minTierValue: string; + maxTierValue: 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; + mmr: string; } ⋮---- -/** - * Error 25159 means a low-liquidity period capped leverage at 5x. - * There is no pre-check API for that cap. - */ +export interface RiskReserveRecordV3 { + balance: string; + amount: string; + ts: string; + type?: string; +} ⋮---- -/** Futures only. Defaults to crossed */ +export interface RiskReserveV3 { + totalBalance?: string; + coin: string; + riskReserveRecords: RiskReserveRecordV3[]; +} ⋮---- -/** Isolated two-way mode: long leverage. Takes priority over leverage when both set */ +export interface RiskReserveHourRecordV3 { + amount: string; + balance: string; + ts: string; +} ⋮---- -/** Isolated two-way mode: short leverage. Takes priority over leverage when both set */ +export interface RiskReserveHourV3 { + coin: string; + riskReserveRecords: RiskReserveHourRecordV3[]; +} ⋮---- -export interface GetAllFeeRatesRequestV3 { +export interface RiskReserveAllItemV3 { + symbols: string[]; + coin: string; + balance: string; +} +⋮---- +export interface RiskReserveAllV3 { + list: RiskReserveAllItemV3[]; +} +⋮---- +export interface InstrumentV3 { + symbol: string; category: | 'SPOT' | 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol?: string; + baseCoin: string; + quoteCoin: string; + buyLimitPriceRatio: string; + sellLimitPriceRatio: string; + feeRateUpRatio: string; + minOrderQty: string; + maxOrderQty: string; + maxMarketOrderQty: string; + /** Spot only. Max amount for a single market order. */ + maxMarketOrderAmount?: string; + pricePrecision: string; + /** + * Max decimal places for qty. + * Futures qty must stay within this and be a multiple of quantityMultiplier. + * Spot qty is not bound by quantityMultiplier. + */ + 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; + /** + * Futures only. Order qty must be a multiple of this, + * with at most quantityPrecision decimal places. + */ + quantityMultiplier?: string; + type?: 'perpetual' | 'delivery'; + symbolType?: 'crypto' | 'metal' | 'stock' | 'commodity'; + /** Display name. Returned alongside symbolType. */ + fullName?: string; + /** + * metal / energy / stock / etf / crypto. + * Independent of symbolType, which is still returned. + */ + instrumentType?: 'metal' | 'energy' | 'stock' | 'etf' | 'crypto'; + /** Set for traditional-finance pairs. Null for crypto. */ + marketRegion?: string | null; + /** ISIN for traditional-finance pairs. Null for crypto. */ + isin?: string | null; + 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; +} +⋮---- +/** Spot only. Max amount for a single market order. */ +⋮---- +/** + * Max decimal places for qty. + * Futures qty must stay within this and be a multiple of quantityMultiplier. + * Spot qty is not bound by quantityMultiplier. + */ +⋮---- +/** yes = Reality stock token, no = non-Reality stock token */ +⋮---- +// Futures specific fields +⋮---- +/** + * Futures only. Order qty must be a multiple of this, + * with at most quantityPrecision decimal places. + */ +⋮---- +/** Display name. Returned alongside symbolType. */ +⋮---- +/** + * metal / energy / stock / etf / crypto. + * Independent of symbolType, which is still returned. + */ +⋮---- +/** Set for traditional-finance pairs. Null for crypto. */ +⋮---- +/** ISIN for traditional-finance pairs. Null for crypto. */ +⋮---- +/** Launch time - Unix millisecond timestamp. Null for some margin pairs. */ +⋮---- +// Margin specific fields +⋮---- +export interface MarketFeeGroupLabelV3 { + weight: string; + label: string; + symbols: string[]; +} +⋮---- +export interface MarketFeeGroupTierV3 { + level: string; + makerFeeRate: string; + /** PRO1~PRO6 only. Taker fee rate in decimal form */ + takerFeeRate?: string; + /** Market maker RPI maker fee rate in decimal form */ + rpiMakerFeeRate?: string; +} +⋮---- +/** PRO1~PRO6 only. Taker fee rate in decimal form */ +⋮---- +/** Market maker RPI maker fee rate in decimal form */ +⋮---- +export interface MarketFeeGroupV3 { + category: string; + group: string; + labelList: MarketFeeGroupLabelV3[]; + tierList: MarketFeeGroupTierV3[]; +} +⋮---- +export interface MarketScoreWeightV3 { + category: string; + label: string; + symbol: string; + requiredSpread: string; + minMakerVolume: string; + weight: string; +} +⋮---- +export interface LiquidationV3 { + symbol: string; + side: 'buy' | 'sell'; + price: string; + amount: string; + ts: string; +} +⋮---- +export interface LiquidationsV3 { + list: LiquidationV3[]; + cursor?: string; +} +⋮---- +export interface OrderBookV3 { + a: string[][]; // asks - [price, size] + b: string[][]; // bids - [price, size] + ts: string; +} +⋮---- +a: string[][]; // asks - [price, size] +b: string[][]; // bids - [price, size] +⋮---- +export interface RealityOrderBookV3 { + symbol: string; + a: string[][]; + b: string[][]; + ts: string; +} +⋮---- +/** [price, onshoreQty, offshoreQty] */ +export type RealitySegmentedLevelV3 = [string, string, string]; +⋮---- +export interface RealityOrderBookSegmentedV3 { + symbol: string; + a: RealitySegmentedLevelV3[]; + b: RealitySegmentedLevelV3[]; + ts: string; +} +⋮---- +export interface RealityFillV3 { + execId: string; + price: string; + size: string; + side: 'buy' | 'sell'; + ts: string; } ⋮---- -export interface GetConvertRecordsRequestV3 { - fromCoin?: string; - toCoin?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: 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; + /** 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; } ⋮---- -/** - * UTA account financial-record type. - * https://www.bitget.com/docs/uta/enum - * MARIN_BUY_DEAL and MARIN_SELL_DEAL keep Bitget's spelling. - */ -export type FinancialRecordTypeV3 = - | 'TRANSFER_IN' - | 'TRANSFER_OUT' - | 'CONVERSION_UPON_DELISTING' - | 'ORDER_DEALT_FROZEN_OUT' - | 'ORDER_DEALT_IN' - | 'ORDER_PLF_FEE_OUT' - | 'EXCHANGE_SOURCE_TOKEN_USER_OUT' - | 'EXCHANGE_TARGET_TOKEN_USER_IN' - | 'OPEN_LONG' - | 'OPEN_SHORT' - | 'BUY_DEAL' - | 'SELL_DEAL' - | 'CLOSE_LONG' - | 'CLOSE_SHORT' - | 'FORCE_CLOSE_LONG' - | 'FORCE_CLOSE_SHORT' - | 'BURST_CLOSE_LONG' - | 'BURST_CLOSE_SHORT' - | 'OFFSET_REDUCE_CLOSE_LONG' - | 'OFFSET_REDUCE_CLOSE_SHORT' - | 'FORCE_BUY_SSM' - | 'FORCE_SELL_SSM' - | 'BURST_BUY_SSM' - | 'BURST_SELL_SSM' - | 'RISK_LIQ_USER_IN' - | 'INTEREST_SETTLEMENT_OUT' - | 'CONTRACT_MAIN_SETTLE_FEE_USER_IN' - | 'CONTRACT_MAIN_SETTLE_FEE_USER_OUT' - | 'RISK_LIQ_USER_OUT' - | 'BORROW' - | 'RESERVE_TRANSFER_IN' - | 'RESERVE_TRANSFER_OUT' - | 'REPAYMENT' - | 'INTEREST_REPAYMENT' - | 'LIQ_FUND_OUT' - | 'LIQ_CONVERT_USER_OUT' - | 'LIQ_CONVERT_SYS_IN' - | 'LIQ_CONVERT_SYS_OUT' - | 'LIQ_CONVERT_USER_IN' - | 'LIQ_TRANSFER_IN' - | 'LIQ_TRANSFER_OUT' - | 'LIQ_FUND_IN' - | 'LIQ_FEE' - | 'LIQ_REPAYMENT' - | 'DELIST_MARGIN_TOKEN_SOURCE_USER_OUT' - | 'DELIST_MARGIN_TOKEN_SOURCE_SYS_IN' - | 'DELIST_MARGIN_TOKEN_TARGET_SYS_OUT' - | 'DELIST_MARGIN_TOKEN_TARGET_USER_IN' - | 'CONFISCATE_TOKEN_USER_OUT' - | 'CONFISCATE_TOKEN_SYS_IN' - | 'DELIST_SMALL_BALANCE_USER_OUT' - | 'DELIST_SMALL_BALANCE_SYS_IN' - | 'DELIST_SMALL_LIABILITY_SYS_OUT' - | 'DELIST_SMALL_LIABILITY_USER_IN' - | 'SMALL_ASSET_SOURCE_TOKEN_USER_OUT' - | 'SMALL_ASSET_SOURCE_TOKEN_SYS_IN' - | 'SMALL_ASSET_TARGET_TOKEN_SYS_OUT' - | 'SMALL_ASSET_TARGET_TOKEN_USER_IN' - | 'SMALL_ASSET_FEE_SYS_IN' - | 'TRACE_SHARE_BENEFIT_USER_OUT' - | 'TRACE_SHARE_BENEFIT_SYSTEM_IN' - | 'TRACE_SHARE_BENEFIT_SYSTEM_OUT' - | 'TRACE_SHARE_BENEFIT_USER_IN' - | 'MARGIN_OPEN_LONG' - | 'MARGIN_OPEN_SHORT' - | 'MARIN_BUY_DEAL' - | 'MARIN_SELL_DEAL' - | 'MARGIN_BACK' - | 'INCREASE_MARGIN' - | 'REDUCE_MARGIN' - | 'MARGIN_SETTLE_FEE_USER_IN' - | 'MARGIN_SETTLE_FEE_USER_OUT' - | 'MARGIN_LEVER_ORDER_REFROZEN' - | 'MARGIN_LEVER_ORDER_FROZEN' - | 'MARGIN_LEVER_POS_IN' - | 'MARGIN_OFFSET_IN_SSM_LONG' - | 'MARGIN_OFFSET_IN_SSM_SHORT' - | 'FIXED_OFFSET_IN_SSM_LONG' - | 'FIXED_OFFSET_IN_SSM_SHORT' - | 'FIXED_CLOSE_LONG' - | 'FIXED_CLOSE_SHORT' - | 'FIXED_FORCE_CLOSE_LONG' - | 'FIXED_FORCE_CLOSE_SHORT' - | 'FIXED_BURST_CLOSE_LONG' - | 'FIXED_BURST_CLOSE_SHORT' - | 'FIXED_ADL_CLOSE_LONG' - | 'FIXED_ADL_CLOSE_SHORT' - | 'FIXED_RISK_LIQ_USER_IN' - | 'FIXED_RISK_LIQ_USER_OUT' - | 'FIXED_FORCE_BUY_SSM' - | 'FIXED_FORCE_SELL_SSM' - | 'FIXED_BURST_BUY_SSM' - | 'FIXED_BURST_SELL_SSM' - | 'ON_CHAIN_TRANSFER_REFUND' - | 'ON_CHAIN_TRANSFER_OUT' - | 'MT5_TRANSFER_IN' - | 'MT5_REFUND_IN' - | 'MT5_TRANSFER_OUT' - | 'TRACE_LOCK_USER_OUT' - | 'TRACE_LOCK_USER_IN' - | 'TRACE_TRANSFER_USER_OUT' - | 'TRACE_TRANSFER_USER_IN' - | 'TRACE_TRANSFER_REFUND_IN' - | 'FINANCIAL_TRANSFER_OUT' - | 'FINANCIAL_TRANSFER_IN' - | 'CONVERT_TRANSFER_IN' - | 'CONVERT_TRANSFER_OUT' - | 'BGPAY_TRANSFER_OUT' - | 'BGPAY_REFUND_IN' - | 'RWA_FIXED_SETTLE_FEE_USER_IN' - | 'RWA_FIXED_SETTLE_FEE_USER_OUT' - | 'RWA_CONTRACT_MAIN_SETTLE_FEE_SYSTEM_IN' - | 'RWA_CONTRACT_MAIN_SETTLE_FEE_SYSTEM_OUT' - | 'RWA_CONTRACT_MAIN_SETTLE_FEE_SYSTEM_KEEP_IN' - | 'RWA_CONTRACT_MAIN_SETTLE_FEE_SYSTEM_KEEP_OUT' - | 'RWA_CONTRACT_MAIN_SETTLE_FEE_USER_IN' - | 'RWA_CONTRACT_MAIN_SETTLE_FEE_USER_OUT' - | 'RWA_CONTRACT_REBASE_USER_OPEN_LONG' - | 'RWA_CONTRACT_REBASE_USER_OPEN_SHORT' - | 'RWA_CONTRACT_REBASE_USER_CLOSE_LONG' - | 'RWA_CONTRACT_REBASE_USER_CLOSE_SHORT' - | 'RWA_CONTRACT_REBASE_USER_BUY_IN_SSM' - | 'RWA_CONTRACT_REBASE_USER_SELL_IN_SSM' - | 'RISK_LIQ_DEFAULT_USER_IN' - | 'FIXED_RISK_LIQ_DEFAULT_USER_IN' - | 'BONUS_GRANT_USER_IN' - | 'BONUS_EXPIRE_USER_OUT' - | 'BONUS_TRANSFER_USER_OUT' - | 'WITHDRAW_TRANSFER_OUT' - | 'WITHDRAW_TRANSFER_IN' - | 'DELIVERY_LONG' - | 'DELIVERY_SHORT' - | 'FIXED_DELIVERY_LONG' - | 'FIXED_DELIVERY_SHORT' - | 'REBASE_COIN_SPLIT_OUT' - | 'REBASE_COIN_SPLIT_IN' - | 'REBASE_COIN_MERGE_OUT' - | 'REBASE_COIN_MERGE_IN'; +/** 24h platform turnover; only available for rtoken */ ⋮---- -export interface GetFinancialRecordsRequestV3 { - category: - | 'SPOT' - | 'MARGIN' - | 'USDT-FUTURES' - | 'COIN-FUTURES' - | 'USDC-FUTURES'; - coin?: string; - type?: FinancialRecordTypeV3; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +// Futures specific fields +⋮---- +export interface ProofOfReservesV3 { + merkleRootHash: string; + totalReserveRatio: string; + list: { + coin: string; + userAssets: string; + platformAssets: string; + reserveRatio: string; + }[]; } ⋮---- -export interface RepayRequestV3 { - repayableCoinList: string[]; - paymentCoinList: string[]; +export interface IndexComponentV3 { + exchange: string; + spotPair: string; + equivalentPrice: string; + weight: string; } ⋮---- -// Sub-account Management Request Types +export interface IndexPriceComponentsV3 { + symbol: string; + componentList: IndexComponentV3[]; +} ⋮---- -export interface CreateSubAccountApiKeyRequestV3 { - subUid: string; - note: string; - type: 'read_write' | 'read_only'; - passphrase: string; - permissions: string[]; - ips: string[]; +export interface RpiSymbolV3 { + category: 'spot' | 'usdt-futures' | 'coin-futures' | 'usdc-futures'; + symbol: string; } ⋮---- -export interface DeleteSubAccountApiKeyRequestV3 { - apiKey: string; +/** RPI order book depth: [price, nonRpiQty, rpiQty] */ +export interface RpiOrderBookV3 { + a: [string, string, string][]; + b: [string, string, string][]; + ts: string; } ⋮---- -export interface GetSubAccountApiKeysRequestV3 { - subUid: string; - limit?: string; - cursor?: string; +export interface CashDividendRecordV3 { + symbol: string; + exDividendDate: string; + cashDividendPerShare: string; + cashDividendTimestamp: string; } ⋮---- -export interface UpdateSubAccountApiKeyRequestV3 { - apiKey: string; - passphrase: string; - type?: 'read_write' | 'read_only'; - permissions?: string[]; - ips?: string[]; +export interface SplitRecordV3 { + symbol: string; + type: 'split' | 'reverse_split' | string; + status: 'pending' | 'ongoing' | 'completed' | string; + adjustmentRatio: string; + exDividendDate: string; + exDividendDateTimezone: string; + tradingHaltStartTime: string; + tradingHaltEndTime: string; } ⋮---- -export interface CreateSubAccountRequestV3 { - username: string; - accountMode?: 'classic' | 'unified'; - note?: string; +export interface SpotWhaleFlowV3 { + volume: string; + date: string; } ⋮---- -export interface FreezeSubAccountRequestV3 { - subUid: string; - operation: 'freeze' | 'unfreeze'; +export interface SpotNetFlowV3 { + netFlow: string; + ts: string; } ⋮---- -export interface GetSubAccountListRequestV3 { - limit?: string; - cursor?: 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; } ⋮---- -// 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'; +export interface MarginLongShortV3 { + longShortRatio: string; + ts: string; } ⋮---- -/** Enable automatic margin borrowing when balance insufficient. yes | no */ +export interface MarginLoanGrowthV3 { + growthRate: string; + ts: string; +} ⋮---- -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 MarginIsolatedBorrowV3 { + borrowRate: string; + ts: string; } ⋮---- -export interface GetSubTransferRecordsRequestV3 { - subUid?: string; - role?: 'initiator' | 'receiver'; - coin?: string; - startTime?: string; - endTime?: string; - clientOid?: string; - limit?: string; - cursor?: string; +export interface FuturesActiveBuySellV3 { + buyVolume: string; + sellVolume: string; + ts: 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'; +export interface FuturesLongShortV3 { + longRatio: string; + shortRatio: string; + longShortRatio: string; + ts: string; } ⋮---- -/** Enable automatic margin borrowing when balance insufficient. yes | no */ +export interface FuturesPositionLongShortV3 { + longPositionRatio: string; + shortPositionRatio: string; + longShortPositionRatio: string; + ts: string; +} ⋮---- -export interface GetSubUnifiedAssetsRequestV3 { - subUid?: string; - cursor?: string; - limit?: 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) +[![Bitget Tutorial](https://img.shields.io/badge/Bitget%20Tutorial-siebly.io-blue)](https://siebly.io/sdk/bitget/javascript/tutorial) + +

+ + + + 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 +- Bitget JavaScript Tutorial: https://siebly.io/sdk/bitget/javascript/tutorial + +## 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/sieblyio/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); + } } -⋮---- -export interface GetFeeRateRequestV3 { + +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/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/types/request/v3/trade.ts +================ +export interface BatchModifyOrderRequestV3 { + orderId?: string; + clientOid?: string; + qty?: string; + price?: string; + /** Custom request ID. Numbers within 18 digits. */ + requestId?: number; + autoCancel?: 'yes' | 'no'; + /** Required since 30 Sep 2026 */ + symbol: string; + /** Required since 30 Sep 2026 */ category: | 'SPOT' | 'MARGIN' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - /** RPI fee rate flag for market maker users. Default: no */ - rpiFlag?: 'yes' | 'no'; -} -⋮---- -/** RPI fee rate flag for market maker users. Default: no */ -⋮---- -export interface GetFundingAssetsRequestV3 { - coin?: string; -} -⋮---- -export interface SwitchDeductRequestV3 { - deduct: 'on' | 'off'; -} -⋮---- -// Deposit Request Types -⋮---- -export interface GetDepositAddressRequestV3 { - coin: string; - chain?: string; - size?: string; + /** Limit orders only. no rejects a price outside the band (default). yes clamps it */ + pxAmendType?: 'yes' | 'no'; } ⋮---- -export interface GetSubDepositAddressRequestV3 { - subUid: string; - coin: string; - chain?: string; - size?: string; -} +/** Custom request ID. Numbers within 18 digits. */ ⋮---- -export interface GetDepositRecordsRequestV3 { - coin?: string; - orderId?: string; - startTime: string; - endTime: string; - limit?: string; - cursor?: string; -} +/** Required since 30 Sep 2026 */ ⋮---- -export interface GetSubDepositRecordsRequestV3 { - coin?: string; - subUid: string; - startTime: string; - endTime: string; - limit?: string; - cursor?: string; -} +/** Required since 30 Sep 2026 */ ⋮---- -// Withdraw Request Types +/** Limit orders only. no rejects a price outside the band (default). yes clamps it */ ⋮---- -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; +export interface CancelAllOrdersRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; } ⋮---- -/** Deduct from funding, uta, and/or otc accounts (comma-separated). Order: funding -> otc -> uta */ -⋮---- -export interface GetWithdrawRecordsRequestV3 { - coin?: string; +export interface CancelBatchOrdersRequestV3 { orderId?: string; clientOid?: string; - startTime: string; - endTime: string; - limit?: string; - cursor?: string; + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol: string; } ⋮---- -export interface GetWithdrawAddressBookRequestV3 { - coin?: string; - type?: 'EVM' | 'regular' | 'universal' | 'internal'; - limit?: string; - cursor?: string; +export interface CloseAllPositionsRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + posSide?: 'long' | 'short'; } ⋮---- -export interface CancelWithdrawalRequestV3 { +export interface CancelOrderRequestV3 { 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: + category?: | '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; - /** Enable Cash+ as collateral. Official field name is allowCashPlus */ - allowCashPlus?: 'yes' | 'no'; -} -⋮---- -/** Required when collateralType=custom. Comma-separated coin names */ -⋮---- -/** Enable Cash+ as collateral. Official field name is allowCashPlus */ -⋮---- -export interface BorrowRequestV3 { - coin: string; - amount: string; - clientOid?: string; -} -⋮---- -export interface GetMaxBorrowableRequestV3 { - coin: string; -} -⋮---- -export interface SetRepayModeRequestV3 { - /** Account-level. Master and each sub-account keep their own setting */ - repayMode: 'auto' | 'manual'; -} -⋮---- -/** Account-level. Master and each sub-account keep their own setting */ -⋮---- -export interface DeleteSubAccountRequestV3 { - subUid: 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 SetMarginRequestV3 { - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - symbol: string; - posSide: 'long' | 'short'; - operation: 'add' | 'remove'; - amount: string; -} -⋮---- -export interface GetMaxWithdrawalRequestV3 { - coin: string; + | 'USDC-FUTURES'; } ⋮---- -export interface GetRealityOrderBookRequestV3 { - symbol: string; -} +export type FuturesMarginModeV3 = 'crossed' | 'isolated'; ⋮---- -export interface GetRealityOrderBookSegmentedRequestV3 { +export interface GetMaxOpenAvailableRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; symbol: string; + orderType: 'limit' | 'market'; + side: 'buy' | 'sell'; + price?: string; + size?: string; + /** Spot only. Default: no */ + autoBorrow?: 'yes' | 'no'; + /** + * crossed (default) or isolated. + * Under isolated margin, available excludes futures trial funds. + */ + marginMode?: FuturesMarginModeV3; } ⋮---- -export interface GetRealityFillsRequestV3 { - symbol: string; - limit?: string; -} +/** Spot only. Default: no */ ⋮---- -export interface SubMasterTransferRequestV3 { - fromType: 'spot' | 'uta'; - toType: 'spot' | 'p2p' | 'uta'; - amount: string; - coin: string; +/** + * crossed (default) or isolated. + * Under isolated margin, available excludes futures trial funds. + */ +⋮---- +export interface GetOrderInfoRequestV3 { + orderId?: string; clientOid?: string; } ⋮---- -export interface CreateAgentSubAccountRequestV3 { - username: string; - passphrase: string; - note?: string; +export interface GetFillsRequestV3 { + category?: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + orderId?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface MovePositionItemRequestV3 { - symbol: string; - side: 'buy' | 'sell'; - qty: 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 MovePositionsRequestV3 { - fromUid: string; - toUid: string; - category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; - positionList: MovePositionItemRequestV3[]; +export interface GetHistoryOrdersRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface GetMovePositionHistoryRequestV3 { +export interface GetPositionHistoryRequestV3 { category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; symbol?: string; startTime?: string; endTime?: string; - cursor?: string; limit?: string; + cursor?: string; } ⋮---- -export interface GetEligibleSymbolsRequestV3 { +export interface GetCurrentPositionRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; symbol?: string; + posSide?: 'long' | 'short'; } ⋮---- -export interface GetEligibleMarginTierRequestV3 { - coin?: string; +export interface ModifyOrderRequestV3 { + orderId?: string; + clientOid?: string; + qty?: string; + price?: string; + /** Custom request ID. Numbers within 18 digits. */ + requestId?: number; + autoCancel?: 'yes' | 'no'; + /** Required since 30 Sep 2026 */ + symbol: string; + /** Required since 30 Sep 2026 */ + 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; + /** Limit orders only. no rejects a price outside the band (default). yes clamps it */ + pxAmendType?: 'yes' | 'no'; } ⋮---- -export interface GetEligibleLoanInfoRequestV3 { - coin?: string; -} +/** Custom request ID. Numbers within 18 digits. */ ⋮---- -export interface GetEligibleDiscountRateRequestV3 { - coin?: string; -} +/** Required since 30 Sep 2026 */ ⋮---- -export interface GetFundingFinancialRecordsRequestV3 { - coin?: string; - type?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +/** Required since 30 Sep 2026 */ +⋮---- +/** Limit orders only. no rejects a price outside the band (default). yes clamps it */ +⋮---- +export interface PlaceRealityOrderRequestV3 { + category?: 'SPOT' | 'MARGIN'; + symbol: string; + side: 'buy' | 'sell'; + orderType: 'limit' | 'market'; + qty: string; + price?: string; + clientOid?: string; + /** + * rToken routing. Accepted: internal_market | lit_market. Omit for default. + * internal_market = on-exchange only (not submitted to the U.S. stock broker). + * lit_market = broker only (not matched on-exchange). + * Omit / default = internal first at best price, then unfilled to broker. + * Live since 5 Nov 2026 (internalization renamed; old lit_market meaning is now default). + */ + venue?: 'internal_market' | 'lit_market'; + /** + * rToken time in force. gtd (default) = current session. + * gtc = 90 days. Same changelog note as venue. + */ + rTokenTimeInForce?: 'gtd' | 'gtc'; } ⋮---- -export interface GetSmallAssetsRequestV3 { - coin?: string; +/** + * rToken routing. Accepted: internal_market | lit_market. Omit for default. + * internal_market = on-exchange only (not submitted to the U.S. stock broker). + * lit_market = broker only (not matched on-exchange). + * Omit / default = internal first at best price, then unfilled to broker. + * Live since 5 Nov 2026 (internalization renamed; old lit_market meaning is now default). + */ +⋮---- +/** + * rToken time in force. gtd (default) = current session. + * gtc = 90 days. Same changelog note as venue. + */ +⋮---- +export interface CancelRealityOrderRequestV3 { + category?: 'SPOT' | 'MARGIN'; + symbol: string; + orderId?: string; + clientOid?: string; } ⋮---- -export interface TradeSmallAssetsRequestV3 { - fromCoinList: string[]; - toCoin?: 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'; + /** Limit orders only. no rejects a price outside the band (default). yes clamps it */ + pxAmendType?: 'yes' | 'no'; + /** + * Unix ms. Used with receiveWindow. + * If omitted, receiveWindow has no effect. + * An order that reaches the matching engine after requestTime + receiveWindow is canceled. + */ + requestTime?: string; + /** Validity window in ms. Range [10, 60000]. Requires requestTime. */ + receiveWindow?: string; } ⋮---- -export interface GetSmallAssetsHistoryRequestV3 { - orderId?: string; - startTime?: string; - endTime?: string; - limit?: string; - cursor?: string; +/** Limit orders only. no rejects a price outside the band (default). yes clamps it */ +⋮---- +/** + * Unix ms. Used with receiveWindow. + * If omitted, receiveWindow has no effect. + * An order that reaches the matching engine after requestTime + receiveWindow is canceled. + */ +⋮---- +/** Validity window in ms. Range [10, 60000]. Requires requestTime. */ +⋮---- +export interface PlaceOrderRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol: string; + /** + * Futures qty must be a multiple of quantityMultiplier + * and have at most quantityPrecision decimal places. + * Both come from /api/v3/market/instruments. Futures only. + */ + qty: string; + price?: string; + side: 'buy' | 'sell'; + /** + * Market orders always run as IOC. + * Staff-confirmed: t.me/bitgetOpenapi/153169. + * timeInForce does not change that. + */ + orderType: 'limit' | 'market'; + timeInForce?: 'ioc' | 'fok' | 'gtc' | 'post_only' | 'rpi'; + 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; + /** Spot only. Default: no */ + autoBorrow?: 'yes' | 'no'; + /** Limit orders only. no rejects a price outside the band (default). yes clamps it */ + pxAmendType?: 'yes' | 'no'; + /** Limit orders only. queue1, queue5, counterparty1, or counterparty5 */ + bboLevel?: 'queue1' | 'queue5' | 'counterparty1' | 'counterparty5'; + /** Market orders only. Decimal, default 0.02, range 0.01-0.05 */ + slippageTolerance?: string; + /** + * rToken routing. Accepted: internal_market | lit_market. Omit for default. + * internal_market = on-exchange only (not submitted to the U.S. stock broker). + * lit_market = broker only (not matched on-exchange). + * Omit / default = internal first at best price, then unfilled to broker. + * Ignored for non-rToken symbols. timeInForce is also ignored for rToken. + * Live since 5 Nov 2026 (internalization renamed; old lit_market meaning is now default). + */ + venue?: 'internal_market' | 'lit_market'; + /** + * rToken time in force. gtd (default) lasts the current session. + * gtc lasts 90 days. Ignored for non-rToken symbols. + */ + rTokenTimeInForce?: 'gtd' | 'gtc'; + /** + * Unix ms. Used with receiveWindow. + * If omitted, receiveWindow has no effect. + * An order that reaches the matching engine after requestTime + receiveWindow is canceled. + */ + requestTime?: string; + /** Validity window in ms. Range [10, 60000]. Requires requestTime. */ + receiveWindow?: string; } ⋮---- -export interface GetRateLimitQuotaRequestV3 { - category: 'spot' | 'futures'; - /** - * Omit to list sub-accounts under the master. - * Ignored when a sub-account calls this for itself. +/** + * Futures qty must be a multiple of quantityMultiplier + * and have at most quantityPrecision decimal places. + * Both come from /api/v3/market/instruments. Futures only. */ - uid?: string; - cursor?: string; - limit?: string; -} ⋮---- /** - * Omit to list sub-accounts under the master. - * Ignored when a sub-account calls this for itself. + * Market orders always run as IOC. + * Staff-confirmed: t.me/bitgetOpenapi/153169. + * timeInForce does not change that. */ ⋮---- -export interface SetRateLimitQuotaRequestV3 { - category: 'spot' | 'futures'; - /** - * Required when the master account sets quotas. - * Not required, and ignored, when a sub-account sets its own quota. +/** Futures only. Defaults to crossed */ +⋮---- +/** Spot only. Default: no */ +⋮---- +/** Limit orders only. no rejects a price outside the band (default). yes clamps it */ +⋮---- +/** Limit orders only. queue1, queue5, counterparty1, or counterparty5 */ +⋮---- +/** Market orders only. Decimal, default 0.02, range 0.01-0.05 */ +⋮---- +/** + * rToken routing. Accepted: internal_market | lit_market. Omit for default. + * internal_market = on-exchange only (not submitted to the U.S. stock broker). + * lit_market = broker only (not matched on-exchange). + * Omit / default = internal first at best price, then unfilled to broker. + * Ignored for non-rToken symbols. timeInForce is also ignored for rToken. + * Live since 5 Nov 2026 (internalization renamed; old lit_market meaning is now default). */ - uids?: string[]; - quota: string; -} ⋮---- /** - * Required when the master account sets quotas. - * Not required, and ignored, when a sub-account sets its own quota. + * rToken time in force. gtd (default) lasts the current session. + * gtc lasts 90 days. Ignored for non-rToken symbols. */ ⋮---- -export interface CreateStpGroupRequestV3 { - /** Max 32 characters. Must be unique. */ - groupName: string; -} +/** + * Unix ms. Used with receiveWindow. + * If omitted, receiveWindow has no effect. + * An order that reaches the matching engine after requestTime + receiveWindow is canceled. + */ ⋮---- -/** Max 32 characters. Must be unique. */ +/** Validity window in ms. Range [10, 60000]. Requires requestTime. */ ⋮---- -export interface StpGroupMembersRequestV3 { - /** Comma-separated sub-account UIDs. Max 50. */ - uids: string; - groupId: string; +export interface CountdownCancelAllRequestV3 { + countdown: string; // seconds until auto-cancel (5-60, or 0 to disable) } ⋮---- -/** Comma-separated sub-account UIDs. Max 50. */ +countdown: string; // seconds until auto-cancel (5-60, or 0 to disable) ================ File: src/types/response/v3/account.ts @@ -18789,604 +19301,775 @@ export interface StpGroupMembersResponseV3 { } ================ -File: src/types/response/v3/public.ts +File: src/types/websockets/ws-api-request.ts ================ -export interface PublicFillV3 { - execId: string; - execLinkId?: string; - price: string; - size: string; - side: 'sell' | 'buy'; - ts: string; - isRPI?: 'yes' | 'no' | 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 +import type { FuturesMarginModeV3 } from '../request/v3/trade.js'; ⋮---- -export interface ContractOiV3 { +export interface WSAPIPlaceOrderRequestV3 { symbol: string; - notionalValue: string; - totalNotionalValue: string; - /** Single UID position ratio. Decimal, 0.1 means 10% */ - singlePositionRatio?: string; - /** Master and sub-account position ratio. Decimal, 0.1 means 10% */ - totalPositionRatio?: string; + orderType: 'limit' | 'market'; + qty: string; + price?: string; + side: 'buy' | 'sell'; + posSide?: 'long' | 'short'; + timeInForce?: 'gtc' | 'ioc' | 'fok' | 'post_only' | 'rpi'; + 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; + /** Spot only. Default: no */ + autoBorrow?: 'yes' | 'no'; + /** Limit orders only. no rejects a price outside the band (default). yes clamps it */ + pxAmendType?: 'yes' | 'no'; + /** Limit orders only. queue1, queue5, counterparty1, or counterparty5. Ignored for market orders */ + bboLevel?: 'queue1' | 'queue5' | 'counterparty1' | 'counterparty5'; + /** Market orders only. Decimal, default 0.02, range 0.01-0.05 */ + slippageTolerance?: string; + /** + * rToken routing. Accepted: internal_market | lit_market. Omit for default. + * internal_market = on-exchange only; lit_market = broker only. + * Omit / default = internal first, then broker. Ignored for non-rToken symbols. + * Live since 5 Nov 2026. + */ + venue?: 'internal_market' | 'lit_market'; + /** rToken time in force. gtd (default) or gtc (90 days). */ + rTokenTimeInForce?: 'gtd' | 'gtc'; } ⋮---- -/** Single UID position ratio. Decimal, 0.1 means 10% */ +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 */ ⋮---- -/** Master and sub-account position ratio. Decimal, 0.1 means 10% */ +/** Order TTL in ms [10, 60000]. Only effective when requestTime is also set on the envelope */ ⋮---- -export interface CurrentFundingRateV3 { - symbol: string; - fundingRate: string; - fundingRateInterval: string; - nextUpdate: string; - minFundingRate: string; - maxFundingRate: string; - /** Previous settlement, decimal */ - lastFundingRate?: string; - /** Upcoming settlement, decimal */ - nextFundingRate?: string; - /** Decimal. 0.0001 means 0.01%. Docs name. Live rows still use baselnterestRate. */ - baseInterestRate?: string; - /** - * Live spelling of baseInterestRate (lowercase L, not i). - * Decimal. 0.0001 means 0.01%. - */ - baselnterestRate?: string; - /** Quote-coin notional used for the impact price */ - impactMarginNotional?: string; - cashDividend?: string; - cashDividendNextUpdate?: string; -} +/** Spot only. Default: no */ ⋮---- -/** Previous settlement, decimal */ +/** Limit orders only. no rejects a price outside the band (default). yes clamps it */ ⋮---- -/** Upcoming settlement, decimal */ +/** Limit orders only. queue1, queue5, counterparty1, or counterparty5. Ignored for market orders */ ⋮---- -/** Decimal. 0.0001 means 0.01%. Docs name. Live rows still use baselnterestRate. */ +/** Market orders only. Decimal, default 0.02, range 0.01-0.05 */ ⋮---- /** - * Live spelling of baseInterestRate (lowercase L, not i). - * Decimal. 0.0001 means 0.01%. + * rToken routing. Accepted: internal_market | lit_market. Omit for default. + * internal_market = on-exchange only; lit_market = broker only. + * Omit / default = internal first, then broker. Ignored for non-rToken symbols. + * Live since 5 Nov 2026. */ ⋮---- -/** Quote-coin notional used for the impact price */ +/** rToken time in force. gtd (default) or gtc (90 days). */ + +================ +File: src/types/request/v3/account.ts +================ +// Account Management Request Types ⋮---- -export interface DiscountRateTierV3 { - tierStartValue: string; - discountRate: string; -} +export type AccountAdjustModeV3 = 'basic' | 'advanced' | 'delta' | 'isolated'; ⋮---- -export interface DiscountRateV3 { - coin: string; - list: DiscountRateTierV3[]; +export interface AdjustAccountModeRequestV3 { + mode: AccountAdjustModeV3; + /** Enable/disable delta-neutral mode when mode is advanced. `delta` mode is deprecated. */ + deltaSwitch?: 'yes' | 'no'; + /** Sub-account UID when the master account switches mode for a sub-account */ + targetUid?: string; } ⋮---- -export interface HistoryFundingRateV3 { - symbol: string; - fundingRate: string; - fundingRateTimestamp: string; -} +/** Enable/disable delta-neutral mode when mode is advanced. `delta` mode is deprecated. */ ⋮---- -export interface MarginLoanV3 { - dailyInterest: string; - annualInterest: string; - limit: string; - masterSubLimit?: string; - /** Bitget spelling */ - platformRemaingQuota?: 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; + /** + * Error 25159 means a low-liquidity period capped leverage at 5x. + * There is no pre-check API for that cap. + */ + 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; } ⋮---- -/** Bitget spelling */ +/** + * Error 25159 means a low-liquidity period capped leverage at 5x. + * There is no pre-check API for that cap. + */ ⋮---- -export interface MarginLoanAllV3 extends MarginLoanV3 { - coin: string; -} +/** Futures only. Defaults to crossed */ ⋮---- -export interface OpenInterestItemV3 { - symbol: string; - openInterest: string; -} +/** Isolated two-way mode: long leverage. Takes priority over leverage when both set */ ⋮---- -export interface OpenInterestV3 { - list: OpenInterestItemV3[]; - ts: string; -} +/** Isolated two-way mode: short leverage. Takes priority over leverage when both set */ ⋮---- -export interface OpenInterestHistoryItemV3 { - symbol: string; - openInterest: string; - oneSideOpenInterest: string; - openInterestValue: string; - oneSideOpenInterestValue: string; - timestamp: string; +export interface GetAllFeeRatesRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + symbol?: string; } ⋮---- -export interface OpenInterestHistoryV3 { - list: OpenInterestHistoryItemV3[]; +export interface GetConvertRecordsRequestV3 { + fromCoin?: string; + toCoin?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface InterestRateHistoryItemV3 { - coin: string; - dailyInterestRate: string; - annualInterestRate: string; - ts: string; -} +/** + * UTA account financial-record type. + * https://www.bitget.com/docs/uta/enum + * MARIN_BUY_DEAL and MARIN_SELL_DEAL keep Bitget's spelling. + */ +export type FinancialRecordTypeV3 = + | 'TRANSFER_IN' + | 'TRANSFER_OUT' + | 'CONVERSION_UPON_DELISTING' + | 'ORDER_DEALT_FROZEN_OUT' + | 'ORDER_DEALT_IN' + | 'ORDER_PLF_FEE_OUT' + | 'EXCHANGE_SOURCE_TOKEN_USER_OUT' + | 'EXCHANGE_TARGET_TOKEN_USER_IN' + | 'OPEN_LONG' + | 'OPEN_SHORT' + | 'BUY_DEAL' + | 'SELL_DEAL' + | 'CLOSE_LONG' + | 'CLOSE_SHORT' + | 'FORCE_CLOSE_LONG' + | 'FORCE_CLOSE_SHORT' + | 'BURST_CLOSE_LONG' + | 'BURST_CLOSE_SHORT' + | 'OFFSET_REDUCE_CLOSE_LONG' + | 'OFFSET_REDUCE_CLOSE_SHORT' + | 'FORCE_BUY_SSM' + | 'FORCE_SELL_SSM' + | 'BURST_BUY_SSM' + | 'BURST_SELL_SSM' + | 'RISK_LIQ_USER_IN' + | 'INTEREST_SETTLEMENT_OUT' + | 'CONTRACT_MAIN_SETTLE_FEE_USER_IN' + | 'CONTRACT_MAIN_SETTLE_FEE_USER_OUT' + | 'RISK_LIQ_USER_OUT' + | 'BORROW' + | 'RESERVE_TRANSFER_IN' + | 'RESERVE_TRANSFER_OUT' + | 'REPAYMENT' + | 'INTEREST_REPAYMENT' + | 'LIQ_FUND_OUT' + | 'LIQ_CONVERT_USER_OUT' + | 'LIQ_CONVERT_SYS_IN' + | 'LIQ_CONVERT_SYS_OUT' + | 'LIQ_CONVERT_USER_IN' + | 'LIQ_TRANSFER_IN' + | 'LIQ_TRANSFER_OUT' + | 'LIQ_FUND_IN' + | 'LIQ_FEE' + | 'LIQ_REPAYMENT' + | 'DELIST_MARGIN_TOKEN_SOURCE_USER_OUT' + | 'DELIST_MARGIN_TOKEN_SOURCE_SYS_IN' + | 'DELIST_MARGIN_TOKEN_TARGET_SYS_OUT' + | 'DELIST_MARGIN_TOKEN_TARGET_USER_IN' + | 'CONFISCATE_TOKEN_USER_OUT' + | 'CONFISCATE_TOKEN_SYS_IN' + | 'DELIST_SMALL_BALANCE_USER_OUT' + | 'DELIST_SMALL_BALANCE_SYS_IN' + | 'DELIST_SMALL_LIABILITY_SYS_OUT' + | 'DELIST_SMALL_LIABILITY_USER_IN' + | 'SMALL_ASSET_SOURCE_TOKEN_USER_OUT' + | 'SMALL_ASSET_SOURCE_TOKEN_SYS_IN' + | 'SMALL_ASSET_TARGET_TOKEN_SYS_OUT' + | 'SMALL_ASSET_TARGET_TOKEN_USER_IN' + | 'SMALL_ASSET_FEE_SYS_IN' + | 'TRACE_SHARE_BENEFIT_USER_OUT' + | 'TRACE_SHARE_BENEFIT_SYSTEM_IN' + | 'TRACE_SHARE_BENEFIT_SYSTEM_OUT' + | 'TRACE_SHARE_BENEFIT_USER_IN' + | 'MARGIN_OPEN_LONG' + | 'MARGIN_OPEN_SHORT' + | 'MARIN_BUY_DEAL' + | 'MARIN_SELL_DEAL' + | 'MARGIN_BACK' + | 'INCREASE_MARGIN' + | 'REDUCE_MARGIN' + | 'MARGIN_SETTLE_FEE_USER_IN' + | 'MARGIN_SETTLE_FEE_USER_OUT' + | 'MARGIN_LEVER_ORDER_REFROZEN' + | 'MARGIN_LEVER_ORDER_FROZEN' + | 'MARGIN_LEVER_POS_IN' + | 'MARGIN_OFFSET_IN_SSM_LONG' + | 'MARGIN_OFFSET_IN_SSM_SHORT' + | 'FIXED_OFFSET_IN_SSM_LONG' + | 'FIXED_OFFSET_IN_SSM_SHORT' + | 'FIXED_CLOSE_LONG' + | 'FIXED_CLOSE_SHORT' + | 'FIXED_FORCE_CLOSE_LONG' + | 'FIXED_FORCE_CLOSE_SHORT' + | 'FIXED_BURST_CLOSE_LONG' + | 'FIXED_BURST_CLOSE_SHORT' + | 'FIXED_ADL_CLOSE_LONG' + | 'FIXED_ADL_CLOSE_SHORT' + | 'FIXED_RISK_LIQ_USER_IN' + | 'FIXED_RISK_LIQ_USER_OUT' + | 'FIXED_FORCE_BUY_SSM' + | 'FIXED_FORCE_SELL_SSM' + | 'FIXED_BURST_BUY_SSM' + | 'FIXED_BURST_SELL_SSM' + | 'ON_CHAIN_TRANSFER_REFUND' + | 'ON_CHAIN_TRANSFER_OUT' + | 'MT5_TRANSFER_IN' + | 'MT5_REFUND_IN' + | 'MT5_TRANSFER_OUT' + | 'TRACE_LOCK_USER_OUT' + | 'TRACE_LOCK_USER_IN' + | 'TRACE_TRANSFER_USER_OUT' + | 'TRACE_TRANSFER_USER_IN' + | 'TRACE_TRANSFER_REFUND_IN' + | 'FINANCIAL_TRANSFER_OUT' + | 'FINANCIAL_TRANSFER_IN' + | 'CONVERT_TRANSFER_IN' + | 'CONVERT_TRANSFER_OUT' + | 'BGPAY_TRANSFER_OUT' + | 'BGPAY_REFUND_IN' + | 'RWA_FIXED_SETTLE_FEE_USER_IN' + | 'RWA_FIXED_SETTLE_FEE_USER_OUT' + | 'RWA_CONTRACT_MAIN_SETTLE_FEE_SYSTEM_IN' + | 'RWA_CONTRACT_MAIN_SETTLE_FEE_SYSTEM_OUT' + | 'RWA_CONTRACT_MAIN_SETTLE_FEE_SYSTEM_KEEP_IN' + | 'RWA_CONTRACT_MAIN_SETTLE_FEE_SYSTEM_KEEP_OUT' + | 'RWA_CONTRACT_MAIN_SETTLE_FEE_USER_IN' + | 'RWA_CONTRACT_MAIN_SETTLE_FEE_USER_OUT' + | 'RWA_CONTRACT_REBASE_USER_OPEN_LONG' + | 'RWA_CONTRACT_REBASE_USER_OPEN_SHORT' + | 'RWA_CONTRACT_REBASE_USER_CLOSE_LONG' + | 'RWA_CONTRACT_REBASE_USER_CLOSE_SHORT' + | 'RWA_CONTRACT_REBASE_USER_BUY_IN_SSM' + | 'RWA_CONTRACT_REBASE_USER_SELL_IN_SSM' + | 'RISK_LIQ_DEFAULT_USER_IN' + | 'FIXED_RISK_LIQ_DEFAULT_USER_IN' + | 'BONUS_GRANT_USER_IN' + | 'BONUS_EXPIRE_USER_OUT' + | 'BONUS_TRANSFER_USER_OUT' + | 'WITHDRAW_TRANSFER_OUT' + | 'WITHDRAW_TRANSFER_IN' + | 'DELIVERY_LONG' + | 'DELIVERY_SHORT' + | 'FIXED_DELIVERY_LONG' + | 'FIXED_DELIVERY_SHORT' + | 'REBASE_COIN_SPLIT_OUT' + | 'REBASE_COIN_SPLIT_IN' + | 'REBASE_COIN_MERGE_OUT' + | 'REBASE_COIN_MERGE_IN'; ⋮---- -export interface InterestRateHistoryV3 { - list: InterestRateHistoryItemV3[]; +export interface GetFinancialRecordsRequestV3 { + category: + | 'SPOT' + | 'MARGIN' + | 'USDT-FUTURES' + | 'COIN-FUTURES' + | 'USDC-FUTURES'; + coin?: string; + type?: FinancialRecordTypeV3; + startTime?: string; + endTime?: string; + limit?: string; cursor?: string; } ⋮---- -export interface AnnouncementV3 { - annId: string; - annTitle: string; - language: string; - annUrl: string; - annType: string; - annSubType?: string; - /** Documented release time. The live payload uses cTime instead. */ - createdTime?: string; - /** Observed live. Unix ms. Docs call this createdTime. */ - cTime?: string; - /** Observed live. Not in the docs example. */ - annDesc?: string; +export interface RepayRequestV3 { + repayableCoinList: string[]; + paymentCoinList: string[]; } ⋮---- -/** Documented release time. The live payload uses cTime instead. */ -⋮---- -/** Observed live. Unix ms. Docs call this createdTime. */ +// Sub-account Management Request Types ⋮---- -/** Observed live. Not in the docs example. */ +export interface CreateSubAccountApiKeyRequestV3 { + subUid: string; + note: string; + type: 'read_write' | 'read_only'; + passphrase: string; + permissions: string[]; + ips: string[]; +} ⋮---- -export interface MarketCoinChainV3 { - chain: string; - needTag: string; - withdrawable: string; - rechargeable: string; - withdrawFee: string; - extraWithdrawFee: string; - depositConfirm: string; - withdrawConfirm: string; - minDepositAmount: string; - minWithdrawAmount: string; - browserUrl: string; - contractAddress: string | null; - withdrawStep: string; - /** - * Live field. The docs example names this withdrawPrecision. - */ - withdrawMinScale: string; - congestion: string; +export interface DeleteSubAccountApiKeyRequestV3 { + apiKey: string; } ⋮---- -/** - * Live field. The docs example names this withdrawPrecision. - */ +export interface GetSubAccountApiKeysRequestV3 { + subUid: string; + limit?: string; + cursor?: string; +} ⋮---- -export interface MarketCoinV3 { - coinId?: string; - coin: string; - /** "true" / "false" */ - transfer: string; - areaCoin?: string; - chains: MarketCoinChainV3[]; +export interface UpdateSubAccountApiKeyRequestV3 { + apiKey: string; + passphrase: string; + type?: 'read_write' | 'read_only'; + permissions?: string[]; + ips?: string[]; } ⋮---- -/** "true" / "false" */ +export interface CreateSubAccountRequestV3 { + username: string; + accountMode?: 'classic' | 'unified'; + note?: string; +} ⋮---- -export interface PositionTierV3 { - tier: string; - minTierValue: string; - maxTierValue: string; - leverage: string; - mmr: string; +export interface FreezeSubAccountRequestV3 { + subUid: string; + operation: 'freeze' | 'unfreeze'; } ⋮---- -export interface RiskReserveRecordV3 { - balance: string; - amount: string; - ts: string; - type?: string; +export interface GetSubAccountListRequestV3 { + limit?: string; + cursor?: string; } ⋮---- -export interface RiskReserveV3 { - totalBalance?: 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; - riskReserveRecords: RiskReserveRecordV3[]; + symbol?: string; + /** Enable automatic margin borrowing when balance insufficient. yes | no */ + allowBorrow?: 'yes' | 'no'; } ⋮---- -export interface RiskReserveHourRecordV3 { - amount: string; - balance: string; - ts: string; +/** 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 RiskReserveHourV3 { - coin: string; - riskReserveRecords: RiskReserveHourRecordV3[]; +export interface GetSubTransferRecordsRequestV3 { + subUid?: string; + role?: 'initiator' | 'receiver'; + coin?: string; + startTime?: string; + endTime?: string; + clientOid?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface RiskReserveAllItemV3 { - symbols: 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; - balance: string; + fromUserId: string; + toUserId: string; + /** Custom order ID, max 50 characters */ + clientOid: string; + /** Enable automatic margin borrowing when balance insufficient. yes | no */ + allowBorrow?: 'yes' | 'no'; } ⋮---- -export interface RiskReserveAllV3 { - list: RiskReserveAllItemV3[]; +/** Custom order ID, max 50 characters */ +⋮---- +/** Enable automatic margin borrowing when balance insufficient. yes | no */ +⋮---- +export interface GetSubUnifiedAssetsRequestV3 { + subUid?: string; + cursor?: string; + limit?: string; } ⋮---- -export interface InstrumentV3 { - symbol: string; +export interface GetFeeRateRequestV3 { 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; - /** Spot only. Max amount for a single market order. */ - maxMarketOrderAmount?: string; - pricePrecision: string; - /** - * Max decimal places for qty. - * Futures qty must stay within this and be a multiple of quantityMultiplier. - * Spot qty is not bound by quantityMultiplier. - */ - 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; - /** - * Futures only. Order qty must be a multiple of this, - * with at most quantityPrecision decimal places. - */ - quantityMultiplier?: string; - type?: 'perpetual' | 'delivery'; - symbolType?: 'crypto' | 'metal' | 'stock' | 'commodity'; - /** Display name. Returned alongside symbolType. */ - fullName?: string; - /** - * metal / energy / stock / etf / crypto. - * Independent of symbolType, which is still returned. - */ - instrumentType?: 'metal' | 'energy' | 'stock' | 'etf' | 'crypto'; - /** Set for traditional-finance pairs. Null for crypto. */ - marketRegion?: string | null; - /** ISIN for traditional-finance pairs. Null for crypto. */ - isin?: string | null; - 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; + symbol: string; + /** RPI fee rate flag for market maker users. Default: no */ + rpiFlag?: 'yes' | 'no'; } ⋮---- -/** Spot only. Max amount for a single market order. */ +/** RPI fee rate flag for market maker users. Default: no */ ⋮---- -/** - * Max decimal places for qty. - * Futures qty must stay within this and be a multiple of quantityMultiplier. - * Spot qty is not bound by quantityMultiplier. - */ +export interface GetFundingAssetsRequestV3 { + coin?: string; +} ⋮---- -/** yes = Reality stock token, no = non-Reality stock token */ +export interface SwitchDeductRequestV3 { + deduct: 'on' | 'off'; +} ⋮---- -// Futures specific fields +// Deposit Request Types ⋮---- -/** - * Futures only. Order qty must be a multiple of this, - * with at most quantityPrecision decimal places. - */ +export interface GetDepositAddressRequestV3 { + coin: string; + chain?: string; + size?: string; +} ⋮---- -/** Display name. Returned alongside symbolType. */ +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; +} ⋮---- -/** - * metal / energy / stock / etf / crypto. - * Independent of symbolType, which is still returned. - */ +/** Deduct from funding, uta, and/or otc accounts (comma-separated). Order: funding -> otc -> uta */ ⋮---- -/** Set for traditional-finance pairs. Null for crypto. */ +export interface GetWithdrawRecordsRequestV3 { + coin?: string; + orderId?: string; + clientOid?: string; + startTime: string; + endTime: string; + limit?: string; + cursor?: string; +} ⋮---- -/** ISIN for traditional-finance pairs. Null for crypto. */ +export interface GetWithdrawAddressBookRequestV3 { + coin?: string; + type?: 'EVM' | 'regular' | 'universal' | 'internal'; + limit?: string; + cursor?: string; +} ⋮---- -/** Launch time - Unix millisecond timestamp. Null for some margin pairs. */ +export interface CancelWithdrawalRequestV3 { + orderId?: string; + clientOid?: string; +} ⋮---- -// Margin specific fields +export interface SetDepositAccountRequestV3 { + coin: string; + accountType: 'funding' | 'unified' | 'otc'; +} ⋮---- -export interface MarketFeeGroupLabelV3 { - weight: string; - label: string; - symbols: string[]; +export interface GetMaxTransferableRequestV3 { + coin: string; } ⋮---- -export interface MarketFeeGroupTierV3 { - level: string; - makerFeeRate: string; - /** PRO1~PRO6 only. Taker fee rate in decimal form */ - takerFeeRate?: string; - /** Market maker RPI maker fee rate in decimal form */ - rpiMakerFeeRate?: string; +export interface GetOpenInterestLimitRequestV3 { + symbol: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; } ⋮---- -/** PRO1~PRO6 only. Taker fee rate in decimal form */ +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; +} ⋮---- -/** Market maker RPI maker fee rate in decimal form */ +export type CollateralTypeV3 = 'mainstream' | 'all' | 'custom'; ⋮---- -export interface MarketFeeGroupV3 { - category: string; - group: string; - labelList: MarketFeeGroupLabelV3[]; - tierList: MarketFeeGroupTierV3[]; +export interface SetCollateralTypeRequestV3 { + collateralType: CollateralTypeV3; + /** Required when collateralType=custom. Comma-separated coin names */ + collateralCoins?: string; + /** Enable Cash+ as collateral. Official field name is allowCashPlus */ + allowCashPlus?: 'yes' | 'no'; } ⋮---- -export interface MarketScoreWeightV3 { - category: string; - label: string; - symbol: string; - requiredSpread: string; - minMakerVolume: string; - weight: string; -} +/** Required when collateralType=custom. Comma-separated coin names */ ⋮---- -export interface LiquidationV3 { - symbol: string; - side: 'buy' | 'sell'; - price: string; +/** Enable Cash+ as collateral. Official field name is allowCashPlus */ +⋮---- +export interface BorrowRequestV3 { + coin: string; amount: string; - ts: string; + clientOid?: string; } ⋮---- -export interface LiquidationsV3 { - list: LiquidationV3[]; - cursor?: string; +export interface GetMaxBorrowableRequestV3 { + coin: string; } ⋮---- -export interface OrderBookV3 { - a: string[][]; // asks - [price, size] - b: string[][]; // bids - [price, size] - ts: string; +export interface SetRepayModeRequestV3 { + /** Account-level. Master and each sub-account keep their own setting */ + repayMode: 'auto' | 'manual'; } ⋮---- -a: string[][]; // asks - [price, size] -b: string[][]; // bids - [price, size] +/** Account-level. Master and each sub-account keep their own setting */ ⋮---- -export interface RealityOrderBookV3 { - symbol: string; - a: string[][]; - b: string[][]; - ts: string; +export interface DeleteSubAccountRequestV3 { + subUid: string; } ⋮---- -/** [price, onshoreQty, offshoreQty] */ -export type RealitySegmentedLevelV3 = [string, string, 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 RealityOrderBookSegmentedV3 { +export interface SetMarginRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; symbol: string; - a: RealitySegmentedLevelV3[]; - b: RealitySegmentedLevelV3[]; - ts: string; + posSide: 'long' | 'short'; + operation: 'add' | 'remove'; + amount: string; } ⋮---- -export interface RealityFillV3 { - execId: string; - price: string; - size: string; - side: 'buy' | 'sell'; - ts: string; +export interface GetMaxWithdrawalRequestV3 { + coin: string; } ⋮---- -export interface TickerV3 { - category: 'SPOT' | 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; +export interface GetRealityOrderBookRequestV3 { 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; } ⋮---- -/** 24h platform turnover; only available for rtoken */ -⋮---- -// Futures specific fields +export interface GetRealityOrderBookSegmentedRequestV3 { + symbol: string; +} ⋮---- -export interface ProofOfReservesV3 { - merkleRootHash: string; - totalReserveRatio: string; - list: { - coin: string; - userAssets: string; - platformAssets: string; - reserveRatio: string; - }[]; +export interface GetRealityFillsRequestV3 { + symbol: string; + limit?: string; } ⋮---- -export interface IndexComponentV3 { - exchange: string; - spotPair: string; - equivalentPrice: string; - weight: string; +export interface SubMasterTransferRequestV3 { + fromType: 'spot' | 'uta'; + toType: 'spot' | 'p2p' | 'uta'; + amount: string; + coin: string; + clientOid?: string; } ⋮---- -export interface IndexPriceComponentsV3 { - symbol: string; - componentList: IndexComponentV3[]; +export interface CreateAgentSubAccountRequestV3 { + username: string; + passphrase: string; + note?: string; } ⋮---- -export interface RpiSymbolV3 { - category: 'spot' | 'usdt-futures' | 'coin-futures' | 'usdc-futures'; +export interface MovePositionItemRequestV3 { symbol: string; + side: 'buy' | 'sell'; + qty: string; } ⋮---- -/** RPI order book depth: [price, nonRpiQty, rpiQty] */ -export interface RpiOrderBookV3 { - a: [string, string, string][]; - b: [string, string, string][]; - ts: string; +export interface MovePositionsRequestV3 { + fromUid: string; + toUid: string; + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + positionList: MovePositionItemRequestV3[]; } ⋮---- -export interface CashDividendRecordV3 { - symbol: string; - exDividendDate: string; - cashDividendPerShare: string; - cashDividendTimestamp: string; +export interface GetMovePositionHistoryRequestV3 { + category: 'USDT-FUTURES' | 'COIN-FUTURES' | 'USDC-FUTURES'; + symbol?: string; + startTime?: string; + endTime?: string; + cursor?: string; + limit?: string; } ⋮---- -export interface SplitRecordV3 { - symbol: string; - type: 'split' | 'reverse_split' | string; - status: 'pending' | 'ongoing' | 'completed' | string; - adjustmentRatio: string; - exDividendDate: string; - exDividendDateTimezone: string; - tradingHaltStartTime: string; - tradingHaltEndTime: string; +export interface GetEligibleSymbolsRequestV3 { + symbol?: string; } ⋮---- -export interface SpotWhaleFlowV3 { - volume: string; - date: string; +export interface GetEligibleMarginTierRequestV3 { + coin?: string; } ⋮---- -export interface SpotNetFlowV3 { - netFlow: string; - ts: string; +export interface GetEligibleLoanInfoRequestV3 { + coin?: 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; +export interface GetEligibleDiscountRateRequestV3 { + coin?: string; } ⋮---- -export interface MarginLongShortV3 { - longShortRatio: string; - ts: string; +export interface GetFundingFinancialRecordsRequestV3 { + coin?: string; + type?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface MarginLoanGrowthV3 { - growthRate: string; - ts: string; +export interface GetSmallAssetsRequestV3 { + coin?: string; } ⋮---- -export interface MarginIsolatedBorrowV3 { - borrowRate: string; - ts: string; +export interface TradeSmallAssetsRequestV3 { + fromCoinList: string[]; + toCoin?: string; } ⋮---- -export interface FuturesActiveBuySellV3 { - buyVolume: string; - sellVolume: string; - ts: string; +export interface GetSmallAssetsHistoryRequestV3 { + orderId?: string; + startTime?: string; + endTime?: string; + limit?: string; + cursor?: string; } ⋮---- -export interface FuturesLongShortV3 { - longRatio: string; - shortRatio: string; - longShortRatio: string; - ts: string; +export interface GetRateLimitQuotaRequestV3 { + category: 'spot' | 'futures'; + /** + * Omit to list sub-accounts under the master. + * Ignored when a sub-account calls this for itself. + */ + uid?: string; + cursor?: string; + limit?: string; } ⋮---- -export interface FuturesPositionLongShortV3 { - longPositionRatio: string; - shortPositionRatio: string; - longShortPositionRatio: string; - ts: string; +/** + * Omit to list sub-accounts under the master. + * Ignored when a sub-account calls this for itself. + */ +⋮---- +export interface SetRateLimitQuotaRequestV3 { + category: 'spot' | 'futures'; + /** + * Required when the master account sets quotas. + * Not required, and ignored, when a sub-account sets its own quota. + */ + uids?: string[]; + quota: string; } ⋮---- -export interface FuturesAccountLongShortV3 { - longAccountRatio: string; - shortAccountRatio: string; - longShortAccountRatio: string; - ts: string; +/** + * Required when the master account sets quotas. + * Not required, and ignored, when a sub-account sets its own quota. + */ +⋮---- +export interface CreateStpGroupRequestV3 { + /** Max 32 characters. Must be unique. */ + groupName: string; +} +⋮---- +/** Max 32 characters. Must be unique. */ +⋮---- +export interface StpGroupMembersRequestV3 { + /** Comma-separated sub-account UIDs. Max 50. */ + uids: string; + groupId: string; } +⋮---- +/** Comma-separated sub-account UIDs. Max 50. */ ================ File: src/rest-client-v3.ts @@ -19453,6 +20136,17 @@ import { UpdateSubAccountApiKeyRequestV3, WithdrawRequestV3, } from './types/request/v3/account.js'; +import { + AgentCustomerAssetRequestV3, + AgentCustomerDepositRequestV3, + AgentCustomerListRequestV3, + AgentCustomerTradeVolumeRequestV3, + GetAgentCustomerCommissionsRequestV3, + GetAgentCustomerKycResultRequestV3, + GetAgentSubCustomerListRequestV3, + GetSubAffiliateCommissionRequestV3, + GetSubAffiliateInfoRequestV3, +} from './types/request/v3/affiliate.js'; import { BrokerSubWithdrawalRequestV3, CreateBrokerSubAccountRequestV3, @@ -19460,11 +20154,17 @@ import { DeleteBrokerSubApiKeyRequestV3, GetBrokerAllSubDepositWithdrawalRequestV3, GetBrokerCommissionRequestV3, + GetBrokerOrderCommissionRequestV3, + GetBrokerRebateInfoRequestV3, GetBrokerSubAccountListRequestV3, GetBrokerSubApiKeyRequestV3, GetBrokerSubDepositAddressRequestV3, + GetBrokerTotalCommissionRequestV3, + GetBrokerTradeVolumeRequestV3, + GetSubaccountEmailRequestV3, ModifyBrokerSubAccountRequestV3, ModifyBrokerSubApiKeyRequestV3, + ModifySubaccountEmailRequestV3, } from './types/request/v3/broker.js'; import { CancelAllCfdOrdersRequestV3, @@ -19519,7 +20219,21 @@ import { GetEarnEliteRedeemInfoRequestV3, GetEarnEliteSubscribeInfoRequestV3, GetEarnEliteSubscribeResultRequestV3, + GetEarnSavingsAssetsRequestV3, + GetEarnSavingsProductsRequestV3, + GetEarnSavingsRecordsRequestV3, + GetEarnSavingsRedemptionResultRequestV3, + GetEarnSavingsSubscriptionRequestV3, + GetEarnSavingsSubscriptionResultRequestV3, + GetSharkfinAssetsRequestV3, + GetSharkfinProductsRequestV3, + GetSharkfinRecordsRequestV3, + GetSharkfinSubscriptionRequestV3, + GetSharkfinSubscriptionResultRequestV3, RedeemEarnEliteRequestV3, + RedeemSavingsRequestV3, + SubscribeSavingsRequestV3, + SubscribeSharkfinRequestV3, } from './types/request/v3/earn.js'; import { AddGridInvestmentRequestV3, @@ -19630,6 +20344,7 @@ import { GetStockPlusHistoryExecutionsRequestV3, GetStockPlusHistoryOrdersRequestV3, GetStockPlusIntradayRequestV3, + GetStockPlusMaxPurchaseRequestV3, GetStockPlusOptionChainInfoRequestV3, GetStockPlusOptionExpiryDateRequestV3, GetStockPlusOptionQuoteRequestV3, @@ -19724,10 +20439,25 @@ import { WithdrawRecordV3, WithdrawResponseV3, } from './types/response/v3/account.js'; +import { + AgentCustomerAssetItemV3, + AgentCustomerCommissionsV3, + AgentCustomerDepositItemV3, + AgentCustomerKycResultV3, + AgentCustomerListItemV3, + AgentCustomerTradeVolumeItemV3, + AgentSubCustomerListV3, + SubAffiliateCommissionV3, + SubAffiliateInfoV3, +} from './types/response/v3/affiliate.js'; import { BrokerCommissionRecordV3, + BrokerOrderCommissionV3, + BrokerRebateInfoV3, BrokerSubDepositAddressV3, BrokerSubWithdrawalResponseV3, + BrokerTotalCommissionV3, + BrokerTradeVolumeV3, CreateBrokerSubAccountResponseV3, CreateBrokerSubApiKeyResponseV3, GetBrokerAllSubDepositWithdrawalResponseV3, @@ -19735,6 +20465,8 @@ import { GetBrokerSubApiKeyResponseV3, ModifyBrokerSubAccountResponseV3, ModifyBrokerSubApiKeyResponseV3, + ModifySubaccountEmailResponseV3, + SubaccountEmailV3, } from './types/response/v3/broker.js'; import { CfdCandlestickV3, @@ -19787,7 +20519,23 @@ import { EarnEliteSubscribeInfoV3, EarnEliteSubscribeResultV3, EarnEliteSubscribeStatusV3, + EarnSavingsAccountV3, + EarnSavingsAssetsV3, + EarnSavingsProductV3, + EarnSavingsRecordsV3, + EarnSavingsRedemptionResultV3, + EarnSavingsSubscriptionDetailV3, + EarnSavingsSubscriptionResultV3, + EarnSharkfinAccountV3, + EarnSharkfinAssetsV3, + EarnSharkfinProductsV3, + EarnSharkfinRecordsV3, + EarnSharkfinSubscriptionDetailV3, + EarnSharkfinSubscriptionResultV3, RedeemEarnEliteResultV3, + RedeemSavingsResponseV3, + SubscribeSavingsResponseV3, + SubscribeSharkfinResponseV3, } from './types/response/v3/earn.js'; import { GridBotDetailV3, @@ -19902,6 +20650,7 @@ import { StockPlusHistoryExecutionsV3, StockPlusHistoryOrdersV3, StockPlusIntradayV3, + StockPlusMaxPurchaseV3, StockPlusModifyOrderResponseV3, StockPlusOptionChainInfoV3, StockPlusOptionExpiryDateV3, @@ -19992,8 +20741,7 @@ getServerTime(): Promise< serverTime: string; serverTimeMicros: string; }> - > { - return this.get('/api/v3/market/time'); + > ⋮---- /** * Get Announcements @@ -20002,7 +20750,7 @@ getServerTime(): Promise< */ getAnnouncements( params: GetAnnouncementsRequestV3, -): Promise> + ): Promise> ⋮---- /** * @@ -20019,21 +20767,21 @@ getAnnouncements( */ getInstruments( params: GetInstrumentsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Market Maker Fee Group - Query fee rate tiers and grouping */ getMarketFeeGroup( params: GetMarketFeeGroupRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Liquidations History - Query historical liquidation order data (last 3 days) */ getLiquidations( params: GetLiquidationsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get RPI Symbols - Trading pairs supporting Retail Price Improvement @@ -20045,95 +20793,95 @@ getRpiSymbols(): Promise> */ getRpiOrderBook( params: GetRpiOrderBookRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Cash Dividend Records - RWA stock futures cash dividend records */ getCashDividendRecords( params: GetCashDividendRecordsRequestV3, -): Promise> + ): Promise> ⋮---- getSplitRecords( params?: GetSplitRecordsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Spot Whale Net Flow Data */ getSpotWhaleFlow( params: GetSpotWhaleFlowRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Spot Fund Flow Data */ getSpotFundFlow( params: GetSpotFundFlowRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Spot 24H Net Capital Inflow Data */ getSpotNetFlow( params: GetSpotNetFlowRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Margin Long Short Ratio Data */ getMarginLongShort( params: GetMarginLongShortRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Margin Loan Growth Rate Data */ getMarginLoanGrowth( params: GetMarginLoanGrowthRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Isolated Margin Borrowing Ratio Data */ getMarginIsolatedBorrow( params: GetMarginIsolatedBorrowRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Futures Active Buy Sell Volume Data */ getFuturesActiveBuySell( params: GetFuturesTradingDataRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Futures Long Short Ratio Data */ getFuturesLongShort( params: GetFuturesTradingDataRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Futures Active Long Short Position Data */ getFuturesPositionLongShort( params: GetFuturesTradingDataRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Futures Active Long Short Account Data */ getFuturesAccountLongShort( params: GetFuturesTradingDataRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Market Maker Score Weight - Query score weights per symbol */ getMarketScoreWeights( params?: GetMarketScoreWeightsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Tickers @@ -20148,14 +20896,14 @@ getTickers(params: GetTickersRequestV3): Promise> */ getOrderBook( params: GetOrderBookRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Recent Public Fills */ getFills( params: GetPublicFillsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Proof Of Reserves @@ -20167,7 +20915,7 @@ getProofOfReserves(): Promise> */ getOpenInterest( params: GetOpenInterestRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Open Interest History @@ -20175,7 +20923,7 @@ getOpenInterest( */ getOpenInterestHistory( params: GetOpenInterestHistoryRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Coins @@ -20190,49 +20938,49 @@ getCoins(params?: GetCoinsRequestV3): Promise> */ getCandles( params: GetCandlesRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Kline/Candlestick History */ getHistoryCandles( params: GetHistoryCandlesRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Current Funding Rate */ getCurrentFundingRate( params: GetCurrentFundingRateRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Funding Rate History */ getHistoryFundingRate( params: GetHistoryFundingRateRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Risk Reserve */ getRiskReserve( params: GetRiskReserveRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Risk Reserve (Hourly) */ getRiskReserveHour( params: GetRiskReserveRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Risk Reserve All — current insurance funds */ getRiskReserveAll( params: GetRiskReserveAllRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Discount Rate @@ -20246,14 +20994,14 @@ getDiscountRate(): Promise> */ getInterestRateHistory( params: GetInterestRateHistoryRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Margin Loan */ getMarginLoans( params: GetMarginLoansRequestV3, -): Promise> + ): Promise> ⋮---- /** * Margin loan info for every coin, or one coin when coin is set. @@ -20261,28 +21009,28 @@ getMarginLoans( */ getMarginLoansAll( params?: GetMarginLoansAllRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Position Tier */ getPositionTier( params: GetPositionTierRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Open Interest Limit */ getContractsOi( params: GetContractsOiRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Index Price Components */ getIndexComponents( params: GetIndexComponentsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Reality OrderBook @@ -20291,7 +21039,7 @@ getIndexComponents( */ getRealityOrderBook( params: GetRealityOrderBookRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Reality OrderBook Segmented @@ -20302,57 +21050,56 @@ getRealityOrderBook( */ getRealityOrderBookSegmented( params: GetRealityOrderBookSegmentedRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Reality Fills */ getRealityFills( params: GetRealityFillsRequestV3, -): Promise> + ): Promise> ⋮---- getRealityCompanyOverview( params: GetRealityCompanyOverviewRequestV3, -): Promise> + ): Promise> ⋮---- getRealityValuationIndicators( params: GetRealityValuationIndicatorsRequestV3, -): Promise> + ): Promise> ⋮---- getRealityEarningsForecast( params: GetRealityEarningsForecastRequestV3, -): Promise> + ): Promise> ⋮---- getRealitySuspensionResumptionInfo( params: GetRealitySuspensionResumptionInfoRequestV3, -): Promise> + ): Promise> ⋮---- getRealityDividends( params: GetRealityDividendsRequestV3, -): Promise>> + ): Promise>> ⋮---- getRealityShareCapitalChange( params: GetRealityShareCapitalChangeRequestV3, -): Promise> + ): Promise> ⋮---- getRealityInnerTrades( params: GetRealityInnerTradesRequestV3, -): Promise>> + ): Promise>> ⋮---- getRealityExecutiveShareholdings( params: GetRealityExecutiveShareholdingsRequestV3, ): Promise< APIResponse> - > { - return this.get('/api/v3/reality/market/executive-shareholdings', params); + > ⋮---- getRealityShareholdDetail( params: GetRealityShareholdDetailRequestV3, -): Promise>> + ): Promise>> ⋮---- getRealityStockInfo( params?: GetRealityStockInfoRequestV3, -): Promise> + ): Promise> ⋮---- getRealityMarketStates(): Promise> ⋮---- @@ -20371,8 +21118,7 @@ getRealityMarketCalendar(): Promise> */ getCopyFuturesTradingPairs(): Promise< APIResponse - > { - return this.getPrivate('/api/v3/copy/futures/trading-pairs'); + > ⋮---- /** * Get copy-trading position summary @@ -20381,8 +21127,7 @@ getCopyFuturesTradingPairs(): Promise< */ getCopyFuturesPositionSummary(): Promise< APIResponse - > { - return this.getPrivate('/api/v3/copy/futures/position-summary'); + > ⋮---- /** * Get max transferable amount and available balance for the copy-trading lead account. @@ -20390,7 +21135,7 @@ getCopyFuturesPositionSummary(): Promise< */ getCopyFuturesMaxTransferable( params: GetCopyFuturesMaxTransferableRequestV3, -): Promise> + ): Promise> ⋮---- /** * Max transferable amount of a follower copy account for one coin. @@ -20399,7 +21144,7 @@ getCopyFuturesMaxTransferable( */ getCopyFuturesCopyMaxTransferable( params: GetCopyFuturesCopyMaxTransferableRequestV3, -): Promise> + ): Promise> ⋮---- /** * Transfer funds between spot/funding and the copy-trading lead account. @@ -20407,7 +21152,7 @@ getCopyFuturesCopyMaxTransferable( */ copyFuturesTransfer( params: CopyFuturesTransferRequestV3, -): Promise> + ): Promise> ⋮---- /** * Query copy-trading lead account transfer history. @@ -20415,92 +21160,91 @@ copyFuturesTransfer( */ getCopyFuturesTransferRecords( params?: GetCopyFuturesTransferRecordRequestV3, -): Promise> + ): Promise> ⋮---- getCopyFuturesCurrentFollowers( params?: GetCopyFuturesFollowersRequestV3, -): Promise> + ): Promise> ⋮---- getCopyFuturesHistoryFollowers( params?: GetCopyFuturesFollowersRequestV3, -): Promise> + ): Promise> ⋮---- getCopyFuturesProfitSummary(): Promise< APIResponse - > { - return this.getPrivate('/api/v3/copy/futures/profit-summary'); + > ⋮---- getCopyFuturesProfitDetails( params?: GetCopyFuturesProfitDetailsRequestV3, -): Promise> + ): Promise> ⋮---- getCopyFuturesPortfolioOverview( params: GetCopyFuturesPortfolioOverviewRequestV3, -): Promise> + ): Promise> ⋮---- createCopyFutures( params: CreateCopyFuturesRequestV3, -): Promise> + ): Promise> ⋮---- modifyCopyFuturesFollowerSettings( params: ModifyCopyFuturesFollowerSettingsRequestV3, -): Promise> + ): Promise> ⋮---- unfollowCopyFutures( params: UnfollowCopyFuturesRequestV3, -): Promise> + ): Promise> ⋮---- getCopyFuturesCopySettings( params: GetCopyFuturesCopySettingsRequestV3, -): Promise> + ): Promise> ⋮---- copyFuturesFollowerTransfer( params: CopyFuturesFollowerTransferRequestV3, -): Promise> + ): Promise> ⋮---- getCopyFuturesFollowerTransferRecords( params: GetCopyFuturesFollowerTransferRecordRequestV3, -): Promise> + ): Promise> ⋮---- getCopyFuturesCurrentCopy( params: GetCopyFuturesCurrentCopyRequestV3, -): Promise> + ): Promise> ⋮---- getCopyFuturesCopyProfitDetails( params: GetCopyFuturesCopyProfitDetailsRequestV3, -): Promise> + ): Promise> ⋮---- closeCopyFuturesPositions( params: CloseCopyFuturesPositionsRequestV3, -): Promise> + ): Promise> ⋮---- closeAllCopyFuturesPositions( params: CloseAllCopyFuturesRequestV3, -): Promise> + ): Promise> ⋮---- getCopyFuturesCurrentPositions( params: GetCopyFuturesCurrentPositionsRequestV3, -): Promise> + ): Promise> ⋮---- placeCopyFuturesTpSl( params: PlaceCopyFuturesTpSlRequestV3, -): Promise> + ): Promise> ⋮---- modifyCopyFuturesTpSl( params: ModifyCopyFuturesTpSlRequestV3, -): Promise> + ): Promise> ⋮---- cancelCopyFuturesTpSl( params: CancelCopyFuturesTpSlRequestV3, -): Promise> + ): Promise> ⋮---- getCopyFuturesCurrentTpSlOrders( params: GetCopyFuturesCurrentTpSlOrdersRequestV3, -): Promise> + ): Promise> ⋮---- getCopyFuturesTpSlOrderHistory( params: GetCopyFuturesTpSlOrderHistoryRequestV3, -): Promise> + ): Promise> ⋮---- /** * @@ -20510,99 +21254,103 @@ getCopyFuturesTpSlOrderHistory( ⋮---- getStockPlusOptionQuote( params: GetStockPlusOptionQuoteRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusOptionChainInfo( params: GetStockPlusOptionChainInfoRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusOptionExpiryDate( params: GetStockPlusOptionExpiryDateRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusOptionVolume( params: GetStockPlusOptionVolumeRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusStaticInfo( params: GetStockPlusStaticInfoRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusQuote( params: GetStockPlusQuoteRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusTradeDetail( params: GetStockPlusTradeDetailRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusIntraday( params: GetStockPlusIntradayRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusHistoryCandlestick( params: GetStockPlusHistoryCandlestickRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusCandlestick( params: GetStockPlusCandlestickRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusDepth( params: GetStockPlusDepthRequestV3, -): Promise> + ): Promise> ⋮---- placeStockPlusOrder( params: PlaceStockPlusOrderRequestV3, -): Promise> + ): Promise> ⋮---- cancelStockPlusOrder( params: CancelStockPlusOrderRequestV3, -): Promise> + ): Promise> ⋮---- modifyStockPlusOrder( params: ModifyStockPlusOrderRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusTodayOrders( params?: GetStockPlusTodayOrdersRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusHistoryOrders( params?: GetStockPlusHistoryOrdersRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusOrderDetail( params: GetStockPlusOrderDetailRequestV3, -): Promise> + ): Promise> +⋮---- +getStockPlusMaxPurchase( + params: GetStockPlusMaxPurchaseRequestV3, + ): Promise> ⋮---- getStockPlusTodayExecutions( params?: GetStockPlusTodayExecutionsRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusHistoryExecutions( params?: GetStockPlusHistoryExecutionsRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusAccount( params?: GetStockPlusAccountRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusCashFlow( params: GetStockPlusCashFlowRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusStockPosition( params?: GetStockPlusStockPositionRequestV3, -): Promise> + ): Promise> ⋮---- stockPlusTransfer( params: StockPlusTransferRequestV3, -): Promise> + ): Promise> ⋮---- getStockPlusTransferRecords( params?: GetStockPlusTransferRecordsRequestV3, -): Promise> + ): Promise> ⋮---- /** * @@ -20612,37 +21360,37 @@ getStockPlusTransferRecords( ⋮---- getCfdTickers( params?: GetCfdTickersRequestV3, -): Promise> + ): Promise> ⋮---- getCfdHistoryCandlestick( params: GetCfdHistoryCandlestickRequestV3, -): Promise> + ): Promise> ⋮---- placeCfdOrder( params: PlaceCfdOrderRequestV3, -): Promise> + ): Promise> ⋮---- modifyCfdOrder( params: ModifyCfdOrderRequestV3, -): Promise> + ): Promise> ⋮---- cancelCfdOrder(params: CancelCfdOrderRequestV3): Promise> ⋮---- cancelAllCfdOrders( params?: CancelAllCfdOrdersRequestV3, -): Promise> + ): Promise> ⋮---- closeCfdPositions( params: CloseCfdPositionsRequestV3, -): Promise> + ): Promise> ⋮---- closeAllCfdPositions( params?: CloseAllCfdPositionsRequestV3, -): Promise> + ): Promise> ⋮---- getCfdUnfilledOrders( params?: GetCfdUnfilledOrdersRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get CFD Order History @@ -20651,29 +21399,29 @@ getCfdUnfilledOrders( */ getCfdOrderHistory( params: GetCfdOrderHistoryRequestV3, -): Promise> + ): Promise> ⋮---- getCfdCurrentPositions( params?: GetCfdCurrentPositionsRequestV3, -): Promise> + ): Promise> ⋮---- getCfdFundDetail(): Promise> ⋮---- cfdTransfer( params: CfdTransferRequestV3, -): Promise> + ): Promise> ⋮---- getCfdTransferRecords( params?: GetCfdTransferRecordsRequestV3, -): Promise> + ): Promise> ⋮---- getCfdFinancialRecords( params?: GetCfdFinancialRecordsRequestV3, -): Promise> + ): Promise> ⋮---- getCfdInstruments( params?: GetCfdInstrumentsRequestV3, -): Promise> + ): Promise> ⋮---- /** * @@ -20691,7 +21439,7 @@ getBalances(): Promise> */ getFundingAssets( params?: GetFundingAssetsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Query account metadata (UID, inviter, parent account, channel, IP whitelist, permissions). @@ -20710,7 +21458,7 @@ getAccountSettings(): Promise> */ adjustAccountMode( params: AdjustAccountModeRequestV3, -): Promise> + ): Promise> ⋮---- /** * Delta-neutral metrics (equity ratio, thresholds, per-coin position ratios). @@ -20730,7 +21478,7 @@ setLeverage(params: SetLeverageRequestV3): Promise> */ setHoldMode(params: { holdMode: 'one_way_mode' | 'hedge_mode'; -}): Promise> + }): Promise> ⋮---- /** * Get Collateral Type - Query unified account collateral configuration @@ -20742,7 +21490,7 @@ getCollateralType(): Promise> */ setCollateralType( params: SetCollateralTypeRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Custom Collateral Coins - Platform-supported custom collateral coins @@ -20754,7 +21502,7 @@ getCustomCollateralCoins(): Promise> */ preSetLeverage( params: PreSetLeverageRequestV3, -): Promise> + ): Promise> ⋮---- /** * Set Margin - Adjust isolated margin position margin amount @@ -20766,18 +21514,29 @@ setMargin(params: SetMarginRequestV3): Promise> */ getMaxWithdrawal( params: GetMaxWithdrawalRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Financial Records */ getFinancialRecords(params: GetFinancialRecordsRequestV3): Promise< APIResponse<{ - list: FinancialRecordV3[]; - cursor: string; + /** + * Undocumented but staff-confirmed: null when there are no records. + * @see https://t.me/bitgetOpenapi/153704 + */ + list: FinancialRecordV3[] | null; + /** Undocumented but staff-confirmed: null when pagination is exhausted. */ + cursor: string | null; }> - > { - return this.getPrivate('/api/v3/account/financial-records', params); + > +⋮---- +/** + * Undocumented but staff-confirmed: null when there are no records. + * @see https://t.me/bitgetOpenapi/153704 + */ +⋮---- +/** Undocumented but staff-confirmed: null when pagination is exhausted. */ ⋮---- getFundingFinancialRecords( params?: GetFundingFinancialRecordsRequestV3, @@ -20786,8 +21545,7 @@ getFundingFinancialRecords( list: FundingFinancialRecordV3[]; cursor: string; }> - > { - return this.getPrivate('/api/v3/account/funding-financial-records', params); + > ⋮---- /** * Get Repayable Coins @@ -20797,8 +21555,7 @@ getRepayableCoins(): Promise< repayableCoinList: RepayableCoinV3[]; maxSelection: string; }> - > { - return this.getPrivate('/api/v3/account/repayable-coins'); + > ⋮---- /** * Get Payment Coins @@ -20808,8 +21565,7 @@ getPaymentCoins(): Promise< paymentCoinList: PaymentCoinV3[]; maxSelection: string; }> - > { - return this.getPrivate('/api/v3/account/payment-coins'); + > ⋮---- /** * Repay @@ -20820,11 +21576,11 @@ borrow(params: BorrowRequestV3): Promise> ⋮---- getMaxBorrowable( params: GetMaxBorrowableRequestV3, -): Promise> + ): Promise> ⋮---- setRepayMode( params: SetRepayModeRequestV3, -): Promise>> + ): Promise>> ⋮---- /** * Get Convert Records @@ -20834,24 +21590,22 @@ getConvertRecords(params: GetConvertRecordsRequestV3): Promise< list: ConvertRecordV3[]; cursor: string; }> - > { - return this.getPrivate('/api/v3/account/convert-records', params); + > ⋮---- getSmallAssets( params?: GetSmallAssetsRequestV3, -): Promise> + ): Promise> ⋮---- tradeSmallAssets( params: TradeSmallAssetsRequestV3, -): Promise> + ): Promise> ⋮---- getSmallAssetsHistory(params?: GetSmallAssetsHistoryRequestV3): Promise< APIResponse<{ list: SmallAssetsHistoryItemV3[]; cursor: string; }> - > { - return this.getPrivate('/api/v3/convert/small-assets-history', params); + > ⋮---- /** * Set up deposit account - Configure default recharge account for a certain symbol @@ -20861,7 +21615,7 @@ getSmallAssetsHistory(params?: GetSmallAssetsHistoryRequestV3): Promise< */ setDepositAccount( params: SetDepositAccountRequestV3, -): Promise> + ): Promise> ⋮---- /** * Switch Deduct - Set BGB deduction @@ -20875,8 +21629,7 @@ getDeductInfo(): Promise< APIResponse<{ deduct: 'on' | 'off'; }> - > { - return this.getPrivate('/api/v3/account/deduct-info'); + > ⋮---- /** * Get Trading Fee Rate @@ -20886,15 +21639,14 @@ getFeeRate(params: GetFeeRateRequestV3): Promise< makerFeeRate: string; takerFeeRate: string; }> - > { - return this.getPrivate('/api/v3/account/fee-rate', params); + > ⋮---- /** * Get All Symbol Fee Rates - Query fee rates for all trading pairs under a product type */ getAllFeeRates( params: GetAllFeeRatesRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Max Transferable @@ -20905,7 +21657,7 @@ getAllFeeRates( */ getMaxTransferable( params: GetMaxTransferableRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Open Interest Limit @@ -20915,23 +21667,23 @@ getMaxTransferable( */ getOpenInterestLimit( params: GetOpenInterestLimitRequestV3, -): Promise> + ): Promise> ⋮---- getEligibleSymbols( params?: GetEligibleSymbolsRequestV3, -): Promise> + ): Promise> ⋮---- getEligibleMarginTier( params?: GetEligibleMarginTierRequestV3, -): Promise> + ): Promise> ⋮---- getEligibleLoanInfo( params?: GetEligibleLoanInfoRequestV3, -): Promise> + ): Promise> ⋮---- getEligibleDiscountRate( params?: GetEligibleDiscountRateRequestV3, -): Promise> + ): Promise> ⋮---- /** * Switch Account - Switch to classic account mode @@ -20952,8 +21704,7 @@ getUnifiedAccountSwitchStatus(): Promise< APIResponse<{ status: 'processProcessing' | 'successSuccess' | 'failFailed'; }> - > { - return this.getPrivate('/api/v3/account/switch-status'); + > ⋮---- /** * Get Tax Records @@ -20965,7 +21716,7 @@ getUnifiedAccountSwitchStatus(): Promise< */ getTaxRecords( params: GetTaxRecordsRequestV3, -): Promise> + ): Promise> ⋮---- /** * @@ -20978,32 +21729,32 @@ getTaxRecords( */ createSubAccount( params: CreateSubAccountRequestV3, -): Promise> + ): Promise> ⋮---- /** * Create Agent Sub-account */ createAgentSubAccount( params: CreateAgentSubAccountRequestV3, -): Promise> + ): Promise> ⋮---- /** * Freeze/Unfreeze Sub-account */ freezeSubAccount( params: FreezeSubAccountRequestV3, -): Promise> + ): Promise> ⋮---- deleteSubAccount( params: DeleteSubAccountRequestV3, -): Promise>> + ): Promise>> ⋮---- /** * Get Sub-account Unified Account Assets */ getSubUnifiedAssets( params?: GetSubUnifiedAssetsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Sub-account List @@ -21014,29 +21765,28 @@ getSubAccountList(params?: GetSubAccountListRequestV3): Promise< hasNext: boolean; cursor: string; }> - > { - return this.getPrivate('/api/v3/user/sub-list', params); + > ⋮---- /** * Create Sub-account API Key */ createSubAccountApiKey( params: CreateSubAccountApiKeyRequestV3, -): Promise> + ): Promise> ⋮---- /** * Modify Sub-account API Key */ updateSubAccountApiKey( params: UpdateSubAccountApiKeyRequestV3, -): Promise> + ): Promise> ⋮---- /** * Delete Sub-account API Key */ deleteSubAccountApiKey( params: DeleteSubAccountApiKeyRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Sub-account API Keys @@ -21047,8 +21797,7 @@ getSubAccountApiKeys(params: GetSubAccountApiKeysRequestV3): Promise< hasNext: boolean; cursor: string; }> - > { - return this.getPrivate('/api/v3/user/sub-api-list', params); + > ⋮---- /** * Get RateLimit Quota @@ -21056,7 +21805,7 @@ getSubAccountApiKeys(params: GetSubAccountApiKeysRequestV3): Promise< */ getRateLimitQuota( params: GetRateLimitQuotaRequestV3, -): Promise> + ): Promise> ⋮---- /** * Set RateLimit Quota @@ -21065,7 +21814,7 @@ getRateLimitQuota( */ setRateLimitQuota( params: SetRateLimitQuotaRequestV3, -): Promise>> + ): Promise>> ⋮---- /** * Create STP Group @@ -21073,7 +21822,7 @@ setRateLimitQuota( */ createStpGroup( params: CreateStpGroupRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get STP Groups @@ -21089,7 +21838,7 @@ getStpGroups(): Promise> */ addStpGroupMembers( params: StpGroupMembersRequestV3, -): Promise> + ): Promise> ⋮---- /** * Remove STP Group Members @@ -21099,7 +21848,7 @@ addStpGroupMembers( */ removeStpGroupMembers( params: StpGroupMembersRequestV3, -): Promise> + ): Promise> ⋮---- /** * @@ -21112,14 +21861,14 @@ removeStpGroupMembers( */ getTransferableCoins( params: GetTransferableCoinsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Transfer */ submitTransfer( params: TransferRequestV3, -): Promise> + ): Promise> ⋮---- /** * Main-Sub Account Transfer @@ -21129,8 +21878,7 @@ subAccountTransfer(params: SubAccountTransferRequestV3): Promise< transferId: string; clientOid: string; }> - > { - return this.postPrivate('/api/v3/account/sub-transfer', params); + > ⋮---- /** * Get Main-Sub Transfer Records @@ -21140,8 +21888,7 @@ getSubTransferRecords(params?: GetSubTransferRecordsRequestV3): Promise< items: SubTransferRecordV3[]; cursor: string; }> - > { - return this.getPrivate('/api/v3/account/sub-transfer-record', params); + > ⋮---- /** * Sub-Main Account Transfer @@ -21151,8 +21898,7 @@ subMasterTransfer(params: SubMasterTransferRequestV3): Promise< transferId: string; clientOid: string; }> - > { - return this.postPrivate('/api/v3/account/sub-master-transfer', params); + > ⋮---- /** * @@ -21165,28 +21911,28 @@ subMasterTransfer(params: SubMasterTransferRequestV3): Promise< */ getDepositAddress( params: GetDepositAddressRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Sub Deposit Address */ getSubDepositAddress( params: GetSubDepositAddressRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Deposit Records */ getDepositRecords( params: GetDepositRecordsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Sub Deposit Records */ getSubDepositRecords( params: GetSubDepositRecordsRequestV3, -): Promise> + ): Promise> ⋮---- /** * @@ -21199,28 +21945,28 @@ getSubDepositRecords( */ submitWithdraw( params: WithdrawRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Withdraw Records */ getWithdrawRecords( params: GetWithdrawRecordsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Query the withdrawal address book. Rate limit: 1/sec/UID. */ getWithdrawAddressBook( params?: GetWithdrawAddressBookRequestV3, -): Promise> + ): Promise> ⋮---- /** * Cancel a withdrawal still in the cooling-off period. Rate limit: 1/sec/UID. */ cancelWithdrawal( params: CancelWithdrawalRequestV3, -): Promise> + ): Promise> ⋮---- /** * @@ -21236,28 +21982,28 @@ cancelWithdrawal( */ submitNewOrder( params: PlaceOrderRequestV3, -): Promise> + ): Promise> ⋮---- /** * Modify Order */ modifyOrder( params: ModifyOrderRequestV3, -): Promise> + ): Promise> ⋮---- /** * Place Reality Order - Limit or market order for Reality stock trading pairs */ placeRealityOrder( params: PlaceRealityOrderRequestV3, -): Promise> + ): Promise> ⋮---- /** * Cancel Reality Order - Cancel an unfilled or partially filled Reality stock order */ cancelRealityOrder( params: CancelRealityOrderRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Loan Data - Query current loan data for the unified trading account @@ -21269,49 +22015,49 @@ getLoanData(): Promise> */ cancelOrder( params: CancelOrderRequestV3, -): Promise> + ): Promise> ⋮---- /** * Batch Order */ placeBatchOrders( params: PlaceBatchOrdersRequestV3[], -): Promise> + ): Promise> ⋮---- /** * Batch Modify Orders */ batchModifyOrders( params: BatchModifyOrderRequestV3[], -): Promise> + ): Promise> ⋮---- /** * Batch Cancel */ cancelBatchOrders( params: CancelBatchOrdersRequestV3[], -): Promise> + ): Promise> ⋮---- /** * Cancel All Orders */ cancelAllOrders( params: CancelAllOrdersRequestV3, -): Promise> + ): Promise> ⋮---- /** * Close All Positions */ closeAllPositions( params: CloseAllPositionsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Order Details */ getOrderInfo( params: GetOrderInfoRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Open Orders @@ -21321,8 +22067,7 @@ getUnfilledOrders(params?: GetUnfilledOrdersRequestV3): Promise< list: UnfilledOrderV3[]; cursor: string; }> - > { - return this.getPrivate('/api/v3/trade/unfilled-orders', params); + > ⋮---- /** * Get Order History @@ -21332,15 +22077,14 @@ getHistoryOrders(params: GetHistoryOrdersRequestV3): Promise< list: HistoryOrderV3[]; cursor: string; }> - > { - return this.getPrivate('/api/v3/trade/history-orders', params); + > ⋮---- /** * Move Positions - Transfer positions between master and sub-accounts */ movePositions( params: MovePositionsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Move Position History @@ -21350,8 +22094,7 @@ getMovePositionHistory(params: GetMovePositionHistoryRequestV3): Promise< list: MovePositionHistoryV3[]; cursor: string; }> - > { - return this.getPrivate('/api/v3/account/move-position-history', params); + > ⋮---- /** * Get Fill History @@ -21361,18 +22104,25 @@ getTradeFills(params?: GetFillsRequestV3): Promise< list: FillV3[]; cursor: string; }> - > { - return this.getPrivate('/api/v3/trade/fills', params); + > ⋮---- /** * Get Position Info */ getCurrentPosition(params: GetCurrentPositionRequestV3): Promise< APIResponse<{ - list: CurrentPositionV3[]; + /** + * Undocumented but staff-confirmed: null when there are no matching positions. + * @see https://t.me/bitgetOpenapi/153786 + */ + list: CurrentPositionV3[] | null; }> - > { - return this.getPrivate('/api/v3/position/current-position', params); + > +⋮---- +/** + * Undocumented but staff-confirmed: null when there are no matching positions. + * @see https://t.me/bitgetOpenapi/153786 + */ ⋮---- /** * Get Positions History @@ -21382,8 +22132,7 @@ getPositionHistory(params: GetPositionHistoryRequestV3): Promise< list: PositionHistoryV3[]; cursor: string; }> - > { - return this.getPrivate('/api/v3/position/history-position', params); + > ⋮---- /** * Get Max Open Available @@ -21392,7 +22141,7 @@ getPositionHistory(params: GetPositionHistoryRequestV3): Promise< */ getMaxOpenAvailable( params: GetMaxOpenAvailableRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Position ADL Rank - Get position auto-deleveraging ranking @@ -21404,7 +22153,7 @@ getPositionAdlRank(): Promise> */ countdownCancelAll( params: CountdownCancelAllRequestV3, -): Promise> + ): Promise> ⋮---- /** * @@ -21417,14 +22166,14 @@ countdownCancelAll( */ getLoanTransfered( params: GetTransferedRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Trade Symbols */ getLoanSymbols( params: GetSymbolsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Risk Unit @@ -21433,36 +22182,35 @@ getLoanRiskUnit(): Promise< APIResponse<{ riskUnitId: string[]; }> - > { - return this.getPrivate('/api/v3/ins-loan/risk-unit'); + > ⋮---- /** * Get Repayment Orders */ getLoanRepaidHistory( params?: GetRepaidHistoryRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Product Info */ getLoanProductInfo( params: GetProductInfosRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Loan Orders */ getLoanOrder( params?: GetLoanOrderRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get LTV */ getLoanLTVConvert( params?: GetLTVConvertRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Margin Coin Info @@ -21472,15 +22220,14 @@ getLoanMarginCoinInfo(params: GetEnsureCoinsRequestV3): Promise< productId: string; coinInfo: CoinInfoV3[]; }> - > { - return this.getPrivate('/api/v3/ins-loan/ensure-coins-convert', params); + > ⋮---- /** * Bind/Unbind UID to Risk Unit */ bindLoanUid( params: BindUidRequestV3, -): Promise> + ): Promise> ⋮---- /** * @@ -21493,63 +22240,63 @@ bindLoanUid( */ getLoanCoins( params?: GetLoanCoinsRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Loan Interest - Query estimated interest and borrowable amount */ getLoanInterest( params: GetLoanInterestRequestV3, -): Promise> + ): Promise> ⋮---- /** * Borrow - Borrow coins */ loanBorrow( params: LoanBorrowRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Borrow Ongoing - Query current borrowings */ getLoanBorrowOngoing( params?: GetLoanBorrowOngoingRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Borrow History - Query borrowing history */ getLoanBorrowHistory( params: GetLoanBorrowHistoryRequestV3, -): Promise> + ): Promise> ⋮---- /** * Repay - Repay coins */ loanRepay( params: LoanRepayRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Repay History - Query repayment history */ getLoanRepayHistory( params: GetLoanRepayHistoryRequestV3, -): Promise> + ): Promise> ⋮---- /** * Revise Pledge - Adjust collateral ratio */ loanRevisePledge( params: LoanRevisePledgeRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Pledge Rate History - Query collateral ratio history */ getLoanPledgeRateHistory( params: GetLoanPledgeRateHistoryRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Loan Debts - Query assets and liabilities @@ -21561,7 +22308,7 @@ getLoanDebts(): Promise> */ getLoanReduces( params: GetLoanReducesRequestV3, -): Promise> + ): Promise> ⋮---- /** * @@ -21574,28 +22321,28 @@ getLoanReduces( */ submitStrategyOrder( params: PlaceStrategyOrderRequestV3, -): Promise> + ): Promise> ⋮---- /** * Modify Strategy Order */ modifyStrategyOrder( params: ModifyStrategyOrderRequestV3, -): Promise> + ): Promise> ⋮---- /** * Cancel Strategy Order */ cancelStrategyOrder( params: CancelStrategyOrderRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Unfilled Strategy Orders */ getUnfilledStrategyOrders( params: GetUnfilledStrategyOrdersRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Strategy Order History @@ -21606,8 +22353,7 @@ getHistoryStrategyOrders(params: GetHistoryStrategyOrdersRequestV3): Promise< /** Observed as a number though the docs say string. */ cursor?: string | number; }> - > { - return this.getPrivate('/api/v3/trade/history-strategy-orders', params); + > ⋮---- /** Observed as a number though the docs say string. */ ⋮---- @@ -21616,8 +22362,7 @@ getStrategySubOrders(params: GetStrategySubOrdersRequestV3): Promise< list: StrategySubOrderV3[]; cursor?: string; }> - > { - return this.getPrivate('/api/v3/trade/strategy-sub-orders', params); + > ⋮---- /** * @@ -21627,59 +22372,59 @@ getStrategySubOrders(params: GetStrategySubOrdersRequestV3): Promise< ⋮---- validateGridBot( params: ValidateGridBotRequestV3, -): Promise> + ): Promise> ⋮---- createGridBot( params: CreateGridBotRequestV3, -): Promise> + ): Promise> ⋮---- modifyGridBot( params: ModifyGridBotRequestV3, -): Promise> + ): Promise> ⋮---- modifyGridInterval( params: ModifyGridIntervalRequestV3, -): Promise> + ): Promise> ⋮---- addGridInvestment( params: AddGridInvestmentRequestV3, -): Promise> + ): Promise> ⋮---- closeGridBot( params: CloseGridBotRequestV3, -): Promise> + ): Promise> ⋮---- getGridBotDetail( params: GetGridBotDetailRequestV3, -): Promise> + ): Promise> ⋮---- getGridBotOrderDetails( params: GetGridBotOrderDetailsRequestV3, -): Promise> + ): Promise> ⋮---- validateNeutralGridBot( params: ValidateNeutralGridBotRequestV3, -): Promise> + ): Promise> ⋮---- createNeutralGridBot( params: CreateNeutralGridBotRequestV3, -): Promise> + ): Promise> ⋮---- modifyNeutralGridBot( params: ModifyNeutralGridBotRequestV3, -): Promise> + ): Promise> ⋮---- modifyNeutralGridInterval( params: ModifyNeutralGridIntervalRequestV3, -): Promise> + ): Promise> ⋮---- getNeutralGridBotDetail( params: GetNeutralGridBotDetailRequestV3, -): Promise> + ): Promise> ⋮---- getNeutralGridBotOrderDetails( params: GetNeutralGridBotOrderDetailsRequestV3, -): Promise> + ): Promise> ⋮---- /** * @@ -21695,7 +22440,7 @@ getNeutralGridBotOrderDetails( */ createBrokerSubAccount( params: CreateBrokerSubAccountRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Broker Sub-Account List @@ -21705,7 +22450,7 @@ createBrokerSubAccount( */ getBrokerSubAccountList( params?: GetBrokerSubAccountListRequestV3, -): Promise> + ): Promise> ⋮---- /** * Modify Broker Sub-Account @@ -21715,7 +22460,7 @@ getBrokerSubAccountList( */ modifyBrokerSubAccount( params: ModifyBrokerSubAccountRequestV3, -): Promise> + ): Promise> ⋮---- /** * Broker Subaccount Withdrawal @@ -21728,7 +22473,7 @@ modifyBrokerSubAccount( */ brokerSubWithdrawal( params: BrokerSubWithdrawalRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Broker Subaccount Deposit Address @@ -21738,7 +22483,7 @@ brokerSubWithdrawal( */ getBrokerSubDepositAddress( params: GetBrokerSubDepositAddressRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get All Broker Subaccount Deposit Withdrawal @@ -21748,7 +22493,7 @@ getBrokerSubDepositAddress( */ getBrokerAllSubDepositWithdrawal( params?: GetBrokerAllSubDepositWithdrawalRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Broker Commission @@ -21758,7 +22503,7 @@ getBrokerAllSubDepositWithdrawal( */ getBrokerCommission( params?: GetBrokerCommissionRequestV3, -): Promise> + ): Promise> ⋮---- /** * Create Broker Sub-Account API Key @@ -21768,7 +22513,7 @@ getBrokerCommission( */ createBrokerSubApiKey( params: CreateBrokerSubApiKeyRequestV3, -): Promise> + ): Promise> ⋮---- /** * Modify Broker Sub-Account API Key @@ -21778,7 +22523,7 @@ createBrokerSubApiKey( */ modifyBrokerSubApiKey( params: ModifyBrokerSubApiKeyRequestV3, -): Promise> + ): Promise> ⋮---- /** * Delete Broker Subaccount Apikey @@ -21792,7 +22537,7 @@ modifyBrokerSubApiKey( */ deleteBrokerSubApiKey( params: DeleteBrokerSubApiKeyRequestV3, -): Promise> + ): Promise> ⋮---- /** * Get Broker Sub-Account API Key @@ -21802,7 +22547,127 @@ deleteBrokerSubApiKey( */ getBrokerSubApiKey( params: GetBrokerSubApiKeyRequestV3, -): Promise> + ): Promise> +⋮---- +/** + * + * =====Affiliate===== + * + */ +⋮---- +/** + * Get Agent Customer List. Rate limit: 10/sec/UID. + * Without startTime/endTime, returns all registered customers (no time restriction). + */ +getAgentCustomerList( + params?: AgentCustomerListRequestV3, + ): Promise> +⋮---- +/** + * Get Agent Customer Asset. Rate limit: 10/sec/UID. + */ +getAgentCustomerAssets( + params?: AgentCustomerAssetRequestV3, + ): Promise> +⋮---- +/** + * Get Agent Customer Trade Volume. Rate limit: 10/sec/UID. + */ +getAgentCustomerTradeVolume( + params?: AgentCustomerTradeVolumeRequestV3, + ): Promise> +⋮---- +/** + * Get Agent Customer Deposit. Rate limit: 10/sec/UID. + */ +getAgentCustomerDeposits( + params?: AgentCustomerDepositRequestV3, + ): Promise> +⋮---- +/** + * Get Agent Customer Kyc Result. Rate limit: 10/sec/UID. + */ +getAgentCustomerKycResult( + params?: GetAgentCustomerKycResultRequestV3, + ): Promise> +⋮---- +/** + * Get Agent Customer Commission. Rate limit: 10/sec/UID. + */ +getAgentCustomerCommissions( + params?: GetAgentCustomerCommissionsRequestV3, + ): Promise> +⋮---- +/** + * Get Agent Sub Customer List. Rate limit: 10/sec/UID. + * Without startTime/endTime, returns all registered customers (no time restriction). + */ +getAgentSubCustomerList( + params?: GetAgentSubCustomerListRequestV3, + ): Promise> +⋮---- +/** + * Get Sub Affiliate Info. Rate limit: 10/sec/UID. + */ +getSubAffiliateInfo( + params?: GetSubAffiliateInfoRequestV3, + ): Promise> +⋮---- +/** + * Get Sub Affiliate Commission. Rate limit: 10/sec/UID. + */ +getSubAffiliateCommission( + params?: GetSubAffiliateCommissionRequestV3, + ): Promise> +⋮---- +/** + * + * =====Broker | Email and Commissions===== + * + */ +⋮---- +/** + * Modify Subaccount Email. Rate limit: 10/sec/UID. + */ +modifySubaccountEmail( + params: ModifySubaccountEmailRequestV3, + ): Promise> +⋮---- +/** + * Get Subaccount Email. Rate limit: 10/sec/UID. + */ +getSubaccountEmail( + params: GetSubaccountEmailRequestV3, + ): Promise> +⋮---- +/** + * Get Broker Trade Volume. Rate limit: 5/sec/UID. + * Contact your BD or RM to apply for access permissions. + */ +getBrokerTradeVolume( + params?: GetBrokerTradeVolumeRequestV3, + ): Promise> +⋮---- +/** + * Get Total Commission. Rate limit: 20/sec/UID. + */ +getBrokerTotalCommission( + params?: GetBrokerTotalCommissionRequestV3, + ): Promise> +⋮---- +/** + * Get Order Commission. Rate limit: 20/sec/UID. + */ +getBrokerOrderCommission( + params?: GetBrokerOrderCommissionRequestV3, + ): Promise> +⋮---- +/** + * Get Rebate Info. Rate limit: 20/sec/UID. + */ +getBrokerRebateInfo( + params: GetBrokerRebateInfoRequestV3, + ): Promise> ⋮---- /** * @@ -21812,23 +22677,23 @@ getBrokerSubApiKey( ⋮---- getP2pAdList( params: GetP2pAdListRequestV3, -): Promise> + ): Promise> ⋮---- getP2pExchangeRate( params: GetP2pExchangeRateRequestV3, -): Promise> + ): Promise> ⋮---- simulateP2pFee( params: P2pFeeSimulateRequestV3, -): Promise> + ): Promise> ⋮---- getP2pAdLimit( params: GetP2pAdLimitRequestV3, -): Promise> + ): Promise> ⋮---- createP2pAd( params: CreateP2pAdRequestV3, -): Promise> + ): Promise> ⋮---- updateP2pAd(params: UpdateP2pAdRequestV3): Promise> ⋮---- @@ -21836,31 +22701,31 @@ operateP2pAd(params: OperateP2pAdRequestV3): Promise> ⋮---- getP2pAdInfo( params: GetP2pAdInfoRequestV3, -): Promise> + ): Promise> ⋮---- getP2pMyAds( params?: GetP2pMyAdsRequestV3, -): Promise>> + ): Promise>> ⋮---- getP2pPendingOrders( params?: GetP2pPendingOrdersRequestV3, -): Promise>> + ): Promise>> ⋮---- getP2pAllOrders( params?: GetP2pAllOrdersRequestV3, -): Promise>> + ): Promise>> ⋮---- getP2pOrderInfo( params: GetP2pOrderInfoRequestV3, -): Promise> + ): Promise> ⋮---- confirmP2pOrderPayment( params: P2pOrderActionRequestV3, -): Promise> + ): Promise> ⋮---- releaseP2pOrderAsset( params: P2pOrderActionRequestV3, -): Promise> + ): Promise> ⋮---- getP2pUserInfo(): Promise> ⋮---- @@ -21870,7 +22735,127 @@ getP2pPayMethods(): Promise> ⋮---- getP2pBalance( params: GetP2pBalanceRequestV3, -): Promise> + ): Promise> +⋮---- +/** + * + * =====Earn | Savings (UTA)===== + * + */ +⋮---- +/** + * Get Savings Product List. Rate limit: 10/sec/UID. + */ +getEarnSavingsProducts( + params?: GetEarnSavingsProductsRequestV3, + ): Promise> +⋮---- +/** + * Savings Account. Rate limit: 10/sec/UID. + */ +getEarnSavingsAccount(): Promise> +⋮---- +/** + * Savings Assets. Rate limit: 10/sec/UID. + */ +getEarnSavingsAssets( + params: GetEarnSavingsAssetsRequestV3, + ): Promise> +⋮---- +/** + * Savings Records. Rate limit: 10/sec/UID. + */ +getEarnSavingsRecords( + params: GetEarnSavingsRecordsRequestV3, + ): Promise> +⋮---- +/** + * Savings Subscription Detail. Rate limit: 10/sec/UID. + */ +getEarnSavingsSubscription( + params: GetEarnSavingsSubscriptionRequestV3, + ): Promise> +⋮---- +/** + * Subscribe Savings. Rate limit: 10/sec/UID. + */ +earnSubscribeSavings( + params: SubscribeSavingsRequestV3, + ): Promise> +⋮---- +/** + * Savings Subscription Result. Rate limit: 10/sec/UID. + */ +getEarnSavingsSubscriptionResult( + params: GetEarnSavingsSubscriptionResultRequestV3, + ): Promise> +⋮---- +/** + * Redeem Savings. Rate limit: 10/sec/UID. + */ +earnRedeemSavings( + params: RedeemSavingsRequestV3, + ): Promise> +⋮---- +/** + * Savings Redemption Results. Rate limit: 10/sec/UID. + */ +getEarnSavingsRedemptionResult( + params: GetEarnSavingsRedemptionResultRequestV3, + ): Promise> +⋮---- +/** + * + * =====Earn | SharkFin (UTA)===== + * + */ +⋮---- +/** + * Get Sharkfin Products. Rate limit: 10/sec/UID. + */ +getSharkfinProducts( + params: GetSharkfinProductsRequestV3, + ): Promise> +⋮---- +/** + * SharkFin Account. Rate limit: 10/sec/UID. + */ +getSharkfinAccount(): Promise> +⋮---- +/** + * SharkFin Assets. Rate limit: 10/sec/UID. + */ +getSharkfinAssets( + params: GetSharkfinAssetsRequestV3, + ): Promise> +⋮---- +/** + * SharkFin Records. Rate limit: 10/sec/UID. + */ +getSharkfinRecords( + params: GetSharkfinRecordsRequestV3, + ): Promise> +⋮---- +/** + * SharkFin Subscription Detail. Rate limit: 10/sec/UID. + */ +getSharkfinSubscription( + params: GetSharkfinSubscriptionRequestV3, + ): Promise> +⋮---- +/** + * Subscribe SharkFin. Rate limit: 10/sec/UID. + */ +subscribeSharkfin( + params: SubscribeSharkfinRequestV3, + ): Promise> +⋮---- +/** + * SharkFin Subscription Result. Rate limit: 5/sec/UID. + */ +getSharkfinSubscriptionResult( + params: GetSharkfinSubscriptionResultRequestV3, + ): Promise> ⋮---- /** * @@ -21884,27 +22869,27 @@ getEarnEliteAssets(): Promise> ⋮---- getEarnEliteRecords( params: GetEarnEliteRecordsRequestV3, -): Promise> + ): Promise> ⋮---- getEarnEliteSubscribeInfo( params: GetEarnEliteSubscribeInfoRequestV3, -): Promise> + ): Promise> ⋮---- subscribeEarnElite( params: EarnEliteSubscribeRequestV3, -): Promise> + ): Promise> ⋮---- getEarnEliteSubscribeResult( params: GetEarnEliteSubscribeResultRequestV3, -): Promise> + ): Promise> ⋮---- getEarnEliteRedeemInfo( params: GetEarnEliteRedeemInfoRequestV3, -): Promise> + ): Promise> ⋮---- redeemEarnElite( params: RedeemEarnEliteRequestV3, -): Promise> + ): Promise> ⋮---- /** * @@ -21919,22 +22904,21 @@ redeemEarnElite( */ getEarnCashPlusSubscribeInfo(): Promise< APIResponse - > { - return this.getPrivate('/api/v3/earn/cashplus/subscribe-info'); + > ⋮---- /** * Subscribe to Cash+. Rate limit: 1/sec/UID. */ subscribeEarnCashPlus( params: EarnCashPlusSubscribeRequestV3, -): Promise> + ): Promise> ⋮---- /** * Result of a Cash+ subscription order. Rate limit: 10/sec/UID. */ getEarnCashPlusSubscribeResult( params: GetEarnCashPlusSubscribeResultRequestV3, -): Promise> + ): Promise> ⋮---- /** * Cash+ redemption prerequisites: credited coins and the redeemable position. @@ -21947,14 +22931,14 @@ getEarnCashPlusRedeemInfo(): Promise> */ redeemEarnCashPlus( params: EarnCashPlusRedeemRequestV3, -): Promise> + ): Promise> ⋮---- /** * Result of a Cash+ redemption order. Rate limit: 10/sec/UID. */ getEarnCashPlusRedeemResult( params: GetEarnCashPlusRedeemResultRequestV3, -): Promise> + ): Promise> ⋮---- /** * Cash+ holding, cumulative profit, and APR. Rate limit: 10/sec/UID. @@ -21966,14 +22950,14 @@ getEarnCashPlusPositions(): Promise> */ getEarnCashPlusHistoryOrders( params?: GetEarnCashPlusHistoryOrdersRequestV3, -): Promise> + ): Promise> ================ File: package.json ================ { "name": "bitget-api", - "version": "3.2.7", + "version": "3.2.8", "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/package-lock.json b/package-lock.json index 7ec7afb..5c36a31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bitget-api", - "version": "3.2.7", + "version": "3.2.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "bitget-api", - "version": "3.2.7", + "version": "3.2.8", "license": "MIT", "dependencies": { "@types/ws": "8.18.1", diff --git a/package.json b/package.json index 9e42538..d0da1f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bitget-api", - "version": "3.2.7", + "version": "3.2.8", "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 4ea6674..e5454fe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,6 +10,7 @@ export * from './types/request/v2/futures.js'; export * from './types/request/v2/margin.js'; export * from './types/request/v2/spot.js'; export * from './types/request/v3/account.js'; +export * from './types/request/v3/affiliate.js'; export * from './types/request/v3/broker.js'; export * from './types/request/v3/cfd.js'; export * from './types/request/v3/copytrading.js'; @@ -30,6 +31,7 @@ export * from './types/response/v2/futures.js'; export * from './types/response/v2/margin.js'; export * from './types/response/v2/spot.js'; export * from './types/response/v3/account.js'; +export * from './types/response/v3/affiliate.js'; export * from './types/response/v3/broker.js'; export * from './types/response/v3/cfd.js'; export * from './types/response/v3/copytrading.js'; diff --git a/src/rest-client-v2.ts b/src/rest-client-v2.ts index 7081848..0315fd1 100644 --- a/src/rest-client-v2.ts +++ b/src/rest-client-v2.ts @@ -1758,7 +1758,11 @@ export class RestClientV2 extends BaseRestClient { getFuturesOpenOrders(params: FuturesGetOpenOrdersRequestV2): Promise< APIResponse<{ - entrustedList: FuturesOpenOrderV2[]; + /** + * Undocumented but staff-confirmed: null and [] can both represent an empty page. + * @see https://t.me/bitgetOpenapi/153977 + */ + entrustedList: FuturesOpenOrderV2[] | null; endId: string; }> > { @@ -1844,7 +1848,11 @@ export class RestClientV2 extends BaseRestClient { getFuturesPlanOrders(params: FuturesGetPlanOrdersRequestV2): Promise< APIResponse<{ - entrustedList: FuturesPendingPlanOrderV2[]; + /** + * Undocumented but staff-confirmed: null and [] can both represent an empty page. + * @see https://t.me/bitgetOpenapi/153977 + */ + entrustedList: FuturesPendingPlanOrderV2[] | null; endId: string; }> > { diff --git a/src/rest-client-v3.ts b/src/rest-client-v3.ts index 1c63c3f..c04d69c 100644 --- a/src/rest-client-v3.ts +++ b/src/rest-client-v3.ts @@ -60,6 +60,17 @@ import { UpdateSubAccountApiKeyRequestV3, WithdrawRequestV3, } from './types/request/v3/account.js'; +import { + AgentCustomerAssetRequestV3, + AgentCustomerDepositRequestV3, + AgentCustomerListRequestV3, + AgentCustomerTradeVolumeRequestV3, + GetAgentCustomerCommissionsRequestV3, + GetAgentCustomerKycResultRequestV3, + GetAgentSubCustomerListRequestV3, + GetSubAffiliateCommissionRequestV3, + GetSubAffiliateInfoRequestV3, +} from './types/request/v3/affiliate.js'; import { BrokerSubWithdrawalRequestV3, CreateBrokerSubAccountRequestV3, @@ -67,11 +78,17 @@ import { DeleteBrokerSubApiKeyRequestV3, GetBrokerAllSubDepositWithdrawalRequestV3, GetBrokerCommissionRequestV3, + GetBrokerOrderCommissionRequestV3, + GetBrokerRebateInfoRequestV3, GetBrokerSubAccountListRequestV3, GetBrokerSubApiKeyRequestV3, GetBrokerSubDepositAddressRequestV3, + GetBrokerTotalCommissionRequestV3, + GetBrokerTradeVolumeRequestV3, + GetSubaccountEmailRequestV3, ModifyBrokerSubAccountRequestV3, ModifyBrokerSubApiKeyRequestV3, + ModifySubaccountEmailRequestV3, } from './types/request/v3/broker.js'; import { CancelAllCfdOrdersRequestV3, @@ -126,7 +143,21 @@ import { GetEarnEliteRedeemInfoRequestV3, GetEarnEliteSubscribeInfoRequestV3, GetEarnEliteSubscribeResultRequestV3, + GetEarnSavingsAssetsRequestV3, + GetEarnSavingsProductsRequestV3, + GetEarnSavingsRecordsRequestV3, + GetEarnSavingsRedemptionResultRequestV3, + GetEarnSavingsSubscriptionRequestV3, + GetEarnSavingsSubscriptionResultRequestV3, + GetSharkfinAssetsRequestV3, + GetSharkfinProductsRequestV3, + GetSharkfinRecordsRequestV3, + GetSharkfinSubscriptionRequestV3, + GetSharkfinSubscriptionResultRequestV3, RedeemEarnEliteRequestV3, + RedeemSavingsRequestV3, + SubscribeSavingsRequestV3, + SubscribeSharkfinRequestV3, } from './types/request/v3/earn.js'; import { AddGridInvestmentRequestV3, @@ -237,6 +268,7 @@ import { GetStockPlusHistoryExecutionsRequestV3, GetStockPlusHistoryOrdersRequestV3, GetStockPlusIntradayRequestV3, + GetStockPlusMaxPurchaseRequestV3, GetStockPlusOptionChainInfoRequestV3, GetStockPlusOptionExpiryDateRequestV3, GetStockPlusOptionQuoteRequestV3, @@ -331,10 +363,25 @@ import { WithdrawRecordV3, WithdrawResponseV3, } from './types/response/v3/account.js'; +import { + AgentCustomerAssetItemV3, + AgentCustomerCommissionsV3, + AgentCustomerDepositItemV3, + AgentCustomerKycResultV3, + AgentCustomerListItemV3, + AgentCustomerTradeVolumeItemV3, + AgentSubCustomerListV3, + SubAffiliateCommissionV3, + SubAffiliateInfoV3, +} from './types/response/v3/affiliate.js'; import { BrokerCommissionRecordV3, + BrokerOrderCommissionV3, + BrokerRebateInfoV3, BrokerSubDepositAddressV3, BrokerSubWithdrawalResponseV3, + BrokerTotalCommissionV3, + BrokerTradeVolumeV3, CreateBrokerSubAccountResponseV3, CreateBrokerSubApiKeyResponseV3, GetBrokerAllSubDepositWithdrawalResponseV3, @@ -342,6 +389,8 @@ import { GetBrokerSubApiKeyResponseV3, ModifyBrokerSubAccountResponseV3, ModifyBrokerSubApiKeyResponseV3, + ModifySubaccountEmailResponseV3, + SubaccountEmailV3, } from './types/response/v3/broker.js'; import { CfdCandlestickV3, @@ -394,7 +443,23 @@ import { EarnEliteSubscribeInfoV3, EarnEliteSubscribeResultV3, EarnEliteSubscribeStatusV3, + EarnSavingsAccountV3, + EarnSavingsAssetsV3, + EarnSavingsProductV3, + EarnSavingsRecordsV3, + EarnSavingsRedemptionResultV3, + EarnSavingsSubscriptionDetailV3, + EarnSavingsSubscriptionResultV3, + EarnSharkfinAccountV3, + EarnSharkfinAssetsV3, + EarnSharkfinProductsV3, + EarnSharkfinRecordsV3, + EarnSharkfinSubscriptionDetailV3, + EarnSharkfinSubscriptionResultV3, RedeemEarnEliteResultV3, + RedeemSavingsResponseV3, + SubscribeSavingsResponseV3, + SubscribeSharkfinResponseV3, } from './types/response/v3/earn.js'; import { GridBotDetailV3, @@ -509,6 +574,7 @@ import { StockPlusHistoryExecutionsV3, StockPlusHistoryOrdersV3, StockPlusIntradayV3, + StockPlusMaxPurchaseV3, StockPlusModifyOrderResponseV3, StockPlusOptionChainInfoV3, StockPlusOptionExpiryDateV3, @@ -1447,6 +1513,12 @@ export class RestClientV3 extends BaseRestClient { return this.getPrivate('/api/v3/stockplus/trade/order-detail', params); } + getStockPlusMaxPurchase( + params: GetStockPlusMaxPurchaseRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/stockplus/trade/max-purchase', params); + } + getStockPlusTodayExecutions( params?: GetStockPlusTodayExecutionsRequestV3, ): Promise> { @@ -1721,8 +1793,13 @@ export class RestClientV3 extends BaseRestClient { */ getFinancialRecords(params: GetFinancialRecordsRequestV3): Promise< APIResponse<{ - list: FinancialRecordV3[]; - cursor: string; + /** + * Undocumented but staff-confirmed: null when there are no records. + * @see https://t.me/bitgetOpenapi/153704 + */ + list: FinancialRecordV3[] | null; + /** Undocumented but staff-confirmed: null when pagination is exhausted. */ + cursor: string | null; }> > { return this.getPrivate('/api/v3/account/financial-records', params); @@ -2443,7 +2520,11 @@ export class RestClientV3 extends BaseRestClient { */ getCurrentPosition(params: GetCurrentPositionRequestV3): Promise< APIResponse<{ - list: CurrentPositionV3[]; + /** + * Undocumented but staff-confirmed: null when there are no matching positions. + * @see https://t.me/bitgetOpenapi/153786 + */ + list: CurrentPositionV3[] | null; }> > { return this.getPrivate('/api/v3/position/current-position', params); @@ -2985,6 +3066,159 @@ export class RestClientV3 extends BaseRestClient { return this.getPrivate('/api/v3/broker/query-sub-apikey', params); } + /** + * + * =====Affiliate===== + * + */ + + /** + * Get Agent Customer List. Rate limit: 10/sec/UID. + * Without startTime/endTime, returns all registered customers (no time restriction). + */ + getAgentCustomerList( + params?: AgentCustomerListRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/affiliate/customer-list', params); + } + + /** + * Get Agent Customer Asset. Rate limit: 10/sec/UID. + */ + getAgentCustomerAssets( + params?: AgentCustomerAssetRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/affiliate/customer-asset', params); + } + + /** + * Get Agent Customer Trade Volume. Rate limit: 10/sec/UID. + */ + getAgentCustomerTradeVolume( + params?: AgentCustomerTradeVolumeRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/affiliate/customer-trade-volume', params); + } + + /** + * Get Agent Customer Deposit. Rate limit: 10/sec/UID. + */ + getAgentCustomerDeposits( + params?: AgentCustomerDepositRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/affiliate/customer-deposit', params); + } + + /** + * Get Agent Customer Kyc Result. Rate limit: 10/sec/UID. + */ + getAgentCustomerKycResult( + params?: GetAgentCustomerKycResultRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/affiliate/customer-kyc-result', params); + } + + /** + * Get Agent Customer Commission. Rate limit: 10/sec/UID. + */ + getAgentCustomerCommissions( + params?: GetAgentCustomerCommissionsRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/affiliate/customer-commission', params); + } + + /** + * Get Agent Sub Customer List. Rate limit: 10/sec/UID. + * Without startTime/endTime, returns all registered customers (no time restriction). + */ + getAgentSubCustomerList( + params?: GetAgentSubCustomerListRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/affiliate/sub-customer-list', params); + } + + /** + * Get Sub Affiliate Info. Rate limit: 10/sec/UID. + */ + getSubAffiliateInfo( + params?: GetSubAffiliateInfoRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/affiliate/sub-affiliate-info', params); + } + + /** + * Get Sub Affiliate Commission. Rate limit: 10/sec/UID. + */ + getSubAffiliateCommission( + params?: GetSubAffiliateCommissionRequestV3, + ): Promise> { + return this.getPrivate( + '/api/v3/affiliate/sub-affiliate-commission', + params, + ); + } + + /** + * + * =====Broker | Email and Commissions===== + * + */ + + /** + * Modify Subaccount Email. Rate limit: 10/sec/UID. + */ + modifySubaccountEmail( + params: ModifySubaccountEmailRequestV3, + ): Promise> { + return this.postPrivate('/api/v3/broker/modify-subaccount-email', params); + } + + /** + * Get Subaccount Email. Rate limit: 10/sec/UID. + */ + getSubaccountEmail( + params: GetSubaccountEmailRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/broker/subaccount-email', params); + } + + /** + * Get Broker Trade Volume. Rate limit: 5/sec/UID. + * Contact your BD or RM to apply for access permissions. + */ + getBrokerTradeVolume( + params?: GetBrokerTradeVolumeRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/broker/trade-volume', params); + } + + /** + * Get Total Commission. Rate limit: 20/sec/UID. + */ + getBrokerTotalCommission( + params?: GetBrokerTotalCommissionRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/broker/total-commission', params); + } + + /** + * Get Order Commission. Rate limit: 20/sec/UID. + */ + getBrokerOrderCommission( + params?: GetBrokerOrderCommissionRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/broker/order-commission', params); + } + + /** + * Get Rebate Info. Rate limit: 20/sec/UID. + */ + getBrokerRebateInfo( + params: GetBrokerRebateInfoRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/broker/rebate-info', params); + } + /** * * =====P2P Merchant (UTA)===== @@ -3089,6 +3323,158 @@ export class RestClientV3 extends BaseRestClient { return this.getPrivate('/api/v3/p2p/balance', params); } + /** + * + * =====Earn | Savings (UTA)===== + * + */ + + /** + * Get Savings Product List. Rate limit: 10/sec/UID. + */ + getEarnSavingsProducts( + params?: GetEarnSavingsProductsRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/savings/product', params); + } + + /** + * Savings Account. Rate limit: 10/sec/UID. + */ + getEarnSavingsAccount(): Promise> { + return this.getPrivate('/api/v3/earn/savings/account'); + } + + /** + * Savings Assets. Rate limit: 10/sec/UID. + */ + getEarnSavingsAssets( + params: GetEarnSavingsAssetsRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/savings/assets', params); + } + + /** + * Savings Records. Rate limit: 10/sec/UID. + */ + getEarnSavingsRecords( + params: GetEarnSavingsRecordsRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/savings/records', params); + } + + /** + * Savings Subscription Detail. Rate limit: 10/sec/UID. + */ + getEarnSavingsSubscription( + params: GetEarnSavingsSubscriptionRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/savings/subscribe-info', params); + } + + /** + * Subscribe Savings. Rate limit: 10/sec/UID. + */ + earnSubscribeSavings( + params: SubscribeSavingsRequestV3, + ): Promise> { + return this.postPrivate('/api/v3/earn/savings/subscribe', params); + } + + /** + * Savings Subscription Result. Rate limit: 10/sec/UID. + */ + getEarnSavingsSubscriptionResult( + params: GetEarnSavingsSubscriptionResultRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/savings/subscribe-result', params); + } + + /** + * Redeem Savings. Rate limit: 10/sec/UID. + */ + earnRedeemSavings( + params: RedeemSavingsRequestV3, + ): Promise> { + return this.postPrivate('/api/v3/earn/savings/redeem', params); + } + + /** + * Savings Redemption Results. Rate limit: 10/sec/UID. + */ + getEarnSavingsRedemptionResult( + params: GetEarnSavingsRedemptionResultRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/savings/redeem-result', params); + } + + /** + * + * =====Earn | SharkFin (UTA)===== + * + */ + + /** + * Get Sharkfin Products. Rate limit: 10/sec/UID. + */ + getSharkfinProducts( + params: GetSharkfinProductsRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/sharkfin/product', params); + } + + /** + * SharkFin Account. Rate limit: 10/sec/UID. + */ + getSharkfinAccount(): Promise> { + return this.getPrivate('/api/v3/earn/sharkfin/account'); + } + + /** + * SharkFin Assets. Rate limit: 10/sec/UID. + */ + getSharkfinAssets( + params: GetSharkfinAssetsRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/sharkfin/assets', params); + } + + /** + * SharkFin Records. Rate limit: 10/sec/UID. + */ + getSharkfinRecords( + params: GetSharkfinRecordsRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/sharkfin/records', params); + } + + /** + * SharkFin Subscription Detail. Rate limit: 10/sec/UID. + */ + getSharkfinSubscription( + params: GetSharkfinSubscriptionRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/sharkfin/subscribe-info', params); + } + + /** + * Subscribe SharkFin. Rate limit: 10/sec/UID. + */ + subscribeSharkfin( + params: SubscribeSharkfinRequestV3, + ): Promise> { + return this.postPrivate('/api/v3/earn/sharkfin/subscribe', params); + } + + /** + * SharkFin Subscription Result. Rate limit: 5/sec/UID. + */ + getSharkfinSubscriptionResult( + params: GetSharkfinSubscriptionResultRequestV3, + ): Promise> { + return this.getPrivate('/api/v3/earn/sharkfin/subscribe-result', params); + } + /** * * =====Earn | On-Chain Elite (UTA)===== diff --git a/src/types/request/v2/futures.ts b/src/types/request/v2/futures.ts index 348e7cc..05a5820 100644 --- a/src/types/request/v2/futures.ts +++ b/src/types/request/v2/futures.ts @@ -284,6 +284,7 @@ export interface FuturesGetOpenOrdersRequestV2 { clientOid?: string; symbol?: string; productType: FuturesProductTypeV2; + /** Defaults to live; query partially_filled separately to include partially filled orders. */ status?: 'live' | 'partially_filled'; idLessThan?: string; startTime?: string; @@ -444,6 +445,7 @@ export interface FuturesGetPlanOrdersRequestV2 { orderId?: string; clientOid?: string; symbol?: string; + /** A single plan type per request; comma-separated values are not supported. */ planType: 'normal_plan' | 'track_plan' | 'profit_loss'; productType: FuturesProductTypeV2; idLessThan?: string; diff --git a/src/types/request/v3/account.ts b/src/types/request/v3/account.ts index f696f92..c5c44b3 100644 --- a/src/types/request/v3/account.ts +++ b/src/types/request/v3/account.ts @@ -339,6 +339,7 @@ export interface SubAccountTransferRequestV3 { coin: string; fromUserId: string; toUserId: string; + /** Custom order ID, max 50 characters */ clientOid: string; /** Enable automatic margin borrowing when balance insufficient. yes | no */ allowBorrow?: 'yes' | 'no'; diff --git a/src/types/request/v3/affiliate.ts b/src/types/request/v3/affiliate.ts new file mode 100644 index 0000000..1f9a0c5 --- /dev/null +++ b/src/types/request/v3/affiliate.ts @@ -0,0 +1,91 @@ +/** + * + * + * Affiliate + * + * + */ + +export interface AgentCustomerListRequestV3 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + referralCode?: string; +} + +export interface AgentCustomerAssetRequestV3 { + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; +} + +export interface AgentCustomerTradeVolumeRequestV3 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; +} + +export interface AgentCustomerDepositRequestV3 { + startTime?: string; + endTime?: string; + pageNo?: string; + pageSize?: string; + uid?: string; + showSub?: 'yes' | 'no'; +} + +export interface GetAgentCustomerKycResultRequestV3 { + startTime?: string; + endTime?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; + limit?: string; + uid?: string; + showSub?: 'yes' | 'no'; +} + +export interface GetAgentCustomerCommissionsRequestV3 { + startTime?: string; + endTime?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; + limit?: string; + uid?: string; + coin?: string; + symbol?: string; + showSub?: 'yes' | 'no'; +} + +export interface GetAgentSubCustomerListRequestV3 { + startTime?: string; + endTime?: string; + /** Pass minId from the previous response. Omit on the first page. */ + cursor?: string; + limit?: string; + uid?: string; + showSub?: 'yes' | 'no'; +} + +export interface GetSubAffiliateInfoRequestV3 { + uid?: string; + startTime?: string; + endTime?: string; + /** Pass endId from the previous response. Omit on the first page. */ + idLessThan?: string; + limit?: string; + includeDownLine?: 'yes' | 'no'; +} + +export interface GetSubAffiliateCommissionRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; +} diff --git a/src/types/request/v3/broker.ts b/src/types/request/v3/broker.ts index 7b2e74c..4cdc0c8 100644 --- a/src/types/request/v3/broker.ts +++ b/src/types/request/v3/broker.ts @@ -81,3 +81,46 @@ export interface DeleteBrokerSubApiKeyRequestV3 { export interface GetBrokerSubApiKeyRequestV3 { subUid: string; } + +/** + * + * + * Broker | Email and Commissions + * + * + */ + +export interface ModifySubaccountEmailRequestV3 { + subUid: string; + subaccountEmail: string; +} + +export interface GetSubaccountEmailRequestV3 { + subUid: string; +} + +export interface GetBrokerTradeVolumeRequestV3 { + startTime?: string; + endTime?: string; + pageSize?: string; + pageNo?: string; +} + +export interface GetBrokerTotalCommissionRequestV3 { + startTime?: string; + endTime?: string; +} + +export interface GetBrokerOrderCommissionRequestV3 { + startTime?: string; + endTime?: string; + limit?: string; + uid?: string; + orderid?: string; + /** Pass endId from the previous response. Omit on the first page. */ + idLessThan?: string; +} + +export interface GetBrokerRebateInfoRequestV3 { + uid: string; +} diff --git a/src/types/request/v3/earn.ts b/src/types/request/v3/earn.ts index 12adfec..004c119 100644 --- a/src/types/request/v3/earn.ts +++ b/src/types/request/v3/earn.ts @@ -97,3 +97,112 @@ export interface GetEarnCashPlusHistoryOrdersRequestV3 { /** Pass nextCursor from the previous page. Omit on the first page */ cursor?: string; } + +/** + * + * + * Earn | Savings (UTA) + * + * + */ + +export interface GetEarnSavingsProductsRequestV3 { + coin?: string; + filter?: 'available' | 'held' | 'available_and_held' | 'all'; +} + +export interface GetEarnSavingsAssetsRequestV3 { + periodType: 'flexible' | 'fixed'; + startTime?: string; + endTime?: string; + limit?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; +} + +export interface GetEarnSavingsRecordsRequestV3 { + coin?: string; + periodType: 'flexible' | 'fixed'; + orderType?: 'subscribe' | 'redeem' | 'pay_interest' | 'deduction'; + startTime?: string; + endTime?: string; + limit?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; +} + +export interface GetEarnSavingsSubscriptionRequestV3 { + productId: string; + periodType: 'flexible' | 'fixed'; +} + +export interface SubscribeSavingsRequestV3 { + productId: string; + periodType: 'flexible' | 'fixed'; + amount: string; +} + +export interface GetEarnSavingsSubscriptionResultRequestV3 { + orderId: string; + periodType: 'flexible' | 'fixed'; +} + +export interface RedeemSavingsRequestV3 { + productId: string; + /** Assets order ID returned by getEarnSavingsAssets */ + orderId?: string; + periodType: 'flexible' | 'fixed'; + amount: string; +} + +export interface GetEarnSavingsRedemptionResultRequestV3 { + orderId: string; + periodType: 'flexible' | 'fixed'; +} + +/** + * + * + * Earn | SharkFin (UTA) + * + * + */ + +export interface GetSharkfinProductsRequestV3 { + coin: string; + limit?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; +} + +export interface GetSharkfinAssetsRequestV3 { + status: 'subscribed' | 'settled'; + startTime?: string; + endTime?: string; + limit?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; +} + +export interface GetSharkfinRecordsRequestV3 { + coin?: string; + type: 'subscription' | 'redemption' | 'interest'; + startTime?: string; + endTime?: string; + limit?: string; + /** Pass endId from the previous response. Omit on the first page. */ + cursor?: string; +} + +export interface GetSharkfinSubscriptionRequestV3 { + productId: string; +} + +export interface SubscribeSharkfinRequestV3 { + productId: string; + amount: string; +} + +export interface GetSharkfinSubscriptionResultRequestV3 { + orderId: string; +} diff --git a/src/types/request/v3/stockplus.ts b/src/types/request/v3/stockplus.ts index 2817d00..27e7d7f 100644 --- a/src/types/request/v3/stockplus.ts +++ b/src/types/request/v3/stockplus.ts @@ -122,6 +122,15 @@ export interface GetStockPlusOrderDetailRequestV3 { orderId: string; } +export interface GetStockPlusMaxPurchaseRequestV3 { + symbol: string; + orderType: 'LO' | 'MO' | 'LIT' | 'MIT' | 'TSLPAMT' | 'TSLPPCT'; + side: 'Buy' | 'Sell'; + price?: string; + currency?: string; + orderId?: string; +} + export interface GetStockPlusTodayExecutionsRequestV3 { symbol?: string; orderId?: string; diff --git a/src/types/request/v3/trade.ts b/src/types/request/v3/trade.ts index d6541a7..74ff344 100644 --- a/src/types/request/v3/trade.ts +++ b/src/types/request/v3/trade.ts @@ -181,12 +181,13 @@ export interface PlaceRealityOrderRequestV3 { price?: string; clientOid?: string; /** - * rToken routing. internalization = on-exchange pool only. - * lit_market (default) = internal first, then the public market. - * The 13 Oct changelog applies this to place-reality-order as well. - * The place-reality-order parameter table does not list it yet. + * rToken routing. Accepted: internal_market | lit_market. Omit for default. + * internal_market = on-exchange only (not submitted to the U.S. stock broker). + * lit_market = broker only (not matched on-exchange). + * Omit / default = internal first at best price, then unfilled to broker. + * Live since 5 Nov 2026 (internalization renamed; old lit_market meaning is now default). */ - venue?: 'internalization' | 'lit_market'; + venue?: 'internal_market' | 'lit_market'; /** * rToken time in force. gtd (default) = current session. * gtc = 90 days. Same changelog note as venue. @@ -275,11 +276,14 @@ export interface PlaceOrderRequestV3 { /** Market orders only. Decimal, default 0.02, range 0.01-0.05 */ slippageTolerance?: string; /** - * rToken routing. internalization = on-exchange pool only. - * lit_market (default) = internal first, then the public market. + * rToken routing. Accepted: internal_market | lit_market. Omit for default. + * internal_market = on-exchange only (not submitted to the U.S. stock broker). + * lit_market = broker only (not matched on-exchange). + * Omit / default = internal first at best price, then unfilled to broker. * Ignored for non-rToken symbols. timeInForce is also ignored for rToken. + * Live since 5 Nov 2026 (internalization renamed; old lit_market meaning is now default). */ - venue?: 'internalization' | 'lit_market'; + venue?: 'internal_market' | 'lit_market'; /** * rToken time in force. gtd (default) lasts the current session. * gtc lasts 90 days. Ignored for non-rToken symbols. diff --git a/src/types/response/v3/affiliate.ts b/src/types/response/v3/affiliate.ts new file mode 100644 index 0000000..fcfbc60 --- /dev/null +++ b/src/types/response/v3/affiliate.ts @@ -0,0 +1,134 @@ +/** + * + * + * Affiliate + * https://www.bitget.com/docs/catalog/affiliate/affiliate + * + * + */ + +export interface AgentCustomerListItemV3 { + uid: string; + registerTime: string; +} + +export interface AgentCustomerAssetItemV3 { + uid: string; + balance: string; + uTime: string; + remark: string; +} + +export interface AgentCustomerTradeVolumeItemV3 { + uid: string; + /** API field name (Bitget spelling). */ + volumn: string; + spotVolume: string; + futuresVolume: string; + time: string; +} + +export interface AgentCustomerDepositItemV3 { + uid: string; + orderId: string; + depositTime: string; + depositCoin: string; + depositAmount: string; +} + +export interface AgentCustomerKycResultItemV3 { + uid: string; + kycResult: 'passed' | 'not_passed'; +} + +/** Pagination wrapper follows the documented response example. */ +export interface AgentCustomerKycResultV3 { + userList: AgentCustomerKycResultItemV3[]; + endId: string; +} + +export interface AgentCustomerCommissionV3 { + uid: string; + date: string; + coin: string; + symbol: string; + productType: 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 AgentCustomerCommissionsV3 { + commissionList: AgentCustomerCommissionV3[]; + endId: string; +} + +/** Pagination wrapper follows the documented response example. */ +export interface AgentSubCustomerListV3 { + list: AgentCustomerListItemV3[]; + minId: string; +} + +export interface SubAffiliateRebateRateV3 { + rebateType: string; + rebateRate: string; +} + +export interface SubAffiliateInfoItemV3 { + uid: string; + uplineName: string; + rebateRateList: SubAffiliateRebateRateV3[]; + verificationStatus: string; + directReferrals: string; + subAffiliates: string; + subAffiliateDirectReferrals: string; + volume: string; + deposit: string; + transactionFee: string; + rebate: string; +} + +export interface SubAffiliateInfoV3 { + list: SubAffiliateInfoItemV3[]; + endId: string; +} + +export interface SubAffiliateCommissionItemV3 { + uid: string; + bizType: 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: string; + startCalculationTime: string; + endCalculationTime: string; +} + +export interface SubAffiliateCommissionV3 { + commissionList: SubAffiliateCommissionItemV3[]; + endId: string; +} diff --git a/src/types/response/v3/broker.ts b/src/types/response/v3/broker.ts index 0a511ef..38143d0 100644 --- a/src/types/response/v3/broker.ts +++ b/src/types/response/v3/broker.ts @@ -105,3 +105,77 @@ export interface GetBrokerSubApiKeyResponseV3 { permList: string[]; ipList: string[] | null; } + +/** + * + * + * Broker | Email and Commissions + * + * + */ + +export type ModifySubaccountEmailResponseV3 = string; + +export interface SubaccountEmailV3 { + subUid: string; + subaccountName: string; + subaccountEmail: string; + cTime: string; + uTime: string; +} + +export interface BrokerTradeVolumeV3 { + uid: string; + volume: string; + spotVolume: string; + futureVolume: string; +} + +export interface BrokerSpotCommissionV3 { + spotTradingVolume: string; + spotTradingFee: string; + spotPureTradingFee: string; + spotCommission: string; +} + +export interface BrokerFuturesCommissionV3 { + futuresTradingVolume: string; + futuresTradingFee: string; + futuresPureTradingFee: string; + futuresCommission: string; +} + +export interface BrokerTotalCommissionV3 { + date: string; + totalTradingVolume: string; + totalActiveTraders: string; + totalCommission: string; + spot: BrokerSpotCommissionV3; + futures: BrokerFuturesCommissionV3; +} + +export interface BrokerOrderCommissionItemV3 { + fillId: string; + orderId: string; + ts: string; + clientOid: string; + bizType: string; + subBizType: string; + symbol: string; + volume: string; + fee: string; + pureFee: string; + rebateAmount: string; +} + +export interface BrokerOrderCommissionV3 { + commissionlist: BrokerOrderCommissionItemV3[]; + endId: string; +} + +export interface BrokerRebateInfoV3 { + affiliationType: string; + userLevel: string; + clientSpotRebateRatio: string; + clientFuturesRebateRatio: string; +} diff --git a/src/types/response/v3/cfd.ts b/src/types/response/v3/cfd.ts index 5353071..55e0193 100644 --- a/src/types/response/v3/cfd.ts +++ b/src/types/response/v3/cfd.ts @@ -157,6 +157,8 @@ export interface CfdInstrumentV3 { tickValue: string; leverage: string; tradeTime: string; + /** Instrument trading timezone as UTC offset hours, e.g. "+2" */ + currentTimezone: string; commissionType: string; commissionRate: string; symbolCategory: string; diff --git a/src/types/response/v3/earn.ts b/src/types/response/v3/earn.ts index a9ba120..c952508 100644 --- a/src/types/response/v3/earn.ts +++ b/src/types/response/v3/earn.ts @@ -267,3 +267,228 @@ export interface EarnCashPlusHistoryOrdersV3 { /** Pass back as cursor. Absent on the last page */ nextCursor?: string; } + +/** + * + * + * Earn | Savings (UTA) + * + * + */ + +export interface EarnSavingsApyV3 { + rateLevel: string; + minStepVal: string; + maxStepVal: string; + currentApy: string; +} + +export interface EarnSavingsProductV3 { + productId: string; + coin: string; + periodType: 'flexible' | 'fixed'; + /** Only returned for fixed-term savings */ + period?: string; + apyType: string; + advanceRedeem: string; + settleMethod: string; + apyList: EarnSavingsApyV3[]; + status: string; + productLevel: string; +} + +export interface EarnSavingsAccountV3 { + btcAmount: string; + usdtAmount: string; + btc24hEarning: string; + usdt24hEarning: string; + btcTotalEarning: string; + usdtTotalEarning: string; +} + +export interface EarnSavingsAssetApyV3 { + rateLevel: string; + minApy: string; + maxApy: string; + currentApy: string; +} + +export interface EarnSavingsAssetV3 { + productId: string; + /** Only returned for fixed-term savings */ + orderId?: string; + productCoin: string; + interestCoin: string; + periodType: 'flexible' | 'fixed'; + /** Only returned for fixed-term savings */ + period?: string; + holdAmount: string; + lastProfit: string; + totalProfit: string; + holdDays: string; + status: string; + allowRedemption: string; + productLevel: string; + apy: EarnSavingsAssetApyV3[]; +} + +export interface EarnSavingsAssetsV3 { + resultList: EarnSavingsAssetV3[]; + endId: string; +} + +export interface EarnSavingsRecordV3 { + orderId: string; + coinName: string; + settleCoinName: string; + productType: 'flexible' | 'fixed'; + /** Only returned for fixed-term savings */ + period?: string; + productLevel: string; + amount: string; + ts: string; + orderType: string; +} + +export interface EarnSavingsRecordsV3 { + resultList: EarnSavingsRecordV3[]; + endId: string; +} + +export interface EarnSavingsSubscriptionDetailV3 { + singleMinAmount: string; + singleMaxAmount: string; + remainingAmount: string; + subscribePrecision: string; + profitPrecision: string; + subscribeTime: string; + interestTime: string; + settleTime: string; + expireTime: string; + redeemTime: string; + settleMethod: string; + apyList: EarnSavingsApyV3[]; + redeemDelay: string; +} + +export interface SubscribeSavingsResponseV3 { + orderId: string; +} + +export interface EarnSavingsSubscriptionResultV3 { + result: 'success' | 'fail'; + msg: string; +} + +export interface RedeemSavingsResponseV3 { + orderId: string; + status: string; +} + +export interface EarnSavingsRedemptionResultV3 { + result: 'success' | 'fail'; + msg: string; +} + +/** + * + * + * Earn | SharkFin (UTA) + * + * + */ + +export interface EarnSharkfinProductV3 { + 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; + startTime: string; + endTime: string; +} + +export interface EarnSharkfinProductsV3 { + resultList: EarnSharkfinProductV3[]; + endId: string; +} + +export interface EarnSharkfinAccountV3 { + btcSubscribeAmount: string; + usdtSubscribeAmount: string; + btcHistoricalAmount: string; + usdtHistoricalAmount: string; + btcTotalEarning: string; + usdtTotalEarning: string; +} + +export interface EarnSharkfinAssetV3 { + productId: string; + interestStartTime: string; + interestEndTime: string; + productCoin: string; + subscribeCoin: string; + trend: string; + settleTime: string; + interestAmount: string; + productStatus: string; +} + +export interface EarnSharkfinAssetsV3 { + resultList: EarnSharkfinAssetV3[]; + endId: string; +} + +export interface EarnSharkfinRecordV3 { + orderId: string; + product: string; + period: string; + amount: string; + ts: string; + type: string; +} + +export interface EarnSharkfinRecordsV3 { + resultList: EarnSharkfinRecordV3[]; + endId: string; +} + +export interface EarnSharkfinSubscriptionDetailV3 { + 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 SubscribeSharkfinResponseV3 { + orderId: string; + status: string; +} + +export interface EarnSharkfinSubscriptionResultV3 { + result: 'success' | 'fail'; + msg: string; +} diff --git a/src/types/response/v3/stockplus.ts b/src/types/response/v3/stockplus.ts index 4e94594..338287a 100644 --- a/src/types/response/v3/stockplus.ts +++ b/src/types/response/v3/stockplus.ts @@ -165,6 +165,11 @@ export interface StockPlusPlaceOrderResponseV3 { export type StockPlusCancelOrderResponseV3 = StockPlusPlaceOrderResponseV3; export type StockPlusModifyOrderResponseV3 = StockPlusPlaceOrderResponseV3; +export interface StockPlusMaxPurchaseV3 { + cashMaxQty: string; + marginMaxQty: string; +} + export interface StockPlusOrderV3 { orderId: string; status: string; diff --git a/src/types/response/v3/strategy.ts b/src/types/response/v3/strategy.ts index d069184..f2f9eeb 100644 --- a/src/types/response/v3/strategy.ts +++ b/src/types/response/v3/strategy.ts @@ -27,7 +27,8 @@ export interface StrategyOrderV3 { qty: string; /** buy / sell. Same field as the WS order push. */ side?: 'buy' | 'sell'; - posSide: 'long' | 'short'; + /** Can be null (seen live on unfilled trigger orders; user report t.me/bitgetOpenapi/153322, staff checking) */ + posSide: 'long' | 'short' | null; status: StrategyOrderStatusV3; type?: StrategyOrderTypeV3 | string; triggerType?: 'takeProfit' | 'stopLoss'; diff --git a/src/types/response/v3/trade.ts b/src/types/response/v3/trade.ts index 9f10087..46b60fb 100644 --- a/src/types/response/v3/trade.ts +++ b/src/types/response/v3/trade.ts @@ -64,10 +64,11 @@ export interface OrderInfoV3 { avgPrice: string; timeInForce: string; /** - * rToken routing. internalization or lit_market. - * Also pushed on the WS order channel. + * rToken routing returned on order details / WS order channel. + * internal_market = on-exchange only; lit_market = broker only; + * default = internal first then broker (former lit_market meaning, since 5 Nov 2026). */ - venue?: 'internalization' | 'lit_market' | string; + venue?: 'internal_market' | 'lit_market' | 'default' | string; /** rToken time in force. gtd = current session, gtc = 90 days. */ rTokenTimeInForce?: 'gtd' | 'gtc' | string; orderStatus: string; diff --git a/src/types/websockets/ws-api-request.ts b/src/types/websockets/ws-api-request.ts index f048546..ed3377f 100644 --- a/src/types/websockets/ws-api-request.ts +++ b/src/types/websockets/ws-api-request.ts @@ -27,11 +27,17 @@ export interface WSAPIPlaceOrderRequestV3 { autoBorrow?: 'yes' | 'no'; /** Limit orders only. no rejects a price outside the band (default). yes clamps it */ pxAmendType?: 'yes' | 'no'; + /** Limit orders only. queue1, queue5, counterparty1, or counterparty5. Ignored for market orders */ + bboLevel?: 'queue1' | 'queue5' | 'counterparty1' | 'counterparty5'; + /** Market orders only. Decimal, default 0.02, range 0.01-0.05 */ + slippageTolerance?: string; /** - * rToken routing. internalization or lit_market (default). - * Ignored for non-rToken symbols. + * rToken routing. Accepted: internal_market | lit_market. Omit for default. + * internal_market = on-exchange only; lit_market = broker only. + * Omit / default = internal first, then broker. Ignored for non-rToken symbols. + * Live since 5 Nov 2026. */ - venue?: 'internalization' | 'lit_market'; + venue?: 'internal_market' | 'lit_market'; /** rToken time in force. gtd (default) or gtc (90 days). */ rTokenTimeInForce?: 'gtd' | 'gtc'; } diff --git a/src/types/websockets/ws-general.ts b/src/types/websockets/ws-general.ts index 01814d1..0237454 100644 --- a/src/types/websockets/ws-general.ts +++ b/src/types/websockets/ws-general.ts @@ -9,6 +9,7 @@ export type BitgetInstType = 'SP' | 'SPBL' | 'MC' | 'UMCBL' | 'DMCBL'; export type BitgetInstTypeV2 = 'SPOT' | FuturesProductTypeV2; export type BitgetInstTypeV3 = | 'UTA' // for account-level topics + | 'uta' | 'spot' | 'usdt-futures' | 'coin-futures' @@ -54,6 +55,10 @@ export type WsTopic = WsPublicTopic | WsPrivateTopic; * * V2 list of topics for WebSocket consumers * + * Spot/futures candle and trade channels send only action=update, without a + * subscription snapshot, from 4 Nov 2026 on demo; live expected 17 Nov 2026. + * Use the corresponding REST API for historical candles and trades. + * https://www.bitget.com/docs/classic/changelog/2026-11 */ export type WsPublicTopicV2 = @@ -109,6 +114,10 @@ export type WsTopicV2 = WsPublicTopicV2 | WsPrivateTopicV2; * * V3 / UTA list of topics for WebSocket consumers * + * kline and publicTrade send only action=update, without a subscription snapshot, + * from 4 Nov 2026 on demo; live expected 17 Nov 2026. + * Use the corresponding REST API for historical candles and trades. + * https://www.bitget.com/docs/uta/update-preview */ export type WsPublicTopicV3 = | 'ticker' @@ -117,7 +126,15 @@ export type WsPublicTopicV3 = | 'books1' | 'books5' | 'books50' - | 'publicTrade'; + | 'publicTrade' + /** Futures public liquidations. Optional payload.symbol filters to that symbol */ + | 'liquidation' + | 'instruments' + | 'open-interest-limit' + | 'position-tier' + | 'funding-rate' + | 'margin-loan' + | 'margin-coins'; // Also update PRIVATE_TOPICS_V3 if this is updated. // `order` includes venue and rTokenTimeInForce for rToken orders. export type WsPrivateTopicV3 =